Exemplo n.º 1
0
/**
	Mouse click scenarios.
*/
void AlbumView::MouseDown(BPoint where)
{
    // This is an event hook so there must be a Looper.
	BMessage *message = Window()->CurrentMessage();

    int32 mods = 0, clicks = 0, buttons=0;
    message->FindInt32("modifiers", &mods);
    message->FindInt32("clicks", &clicks);
    message->FindInt32("buttons", &buttons);
		
    // Scale back.
	where.x /= fZoom;
	where.y /= fZoom;
	
	int32 i = IndexOf(&where);
	int32 changes = 0;
	if (i >= 0) {
		AlbumItem *item = ItemAt(i);
		
		// double-clicks are handled later in MouseUp()
		fDoubleClick = (fLastSelected == i && clicks == 2 && (buttons & B_PRIMARY_MOUSE_BUTTON));
        fMayDrag = !fDoubleClick && (buttons & B_PRIMARY_MOUSE_BUTTON);			
        if (mods & B_SHIFT_KEY) 
        	// Block selection
			changes += SelectBlock(fLastSelected, i, !item->IsSelected());
        else if (mods & B_COMMAND_KEY)
        	// Modify selection
        	changes += Select(i, 1, !item->IsSelected());
		else {
			// Normal selection
			if (!item->IsSelected())
				changes += DeselectAll();
        	changes += Select(i);
		}
        fLastWhere = where;
        fLastSelected = i;
    }
    else
	   	changes += DeselectAll();

	if (changes > 0) {
		//PRINT(("selection changed\n"));
    	SelectionChanged();
    	if (!fDoubleClick && Message()) {
			BMessage msg = *Message();
			msg.AddInt32("buttons", buttons);
    		msg.AddPoint("where", where);        
        	msg.AddInt32("index", fLastSelected);
			Invoke(&msg);
    	}
	}
    
    
}
Exemplo n.º 2
0
void CTDCTaskListCtrl::SetSelectedTasks(const CDWordArray& aTaskIDs, DWORD dwFocusedTaskID)
{
	DeselectAll();

	int nID = aTaskIDs.GetSize();

	if (nID)
	{
		CTLSHoldResync hr(*this);
				
		while (nID--)
		{
			DWORD dwTaskID = aTaskIDs[nID];
			int nItem = FindTaskItem(dwTaskID);
			
			if (nItem != -1)
			{
				BOOL bAnchor = (dwTaskID == dwFocusedTaskID);
				DWORD dwState = LVIS_SELECTED;
				
				if (bAnchor)
				{
					dwState |= LVIS_FOCUSED;

					m_lcTasks.SetSelectionMark(nItem);
					m_lcColumns.SetSelectionMark(nItem);
				}
				
				m_lcTasks.SetItemState(nItem, dwState, (LVIS_SELECTED | LVIS_FOCUSED));
				m_lcColumns.SetItemState(nItem, dwState, (LVIS_SELECTED | LVIS_FOCUSED));
			}
		}

	}
}
BOOL CLibraryAlbumView::Select(DWORD nObject)
{
	CRect rcClient, rcItem;

	CLibraryAlbumTrack** pList = m_pList + m_nCount - 1;

	int nItem = m_nCount;
	for ( ; nItem ; nItem--, pList-- )
	{
		CLibraryAlbumTrack* pTrack = *pList;
		if ( pTrack->m_nIndex == nObject ) break;
	}

	if ( nItem == 0 ) return FALSE;

	m_pFocus = *pList;
	DeselectAll( m_pFocus );
	Select( m_pFocus );
	Invalidate();

	GetClientRect( &rcClient );
	GetItemRect( m_pFocus, &rcItem );

	if ( rcItem.top < rcClient.top )
		ScrollBy( rcItem.top - rcClient.top );
	else if ( rcItem.bottom > rcClient.bottom )
		ScrollBy( rcItem.bottom - rcClient.bottom );

	return TRUE;
}
Exemplo n.º 4
0
void
PrefListView::MouseDown(BPoint point)
{
	BPoint cursor;
	ulong m_buttons;
	
	GetMouse(&cursor,&m_buttons);
	
	if (!(m_buttons & 0x2))
		BOutlineListView::MouseDown(point);
	else {
		// right mouse button is for popup only :-)		
		BMessage msg(MSG_LIST_POPUP);
		msg.AddPoint("point", point);
		
		int32 index = IndexOf(point);
		msg.AddInt32("index", index);
		
		if (index>0) {
			DeselectAll();
			Select(index);
			InvalidateItem(index);
		}

		Window()->PostMessage( &msg );
	}
}
Exemplo n.º 5
0
void BrushIconBox::SelectFirstBrush() {
	if(tileset && tileset->size() > 0) {
		DeselectAll();
		brush_buttons[0]->SetValue(true);
		EnsureVisible((size_t)0);
	}
}
Exemplo n.º 6
0
void CLibraryTileView::OnChar(UINT nChar, UINT nRepCnt, UINT nFlags)
{
	CSingleLock oLock( &Library.m_pSection );
	if ( oLock.Lock( 200 ) )
	{
		if ( _istalnum( TCHAR( nChar ) ) )
		{
			iterator pStart = m_pFocus;

			for ( int nLoop = 0; nLoop < 2; nLoop++ )
			{
				for ( iterator pChild = begin(); pChild != end(); ++pChild )
				{
					if ( pStart != end() )
					{
						if ( pStart == pChild )
							pStart = end();
					}
					else if ( toupper( (*pChild)->GetTitle().GetAt( 0 ) ) == toupper( (int)nChar ) )
					{
						DeselectAll( m_pFocus = pChild );
						Select( m_pFocus, TRI_TRUE );
						Highlight( m_pFocus );
						Invalidate();
						return;
					}
				}
			}
		}
	}

	CLibraryView::OnChar( nChar, nRepCnt, nFlags );
}
Exemplo n.º 7
0
void TItemList::RemoveSelItems(TOnItemRemove on_remove)
{
	if (mrYes==MessageDlg("Remove selected item(s)?", mtConfirmation, TMsgDlgButtons() << mbYes << mbNo, 0)){
        on_remove 	= on_remove.empty()?OnItemRemoveEvent:on_remove;
        VERIFY		(!on_remove.empty());
        RStringVec sel_items;
        if (GetSelected(sel_items)){
            tvItems->IsUpdating = true; // LockUpdating нельзя
            DeselectAll					();
            tvItemsAfterSelectionChange	(0);
            bool bSelChanged=false;
            bool bRes=false;
            for (RStringVecIt it=sel_items.begin(); it!=sel_items.end(); it++){
                TElTreeItem* pNode	= FHelper.FindItem(tvItems,**it);
                if (!FHelper.RemoveItem(tvItems,pNode,on_remove.empty()?OnItemRemoveEvent:on_remove)){
                    SelectItem(**it,true,true,false);
                    bSelChanged=true;
                }else{
                    bRes = true;
                }
            }
            if (bSelChanged||bRes){
                tvItemsAfterSelectionChange	(0);
                if (bRes&&!OnModifiedEvent.empty())	OnModifiedEvent(); 
            }
            tvItems->IsUpdating 		= false;
        }
    }
}
Exemplo n.º 8
0
// MoveItems
void
DragSortableListView::MoveItems(BList& items, int32 index)
{
	DeselectAll();
	// we remove the items while we look at them, the insertion index is decreased
	// when the items index is lower, so that we insert at the right spot after
	// removal
	BList removedItems;
	int32 count = items.CountItems();
	for (int32 i = 0; i < count; i++) {
		BListItem* item = (BListItem*)items.ItemAt(i);
		int32 removeIndex = IndexOf(item);
		if (RemoveItem(item) && removedItems.AddItem((void*)item)) {
			if (removeIndex < index)
				index--;
		}
		// else ??? -> blow up
	}
	for (int32 i = 0;
		 BListItem* item = (BListItem*)removedItems.ItemAt(i); i++) {
		if (AddItem(item, index)) {
			// after we're done, the newly inserted items will be selected
			Select(index, true);
			// next items will be inserted after this one
			index++;
		} else
			delete item;
	}
}
Exemplo n.º 9
0
// CopyItems
void
DragSortableListView::CopyItems(BList& items, int32 index)
{
	DeselectAll();
	// by inserting the items after we copied all items first, we avoid
	// cloning an item we already inserted and messing everything up
	// in other words, don't touch the list before we know which items
	// need to be cloned
	BList clonedItems;
	int32 count = items.CountItems();
	for (int32 i = 0; i < count; i++) {
		BListItem* item = CloneItem(IndexOf((BListItem*)items.ItemAt(i)));
		if (item && !clonedItems.AddItem((void*)item))
			delete item;
	}
	for (int32 i = 0;
		 BListItem* item = (BListItem*)clonedItems.ItemAt(i); i++) {
		if (AddItem(item, index)) {
			// after we're done, the newly inserted items will be selected
			Select(index, true);
			// next items will be inserted after this one
			index++;
		} else
			delete item;
	}
}
Exemplo n.º 10
0
BOOL CBrowseTreeCtrl::CleanItems(CBrowseTreeItem* pItem, DWORD nCookie, BOOL bVisible)
{
	CSingleLock lRoot( &m_csRoot, TRUE );

	CBrowseTreeItem** pChild = pItem->m_pList + pItem->m_nCount - 1;
	BOOL bChanged = FALSE;

	for ( int nChild = pItem->m_nCount ; nChild ; nChild--, pChild-- )
	{
		if ( (*pChild)->m_nCleanCookie != nCookie )
		{
			if ( m_pFocus == *pChild ) m_pFocus = NULL;

			if ( (*pChild)->m_bSelected ) Select( *pChild, TS_FALSE, FALSE );
			bChanged |= DeselectAll( NULL, *pChild, FALSE );

			if ( bVisible )
			{
				m_nTotal -= (*pChild)->GetChildCount() + 1;
				bChanged = TRUE;
			}

			delete *pChild;
			MoveMemory( pChild, pChild + 1, 4 * ( pItem->m_nCount - nChild ) );
			pItem->m_nCount--;
		}
	}

	return bChanged;
}
Exemplo n.º 11
0
	void KeyHandlesSheet::OnCursorStillDown(const Input::Cursor& cursor)
	{
		if (cursor.isPressed) {
			if (!mIsFrameSelecting) 
			{
				if (cursor.delta != Vec2F())
					mIsFrameSelecting = true;
			}
			

			if (mIsFrameSelecting)
			{
				mSelectionFrame->enabled = true;

				Vec2F current(mTimeline->WorldToLocal(cursor.position.x), mTree->GetLineNumber(cursor.position.y));
				mSelectionRect.left = Math::Min(mBeginSelectPoint.x, current.x);
				mSelectionRect.right = Math::Max(mBeginSelectPoint.x, current.x);
				mSelectionRect.top = Math::Floor(Math::Min(mBeginSelectPoint.y, current.y));
				mSelectionRect.bottom = Math::Ceil(Math::Max(mBeginSelectPoint.y, current.y));

				DeselectAll();

				for (auto handle : mBeginSelectHandles)
					SelectHandle(handle);

				for (auto handle : mHandles) {
					Vec2F handlePos(handle->GetPosition().x, mTree->GetLineNumber(handle->GetScreenPosition().y));
					if (handlePos.x > mSelectionRect.left && handlePos.x < mSelectionRect.right && handlePos.y > mSelectionRect.top && handlePos.y < mSelectionRect.bottom + 0.5f) {
						SelectHandle(handle);
					}
				}
			}
		}
	}
