[commit] r2347 - trunk/GME/GMEActiveBrowser
GMESRC Repository Notifications
gme-commit at list.isis.vanderbilt.edu
Thu Sep 12 15:24:15 CDT 2013
Author: ksmyth
Date: Thu Sep 12 15:24:15 2013
New Revision: 2347
Log:
Add HighlightItem(MgaFCO, int) to TreeBrowser interface
Modified:
trunk/GME/GMEActiveBrowser/ActiveBrowserPropertyPage.cpp
trunk/GME/GMEActiveBrowser/ActiveBrowserPropertyPage.h
trunk/GME/GMEActiveBrowser/AggregateTreeCtrl.cpp
trunk/GME/GMEActiveBrowser/AggregateTreeCtrl.h
trunk/GME/GMEActiveBrowser/GMEActiveBrowser.odl
trunk/GME/GMEActiveBrowser/GMEActiveBrowserCtl.cpp
trunk/GME/GMEActiveBrowser/GMEActiveBrowserCtl.h
Modified: trunk/GME/GMEActiveBrowser/ActiveBrowserPropertyPage.cpp
==============================================================================
--- trunk/GME/GMEActiveBrowser/ActiveBrowserPropertyPage.cpp Thu Sep 12 15:22:36 2013 (r2346)
+++ trunk/GME/GMEActiveBrowser/ActiveBrowserPropertyPage.cpp Thu Sep 12 15:24:15 2013 (r2347)
@@ -2020,6 +2020,13 @@
m_TreeAggregate.DeleteItem(hItem);
}
+ CComBSTR id;
+ ccpMgaObject->get_ID(&id);
+ auto highlightIt = m_TreeAggregate.m_highlightedObjects.find(id);
+ if (highlightIt != m_TreeAggregate.m_highlightedObjects.end())
+ {
+ m_TreeAggregate.m_highlightedObjects.erase(highlightIt);
+ }
// If the parent is in the object tree and there is dynamic loading
// we set the +/- button
@@ -4239,3 +4246,36 @@
msg = p_msgText + (lst.IsEmpty()?_T("None"):lst);
}
+
+void CAggregatePropertyPage::HighlightItem(IMgaObject* pObj, int highlight)
+{
+ CGMEActiveBrowserApp* pApp=(CGMEActiveBrowserApp*)AfxGetApp();
+ CMgaContext* pMgaContext=&pApp->m_CurrentProject.m_MgaContext;
+ CComPtr<IMgaObject> terrObj;
+ pMgaContext->m_ccpTerritory->OpenObj(pObj, &terrObj);
+ CComPtr<IUnknown> pUnk;
+ terrObj.QueryInterface(&pUnk.p);
+
+ CComBSTR id;
+ pObj->get_ID(&id);
+
+ auto& highlightedObjects = m_TreeAggregate.m_highlightedObjects;
+ if (highlight)
+ {
+ highlightedObjects[id] = highlight;
+ }
+ else
+ {
+ auto it = highlightedObjects.find(id);
+ if (it != highlightedObjects.end())
+ {
+ highlightedObjects.erase(it);
+ }
+ }
+ HTREEITEM hItem;
+ IUnknown* punk;
+ if (m_TreeAggregate.m_MgaMap.SearchTreeItem(id, hItem, punk))
+ {
+ m_TreeAggregate.SetItemProperties(hItem);
+ }
+}
Modified: trunk/GME/GMEActiveBrowser/ActiveBrowserPropertyPage.h
==============================================================================
--- trunk/GME/GMEActiveBrowser/ActiveBrowserPropertyPage.h Thu Sep 12 15:22:36 2013 (r2346)
+++ trunk/GME/GMEActiveBrowser/ActiveBrowserPropertyPage.h Thu Sep 12 15:24:15 2013 (r2347)
@@ -42,6 +42,7 @@
void DoCopySmart( int k = 0);
bool askUserAndDetach( CComPtr<IMgaObject> obj); // called when archetype is deleted
void accessRights( bool pbProtectIt);
+ void HighlightItem(IMgaObject* pUnk, int highlight);
CComboEdit m_ComboEditCtrl;
Modified: trunk/GME/GMEActiveBrowser/AggregateTreeCtrl.cpp
==============================================================================
--- trunk/GME/GMEActiveBrowser/AggregateTreeCtrl.cpp Thu Sep 12 15:22:36 2013 (r2346)
+++ trunk/GME/GMEActiveBrowser/AggregateTreeCtrl.cpp Thu Sep 12 15:24:15 2013 (r2347)
@@ -308,6 +308,7 @@
/* Saving the items to the registry */
// Getting item state
UINT nItemState=CTreeCtrlEx::GetItemState(hItem,0xffffffff);
+ nItemState = nItemState & ~TVIS_BOLD;
// Searching the map for the Mga pointer
LPUNKNOWN pUnknown;
@@ -1320,6 +1321,20 @@
CComQIPtr<IMgaObject> ccpMgaObject(ObjectProxy.m_pMgaObject);
+ if (ccpMgaObject)
+ {
+ CComBSTR id;
+ ccpMgaObject->get_ID(&id);
+ auto it = m_highlightedObjects.find(id);
+ if (it != m_highlightedObjects.end())
+ {
+ CTreeCtrl::SetItemState(hItem, TVIS_BOLD, TVIS_BOLD);
+ }
+ else
+ {
+ CTreeCtrl::SetItemState(hItem, 0, TVIS_BOLD);
+ }
+ }
/////////////// If it is an FCO cast it //////////////
// If not an Folder deal with Subtype/instance flags
Modified: trunk/GME/GMEActiveBrowser/AggregateTreeCtrl.h
==============================================================================
--- trunk/GME/GMEActiveBrowser/AggregateTreeCtrl.h Thu Sep 12 15:22:36 2013 (r2346)
+++ trunk/GME/GMEActiveBrowser/AggregateTreeCtrl.h Thu Sep 12 15:24:15 2013 (r2347)
@@ -14,6 +14,21 @@
#include <GdiPlus.h>
#include <memory>
#include <map>
+#include <unordered_map>
+
+struct CComBSTR_hashfunc : public stdext::hash_compare<CComBSTR>
+{
+ size_t operator()(const CComBSTR &p_ob) const
+ {
+ size_t c = 0;
+ for(unsigned int i = 0; i < p_ob.Length(); i+= 3) c += p_ob[i];
+ return c;
+ }
+ bool operator()(const CComBSTR &p_ob1, const CComBSTR &p_ob2) const
+ {
+ return p_ob1 < p_ob2;
+ }
+};
struct CAggregateMgaObjectProxy : public CMgaObjectProxy
{
@@ -38,6 +53,7 @@
void SetItemProperties(HTREEITEM hItem, int p_fileLatentState=0, CAggregateMgaObjectProxy* insertedProxy=nullptr);
std::map<_bstr_t, int> treeIcons;
+ std::unordered_map<CComBSTR, int, CComBSTR_hashfunc> m_highlightedObjects;
void GetCustomTreeIcon(IMgaObject* ccpMgaObject, TVITEM& tvItem);
BOOL DoDrop(eDragOperation doDragOp, COleDataObject *pDataObject, CPoint point);
BOOL DoDropWithoutChecking(eDragOperation doDragOp, COleDataObject *pDataObject, CPoint point);
Modified: trunk/GME/GMEActiveBrowser/GMEActiveBrowser.odl
==============================================================================
--- trunk/GME/GMEActiveBrowser/GMEActiveBrowser.odl Thu Sep 12 15:22:36 2013 (r2346)
+++ trunk/GME/GMEActiveBrowser/GMEActiveBrowser.odl Thu Sep 12 15:24:15 2013 (r2347)
@@ -19,7 +19,7 @@
// Primary dispatch interface for CGMEActiveBrowserCtrl
- [ uuid(9D345706-0DE7-4A6A-B32A-DD1BB2F8B81F),
+ [ uuid(9D345706-0DE7-4A6A-B32A-DD1BB2F8B810),
helpstring("Dispatch interface for GMEActiveBrowser Control"), hidden ]
dispinterface _DGMEActiveBrowser
{
@@ -46,6 +46,7 @@
[id(11)] void Down();
[id(12)] void ChangePropPage(browser_page);
//}}AFX_ODL_METHOD
+ [id(50)] void HighlightItem(IUnknown* pMgaObject);
};
// Event dispatch interface for CGMEActiveBrowserCtrl
Modified: trunk/GME/GMEActiveBrowser/GMEActiveBrowserCtl.cpp
==============================================================================
--- trunk/GME/GMEActiveBrowser/GMEActiveBrowserCtl.cpp Thu Sep 12 15:22:36 2013 (r2346)
+++ trunk/GME/GMEActiveBrowser/GMEActiveBrowserCtl.cpp Thu Sep 12 15:24:15 2013 (r2347)
@@ -49,6 +49,7 @@
DISP_FUNCTION(CGMEActiveBrowserCtrl, "Down", Down, VT_EMPTY, VTS_NONE)
DISP_FUNCTION(CGMEActiveBrowserCtrl, "ChangePropPage", ChangePropPage, VT_EMPTY, VTS_I2)
//}}AFX_DISPATCH_MAP
+ DISP_FUNCTION(CGMEActiveBrowserCtrl, "HighlightItem", HighlightItem, VT_EMPTY, VTS_UNKNOWN VTS_I4)
END_DISPATCH_MAP()
@@ -698,3 +699,30 @@
cs.dwExStyle |= WS_EX_CONTROLPARENT;
return COleControl::PreCreateWindow(cs);
}
+
+
+void CGMEActiveBrowserCtrl::HighlightItem(IUnknown* item, int highlight)
+{
+ if (item == nullptr)
+ return;
+ CComPtr<IMgaObject> object;
+ item->QueryInterface(&object.p);
+ if (!object)
+ return;
+
+ CGMEActiveBrowserApp* pApp = (CGMEActiveBrowserApp*)AfxGetApp();
+ if (pApp)
+ {
+ pApp->m_CurrentProject.m_MgaContext.SetEventTransactionMode(true);
+ try
+ {
+ m_pPropFrame->m_pModelessPropSheet->m_PageAggregate.HighlightItem(object, highlight);
+ }
+ catch (...)
+ {
+ pApp->m_CurrentProject.m_MgaContext.SetEventTransactionMode(false);
+ throw;
+ }
+ pApp->m_CurrentProject.m_MgaContext.SetEventTransactionMode(false);
+ }
+}
Modified: trunk/GME/GMEActiveBrowser/GMEActiveBrowserCtl.h
==============================================================================
--- trunk/GME/GMEActiveBrowser/GMEActiveBrowserCtl.h Thu Sep 12 15:22:36 2013 (r2346)
+++ trunk/GME/GMEActiveBrowser/GMEActiveBrowserCtl.h Thu Sep 12 15:24:15 2013 (r2347)
@@ -140,6 +140,8 @@
void PropagateMgaMessages();
CMgaObjectEventList m_MgaObjectEventList;
int CreateActiveBrowser();
+public:
+ void HighlightItem(IUnknown* item, int highlight);
};
//{{AFX_INSERT_LOCATION}}
More information about the gme-commit
mailing list