[commit] r1940 - trunk/Tools/TableEditor

GMESRC Repository Notifications gme-commit at list.isis.vanderbilt.edu
Tue Jun 26 14:09:41 CDT 2012


Author: ksmyth
Date: Tue Jun 26 14:09:40 2012
New Revision: 1940

Log:
Display only children by default. Add recurse button.

Modified:
   trunk/Tools/TableEditor/Component.rc
   trunk/Tools/TableEditor/GridDlg.cpp
   trunk/Tools/TableEditor/GridDlg.h
   trunk/Tools/TableEditor/RawComponent.cpp
   trunk/Tools/TableEditor/Resource.h
   trunk/Tools/TableEditor/TableEditor.vcxproj

Modified: trunk/Tools/TableEditor/Component.rc
==============================================================================
--- trunk/Tools/TableEditor/Component.rc	Thu Jun 21 15:06:02 2012	(r1939)
+++ trunk/Tools/TableEditor/Component.rc	Tue Jun 26 14:09:40 2012	(r1940)
@@ -1,4 +1,4 @@
-//Microsoft Developer Studio generated resource script.
+// Microsoft Visual C++ generated resource script.
 //
 #include "resource.h"
 
@@ -13,13 +13,11 @@
 #undef APSTUDIO_READONLY_SYMBOLS
 
 /////////////////////////////////////////////////////////////////////////////
-// English (U.S.) resources
+// English (United States) resources
 
 #if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
-#ifdef _WIN32
 LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
 #pragma code_page(1252)
-#endif //_WIN32
 
 #ifdef APSTUDIO_INVOKED
 /////////////////////////////////////////////////////////////////////////////
@@ -27,18 +25,18 @@
 // TEXTINCLUDE
 //
 
-1 TEXTINCLUDE DISCARDABLE 
+1 TEXTINCLUDE 
 BEGIN
     "resource.h\0"
 END
 
-2 TEXTINCLUDE DISCARDABLE 
+2 TEXTINCLUDE 
 BEGIN
     "#include ""afxres.h""\r\n"
     "\0"
 END
 
-3 TEXTINCLUDE DISCARDABLE 
+3 TEXTINCLUDE 
 BEGIN
     "1 TYPELIB ""ComponentLib.tlb""\r\n"
     "\0"
@@ -47,7 +45,6 @@
 #endif    // APSTUDIO_INVOKED
 
 
-#ifndef _MAC
 /////////////////////////////////////////////////////////////////////////////
 //
 // Version
@@ -70,15 +67,13 @@
     BEGIN
         BLOCK "040904B0"
         BEGIN
-            VALUE "CompanyName", "\0"
-            VALUE "FileDescription", "Interpreter Module\0"
-            VALUE "FileVersion", "1, 0, 0, 1\0"
-            VALUE "InternalName", "Interpreter\0"
-            VALUE "LegalCopyright", "Copyright 2000\0"
-            VALUE "OriginalFilename", "Interpreter.DLL\0"
-            VALUE "ProductName", "Interpreter Module\0"
-            VALUE "ProductVersion", "1, 0, 0, 1\0"
-            VALUE "OLESelfRegister", "\0"
+            VALUE "FileDescription", "Interpreter Module"
+            VALUE "FileVersion", "1, 0, 0, 1"
+            VALUE "InternalName", "Interpreter"
+            VALUE "LegalCopyright", "Copyright 2000"
+            VALUE "OriginalFilename", "Interpreter.DLL"
+            VALUE "ProductName", "Interpreter Module"
+            VALUE "ProductVersion", "1, 0, 0, 1"
         END
     END
     BLOCK "VarFileInfo"
@@ -87,8 +82,6 @@
     END
 END
 
-#endif    // !_MAC
-
 
 /////////////////////////////////////////////////////////////////////////////
 //
@@ -97,47 +90,36 @@
 
 // Icon with lowest ID value placed first to ensure application icon
 // remains consistent on all systems.