Exemplo n.º 12
0
STDMETHODIMP CSwatchesList::put_swatches(IPDSwatches *newVal)
{
	DeselectAll();

	if (m_swatches)
	{
		CComQIPtr<INotifySend> cp = m_swatches;
		cp->Unadvise(this);
	}

	m_swatches = newVal;

	if (m_swatches)
	{
		CComQIPtr<INotifySend> cp = m_swatches;
		DWORD cookie;
		cp->Advise(this, &cookie);
	}

	if (m_hWnd)
	{
		OnSize();
		InvalidateRect(&m_areaRect);
	}

	return S_OK;
}
Exemplo n.º 13
0
	void
PrefListView::BuildView(XmlNode *node, int level, BListItem* parent)
{
	if (!node) {
		puts("Rebuild mit NULL?!");
		return;
	}

	int anz = node->Children();

	//printf("BuildView: %s %d einträge\n", node->Attribute("text"), anz);

	if (anz>0) {
		if (level==0) {
			for (int i=0;i<anz;i++) {
				XmlNode* c = (XmlNode*)node->ItemAt(i);
				const char* t = c->Attribute("text");

				BStringItem* item = new BStringItem(t);
				item->SetText( t );

				if (level>0)
					AddUnder(item, parent);
				else
					AddItem(item);

				//printf("Hinzufügen war %d\n", b);

				if (c->Children()>0) {
					BuildView(c, level+1, item);
				}
			}
			DeselectAll();
		}
		else {
			for (int i=anz-1;i>=0;i--) {
				XmlNode* c = (XmlNode*)node->ItemAt(i);
				const char* t = c->Attribute("text");

				BStringItem* item = new BStringItem(t);
				item->SetText( t );

				if (level>0)
					AddUnder(item, parent);
				else
					AddItem(item);

				//printf("Hinzufügen war %d\n", b);

				if (c->Children()>0) {
					BuildView(c, level+1, item);
				}
			}
		}
	}
	else {
		//puts("Tja...");
	}	
}
Exemplo n.º 14
0
// MouseDown
void
PropertyListView::MouseDown(BPoint where)
{
	if (!(modifiers() & B_SHIFT_KEY)) {
		DeselectAll();
	}
	MakeFocus(true);
}
Exemplo n.º 15
0
void SelectionState::DeselectAll(Node* pNode)
{
	while (pNode != NULL)
	{
		DeselectAll(pNode->FindFirstChild());
		pNode->ClearSelection();
		pNode = pNode->FindNext();
	}
}
Exemplo n.º 16
0
afx_msg void
MFCSequenceEditor::OnLButtonDown(
			UINT nFlags,
			CPoint point 
		)
{
	point += GetScrollPosition();
	last_mouse_point = mouse_click = point;

	short	at_channel;
//	at_channel = Pix2Channel(point.y);
	Time	at_time;
	Pix2Time(point.x, at_time);

//	int		bar, barbeat, beattick;
//	at_time.GetBBQValue(bar, barbeat, beattick);
//	fprintf(stderr, "left button down: on point %d %d, channel %d, ticks %d t %d:%d.%d\n", point.x, point.y, at_channel, at_time.ticks, bar, barbeat, beattick);

	switch (currentTool) {
		case ID_ARTOOL_POINT: {
			DeselectAll();
//			mouse_instance = InstanceViewAtPoint(mouse_click);
//			if (mouse_instance) {
//				mouse_action = QUA_MOUSE_ACTION_MOVE_INSTANCE;
//				mouse_move_inst_offset.x = mouse_click.x - mouse_instance->bounds.left;
//				mouse_move_inst_offset.y = mouse_click.y;
//				mouse_instance->Select(true);
//			}
			break;
		}
		case ID_ARTOOL_SLICE: {
			break;
		}
		case ID_ARTOOL_RGSELECT: {
			fprintf(stderr, "region select\n");
			mouse_action = QUA_MOUSE_ACTION_REGION_SELECT;
			BRect	r(min(mouse_click.x,point.x),min(mouse_click.y,point.y),max(mouse_click.x,point.x),max(mouse_click.y,point.y));
			ChangeSelection(r);
			break;
		}
		case ID_ARTOOL_DRAW: {
//			mouse_instance = InstanceViewAtPoint(mouse_click);
//			if (mouse_instance) {
//				mouse_action = QUA_MOUSE_ACTION_SIZE_INSTANCE;
//				mouse_move_inst_offset.x = mouse_instance->bounds.left;
//				mouse_move_inst_offset.y = mouse_click.y;
//				Instance	*inst = mouse_instance->instance;
//				if (inst) {
//					Pix2Time(point.x-mouse_move_inst_offset.x, at_time);
//					quaLink->MoveInstance(inst->sym, -1, NULL, &at_time);
//				}
//			}
			break;
		}
	}
}
Exemplo n.º 17
0
	void KeyHandlesSheet::OnCursorPressed(const Input::Cursor& cursor)
	{
		if (!o2Input.IsKeyDown(VK_CONTROL)) 
			DeselectAll();

		mBeginSelectHandles = mSelectedHandles;

		mBeginSelectPoint.x = mTimeline->WorldToLocal(cursor.position.x);
		mBeginSelectPoint.y = mTree->GetLineNumber(cursor.position.y);
	}
