[commit] r1684 - in trunk/GME: Gme Mga

GMESRC Repository Notifications gme-commit at list.isis.vanderbilt.edu
Tue Nov 15 13:32:30 CST 2011


Author: ksmyth
Date: Tue Nov 15 13:32:30 2011
New Revision: 1684

Log:
If addons cant start up (eg no x64 version), offer to open without addons

Modified:
   trunk/GME/Gme/GMEApp.cpp
   trunk/GME/Mga/MgaProject.cpp

Modified: trunk/GME/Gme/GMEApp.cpp
==============================================================================
--- trunk/GME/Gme/GMEApp.cpp	Tue Nov 15 13:32:17 2011	(r1683)
+++ trunk/GME/Gme/GMEApp.cpp	Tue Nov 15 13:32:30 2011	(r1684)
@@ -1302,6 +1302,7 @@
 		ASSERT( mgaProject == 0 );
 		COMTHROW( mgaProject.CoCreateInstance(OLESTR("Mga.MgaProject")) );
 
+		VARIANT_BOOL enableAutoAddOns = VARIANT_TRUE;
 		VARIANT_BOOL readable_only;
 
 		COMTHROW( mgaProject->EnableAutoAddOns(VARIANT_TRUE));
@@ -1393,6 +1394,18 @@
 						newparname = parn;
 					}
 				}
+				if(hr == E_MGA_COMPONENT_ERROR) {
+					_bstr_t errorInfo;
+					GetErrorInfo(errorInfo.GetAddress());
+					_bstr_t err(_T("ERROR: automatic addon components could not start up:\n"));
+					err += errorInfo;
+					err += "\nDo you want to open the project without addons?";
+					if (AfxMessageBox(err, MB_YESNO) == IDYES) {
+						enableAutoAddOns = VARIANT_FALSE;
+						mgaProject->EnableAutoAddOns(enableAutoAddOns);
+						tryit = true;
+					}
+				}
 				if(tryit) {
 					hr = mgaProject->OpenEx(PutInBstr(conn), CComBSTR(newparname), guidpar);
 					if(hr == E_MGA_PARADIGM_NOTREG || hr == E_MGA_PARADIGM_INVALID) {
@@ -1401,13 +1414,6 @@
 				}
 				else break;
 			}
-			if(hr == E_MGA_COMPONENT_ERROR) {
-				BSTR errorInfo;
-				GetErrorInfo(&errorInfo);
-				_bstr_t err(_T("ERROR: automatic addon components could not start up:\n"));
-				err += errorInfo;
-				AfxMessageBox(err);
-			}
 			COMTHROW(hr);
 		}
 
@@ -1451,7 +1457,7 @@
 					// PETER: Create new MgaProject COM object (workaround MGA addon bug)
 					mgaProject.Release();
 					COMTHROW( mgaProject.CoCreateInstance(OLESTR("Mga.MgaProject")) );
-					COMTHROW( mgaProject->EnableAutoAddOns(VARIANT_TRUE));
+					COMTHROW( mgaProject->EnableAutoAddOns(enableAutoAddOns));
 					
 					HRESULT hr = mgaProject->OpenEx(PutInBstr(conn), pname, g2);
 					if(hr == E_MGA_PARADIGM_NOTREG || hr == E_MGA_PARADIGM_INVALID) {
@@ -1502,12 +1508,16 @@
 			AfxMessageBox(buf);
 			DiagnoseParadigm(metaname);
 		}
-	    if(hr == E_MGA_COMPONENT_ERROR) {
-				BSTR errorInfo;
-				GetErrorInfo(&errorInfo);
-				_bstr_t err(L"ERROR: automatic addon components could not start up:\n");
-				err += errorInfo;
-				AfxMessageBox(err);
+		if(hr == E_MGA_COMPONENT_ERROR) {
+			_bstr_t errorInfo;
+			GetErrorInfo(errorInfo.GetAddress());
+			_bstr_t err(_T("ERROR: automatic addon components could not start up:\n"));
+			err += errorInfo;
+			err += "\nDo you want to create the project without addons?";
+			if (AfxMessageBox(err, MB_YESNO) == IDYES) {
+				mgaProject->EnableAutoAddOns(VARIANT_FALSE);
+				hr = mgaProject->Create(PutInBstr(conn), PutInBstr(metaname)) ;
+			}
 		}
 		if( hr == E_UNKNOWN_STORAGE && conn.Left(5) == _T("MGX=\"")) {
 			CloseProject();
@@ -2120,11 +2130,15 @@
 					AfxMessageBox(buf);
 				}
 				if(hr == E_MGA_COMPONENT_ERROR) {
-					CComBSTR errorInfo;
-					GetErrorInfo(&errorInfo);
-					_bstr_t err(L"ERROR: automatic addon components could not start up:\n");
-					err += (BSTR)errorInfo;
-					AfxMessageBox(err);
+					_bstr_t errorInfo;
+					GetErrorInfo(errorInfo.GetAddress());
+					_bstr_t err(_T("ERROR: automatic addon components could not start up:\n"));
+					err += errorInfo;
+					err += "\nDo you want to create the project without addons?";
+					if (AfxMessageBox(err, MB_YESNO) == IDYES) {
+						mgaProject->EnableAutoAddOns(VARIANT_FALSE);
+						hr = mgaProject->CreateEx(PutInBstr(dataconn), PutInBstr(paradigm), parguid);
+					}
 				}
 				COMTHROW(hr);
 				AfterOpenOrCreateProject(dataconn); 
@@ -2822,11 +2836,15 @@
 					AfxMessageBox(buf);
 				}
 				if(hr == E_MGA_COMPONENT_ERROR) {
-					BSTR errorInfo;
-					GetErrorInfo(&errorInfo);
-					_bstr_t err(L"ERROR: automatic addon components could not start up:\n");
+					_bstr_t errorInfo;
+					GetErrorInfo(errorInfo.GetAddress());
+					_bstr_t err(_T("ERROR: automatic addon components could not start up:\n"));
 					err += errorInfo;
-					AfxMessageBox(err);
+					err += "\nDo you want to create the project without addons?";
+					if (AfxMessageBox(err, MB_YESNO) == IDYES) {
+						mgaProject->EnableAutoAddOns(VARIANT_FALSE);
+						hr = mgaProject->CreateEx(PutInBstr(dataconn), PutInBstr(paradigm), parguid);
+					}
 				}
 				COMTHROW(hr);
 				AfterOpenOrCreateProject(dataconn); 

Modified: trunk/GME/Mga/MgaProject.cpp
==============================================================================
--- trunk/GME/Mga/MgaProject.cpp	Tue Nov 15 13:32:17 2011	(r1683)
+++ trunk/GME/Mga/MgaProject.cpp	Tue Nov 15 13:32:30 2011	(r1684)
@@ -286,7 +286,7 @@
 		CComBSTR soldname = s;
 		CComVariant soldguid = pGUID;
 
-		if(paradigmname) {
+		if(SysStringLen(paradigmname) != 0) {
 			ver.Empty();
 			s = paradigmname;
 		}
@@ -299,6 +299,7 @@
 			if (ver.Length()) {
 				// Version string has precedence
 				COMTHROW(OpenParadigm(s,ver));
+				pGUID.Clear();
 				COMTHROW(metapr->get_GUID(&pGUID));
 			}
 			else {


More information about the gme-commit mailing list