-IDI_COMPICON            ICON    DISCARDABLE     "compicon.ico"
+IDI_COMPICON            ICON                    "compicon.ico"
 
 /////////////////////////////////////////////////////////////////////////////
 //
 // Dialog
 //
 
-IDD_GRIDDLG DIALOG DISCARDABLE  0, 0, 434, 345
-STYLE WS_MINIMIZEBOX | WS_MAXIMIZEBOX | WS_POPUP | WS_CAPTION | WS_SYSMENU | 
-    WS_THICKFRAME
+IDD_GRIDDLG DIALOGEX 0, 0, 434, 345
+STYLE DS_SETFONT | WS_MINIMIZEBOX | WS_MAXIMIZEBOX | WS_POPUP | WS_CAPTION | WS_SYSMENU | WS_THICKFRAME
 CAPTION "GME Table Editor"
-FONT 8, "MS Sans Serif"
+MENU IDR_GRIDDLG_MENU
+FONT 8, "MS Sans Serif", 0, 0, 0x0
 BEGIN
     DEFPUSHBUTTON   "OK",IDOK,14,324,50,14
     PUSHBUTTON      "Cancel",IDCANCEL,69,324,50,14
     CONTROL         "Custom1",IDC_GRID,"MFCGridCtrl",WS_TABSTOP,7,7,420,265
     PUSHBUTTON      "Export...",IDC_BTNEXPORT,125,324,48,14
-    CONTROL         "Display All Types",IDC_CHKALLTYPES,"Button",
-                    BS_AUTOCHECKBOX | WS_TABSTOP,64,295,69,10
-    CONTROL         "Models",IDC_CHKMODEL,"Button",BS_AUTOCHECKBOX | 
-                    WS_TABSTOP,18,308,39,10
-    CONTROL         "Atoms",IDC_CHKATOM,"Button",BS_AUTOCHECKBOX | 
-                    WS_TABSTOP,60,308,35,10
-    CONTROL         "References",IDC_CHKREF,"Button",BS_AUTOCHECKBOX | 
-                    WS_TABSTOP,96,308,49,10
-    CONTROL         "Sets",IDC_CHKSET,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,
-                    150,308,27,10
-    CONTROL         "Connections",IDC_CHKCON,"Button",BS_AUTOCHECKBOX | 
-                    WS_TABSTOP,182,308,59,10
+    CONTROL         "Display All Types",IDC_CHKALLTYPES,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,64,295,69,10
+    CONTROL         "Models",IDC_CHKMODEL,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,18,308,39,10
+    CONTROL         "Atoms",IDC_CHKATOM,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,60,308,35,10
+    CONTROL         "References",IDC_CHKREF,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,96,308,49,10
+    CONTROL         "Sets",IDC_CHKSET,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,150,308,27,10
+    CONTROL         "Connections",IDC_CHKCON,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,182,308,59,10
     LTEXT           "Kind Filters:",IDC_STATIC_KIND,274,280,37,8
-    LISTBOX         IDC_LISTKIND,243,291,171,35,LBS_SORT | 
-                    LBS_NOINTEGRALHEIGHT | LBS_EXTENDEDSEL | WS_VSCROLL | 
-                    WS_TABSTOP
-    CONTROL         "Display All Kinds",IDC_CHECKALLKINDS,"Button",
-                    BS_AUTOCHECKBOX | WS_TABSTOP,327,278,67,10
-    LTEXT           "Use Ctrl and/or Shift to select multiple Kinds",
-                    IDC_STATICHELP,249,330,138,8
+    LISTBOX         IDC_LISTKIND,243,291,171,35,LBS_SORT | LBS_NOINTEGRALHEIGHT | LBS_EXTENDEDSEL | WS_VSCROLL | WS_TABSTOP
+    CONTROL         "Display All Kinds",IDC_CHECKALLKINDS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,327,278,67,10
+    LTEXT           "Use Ctrl and/or Shift to select multiple Kinds",IDC_STATICHELP,249,330,138,8
     PUSHBUTTON      "Update Display",IDC_BTNDISP,136,289,79,15
     LTEXT           "Type Filters:",IDC_STATIC_TYPE,13,295,46,10