Exemplo n.º 18
0
void CUploadsCtrl::OnRButtonUp(UINT nFlags, CPoint point)
{
	if ( m_pDeselect != NULL )
	{
		DeselectAll( m_pDeselect );
		m_pDeselect = NULL;
	}
	
	CWnd::OnRButtonUp( nFlags, point );
}
Exemplo n.º 19
0
/*****************************************************************************
 * PlaylistView::MoveItems
 *****************************************************************************/
void
PlaylistView::MoveItems( BList& items, int32 index )
{
#if 0
    DeselectAll();
    // we remove the items while we look at them, the insertion index is decreased
    // when the items index is lower, so that we insert at the right spot after
    // removal
    if ( fVlcWrapper->PlaylistLock() )
    {
        BList removedItems;
        BList removeItems;
        int32 count = items.CountItems();
        int32 indexOriginal = index;
        // remember currently playing item
        BListItem* playingItem = _PlayingItem();
        // collect item pointers for removal by index
        for ( int32 i = 0; i < count; i++ )
        {
            int32 removeIndex = IndexOf( (BListItem*)items.ItemAt( i ) );
            void* item = fVlcWrapper->PlaylistItemAt( removeIndex );
            if ( item && removeItems.AddItem( item ) )
            {
                if ( removeIndex < index )
                    index--;
            }
            // else ??? -> blow up
        }
        // actually remove items using pointers
        for ( int32 i = 0; i < count; i++ )
        {
            void* item = fVlcWrapper->PlaylistRemoveItem( removeItems.ItemAt( i ) );
            if ( item && !removedItems.AddItem( item ) )
                free( item );
        }
        // add items at index
        for ( int32 i = 0; void* item = removedItems.ItemAt( i ); i++ )
        {
            if ( fVlcWrapper->PlaylistAddItem( item, index ) )
                // next items will be inserted after this one
                index++;
            else
                free( item );
        }
        // update GUI
        DragSortableListView::MoveItems( items, indexOriginal );
        // restore currently playing item
        _SetPlayingIndex( playingItem );
        // update interface (in case it isn't playing,
        // there is a chance that it needs to update)
        fMainWindow->PostMessage( MSG_UPDATE );
        fVlcWrapper->PlaylistUnlock();
    }
#endif
}
Exemplo n.º 20
0
bool wxListBox::FindItem(const wxString& prefix, bool strictlyAfter)
{
    int count = GetCount();
    if ( !count )
    {
        // empty listbox, we can't find anything in it
        return false;
    }

    // start either from the current item or from the next one if strictlyAfter
    // is true
    int first;
    if ( strictlyAfter )
    {
        // the following line will set first correctly to 0 if there is no
        // selection (m_current == -1)
        first = m_current == count - 1 ? 0 : m_current + 1;
    }
    else // start with the current
    {
        first = m_current == -1 ? 0 : m_current;
    }

    int last = first == 0 ? count - 1 : first - 1;

    // if this is not true we'd never exit from the loop below!
    wxASSERT_MSG( first < count && last < count, _T("logic error") );

    // precompute it outside the loop
    size_t len = prefix.length();

    // loop over all items in the listbox
    for ( int item = first; item != last; item < count - 1 ? item++ : item = 0 )
    {
        if ( wxStrnicmp(this->GetString(item).c_str(), prefix, len) == 0 )
        {
            SetCurrentItem(item);

            if ( !(GetWindowStyle() & wxLB_MULTIPLE) )
            {
                DeselectAll(item);
                SelectAndNotify(item);

                if ( GetWindowStyle() & wxLB_EXTENDED )
                    AnchorSelection(item);
            }

            return true;
        }
    }

    // nothing found
    return false;
}
Exemplo n.º 21
0
void CLibraryAlbumView::OnLButtonUp(UINT nFlags, CPoint point) 
{
	m_bDrag = FALSE;
	
	if ( ( nFlags & (MK_SHIFT|MK_CONTROL) ) == 0 && m_pFocus && m_pFocus->m_bSelected )
	{
		if ( DeselectAll( m_pFocus ) ) Invalidate();
	}

	CLibraryFileView::OnLButtonUp( nFlags, point );
}
Exemplo n.º 22
0
bool BrushIconBox::SelectBrush(const Brush* whatbrush) {
	DeselectAll();
	for(std::vector<BrushButton*>::iterator it = brush_buttons.begin(); it != brush_buttons.end(); ++it) {
		if((*it)->brush == whatbrush) {
			(*it)->SetValue(true);
			EnsureVisible(*it);
			return true;
		}
	}
	return false;
}
Exemplo n.º 23
0
/*************
 * DESCRIPTION:	create mesh dialog
 * INPUT:			ID		dialog ID
 * OUTPUT:			-
 *************/
