[commit] r1971 - trunk/GME/GMEActiveBrowser

GMESRC Repository Notifications gme-commit at list.isis.vanderbilt.edu
Thu Jul 19 14:37:09 CDT 2012


Author: ksmyth
Date: Thu Jul 19 14:37:09 2012
New Revision: 1971

Log:
Update custom icons in InsertItemUpdate. Fixes bug with drag-n-drop hosing custom tree icons.

Modified:
   trunk/GME/GMEActiveBrowser/AggregateTreeCtrl.cpp
   trunk/GME/GMEActiveBrowser/AggregateTreeCtrl.h

Modified: trunk/GME/GMEActiveBrowser/AggregateTreeCtrl.cpp
==============================================================================
--- trunk/GME/GMEActiveBrowser/AggregateTreeCtrl.cpp	Tue Jul 17 16:13:36 2012	(r1970)
+++ trunk/GME/GMEActiveBrowser/AggregateTreeCtrl.cpp	Thu Jul 19 14:37:09 2012	(r1971)
@@ -114,7 +114,7 @@
 	}
 	CComPtr<IMgaObject> ccpObject;
 	QueryInterface(pUnknown, &ccpObject);
-	GetCustomTreeIcon(ccpObject, &tvInsert.item);
+	GetCustomTreeIcon(ccpObject, tvInsert.item);
 
 	// Inserting item into the tree control
 	HTREEITEM hItem = CTreeCtrl::InsertItem(&tvInsert);
@@ -205,6 +205,10 @@
 
 	}
 
+	CComPtr<IMgaObject> ccpObject;
+	QueryInterface(pUnknown, &ccpObject);
+	GetCustomTreeIcon(ccpObject, tvInsert.item);
+
 	// Inserting item into the tree control
 	HTREEITEM hItem=CTreeCtrl::InsertItem(&tvInsert);
 	strObjectName.ReleaseBuffer();
@@ -1255,7 +1259,7 @@
 	DeleteObject(hBmp);
 }
 
-void CAggregateTreeCtrl::GetCustomTreeIcon(IMgaObject* ccpMgaObject, TVITEM* tvItem)
+void CAggregateTreeCtrl::GetCustomTreeIcon(IMgaObject* ccpMgaObject, TVITEM& tvItem)
 {
 	CGMEActiveBrowserApp* pApp=(CGMEActiveBrowserApp*)AfxGetApp();
 	CMgaContext* pMgaContext=&pApp->m_CurrentProject.m_MgaContext;
@@ -1286,7 +1290,7 @@
 			if (expandedIt == treeIcons.end())
 				expandedIt = it;
 
-			tvItem->iSelectedImage = tvItem->iImage = it->second;
+			tvItem.iSelectedImage = tvItem.iImage = it->second;
 			return;
 		}
 	}
@@ -1323,7 +1327,7 @@
 		ImageList_AddGdiplusBitmap(static_cast<HIMAGELIST>(*imageList), *treeIconBmp.get());
 		ImageList_AddGdiplusBitmap(static_cast<HIMAGELIST>(*imageList), expandedTreeIconBmp != nullptr ? *expandedTreeIconBmp.get() : *treeIconBmp.get());
 
-		tvItem->iSelectedImage = tvItem->iImage = imageList->GetImageCount() - 2;
+		tvItem.iSelectedImage = tvItem.iImage = imageList->GetImageCount() - 2;
 		treeIcons.insert(std::make_pair(treeIcon, imageList->GetImageCount() - 2));
 		if (expandedTreeIcon.length() != 0)
 			treeIcons.insert(std::make_pair(treeIcon, imageList->GetImageCount()));

Modified: trunk/GME/GMEActiveBrowser/AggregateTreeCtrl.h
==============================================================================
--- trunk/GME/GMEActiveBrowser/AggregateTreeCtrl.h	Tue Jul 17 16:13:36 2012	(r1970)
+++ trunk/GME/GMEActiveBrowser/AggregateTreeCtrl.h	Thu Jul 19 14:37:09 2012	(r1971)
@@ -42,7 +42,7 @@
     
 	void SetItemProperties(HTREEITEM hItem, int p_fileLatentState=0, CAggregateMgaObjectProxy* insertedProxy=nullptr);
 	std::map<_bstr_t, int> treeIcons;
-	void GetCustomTreeIcon(IMgaObject* ccpMgaObject, TVITEM* tvItem);
+	void GetCustomTreeIcon(IMgaObject* ccpMgaObject, TVITEM& tvItem);
 	BOOL DoDrop(eDragOperation doDragOp, COleDataObject *pDataObject, CPoint point);
 	BOOL DoDropWithoutChecking(eDragOperation doDragOp, COleDataObject *pDataObject, CPoint point);
 	void MakeSureGUIDIsUniqueForSmartCopy( CComPtr<IMgaFCO>& fco);


More information about the gme-commit mailing list