-    LTEXT           "Invoking the table editor with selected objects will display only those objects",
-                    IDC_STATIC_SELECTION,7,276,257,8
+    LTEXT           "Invoking the table editor with selected objects will display only those objects",IDC_STATIC_SELECTION,7,276,257,8
     LTEXT           "Filters:",IDC_STATIC_FILTERS,12,286,54,8
     PUSHBUTTON      "Import...",IDC_BTNIMPORT,179,324,48,14
 END
@@ -149,7 +131,7 @@
 //
 
 #ifdef APSTUDIO_INVOKED
-GUIDELINES DESIGNINFO DISCARDABLE 
+GUIDELINES DESIGNINFO
 BEGIN
     IDD_GRIDDLG, DIALOG
     BEGIN
@@ -164,15 +146,34 @@
 
 /////////////////////////////////////////////////////////////////////////////
 //
+// Menu
+//
+
+IDR_GRIDDLG_MENU MENU
+BEGIN
+    POPUP "&File"
+    BEGIN
+        MENUITEM "&Import ...",                 ID_FILE_IMPORT
+        MENUITEM "&Export ...",                 ID_FILE_EXPORT
+    END
+    POPUP "&View"
+    BEGIN
+        MENUITEM "&Recursively Show Items",     ID_VIEW_RECURSIVELYSHOWITEMS
+    END
+END
+
+
+/////////////////////////////////////////////////////////////////////////////
+//
 // String Table
 //
 
-STRINGTABLE DISCARDABLE 
+STRINGTABLE
 BEGIN
     IDS_PROJNAME            "Component"
 END
 
-#endif    // English (U.S.) resources
+#endif    // English (United States) resources
 /////////////////////////////////////////////////////////////////////////////
 
 

Modified: trunk/Tools/TableEditor/GridDlg.cpp
==============================================================================
--- trunk/Tools/TableEditor/GridDlg.cpp	Thu Jun 21 15:06:02 2012	(r1939)
+++ trunk/Tools/TableEditor/GridDlg.cpp	Tue Jun 26 14:09:40 2012	(r1940)
@@ -12,6 +12,8 @@
 #include "NewCellTypes/GridCellAttrName.h"
 #include "TableEditorParser.h"
 #include "TableEditorDumper.h"
+#include <queue>
+#include "Console.h"
 
 #ifdef _DEBUG
 #define new DEBUG_NEW
@@ -470,6 +472,69 @@
 	}MGACOLL_ITERATE_END;	
 }
 
