[commit] r2096 - in trunk/GME: CSGUI Gme

GMESRC Repository Notifications gme-commit at list.isis.vanderbilt.edu
Fri Nov 2 11:19:38 CDT 2012


Author: ksmyth
Date: Fri Nov  2 11:19:38 2012
New Revision: 2096

Log:
Use ReferenceSwitcher on drag-n-drop to reconnect refports based on name and kind

Modified:
   trunk/GME/CSGUI/CSGUI.csproj
   trunk/GME/CSGUI/WelcomeScreenExp.cs
   trunk/GME/CSGUI/app.manifest
   trunk/GME/Gme/GME.vcxproj
   trunk/GME/Gme/GME.vcxproj.filters
   trunk/GME/Gme/GMEApp.cpp
   trunk/GME/Gme/GMEView.cpp
   trunk/GME/Gme/StdAfx.h

Modified: trunk/GME/CSGUI/CSGUI.csproj
==============================================================================
--- trunk/GME/CSGUI/CSGUI.csproj	Tue Oct 30 17:26:32 2012	(r2095)
+++ trunk/GME/CSGUI/CSGUI.csproj	Fri Nov  2 11:19:38 2012	(r2096)
@@ -10,7 +10,7 @@
     <AppDesignerFolder>Properties</AppDesignerFolder>
     <RootNamespace>CSGUI</RootNamespace>
     <AssemblyName>CSGUI</AssemblyName>
-    <TargetFrameworkVersion>v2.0</TargetFrameworkVersion>
+    <TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
     <FileAlignment>512</FileAlignment>
     <TargetFrameworkProfile />
   </PropertyGroup>
@@ -42,6 +42,27 @@
     <RunPostBuildEvent>OnOutputUpdated</RunPostBuildEvent>
   </PropertyGroup>
   <ItemGroup>
+    <Reference Include="GME, Version=1.0.0.0, Culture=neutral, PublicKeyToken=f240a760fe751c2e, processorArchitecture=MSIL">
+      <SpecificVersion>False</SpecificVersion>
+      <EmbedInteropTypes>True</EmbedInteropTypes>
+      <HintPath>..\DotNetPIAs_1.0.0.0\GME.dll</HintPath>
+    </Reference>
+    <Reference Include="GME.MGA, Version=1.0.0.0, Culture=neutral, PublicKeyToken=f240a760fe751c2e, processorArchitecture=MSIL">
+      <SpecificVersion>False</SpecificVersion>
+      <EmbedInteropTypes>True</EmbedInteropTypes>
+      <HintPath>..\DotNetPIAs_1.0.0.0\GME.MGA.dll</HintPath>
+    </Reference>
+    <Reference Include="GME.MGA.Core, Version=1.0.0.0, Culture=neutral, PublicKeyToken=f240a760fe751c2e, processorArchitecture=MSIL">
+      <SpecificVersion>False</SpecificVersion>
+      <EmbedInteropTypes>True</EmbedInteropTypes>
+      <HintPath>..\DotNetPIAs_1.0.0.0\GME.MGA.Core.dll</HintPath>
+    </Reference>
+    <Reference Include="GME.MGA.Meta, Version=1.0.0.0, Culture=neutral, PublicKeyToken=f240a760fe751c2e, processorArchitecture=MSIL">
+      <SpecificVersion>False</SpecificVersion>
+      <EmbedInteropTypes>True</EmbedInteropTypes>
+      <HintPath>..\DotNetPIAs_1.0.0.0\GME.MGA.Meta.dll</HintPath>
+    </Reference>
+    <Reference Include="Microsoft.CSharp" />
     <Reference Include="System" />
     <Reference Include="System.Data" />
     <Reference Include="System.Drawing" />
@@ -49,6 +70,10 @@
     <Reference Include="System.Xml" />
   </ItemGroup>
   <ItemGroup>
+    <Compile Include="GMEConsole.cs" />
+    <Compile Include="MgaGateway.cs" />
+    <Compile Include="ParentChain.cs" />
+    <Compile Include="ReferenceSwitcher.cs" />
     <Compile Include="WelcomeScreen.cs">
       <SubType>Form</SubType>
     </Compile>
@@ -84,7 +109,7 @@
   </ItemGroup>
   <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
   <PropertyGroup>
