[commit] r2691 - trunk/GME/ObjectInspector
GMESRC Repository Notifications
gme-commit at list.isis.vanderbilt.edu
Thu Aug 24 15:37:36 CDT 2017
Author: ksmyth
Date: Thu Aug 24 15:37:35 2017
New Revision: 2691
Log:
Object Inspector: add 'Open Refered' option to references
Modified:
trunk/GME/ObjectInspector/InspectorDefs.h
trunk/GME/ObjectInspector/InspectorDlg.cpp
trunk/GME/ObjectInspector/InspectorDlg.h
trunk/GME/ObjectInspector/InspectorList.cpp
trunk/GME/ObjectInspector/InspectorList.h
trunk/GME/ObjectInspector/ObjectInspectorCtl.cpp
trunk/GME/ObjectInspector/ObjectInspectorCtl.h
trunk/GME/ObjectInspector/Resource.h
trunk/GME/ObjectInspector/StdAfx.h
Modified: trunk/GME/ObjectInspector/InspectorDefs.h
==============================================================================
--- trunk/GME/ObjectInspector/InspectorDefs.h Wed Aug 2 15:55:34 2017 (r2690)
+++ trunk/GME/ObjectInspector/InspectorDefs.h Thu Aug 24 15:37:35 2017 (r2691)
@@ -56,6 +56,7 @@
// Inspector List Messages
#define LBN_ON_ITEM_CHANGED WM_APP + 1022
+#define LBN_ON_OPEN_REFERED WM_APP + 1025
// NameEdit Messages
Modified: trunk/GME/ObjectInspector/InspectorDlg.cpp
==============================================================================
--- trunk/GME/ObjectInspector/InspectorDlg.cpp Wed Aug 2 15:55:34 2017 (r2690)
+++ trunk/GME/ObjectInspector/InspectorDlg.cpp Thu Aug 24 15:37:35 2017 (r2691)
@@ -81,6 +81,7 @@
ON_WM_SIZE()
ON_NOTIFY(TCN_SELCHANGE, IDC_INSPECTOR_SHEET, OnSelchangeInspectorSheet)
ON_MESSAGE(LBN_ON_ITEM_CHANGED, OnItemChanged)
+ ON_MESSAGE(LBN_ON_OPEN_REFERED, OnOpenRefered)
ON_MESSAGE(MSG_NAME_EDIT_END_OK, OnNameEditEndOK)
ON_MESSAGE(MSG_NAME_EDIT_END_CANCEL, OnNameEditEndCancel)
ON_EN_KILLFOCUS(IDC_EDIT_NAME, OnKillfocusEditName)
@@ -427,6 +428,17 @@
return TRUE;
}
+LRESULT CInspectorDlg::OnOpenRefered(WPARAM wParam, LPARAM lParam)
+{
+ CListItem ListItem;
+ m_inspectorLists[INSP_PROP_PANEL]->GetItem(wParam, ListItem);
+
+ CObjectInspectorCtrl* pParent = (CObjectInspectorCtrl*)GetParent();
+
+ pParent->OpenRefered();
+ return TRUE;
+}
+
void CInspectorDlg::SetName(const CString &strName, bool bIsReadOnly,bool bIsEnabled)
{
m_NameCtrl.SetWindowText(strName);
Modified: trunk/GME/ObjectInspector/InspectorDlg.h
==============================================================================
--- trunk/GME/ObjectInspector/InspectorDlg.h Wed Aug 2 15:55:34 2017 (r2690)
+++ trunk/GME/ObjectInspector/InspectorDlg.h Thu Aug 24 15:37:35 2017 (r2691)
@@ -69,6 +69,7 @@
afx_msg LRESULT OnNameEditEndCancel(WPARAM wParam, LPARAM lParam);
afx_msg LRESULT OnItemChanged(WPARAM wParam, LPARAM lParam);
+ afx_msg LRESULT OnOpenRefered(WPARAM wParam, LPARAM lParam);
void OnItemChangedPreference(int nItem);
void OnItemChangedAttribute(int nItem);
Modified: trunk/GME/ObjectInspector/InspectorList.cpp
==============================================================================
--- trunk/GME/ObjectInspector/InspectorList.cpp Wed Aug 2 15:55:34 2017 (r2690)
+++ trunk/GME/ObjectInspector/InspectorList.cpp Thu Aug 24 15:37:35 2017 (r2691)
@@ -54,6 +54,7 @@
ON_MESSAGE(MSG_EDIT_END_OK, OnEditEndOK)
ON_COMMAND(ID_LISTCONTEXT_RESETTODEFAULT, OnListContextResetToDefault)
ON_COMMAND(ID_LISTCONTEXT_COPY, OnListContextCopy)
+ ON_COMMAND(ID_OPENREFERED, OnOpenRefered)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
@@ -1219,12 +1220,27 @@
const wchar_t* archetype = L" (Archetype)";
auto value = listItem.Value.stringVal.GetAt(0);
if (value.GetLength() >= wcslen(archetype) && wcscmp(archetype, value.Right(wcslen(archetype))) == 0) {
+ // FIXME: should disable for non-primary derived
menu.EnableMenuItem(ID_LISTCONTEXT_RESETTODEFAULT, MF_GRAYED);
}
ClientToScreen(&point);
menu.TrackPopupMenu(TPM_LEFTALIGN | TPM_RIGHTBUTTON, point.x, point.y, this);
}
+ else if (listItem.strName == L"References") {
+ CMenu menu;
+ menu.CreatePopupMenu();
+ menu.AppendMenuW(MF_STRING, ID_OPENREFERED, L"Open refered");
+
+ const wchar_t* objectID = L"ObjectID=";
+ auto& value = listItem.Value.stringVal.GetAt(0);
+ if (value.Find(objectID) == -1) {
+ menu.EnableMenuItem(ID_OPENREFERED, MF_GRAYED);
+ }
+
+ ClientToScreen(&point);
+ menu.TrackPopupMenu(TPM_LEFTALIGN | TPM_RIGHTBUTTON, point.x, point.y, this);
+ }
}
}
@@ -1238,6 +1254,11 @@
Invalidate();
}
+void CInspectorList::OnOpenRefered()
+{
+ GetParent()->GetParent()->SendMessage(LBN_ON_OPEN_REFERED, 0, 0);
+}
+
void SetClipboardText(const CString& szData)
{
HGLOBAL h;
Modified: trunk/GME/ObjectInspector/InspectorList.h
==============================================================================
--- trunk/GME/ObjectInspector/InspectorList.h Wed Aug 2 15:55:34 2017 (r2690)
+++ trunk/GME/ObjectInspector/InspectorList.h Thu Aug 24 15:37:35 2017 (r2691)
@@ -98,6 +98,7 @@
afx_msg void OnRButtonDown(UINT nFlags, CPoint point);
afx_msg void OnListContextResetToDefault();
afx_msg void OnListContextCopy();
+ afx_msg void OnOpenRefered();
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
Modified: trunk/GME/ObjectInspector/ObjectInspectorCtl.cpp
==============================================================================
--- trunk/GME/ObjectInspector/ObjectInspectorCtl.cpp Wed Aug 2 15:55:34 2017 (r2690)
+++ trunk/GME/ObjectInspector/ObjectInspectorCtl.cpp Thu Aug 24 15:37:35 2017 (r2691)
@@ -868,7 +868,7 @@
}
template<typename F>
-void CObjectInspectorCtrl::WriteToMga(CListItem ListItem, F f)
+void CObjectInspectorCtrl::WriteToMga(F f)
{
CComPtr<IMgaMetaProject> ccpMetaProject;
try
@@ -926,7 +926,7 @@
ptr->DetachFromArcheType();
}
};
- WriteToMga(ListItem, write);
+ WriteToMga(write);
}
void CObjectInspectorCtrl::WriteAttributeItemToMga(CListItem ListItem)
@@ -939,7 +939,29 @@
m_Attribute.WriteItemToMga(ListItem, m_FCOList);
}
};
- WriteToMga(ListItem, write);
+ WriteToMga(write);
+}
+
+void CObjectInspectorCtrl::OpenRefered()
+{
+ IMgaFCOPtr referred;
+ if (m_FCOList.IsEmpty()) {
+ }
+ else {
+ MgaFCOPtr ptr = m_FCOList.GetHead();
+ CComQIPtr<IMgaReference> ref = ptr;
+ if (ref) {
+ WriteToMga([&]() {
+ referred = ref->Referred;
+ });
+ }
+ }
+ if (referred) {
+ auto gme = get_GME(referred->Project);
+ if (gme) {
+ gme->ShowFCO(referred, VARIANT_FALSE);
+ }
+ }
}
void CObjectInspectorCtrl::WritePreferenceItemToMga(CListItem ListItem, bool bIsForKind)
Modified: trunk/GME/ObjectInspector/ObjectInspectorCtl.h
==============================================================================
--- trunk/GME/ObjectInspector/ObjectInspectorCtl.h Wed Aug 2 15:55:34 2017 (r2690)
+++ trunk/GME/ObjectInspector/ObjectInspectorCtl.h Thu Aug 24 15:37:35 2017 (r2691)
@@ -31,8 +31,6 @@
#include "Property.h"
-
-
class CObjectInspectorCtrl : public COleControl
{
DECLARE_DYNCREATE(CObjectInspectorCtrl)
@@ -116,7 +114,7 @@
private:
template<typename F>
- void WriteToMga(CListItem ListItem, F f);
+ void WriteToMga(F f);
// Dispatch and event IDs
public:
@@ -129,6 +127,7 @@
void RefreshReferencePanel();
void RefreshAttributePanel();
void RefreshPropertyPanel();
+ void OpenRefered();
CAttribute m_Attribute;
CPreference m_Preference;
@@ -153,7 +152,27 @@
void RefreshName();
CMgaObjectEventList m_MgaObjectEventList;
void PropagateMgaMessages();
-};
+
+ static CComPtr<IGMEOLEApp> get_GME(IMgaProjectPtr& p_mgaproject)
+ {
+ CComPtr<IGMEOLEApp> gme;
+ if (p_mgaproject) {
+ CComBSTR bstrName("GME.Application");
+ CComPtr<IMgaClient> pClient;
+ HRESULT hr = p_mgaproject->GetClientByName(bstrName, &pClient);
+ if (SUCCEEDED(hr) && pClient) {
+ CComPtr<IDispatch> pDispatch;
+ hr = pClient->get_OLEServer(&pDispatch);
+ if (SUCCEEDED(hr) && pDispatch) {
+ hr = pDispatch.QueryInterface(&gme);
+ if (FAILED(hr)) {
+ gme = NULL;
+ }
+ }
+ }
+ }
+ return gme;
+ }};
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
Modified: trunk/GME/ObjectInspector/Resource.h
==============================================================================
--- trunk/GME/ObjectInspector/Resource.h Wed Aug 2 15:55:34 2017 (r2690)
+++ trunk/GME/ObjectInspector/Resource.h Thu Aug 24 15:37:35 2017 (r2691)
@@ -50,6 +50,7 @@
#define IDC_STATIC_BKG 243
#define ID_LISTCONTEXT_RESETTODEFAULT 32768
#define ID_LISTCONTEXT_COPY 32769
+#define ID_OPENREFERED 32770
// Next default values for new objects
//
Modified: trunk/GME/ObjectInspector/StdAfx.h
==============================================================================
--- trunk/GME/ObjectInspector/StdAfx.h Wed Aug 2 15:55:34 2017 (r2690)
+++ trunk/GME/ObjectInspector/StdAfx.h Thu Aug 24 15:37:35 2017 (r2691)
@@ -41,7 +41,7 @@
#import "MgaLib.tlb" no_implementation no_namespace raw_method_prefix("") high_method_prefix("__") no_registry
#import "MgaUtilLib.tlb" no_implementation no_namespace raw_method_prefix("") high_method_prefix("__") no_registry
//#import "ParserLib.tlb" no_implementation no_namespace raw_method_prefix("") high_method_prefix("__") no_registry
-//#import "GMELib.tlb" no_implementation no_namespace raw_method_prefix("") high_method_prefix("__") no_registry
+#import "GMELib.tlb" no_implementation no_namespace raw_method_prefix("") high_method_prefix("__") no_registry
#include "CommonImport.h"
More information about the gme-commit
mailing list