+HRESULT CGridDlg::ShowItemsRecursively()
+{
+	COMTRY {
+		std::queue< CComPtr<IMgaFCO> > fcoq;
+
+		CComPtr<IMgaFCOs> recursiveFCOs = NULL;
+		COMTHROW(recursiveFCOs.CoCreateInstance(L"Mga.MgaFCOs"));
+
+		long count = 0;
+		COMTHROW(this->m_FCOs->get_Count(&count));
+
+		for (int idx = 1; idx <= count; idx++) {
+			CComPtr<IMgaFCO> fco;
+			COMTHROW(this->m_FCOs->get_Item(idx, &fco));
+			fcoq.push(fco);
+		}
+
+		while (! fcoq.empty()) {
+			CComPtr<IMgaFCO> parent = fcoq.front();
+			fcoq.pop();
+
+			COMTHROW(recursiveFCOs->Append(parent));
+
+			objtype_enum type;
+			COMTHROW(parent->get_ObjType(&type));
+			if (type != OBJTYPE_MODEL && type != OBJTYPE_FOLDER)
+				continue;
+
+			CComPtr<IMgaObjects> children = NULL;
+			COMTHROW(parent->get_ChildObjects(&children));
+
+			long count = 0;
+			COMTHROW(children->get_Count(&count));
+
+			for (int idx = 1; idx <= count; idx++) {
+				CComPtr<IMgaObject> child;
+				COMTHROW(children->get_Item(idx, &child));
+
+				objtype_enum type = OBJTYPE_NULL;
+				COMTHROW(child->get_ObjType(&type));
+
+				switch (type) {
+				case OBJTYPE_MODEL:
+				case OBJTYPE_ATOM:
+				case OBJTYPE_REFERENCE:
+				case OBJTYPE_CONNECTION:
+				case OBJTYPE_SET:
+					CComPtr<IMgaFCO> fco = NULL;
+					fco = static_cast<IMgaFCO*>(child.p);
+					fcoq.push(fco);
+					break;
+				}
+			}
+		}
+
+		this->m_FCOs = recursiveFCOs;
+		this->InitGrid();
+
+		return S_OK;
+	}
+	COMCATCH(;);
+}
+
 void CGridDlg::GetMetaObjectNames(IMgaMetaBase *metaBase) //based on GetMetaObjectsR in OCLCommonEx.cpp
 {
 		CComPtr<IMgaMetaFCOs> p_FCOs;
@@ -566,6 +631,9 @@
 
 BEGIN_MESSAGE_MAP(CGridDlg, CDialog)
 	//{{AFX_MSG_MAP(CGridDlg)
+	ON_COMMAND(ID_FILE_IMPORT, OnBtnImport)
+	ON_COMMAND(ID_FILE_EXPORT, OnBtnExport)
+	ON_COMMAND(ID_VIEW_RECURSIVELYSHOWITEMS, OnRecursivelyShowItems)
 	ON_WM_SIZE()
 	ON_BN_CLICKED(IDC_BTNEXPORT, OnBtnExport)
 	ON_BN_CLICKED(IDC_BTNDISP, OnButtonDisplay)
@@ -987,6 +1055,11 @@
 	}
 }
 
