[commit] r1197 - trunk/GME/Gme

GMESRC Repository Notifications gme-commit at list.isis.vanderbilt.edu
Fri Feb 25 16:50:32 CST 2011


Author: ksmyth
Date: Fri Feb 25 16:50:31 2011
New Revision: 1197

Log:
Remove dialog on File>Open; just ask for a file and look at the extension

Modified:
   trunk/GME/Gme/GMEApp.cpp
   trunk/GME/Gme/MgaOpenDlg.cpp

Modified: trunk/GME/Gme/GMEApp.cpp
==============================================================================
--- trunk/GME/Gme/GMEApp.cpp	Fri Feb 25 15:29:27 2011	(r1196)
+++ trunk/GME/Gme/GMEApp.cpp	Fri Feb 25 16:50:31 2011	(r1197)
@@ -1701,7 +1701,6 @@
 		CloseProject();
 
 	if (conn.Left(4) == "XML=") {
-		//wer
 		MSGTRY {
 			CString fullPath = conn.Right(conn.GetLength() - 4);
 			TCHAR buffer[MAX_PATH];
@@ -1710,12 +1709,26 @@
 			if (filepart == NULL) {
 				COMTHROW(E_FILEOPEN);
 			}
-			CString fname = conn.Right(conn.ReverseFind('\\'));
 			CString filename = filepart;
 			CString title = filename.Left(filename.ReverseFind('.'));
 			Importxml(fullPath, filepart, title);
-		} MSGCATCH("Error opening XML file",;)
+		} MSGCATCH("Error opening XME file",;)
 	} else {
+		if (conn.Left(4) == "MGX=") {
+			CString fullPath = conn.Right(conn.GetLength() - 4);
+			TCHAR buffer[MAX_PATH];
+			TCHAR* filepart = NULL;
+			GetFullPathName(fullPath, MAX_PATH, buffer, &filepart);
+			if (filepart == NULL) {
+				DisplayError("Error opening MGX file", E_FILEOPEN);
+				return;
+			}
+			// FIXME: KMS: yes, the quotes are necessary...
+			conn = "MGX=\"";
+			// FIXME: KMS: yes, a trailing slash makes it not work
+			conn += fullPath.Left(fullPath.GetLength() - strlen(filepart) - 1);
+			conn += "\"";
+		}
 		OpenProject(conn);
 	}
 
@@ -1748,6 +1761,13 @@
 int CGMEApp::ExitInstance() 
 {
 	CloseProject(false);
+
+#ifdef _DEBUG
+	// Do this under Debug to silence memory leaks
+	// Don't do it under Release, since we may yet crash, and it's wasteful since we're exiting anyway
+	crUninstall();
+#endif
+
 	return CWinAppEx::ExitInstance();
 }
 

Modified: trunk/GME/Gme/MgaOpenDlg.cpp
==============================================================================
--- trunk/GME/Gme/MgaOpenDlg.cpp	Fri Feb 25 15:29:27 2011	(r1196)
+++ trunk/GME/Gme/MgaOpenDlg.cpp	Fri Feb 25 16:50:31 2011	(r1197)
@@ -85,21 +85,15 @@
 }
 
 static char mgafilter[] = "MGA Files (*.mga)|*.mga|Exported Files (*.xme;*.xml)|*.xme; *.xml|"
-	"Microsoft Access Files (*.mdb)|*.mdb|All files (*.*)|*.*||";
+	"All files (*.*)|*.*||";
 
-static char xmemgafilter[] = "GME Model Files (*.mga;*.xme)|*.mga; *.xme|MGA Files (*.mga)|*.mga|Exported Files (*.xme;*.xml)|*.xme; *.xml|"
-	"Microsoft Access Files (*.mdb)|*.mdb|All files (*.*)|*.*||";
-
-/*static char mgafilter[] = "MGA Files (*.mga)|*.mga|Exported Files (*.xme;*.xml)|*.xme; *.xml|"
-	"Microsoft Access Files (*.mdb)|*.mdb||";*/
-
-/*static char mgafilter[] = "MGA Files (*.mga)|*.mga|Exported Files (*.xme;*.xml)|*.xme; *.xml|"
-	"Microsoft Access Files (*.mdb)|*.mdb|MGX Files (*.mgx)|*.mgx||";*/
+static char xmemgafilter[] = "GME Model Files (*.mga;*.xme;*.mgx)|*.mga; *.xme; *.mgx|MGA Files (*.mga)|*.mga|Exported Files (*.xme;*.xml)|*.xme; *.xml|"
+	"Multi-user files (*.mgx)|*.mgx|All files (*.*)|*.*||";
 
 static char mgaonlyfilter[] = "MGA Files (*.mga)|*.mga||";
 
 static char metafilter[] = "MGA Meta Files (*.mta)|*.mta|XML Paradigm Files (*.xmp)|*.xmp|"
-	"Microsoft Access Files (*.mdb)|*.mdb|All files (*.*)|*.*||";
+	"All files (*.*)|*.*||";
 
 
 CString CMgaOpenDlg::AskMGAConnectionString(const CString& spec_ext)
@@ -162,7 +156,7 @@
 
 	try
 	{
-		if( DoModal() == IDOK && !pressed_back )
+		if( (allowXme && (m_radio = 1)) || (DoModal() == IDOK && !pressed_back) )
 		{
 			if( m_radio == 0 || m_radio == 2)
 			{


More information about the gme-commit mailing list