-    <PostBuildEvent>"C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Bin\tlbexp" "$(TargetPath)"</PostBuildEvent>
+    <PostBuildEvent>"C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Bin\NETFX 4.0 Tools\TlbExp.exe" "$(TargetPath)"</PostBuildEvent>
   </PropertyGroup>
   <!-- To modify your build process, add your task inside one of the targets below and uncomment it. 
        Other similar extension points exist, see Microsoft.Common.targets.

Modified: trunk/GME/CSGUI/WelcomeScreenExp.cs
==============================================================================
--- trunk/GME/CSGUI/WelcomeScreenExp.cs	Tue Oct 30 17:26:32 2012	(r2095)
+++ trunk/GME/CSGUI/WelcomeScreenExp.cs	Fri Nov  2 11:19:38 2012	(r2096)
@@ -13,7 +13,7 @@
     }
 
     [Guid("68FDA295-8D49-4445-BE29-1F171B4BE07D"),
-    ProgId("MGA.WelcomeScreen"),
+    ProgId("CSGUI.WelcomeScreenExp"),
     ClassInterface(ClassInterfaceType.AutoDual)]
     [ComVisible(true)]
     public class WelcomeScreenExp
@@ -37,6 +37,11 @@
                     this.recents.Add(recent);
             }
         }
+
+        public void SwitchRef()
+        {
+            new ReferenceSwitcher().SwitchReference(null, null);
+        }
     }
 
 }

Modified: trunk/GME/CSGUI/app.manifest
==============================================================================
--- trunk/GME/CSGUI/app.manifest	Tue Oct 30 17:26:32 2012	(r2095)
+++ trunk/GME/CSGUI/app.manifest	Fri Nov  2 11:19:38 2012	(r2096)
@@ -6,16 +6,21 @@
              version="1.0.0.0"
              processorArchitecture="msil" />
   <clrClass
-               clsid="{78BE7B95-3564-4BA9-8FE6-8D9B91EEE0B8}"
-               progid="MGA.WelcomeScreen"
+               clsid="{68FDA295-8D49-4445-BE29-1F171B4BE07D}"
+               progid="CSGUI.WelcomeScreenExp"
                threadingModel="Both"
                name="CSGUI.WelcomeScreenExp"
-               runtimeVersion="v4.0.30319">
-  </clrClass>
+               runtimeVersion="v4.0.30319"/>
+  <clrClass
+               clsid="{0ACC000C-29E6-418B-9F8B-968418C533B9}"
+               progid="CSGUI.ReferenceSwitcher"
+               threadingModel="Both"
+               name="CSGUI.ReferenceSwitcher"
+               runtimeVersion="v4.0.30319"/>
   <file name="CSGUI.dll">
   </file>
 
-<!--
+  <!--
   <trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">
     <security>
       <requestedPrivileges xmlns="urn:schemas-microsoft-com:asm.v3">
@@ -45,7 +50,7 @@
       
     </application>
   </compatibility>
--->  
+-->
   <!-- Enable themes for Windows common controls and dialogs (Windows XP and later) -->
   <!-- <dependency>
     <dependentAssembly>

Modified: trunk/GME/Gme/GME.vcxproj
==============================================================================
--- trunk/GME/Gme/GME.vcxproj	Tue Oct 30 17:26:32 2012	(r2095)
+++ trunk/GME/Gme/GME.vcxproj	Fri Nov  2 11:19:38 2012	(r2096)
@@ -301,6 +301,7 @@
     <ClCompile Include="ConnityDlg.cpp" />
     <ClCompile Include="console.cpp" />
     <ClCompile Include="CrashTest.cpp" />
+    <ClCompile Include="CSGUIInterop.cpp" />
     <ClCompile Include="DecoratorEventSink.cpp" />
     <ClCompile Include="DynMenu.cpp" />
     <ClCompile Include="EnumVar.cpp" />

Modified: trunk/GME/Gme/GME.vcxproj.filters
==============================================================================
--- trunk/GME/Gme/GME.vcxproj.filters	Tue Oct 30 17:26:32 2012	(r2095)
+++ trunk/GME/Gme/GME.vcxproj.filters	Fri Nov  2 11:19:38 2012	(r2096)
@@ -225,6 +225,9 @@
     <ClCompile Include="GMEVistaUtil.cpp">
       <Filter>Source Files</Filter>
     </ClCompile>
+    <ClCompile Include="CSGUIInterop.cpp">
+      <Filter>Source Files</Filter>
+    </ClCompile>
   </ItemGroup>
   <ItemGroup>
     <None Include="AnnotatorEventSink.rgs">