+void CGridDlg::OnRecursivelyShowItems()
+{
+	ShowItemsRecursively();
+}
+
 void CGridDlg::OnBtnImport() 
 {
 	CFileDialog FileSelector(TRUE,"xml",NULL, NULL,"EXCEL Exported XML (*.xml)|*.xml||");

Modified: trunk/Tools/TableEditor/GridDlg.h
==============================================================================
--- trunk/Tools/TableEditor/GridDlg.h	Thu Jun 21 15:06:02 2012	(r1939)
+++ trunk/Tools/TableEditor/GridDlg.h	Tue Jun 26 14:09:40 2012	(r1940)
@@ -89,12 +89,14 @@
 
 	BOOL GetMultiLine(CComPtr<IMgaMetaAttribute> p_Meta);
 	void InitGrid();
+	HRESULT ShowItemsRecursively();
 
 	// Generated message map functions
 	//{{AFX_MSG(CGridDlg)
 	virtual BOOL OnInitDialog();
 	afx_msg void OnSize(UINT nType, int cx, int cy);
 	afx_msg void OnBtnExport();
+	afx_msg void OnRecursivelyShowItems();
 	afx_msg void OnButtonDisplay();
 	afx_msg void OnCheckAllKinds();
 	afx_msg void OnChkAllTypes();

Modified: trunk/Tools/TableEditor/RawComponent.cpp
==============================================================================
--- trunk/Tools/TableEditor/RawComponent.cpp	Thu Jun 21 15:06:02 2012	(r1939)
+++ trunk/Tools/TableEditor/RawComponent.cpp	Tue Jun 26 14:09:40 2012	(r1940)
@@ -12,6 +12,7 @@
 #include "RawComponent.h"
 #include "GridDlg.h"
 
+
 // this method is called after all the generic initialization is done
 // this should be empty, unless application-specific initialization is needed
 STDMETHODIMP RawComponent::Initialize(struct IMgaProject *) {
@@ -46,11 +47,42 @@
 		COMTHROW(project->CreateTerritory(NULL, &terr));
 		COMTHROW(project->BeginTransaction(terr));
 		try {
-			COMTHROW(project->get_Name(&projname));
-			if(currentobj) COMTHROW(currentobj->get_Name(&focusname));
-			//custom code HERE:
+			CComPtr<IMgaFCOs> gridFCOs = NULL;
+
+			long count = 0;
+			COMTHROW(selectedobjs->get_Count(&count));
+
+			// If there are selected objects, display those.
+			// If there is no current model, display the children of the root folder.
+			// If nothing is selected, display the children of the current
+			// object (assuming it's a model).
+			// If the current object isn't a model, display an empty list.
+			if (count > 0) {
+				gridFCOs = selectedobjs;
+			}
+			else if (!currentobj) {
+				IMgaFolder* rootFolder = NULL;
+				COMTHROW(project->get_RootFolder(&rootFolder));
+				COMTHROW(rootFolder->get_ChildFCOs(&gridFCOs));
+			}
+			else {
+				IMgaMetaFCO* meta = NULL;
+				objtype_enum type = OBJTYPE_NULL;
+
+				COMTHROW(currentobj->get_Meta(&meta));
+				COMTHROW(meta->get_ObjType(&type));
+
+				if (type == OBJTYPE_MODEL) {
+					IMgaModel* model = static_cast<IMgaModel*>(currentobj);
+					COMTHROW(model->get_ChildFCOs(&gridFCOs));
+				}
+				else {
+					// empty list
+					COMTHROW(gridFCOs.CoCreateInstance(L"Mga.MgaFCOs"));
+				}
+			}
 
-			CGridDlg m_Dlg(selectedobjs);
+			CGridDlg m_Dlg(gridFCOs);
 			m_Dlg.SetProject(project);
 		
 			if( m_Dlg.DoModal() == IDCANCEL)

Modified: trunk/Tools/TableEditor/Resource.h
==============================================================================
--- trunk/Tools/TableEditor/Resource.h	Thu Jun 21 15:06:02 2012	(r1939)
+++ trunk/Tools/TableEditor/Resource.h	Tue Jun 26 14:09:40 2012	(r1940)
@@ -1,11 +1,12 @@
 //{{NO_DEPENDENCIES}}
-// Microsoft Developer Studio generated include file.
+// Microsoft Visual C++ generated include file.
 // Used by Component.rc
 //
 #define IDS_PROJNAME                    100
 #define IDC_GRID                        201
 #define IDD_GRIDDLG                     201
 #define IDD_SELECTDLG                   202
+#define IDR_GRIDDLG_MENU                205
 #define IDC_STATIC_KIND                 209
 #define IDC_LISTKIND                    210
 #define IDC_CHECKALLKINDS               212
@@ -22,13 +23,17 @@
 #define IDC_STATIC_SELECTION            224
 #define IDC_STATIC_FILTERS              225
 #define IDC_BTNIMPORT                   226
+#define ID_FILE_EXPORTAS                32768
+#define ID_FILE_IMPORT                  32769
+#define ID_FILE_EXPORT                  32770
+#define ID_VIEW_RECURSIVELYSHOWITEMS    32771
 
 // Next default values for new objects
 // 
 #ifdef APSTUDIO_INVOKED
 #ifndef APSTUDIO_READONLY_SYMBOLS
-#define _APS_NEXT_RESOURCE_VALUE        205
-#define _APS_NEXT_COMMAND_VALUE         32768
+#define _APS_NEXT_RESOURCE_VALUE        206
+#define _APS_NEXT_COMMAND_VALUE         32772
 #define _APS_NEXT_CONTROL_VALUE         226
 #define _APS_NEXT_SYMED_VALUE           101
 #endif

Modified: trunk/Tools/TableEditor/TableEditor.vcxproj
==============================================================================
--- trunk/Tools/TableEditor/TableEditor.vcxproj	Thu Jun 21 15:06:02 2012	(r1939)
+++ trunk/Tools/TableEditor/TableEditor.vcxproj	Tue Jun 26 14:09:40 2012	(r1940)
@@ -213,4 +213,9 @@
   <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
   <ImportGroup Label="ExtensionTargets">
   </ImportGroup>
+  <ProjectExtensions>
+    <VisualStudio>
+      <UserProperties RESOURCE_FILE="Component.rc" />
+    </VisualStudio>
+  </ProjectExtensions>
 </Project>
\ No newline at end of file


More information about the gme-commit mailing list