void CDoc::CreateMesh(int ID)
{
	UNDO_CREATE *pUndo;
	MESH *pMesh;
	BOOL bErr;

	nDialogID = ID;
	CCMeshDlg dialog;

	if (dialog.DoModal() == IDOK)
	{
		pMesh = new MESH;
		if (pMesh)
		{
			pMesh->selected = TRUE;
			pMesh->surf = new SURFACE;
			if (pMesh->surf)
			{
				switch (nDialogID)
				{
					case IDD_CUBE:   bErr = pMesh->CreateCube(&dialog.m_vSize); break;
					case IDD_TORUS:  bErr = pMesh->CreateTorus(dialog.m_Radius, dialog.m_Thickness, dialog.m_nDivs, dialog.m_nSlices); break;
					case IDD_SPHERE: bErr = pMesh->CreateSphere(dialog.m_Radius, dialog.m_nDivs, dialog.m_nSlices); break;
					case IDD_TUBE:   bErr = pMesh->CreateTube(dialog.m_Radius, dialog.m_Height, dialog.m_nDivs, dialog.m_nSlices, dialog.m_bClosedBottom, dialog.m_bClosedTop); break;
					case IDD_PLANE:  bErr = pMesh->CreatePlane(&dialog.m_vSize, dialog.m_nXDivs, dialog.m_nZDivs); break;
					case IDD_CONE:   bErr = pMesh->CreateCone(dialog.m_Radius, dialog.m_Height, dialog.m_nDivs, dialog.m_nSlices, dialog.m_bClosedBottom); break;
				}
				if (!bErr)
					delete pMesh;
				else
				{
					DeselectAll();
					pMesh->Append();
					pMesh->IsFirstSelected();
					
					pUndo = new UNDO_CREATE;
					if (pUndo)
					{
						if (pUndo->AddCreated(pMesh))
							pUndo->Add();
						else
							delete pUndo;
					}	
					sciBrowserBuild();
 				}
			}
			else
				delete pMesh;
		}
	}
	sciRedraw();
}
Exemplo n.º 24
0
void AHair::SelectLayer(AHairLayer* Layer, bool IsAppend)
{
	AMyPlayerController* Controller = GetController();
	if (!Controller) return;

	if (!IsAppend)
		DeselectAll();

	for (int i = 0; i < Layer->Segments.Num(); i++)
	{
		SelectSegment(Layer->Segments[i]);
	}
}
Exemplo n.º 25
0
void
PackageListView::SelectPackage(const PackageInfoRef& package)
{
	PackageRow* row = _FindRow(package);
	BRow* selected = CurrentSelection();
	if (row != selected)
		DeselectAll();
	if (row != NULL) {
		AddToSelection(row);
		SetFocusRow(row, false);
		ScrollTo(row);
	}
}
Exemplo n.º 26
0
//-----------------------------------------------------------------------------
// Purpose: Enables or disables multiselect for this tool.
//-----------------------------------------------------------------------------
void CToolPickFace::AllowMultiSelect(bool bAllow)
{
	m_bAllowMultiSelect = bAllow;

	//
	// Shouldn't ever happen, but you never know.
	//
	if ((!bAllow) && (m_Faces.Count() > 1))
	{
		CMapFace *pFace = m_Faces[0].pFace;
		DeselectAll();
		SelectFace(pFace);
	}
}
Exemplo n.º 27
0
void SelectionState::DeselectAll(BOOL RenderBlobs)
{
	// Find the selected objects in the tree;
	SelRange* Selected = GetApplication()->FindSelection();
	ERROR3IF( Selected==NULL, "Selection object is null in DeselectAll()");

	// Get the selected spread
 	Spread* pSpread = Document::GetSelectedSpread();
	ERROR3IF(pSpread == NULL,"NULL selected spread");

	// Make sure that we have a spread and a selection
	if (pSpread == NULL || Selected == NULL)
		return;

	// Find first selected node

#if !defined(EXCLUDE_FROM_RALPH)
	Node* pFirstSelectedNode = Selected->FindFirst();
	// If there is a selection, EOR blobs off, deselect nodes, and inform everybody
	if (pFirstSelectedNode != NULL && RenderBlobs)
	{
		// Go though and render all the EOR blobs off the screen

		// Find the Blob Manager
		BlobManager* BlobMgr = GetApplication()->GetBlobManager();
		ENSURE( BlobMgr!=NULL, "Blob Manager unexpectedly not there.");

		// Render all the blobs
		BlobMgr->RenderOff(NULL, pFirstSelectedNode->FindParentSpread());

		Tool* pTool = Tool::GetCurrent();
			
		// Get the tool to remove all its blobs before we deselect the nodes.
		// Only do this if the current tool dosent update itself on sel changed messages
		if (pSpread!=NULL && pTool!=NULL && !pTool->AreToolBlobsRenderedOnSelection())
			pTool->RenderToolBlobs(pSpread,NULL);
	}
#endif

	DeselectAll(pSpread->FindFirstChild());

	// Selection cache is no longer valid, so update and tell everyone that it has changed

	// *Note*, This used to be 'Selected->Update(TRUE)', but I (Will) removed the TRUE, so
	// that a message is NOT broadcast.  This should only be called from an operation,
	// and the op will send a message when it ends.

	Selected->Update();
}
Exemplo n.º 28
0
BOOL CBrowseTreeCtrl::Expand(CBrowseTreeItem* pItem, TRISTATE bExpand, BOOL bInvalidate)
{
	CSingleLock lRoot( &m_csRoot, TRUE );

	if ( pItem == NULL ) return FALSE;

	switch ( bExpand )
	{
	case TS_UNKNOWN:
		pItem->m_bExpanded = ! pItem->m_bExpanded;
		break;
	case TS_TRUE:
		if ( pItem->m_bExpanded ) return FALSE;
		pItem->m_bExpanded = TRUE;
		break;
	case TS_FALSE:
		if ( ! pItem->m_bExpanded ) return FALSE;
		pItem->m_bExpanded = FALSE;
		break;
	}

	if ( ! pItem->IsVisible() ) return FALSE;

	if ( pItem->m_bExpanded )
	{
		m_nTotal += pItem->GetChildCount();
	}
	else
	{
		m_nTotal -= pItem->GetChildCount();
		DeselectAll( NULL, pItem, FALSE );
	}

	pItem->m_bContract1 = pItem->m_bExpanded == TRUE && bExpand == TS_TRUE && bInvalidate == FALSE;

	if ( pItem->m_bContract1 == FALSE )
	{
		for ( CBrowseTreeItem* pParent = pItem ; pParent != NULL ; pParent = pParent->m_pParent )
			pParent->m_bContract1 = FALSE;
	}

	if ( bInvalidate )
	{
		UpdateScroll();
		Invalidate();
	}

	return TRUE;
}
Exemplo n.º 29
0
void
TreeTable::SelectNode(const TreeTablePath& path, bool extendSelection)
{
	TreeTableNode* node = _NodeForPath(path);
	if (node == NULL)
		return;

	if (!extendSelection) {
		fIgnoreSelectionChange++;
		DeselectAll();
		fIgnoreSelectionChange--;
	}

	AddToSelection(node->Row());
}
Exemplo n.º 30
0
void CLibraryTileView::OnLButtonUp(UINT nFlags, CPoint point)
{
	CSingleLock oLock( &Library.m_pSection );
	if ( ! oLock.Lock( 250 ) )
		return;

	m_bDrag = FALSE;

	if ( ( nFlags & (MK_SHIFT|MK_CONTROL) ) == 0 && m_pFocus != end() && (*m_pFocus)->m_bSelected )
	{
		if ( DeselectAll( m_pFocus ) )
			Invalidate();
	}

	CLibraryView::OnLButtonUp( nFlags, point );
}