Modified: trunk/GME/Gme/GMEApp.cpp
==============================================================================
--- trunk/GME/Gme/GMEApp.cpp	Tue Oct 30 17:26:32 2012	(r2095)
+++ trunk/GME/Gme/GMEApp.cpp	Fri Nov  2 11:19:38 2012	(r2096)
@@ -34,13 +34,12 @@
 #pragma comment(lib, "CrashRpt.lib")
 #endif
 
-#import "C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\mscorlib.tlb"
+#import "C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\mscorlib.tlb" no_implementation
 namespace CSGUI {
 using namespace mscorlib;
 }
-#import "CSGUI.tlb"
+#import "CSGUI.tlb" no_implementation
 
-#pragma comment(linker, "\"/manifestdependency:type='win32' processorArchitecture='msil' name='CSGUI' version='1.0.0.0' language='*'\"")
 #ifndef _DEBUG
 #pragma comment(linker, "\"/manifestdependency:type='win32' name='Core' version='1.0.0.0' language='*'\"")
 #pragma comment(linker, "\"/manifestdependency:type='win32' name='Meta' version='1.0.0.0' language='*'\"")
@@ -550,7 +549,7 @@
 BOOL CGMEApp::ShowWelcomeWindow()
 {
 	CSGUI::_WelcomeScreenExpPtr ws;
-	ws.CreateInstance(L"MGA.WelcomeScreen");
+	ws.CreateInstance(L"CSGUI.WelcomeScreenExp");
 	if (ws)
 	try {
 		ATL::CComSafeArray<BSTR> recents;

Modified: trunk/GME/Gme/GMEView.cpp
==============================================================================
--- trunk/GME/Gme/GMEView.cpp	Tue Oct 30 17:26:32 2012	(r2095)
+++ trunk/GME/Gme/GMEView.cpp	Fri Nov  2 11:19:38 2012	(r2096)
@@ -51,6 +51,9 @@
 CGraphics graphics;
 static CViewList viewsToKill;
 
+// CSGUIInterop.cpp
+void MoveReferenceWithRefportConnectionsAndWriteToConsole(IMgaFCO* target, IMgaReference* ref);
+
 #define MIN_ZOOM_RECT 12 // the minimal size of zoomable rectangle
 /*
 int setZoomPercents[GME_ZOOM_LEVEL_NUM] = {
@@ -3685,10 +3688,13 @@
 							throw hresult_exception(E_FAIL);
 						}
 						CComPtr<IMgaFCO> fco;
-						COMTHROW(fcos->get_Item(1,&fco));// index modified from 0 to 1 [zolmol]
+						COMTHROW(fcos->get_Item(1,&fco));
 						if(!IsEqualObject(fco,mgaRef)) {
 							try {
-								COMTHROW(mgaRef->put_Referred(fco));
+								if (mgaRef->UsedByConns->Count > 0)
+									MoveReferenceWithRefportConnectionsAndWriteToConsole(fco, mgaRef); // only works if fco.ObjType == model
+								else
+									COMTHROW(mgaRef->put_Referred(fco));
 
 								CComBSTR bstr;
 								CString newID;
@@ -3711,6 +3717,20 @@
 
 								return false;
 							}
+							catch(_com_error &e) {
+								AbortTransaction(e.Error());
+								CString error = _T("Cannot redirect reference to specified object");
+								if (e.Description().length() != 0)
+								{
+									error += _T(": ");
+									error += static_cast<const TCHAR*>(e.Description());
+								}
+								CGMEEventLogger::LogGMEEvent(error + "\r\n");
+								if (CGMEConsole::theInstance)
+									CGMEConsole::theInstance->Message(error, MSG_ERROR);
+
+								return false;
+							}
 						}
 					}
 					else {

Modified: trunk/GME/Gme/StdAfx.h
==============================================================================
--- trunk/GME/Gme/StdAfx.h	Tue Oct 30 17:26:32 2012	(r2095)
+++ trunk/GME/Gme/StdAfx.h	Fri Nov  2 11:19:38 2012	(r2096)
@@ -16,6 +16,8 @@
 #define VC_EXTRALEAN            // Exclude rarely-used stuff from Windows headers
 #endif
 
+#define ISOLATION_AWARE_ENABLED 1
+
 #include "targetver.h"
 
 #define _CRT_SECURE_NO_WARNINGS


More information about the gme-commit mailing list