[GME-commit]
GMESRC/Tools/GMEMerge StdAfx.h,NONE,1.1 StdAfx.cpp,NONE,1.1
Resource.h,NONE,1.1 RawComponent.h,NONE,1.1
RawComponent.cpp,NONE,1.1 Merge.h,NONE,1.1 Merge.cpp,NONE,1.1
GMEMergeComponent.vcproj,NONE,1.1 ComponentObj.cpp,NONE,1.1
ComponentDll.cpp,NONE,1.1 ComponentConfig.h,NONE,1.1
Component.rc,NONE,1.1 component.def,NONE,1.1 compicon.ico,NONE,1.1
gme-commit at list.isis.vanderbilt.edu
gme-commit at list.isis.vanderbilt.edu
Tue Aug 15 20:33:39 CDT 2006
Update of /project/gme-repository/GMESRC/Tools/GMEMerge
In directory escher:/tmp/cvs-serv24317
Added Files:
StdAfx.h StdAfx.cpp Resource.h RawComponent.h RawComponent.cpp
Merge.h Merge.cpp GMEMergeComponent.vcproj ComponentObj.cpp
ComponentDll.cpp ComponentConfig.h Component.rc component.def
compicon.ico
Log Message:
no message
CVS User: Gyorgy Balogh, ISIS (bogyom)
--- NEW FILE: ComponentConfig.h ---
// Component configuration file automatically generated as ComponentConfig.h
// by ConfigureComponent on Mon Jul 24 09:33:55 2006
#define RAWCOMPONENT
// COM UUID-s, names and progID
#define TYPELIB_UUID "A3DDD461-FDA2-49AF-B757-B6361E105072"
#define TYPELIB_NAME "MGA Interpreter TypeLibrary (GMEMerge)"
#define COCLASS_UUID "FFB720E0-4E92-4A01-A792-29518F09B60C"
#define COCLASS_NAME "MGA Interpreter CoClass (GMEMerge)"
#define COCLASS_PROGID "MGA.Interpreter.GMEMerge"
// This name will appear in the popup window for interpreter selection.
#define COMPONENT_NAME "GMEMerge"
// This text will appear in the toolbar icon tooltip and in the menu.
#define TOOLTIP_TEXT "GMEMerge Interpreter"
// This #define determines the interpreter type:
#define GME_INTERPRETER
#define PARADIGM_INDEPENDENT
// This is the location of the GME interfaces file (Mga.idl, Meta.idl, etc)
#define GME_BASE ../../GME
#define BON_ICON_SUPPORT
// not defined: #define BON_CUSTOM_TRANSACTIONS
#define REGISTER_SYSTEMWIDE
// Just to please the whims of those Microsoft jerks:
#define COCLASS_UUID_EXPLODED1 0xFFB720E0
#define COCLASS_UUID_EXPLODED2 0x4E92
#define COCLASS_UUID_EXPLODED3 0x4A01
#define COCLASS_UUID_EXPLODED4 0xA7
#define COCLASS_UUID_EXPLODED5 0x92
#define COCLASS_UUID_EXPLODED6 0x29
#define COCLASS_UUID_EXPLODED7 0x51
#define COCLASS_UUID_EXPLODED8 0x8F
#define COCLASS_UUID_EXPLODED9 0x09
#define COCLASS_UUID_EXPLODED10 0xB6
#define COCLASS_UUID_EXPLODED11 0x0C
--- NEW FILE: GMEMergeComponent.vcproj ---
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="7.10"
Name="GMEMergeComponent"
ProjectGUID="{690EC135-ECE6-4AD7-B566-3D4FDC6B7067}"
SccProjectName=""
SccLocalPath=""
Keyword="AtlProj">
<Platforms>
<Platform
Name="Win32"/>
</Platforms>
<Configurations>
<Configuration
Name="Debug|Win32"
OutputDirectory=".\Debug"
IntermediateDirectory=".\Debug"
ConfigurationType="2"
UseOfMFC="2"
ATLMinimizesCRunTimeLibraryUsage="FALSE"
CharacterSet="2">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="../../GME/Common;./;"C:/Program Files/GME/sdk/BON/""
PreprocessorDefinitions="_DEBUG;WIN32;_WINDOWS;_USRDLL"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
UsePrecompiledHeader="3"
PrecompiledHeaderThrough="stdafx.h"
PrecompiledHeaderFile=".\Debug/GMEMergeComponent.pch"
AssemblerListingLocation=".\Debug/"
ObjectFile=".\Debug/"
ProgramDataBaseFileName=".\Debug/"
BrowseInformation="1"
WarningLevel="3"
SuppressStartupBanner="TRUE"
DebugInformationFormat="4"/>
<Tool
Name="VCCustomBuildTool"
Description="Performing registration"
CommandLine="regsvr32 /s /c "$(TargetPath)"
echo regsvr32 exec. time > "$(OutDir)\regsvr32.trg"
"
Outputs="$(OutDir)\regsvr32.trg"/>
<Tool
Name="VCLinkerTool"
OutputFile=".\Debug/GMEMergeComponent.dll"
LinkIncremental="1"
SuppressStartupBanner="TRUE"
ModuleDefinitionFile=".\Component.def"
GenerateDebugInformation="TRUE"
ProgramDatabaseFile=".\Debug/GMEMergeComponent.pdb"
SubSystem="2"
ImportLibrary=".\Debug/GMEMergeComponent.lib"
TargetMachine="1"/>
<Tool
Name="VCMIDLTool"
AdditionalIncludeDirectories="."
TypeLibraryName=".\Debug/GMEMergeComponent.tlb"
HeaderFileName=""/>
<Tool
Name="VCPostBuildEventTool"/>
<Tool
Name="VCPreBuildEventTool"/>
<Tool
Name="VCPreLinkEventTool"/>
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions="_DEBUG"
Culture="1033"/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="VCXMLDataGeneratorTool"/>
<Tool
Name="VCWebDeploymentTool"/>
<Tool
Name="VCManagedWrapperGeneratorTool"/>
<Tool
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
</Configuration>
<Configuration
Name="Release|Win32"
OutputDirectory=".\Release"
IntermediateDirectory=".\Release"
ConfigurationType="2"
UseOfMFC="2"
UseOfATL="1"
ATLMinimizesCRunTimeLibraryUsage="FALSE"
CharacterSet="2">
<Tool
Name="VCCLCompilerTool"
Optimization="1"
InlineFunctionExpansion="1"
AdditionalIncludeDirectories="../../gme/common;./"
PreprocessorDefinitions="NDEBUG;WIN32;_WINDOWS;_USRDLL"
StringPooling="TRUE"
RuntimeLibrary="2"
EnableFunctionLevelLinking="TRUE"
UsePrecompiledHeader="3"
PrecompiledHeaderThrough="stdafx.h"
PrecompiledHeaderFile=".\Release/GMEMergeComponent.pch"
AssemblerListingLocation=".\Release/"
ObjectFile=".\Release/"
ProgramDataBaseFileName=".\Release/"
WarningLevel="3"
SuppressStartupBanner="TRUE"/>
<Tool
Name="VCCustomBuildTool"
Description="Performing registration"
CommandLine="regsvr32 /s /c "$(TargetPath)"
echo regsvr32 exec. time > "$(OutDir)\regsvr32.trg"
"
Outputs="$(OutDir)\regsvr32.trg"/>
<Tool
Name="VCLinkerTool"
OutputFile=".\Release/GMEMergeComponent.dll"
LinkIncremental="1"
SuppressStartupBanner="TRUE"
ModuleDefinitionFile=".\Component.def"
ProgramDatabaseFile=".\Release/GMEMergeComponent.pdb"
SubSystem="2"
ImportLibrary=".\Release/GMEMergeComponent.lib"
TargetMachine="1"/>
<Tool
Name="VCMIDLTool"
AdditionalIncludeDirectories="."
TypeLibraryName=".\Release/GMEMergeComponent.tlb"
HeaderFileName=""/>
<Tool
Name="VCPostBuildEventTool"/>
<Tool
Name="VCPreBuildEventTool"/>
<Tool
Name="VCPreLinkEventTool"/>
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions="NDEBUG"
Culture="1033"
AdditionalIncludeDirectories=""/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="VCXMLDataGeneratorTool"/>
<Tool
Name="VCWebDeploymentTool"/>
<Tool
Name="VCManagedWrapperGeneratorTool"/>
<Tool
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<Filter
Name="Source Files"
Filter="cpp;c;cxx;rc;def;r;odl;idl;hpj;bat">
<File
RelativePath="..\..\Gme\Common\CommonError.cpp">
</File>
<File
RelativePath="..\..\Gme\Common\CommonMfc.cpp">
</File>
<File
RelativePath="..\..\Gme\Common\CommonSmart.cpp">
</File>
<File
RelativePath="Component.def">
</File>
<File
RelativePath="Component.rc">
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions=""
AdditionalIncludeDirectories="$(OUTDIR)"/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32">
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions=""
AdditionalIncludeDirectories="$(OUTDIR)"/>
</FileConfiguration>
</File>
<File
RelativePath="..\..\Sdk\Bon\ComponentDll.cpp">
</File>
<File
RelativePath="..\..\Sdk\Bon\ComponentLib.idl">
</File>
<File
RelativePath="..\..\Sdk\Bon\ComponentObj.cpp">
</File>
<File
RelativePath=".\Merge.cpp">
</File>
<File
RelativePath="RawComponent.cpp">
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
PreprocessorDefinitions=""
BasicRuntimeChecks="3"
BrowseInformation="1"/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="1"
PreprocessorDefinitions=""/>
</FileConfiguration>
</File>
<File
RelativePath="StdAfx.cpp">
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
PreprocessorDefinitions=""
BasicRuntimeChecks="3"
UsePrecompiledHeader="1"
BrowseInformation="1"/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="1"
PreprocessorDefinitions=""
UsePrecompiledHeader="1"/>
</FileConfiguration>
</File>
</Filter>
<Filter
Name="Header Files"
Filter="h;hpp;hxx;hm;inl">
<File
RelativePath="C:\Program Files\GME\sdk\BON\ComHelp.h">
</File>
<File
RelativePath="..\..\Gme\Common\CommonCollection.h">
</File>
<File
RelativePath="..\..\Gme\Common\CommonComponent.h">
</File>
<File
RelativePath="..\..\Gme\Common\CommonError.h">
</File>
<File
RelativePath="..\..\Gme\Common\CommonMfc.h">
</File>
<File
RelativePath="..\..\Gme\Common\CommonMgaTrukk.h">
</File>
<File
RelativePath="..\..\Gme\Common\CommonSmart.h">
</File>
<File
RelativePath="..\..\Gme\Common\CommonVersionInfo.h">
</File>
<File
RelativePath="ComponentConfig.h">
</File>
<File
RelativePath="C:\Program Files\GME\sdk\BON\ComponentDll.h">
</File>
<File
RelativePath="C:\Program Files\GME\sdk\BON\ComponentObj.h">
</File>
<File
RelativePath="C:\Program Files\GME\sdk\BON\GMECOM.h">
</File>
<File
RelativePath=".\Merge.h">
</File>
<File
RelativePath="RawComponent.h">
</File>
<File
RelativePath="Resource.h">
</File>
<File
RelativePath="StdAfx.h">
</File>
</Filter>
<Filter
Name="Resource Files"
Filter="ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe">
<File
RelativePath=".\compicon.ico">
</File>
</Filter>
<File
RelativePath="ConfigureComponent.exe">
</File>
</Files>
<Globals>
</Globals>
</VisualStudioProject>
--- NEW FILE: compicon.ico ---
(This appears to be a binary file; contents omitted.)
--- NEW FILE: RawComponent.h ---
#ifndef RAWCOMPONENT_H
#define RAWCOMPONENT_H
// Declaration of the main RAW COM component interface class
#ifdef BUILDER_OBJECT_NETWORK
#error This file should only be included in the RAW COM configurations
#endif
class RawComponent {
////////////////////
// Insert your application specific member and method definitions here
public:
RawComponent() { ; }
private:
// Try not to modify the code below this line
////////////////////
public:
#ifdef GME_ADDON
CComPtr<IMgaProject> project; // this is set before Initialize() is called
CComPtr<IMgaAddOn> addon; // this is set before Initialize() is called
#endif
bool interactive;
STDMETHODIMP Initialize(struct IMgaProject *);
STDMETHODIMP Invoke(IMgaProject* gme, IMgaFCOs *models, long param);
STDMETHODIMP InvokeEx( IMgaProject *project, IMgaFCO *currentobj, IMgaFCOs *selectedobjs, long param);
STDMETHODIMP ObjectsInvokeEx( IMgaProject *project, IMgaObject *currentobj, IMgaObjects *selectedobjs, long param);
STDMETHODIMP get_ComponentParameter(BSTR name, VARIANT *pVal);
STDMETHODIMP put_ComponentParameter(BSTR name, VARIANT newVal);
#ifdef GME_ADDON
STDMETHODIMP GlobalEvent(globalevent_enum event);
STDMETHODIMP ObjectEvent(IMgaObject * obj, unsigned long eventmask, VARIANT v);
#endif
};
#endif //RAWCOMPONENT_H
--- NEW FILE: Resource.h ---
//{{NO_DEPENDENCIES}}
// Microsoft Visual C++ generated include file.
// Used by Component.rc
//
#define IDS_PROJNAME 100
// Next default values for new objects
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 201
#define _APS_NEXT_COMMAND_VALUE 32768
#define _APS_NEXT_CONTROL_VALUE 201
#define _APS_NEXT_SYMED_VALUE 101
#endif
#endif
--- NEW FILE: RawComponent.cpp ---
///////////////////////////////////////////////////////////////////////////
// RawComponent.cpp, the main RAW COM component implementation file
// This is the file (along with its header RawComponent.h)
// that the component implementor is expected to modify in the first place
//
///////////////////////////////////////////////////////////////////////////
#include "stdafx.h"
#include "CommonSmart.h"
#include "ComponentLib.h"
#include <ComponentConfig.h>
#include "RawComponent.h"
#include "merge.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 *) {
return S_OK;
}
// this is the obsolete component interface
// this present implementation either tries to call InvokeEx, or returns an error;
STDMETHODIMP RawComponent::Invoke(IMgaProject* gme, IMgaFCOs *models, long param) {
#ifdef SUPPORT_OLD_INVOKE
CComPtr<IMgaFCO> focus;
CComVariant parval = param;
return InvokeEx(gme, focus, selected, parvar);
#else
if(interactive) {
AfxMessageBox("This component does not support the obsolete invoke mechanism");
}
return E_MGA_NOT_SUPPORTED;
#endif
}
// This is the main component method for interpereters and plugins.
// May als be used in case of invokeable addons
STDMETHODIMP RawComponent::InvokeEx( IMgaProject *project, IMgaFCO *currentobj,
IMgaFCOs *selectedobjs, long param)
{
CFileDialog dlg( TRUE, "mga", NULL, OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT, "MGA Files (*.mga)|*.mga||" );
if( dlg.DoModal() == IDOK )
{
// open the selected mga file
CComPtr<IMgaProject> p;
CComBSTR conn_string = "MGA=" + dlg.GetPathName();
try
{
COMTHROW( p.CoCreateInstance(L"Mga.MgaProject") );
COMTHROW( p->Open(conn_string) );
}
catch(...)
{
AfxMessageBox("Cannot open " + dlg.GetPathName() + " as an MGA file!");
return S_OK;
}
Merge m;
m.doMerge( project, p );
}
return S_OK;
/*COMTRY {
if(interactive) {
CComBSTR projname;
CComBSTR focusname = "<nothing>";
CComPtr<IMgaTerritory> terr;
COMTHROW(project->CreateTerritory(NULL, &terr));
COMTHROW(project->BeginTransaction(terr));
try {
COMTHROW(project->get_Name(&projname));
if(currentobj) COMTHROW(currentobj->get_Name(&focusname));
AfxMessageBox("RAW Com Component --- Plugin!!!! Sample (project: " + CString(projname) +
", focus: " + CString(focusname));
COMTHROW(project->CommitTransaction());
} catch(...) { project->AbortTransaction(); throw; }
}
} COMCATCH(;);*/
}
// GME currently does not use this function
// you only need to implement it if other invokation mechanisms are used
STDMETHODIMP RawComponent::ObjectsInvokeEx( IMgaProject *project, IMgaObject *currentobj, IMgaObjects *selectedobjs, long param) {
if(interactive) {
AfxMessageBox("Tho ObjectsInvoke method is not implemented");
}
return E_MGA_NOT_SUPPORTED;
}
// implement application specific parameter-mechanism in these functions:
STDMETHODIMP RawComponent::get_ComponentParameter(BSTR name, VARIANT *pVal) {
return S_OK;
}
STDMETHODIMP RawComponent::put_ComponentParameter(BSTR name, VARIANT newVal) {
return S_OK;
}
#ifdef GME_ADDON
// these two functions are the main
STDMETHODIMP RawComponent::GlobalEvent(globalevent_enum event) {
if(event == GLOBALEVENT_UNDO) {
AfxMessageBox("UNDO!!");
}
return S_OK;
}
STDMETHODIMP RawComponent::ObjectEvent(IMgaObject * obj, unsigned long eventmask, VARIANT v) {
if(eventmask & OBJEVENT_CREATED) {
CComBSTR objID;
COMTHROW(obj->get_ID(&objID));
AfxMessageBox( "Object created! ObjID: " + CString(objID));
}
return S_OK;
}
#endif
--- NEW FILE: ComponentDll.cpp ---
// Component.cpp : Defines the initialization routines for the DLL.
//
#include "stdafx.h"
//#include <afxctl.h>
#include "ComponentDll.h"
#include "ComponentObj.h"
#include <ComponentConfig.h>
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
//
// Note!
//
// If this DLL is dynamically linked against the MFC
// DLLs, any functions exported from this DLL which
// call into MFC must have the AFX_MANAGE_STATE macro
// added at the very beginning of the function.
//
// For example:
//
// extern "C" BOOL PASCAL EXPORT ExportedFunction()
// {
// AFX_MANAGE_STATE(AfxGetStaticModuleState());
// // normal function body here
// }
//
// It is very important that this macro appear in each
// function, prior to any calls into MFC. This means that
// it must appear as the first statement within the
// function, even before any object variable declarations
// as their constructors may generate calls into the MFC
// DLL.
//
// Please see MFC Technical Notes 33 and 58 for additional
// details.
//
/////////////////////////////////////////////////////////////////////////////
// CComponentApp
BEGIN_MESSAGE_MAP(CComponentApp, CWinApp)
//{{AFX_MSG_MAP(CComponentApp)
// NOTE - the ClassWizard will add and remove mapping macros here.
// DO NOT EDIT what you see in these blocks of generated code!
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CComponentApp construction
CComponentApp::CComponentApp() : CWinApp(COMPONENT_NAME)
{
// TODO: add construction code here,
// Place all significant initialization in InitInstance
}
/////////////////////////////////////////////////////////////////////////////
// The one and only CComponentApp object
CComponentApp theApp;
/////////////////////////////////////////////////////////////////////////////
// CComponentApp initialization
BOOL CComponentApp::InitInstance()
{
// Register all OLE server (factories) as running. This enables the
// OLE libraries to create objects from other applications.
COleObjectFactory::RegisterAll();
return TRUE;
}
/////////////////////////////////////////////////////////////////////////////
// Special entry points required for inproc servers
STDAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID* ppv)
{
AFX_MANAGE_STATE(AfxGetStaticModuleState());
return AfxDllGetClassObject(rclsid, riid, ppv);
}
STDAPI DllCanUnloadNow(void)
{
AFX_MANAGE_STATE(AfxGetStaticModuleState());
return AfxDllCanUnloadNow();
}
#define COMRETURN(hr) { HRESULT res; if((res = (hr)) != S_OK) return res; }
// this flag supresses running Dll(Un)RegisterServer if DllInstall is also used
// bool called = false;
// by exporting DllRegisterServer, you can use regsvr.exe
STDAPI DllRegisterServer(void)
{
/*
if(called) return S_OK;
called = true;
*/
AFX_MANAGE_STATE(AfxGetStaticModuleState());
if (!COleObjectFactory::UpdateRegistryAll(TRUE))
return SELFREG_E_CLASS;
// Note:
// We can register the typelib either from the .tlb file
// or from the resources. But the resource ID of the
// TYPELIB must be 1 !!!
/*
if( !AfxOleRegisterTypeLib(AfxGetInstanceHandle(),
LIBID_MgaComponentLib, NULL) )
return E_FAIL;
*/
CComponentReg reg;
#ifdef REGISTER_SYSTEMWIDE
COMRETURN( reg.RegisterParadigms(REGACCESS_SYSTEM));
#else
COMRETURN( reg.RegisterParadigms());
#endif
return S_OK;
}
STDAPI DllUnregisterServer(void)
{
/*
if(called) return S_OK;
called = true;
*/
AFX_MANAGE_STATE(AfxGetStaticModuleState());
if (!COleObjectFactory::UpdateRegistryAll(FALSE))
return SELFREG_E_CLASS;
CComponentReg reg;
#ifdef REGISTER_SYSTEMWIDE
COMRETURN( reg.UnregisterParadigms(REGACCESS_SYSTEM));
#else
COMRETURN( reg.UnregisterParadigms());
#endif
return S_OK;
}
#define DIM(x) (sizeof(x)/sizeof((x)[0]))
STDAPI DllInstall(BOOL bInstall, LPCWSTR cmdl) {
regaccessmode_enum code = REGACCESS_NONE;
if(iswdigit(cmdl[0]) && cmdl[1] == 0) {
code = regaccessmode_enum(cmdl[0] - L'0');
}
else {
struct {
LPCWSTR name;
regaccessmode_enum cc;
} mnemonics[] = { { L"USER" , REGACCESS_USER},
{ L"REGACCESS_USER" , REGACCESS_USER},
{ L"SYSTEM" , REGACCESS_SYSTEM},
{ L"REGACCESS_SYSTEM" , REGACCESS_SYSTEM},
{ L"BOTH" , REGACCESS_BOTH},
{ L"REGACCESS_BOTH" , REGACCESS_BOTH} };
for(int i = 0; i < DIM(mnemonics); i++) {
if(_wcsicmp(cmdl, mnemonics[i].name) == 0) {
code = mnemonics[i].cc;
break;
}
}
}
// if(called || code == REGACCESS_NONE) return E_INVALIDARG;
// called = true;
CComponentReg reg;
if(bInstall) { COMRETURN(reg.RegisterParadigms(code)); }
else { COMRETURN(reg.UnregisterParadigms(code)); }
return S_OK;
};
--- NEW FILE: Merge.cpp ---
#include "stdafx.h"
#include "CommonSmart.h"
#include "ComponentLib.h"
#include ".\merge.h"
#pragma warning(disable:4244)
Merge::Merge()
{
}
Merge::~Merge()
{
}
void Merge::doMerge( IMgaProject * act_proj, IMgaProject * mergein_proj )
{
try
{
[...964 lines suppressed...]
if( map.find(g)==map.end() )
map.insert( ObjMap::value_type(g,o) );
int type = getType(o);
if( type==OBJTYPE_MODEL || type==OBJTYPE_FOLDER )
{
long i,n;
CComPtr<IMgaObjects> children;
COMTHROW( o->get_ChildObjects(&children) );
COMTHROW( children->get_Count(&n) );
for( i=1; i<=n; ++i )
{
CComPtr<IMgaObject> child;
COMTHROW( children->get_Item(i,&child) );
addSubTreeToMap( child, map );
child.Release();
}
}
}
--- NEW FILE: ComponentObj.cpp ---
//////////////////////////////////////////////////////////////////////////////
// ComponentObj.cpp : implementation file
//
// In case of standard and simple components, this file does not need tobe modified
// However, if anything except Component.[cpp,h] or RawComponent.[cpp,h] is to be modified,
// this is the likely and preferred candidate
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
// How to convert deprecated BON invoke mechanism into new one
// SITUATION DESCRIPTION:
// The IMgaComponent interface has been extended (IMgaComponentEx), and, accordingly,
// the BON invoke mechanism has also changed, for some time, the
// old mechanism (old Component.h) will also be supported to a limited extent.
// The old BON invoke function was
// void Invoke(CBuilder &builder, CBuilderObjectList &selected, long param);
// The new one is:
// void InvokeEx(CBuilder &builder,CBuilderObject *focus, CBuilderObjectList &selected, long param);
// Differences:
[...1029 lines suppressed...]
return S_OK;
}
HRESULT CComponentReg::RegisterParadigms(regaccessmode_enum loc) {
CComPtr<IMgaRegistrar> registrar;
COMRETURN(registrar.CoCreateInstance(OLESTR("Mga.MgaRegistrar")));
COMRETURN(registrar->RegisterComponent(CComBSTR(COCLASS_PROGID),EXCETYPE, CComBSTR(COMPONENT_NAME), loc));
#ifdef BON_ICON_SUPPORT
COMRETURN(registrar->put_ComponentExtraInfo(loc, CComBSTR(COCLASS_PROGID), CComBSTR("Icon"), CComBSTR(",IDI_COMPICON")));
#endif
COMRETURN(registrar->put_ComponentExtraInfo(loc, CComBSTR(COCLASS_PROGID), CComBSTR("Tooltip"), CComBSTR(TOOLTIP_TEXT)));
POSITION pos = paradigms.GetHeadPosition();
while(pos)
{
CString paradigm = paradigms.GetNext(pos);
COMRETURN(registrar->Associate(CComBSTR(COCLASS_PROGID), CComBSTR(paradigm), loc));
}
return S_OK;
}
--- NEW FILE: StdAfx.cpp ---
// stdafx.cpp : source file that includes just the standard includes
// stdafx.pch will be the pre-compiled header
// stdafx.obj will contain the pre-compiled type information
#include "stdafx.h"
#ifdef _ATL_STATIC_REGISTRY
#include <statreg.h>
#if _ATL_VER < 0x0700
#include <statreg.cpp>
#endif // _ATL_VER < 0x0700
#endif // _ATL_STATIC_REGISTRY
#if _ATL_VER < 0x0700
#include <atlimpl.cpp>
#endif // _ATL_VER < 0x0700
--- NEW FILE: StdAfx.h ---
// stdafx.h : include file for standard system include files,
// or project specific include files that are used frequently,
// but are changed infrequently
#if !defined(AFX_STDAFX_H__C4EFDDFC_C095_4509_B571_632F0986D162__INCLUDED_)
#define AFX_STDAFX_H__C4EFDDFC_C095_4509_B571_632F0986D162__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#define STRICT
#ifndef _WIN32_WINNT
#define _WIN32_WINNT 0x0400
#endif
#define _ATL_APARTMENT_THREADED
#include <afxwin.h>
#include <afxdisp.h>
#include <atlbase.h>
//You may derive a class from CComModule and use it if you want to override
//something, but do not change the name of _Module
extern CComModule _Module;
#include <atlcom.h>
#include <afxdlgs.h>
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_STDAFX_H__C4EFDDFC_C095_4509_B571_632F0986D162__INCLUDED)
--- NEW FILE: Merge.h ---
#pragma once
#include <map>
#include <string>
#include <vector>
#include <set>
struct GUID_less
{
bool operator()(const GUID& a, const GUID& b) const
{
if( a.Data1 < b.Data1 )
return true;
else if( a.Data1 > b.Data1 )
return false;
else
{
DWORD * adw = (DWORD*)&a;
DWORD * bdw = (DWORD*)&b;
if( *(adw+1) < *(bdw+1) )
return true;
else if( *(adw+1) > *(bdw+1) )
return false;
else if( *(adw+2) < *(bdw+2) )
return true;
else if( *(adw+2) > *(bdw+2) )
return false;
else if( *(adw+3) < *(bdw+3) )
return true;
else
return false;
}
}
};
struct TypeInfo
{
GUID type;
VARIANT_BOOL instance;
};
struct ConnPoint
{
GUID target;
CComBSTR role_name;
// TODO:references
};
typedef std::set<int> IntSet;
typedef std::vector<GUID> GUIDVec;
typedef std::map<GUID,TypeInfo,GUID_less> TypeInfoMap;
typedef std::map<GUID,GUID,GUID_less> RefInfoMap;
typedef std::vector<ConnPoint> ConnPointVec;
typedef std::map<GUID,ConnPointVec,GUID_less> ConnInfoMap;
typedef std::map<GUID,GUIDVec,GUID_less> GUIDVecMap;
typedef std::map<GUID,CComPtr<IMgaObject>,GUID_less> ObjMap;
class Merge
{
protected:
CComPtr<IMgaProject> act_project;
CComPtr<IMgaFolder> act_root;
CComPtr<IMgaProject> mergein_project;
CComPtr<IMgaFolder> mergein_root;
TypeInfoMap type_info;
RefInfoMap ref_info;
ConnInfoMap conn_info;
GUIDVecMap set_info;
public:
Merge();
~Merge();
void doMerge( IMgaProject * act_proj, IMgaProject * mergein_proj );
protected:
void checkParadigms();
void checkRootFolders();
void doMerge();
void deleteObjects();
void savePointers();
void savePointers( CComPtr<IMgaObject> parent );
void restoreTypes();
void restoreReferences();
void restoreConnections();
void restoreSets();
void mergeFolders( CComPtr<IMgaFolder> act, CComPtr<IMgaFolder> mergein );
void mergeModels( CComPtr<IMgaModel> act, CComPtr<IMgaModel> mergein );
CComPtr<IMgaFCO> copyFCO( CComPtr<IMgaFCO> src, CComPtr<IMgaModel> parent );
CComPtr<IMgaFCO> copyFCO( CComPtr<IMgaFCO> src, CComPtr<IMgaFolder> parent );
CComPtr<IMgaFolder> copyFolder( CComPtr<IMgaFolder> src, CComPtr<IMgaFolder> parent );
//CComPtr<IMgaReference> copyRef( CComPtr<IMgaReference> src, CComPtr<IMgaModel> parent );
void copyRegistry( CComPtr<IMgaFCO> src, CComPtr<IMgaFCO> dest );
void copyRegistry( CComPtr<IMgaRegNodes> nodes, CComPtr<IMgaFCO> dest );
void copyRegistry( CComPtr<IMgaRegNodes> nodes, CComPtr<IMgaFolder> dest );
void copyAttribs( CComPtr<IMgaFCO> src, CComPtr<IMgaFCO> dest );
void copyAttribsAndRegistry( CComPtr<IMgaFCO>(src), CComPtr<IMgaFCO>(new_fco) );
void copyFolderAttribs( CComPtr<IMgaFolder>(src), CComPtr<IMgaFolder>(new_folder) );
// helper
GUID getGuid( CComPtr<IMgaObject> o );
CString formatGuid( GUID g );
int getType( CComPtr<IMgaObject> o );
CComPtr<IMgaFCO> findFCO( CComPtr<IMgaModel> parent, GUID g );
CComPtr<IMgaFCO> findFCO( CComPtr<IMgaFolder> parent, GUID g );
CComPtr<IMgaFCO> findFCOInChildren( CComPtr<IMgaModel> parent, GUID g );
CComPtr<IMgaFCO> findFCOInChildren( CComPtr<IMgaFolder> parent, GUID g );
CComPtr<IMgaFolder> findFolder( CComPtr<IMgaFolder> parent, GUID g );
CComPtr<IMgaFolder> findFolderInChildren( CComPtr<IMgaFolder> parent, GUID g );
int getMerginClosureID();
bool inClosure( CComPtr<IMgaObject> obj, int closureID );
IntSet parseClosureString( const char * str );
void addSubTreeToMap( CComPtr<IMgaObject> o, ObjMap& map );
};
--- NEW FILE: component.def ---
; Interpreter.def : Declares the module parameters.
LIBRARY "GMEMergeComponent.DLL"
EXPORTS
DllCanUnloadNow PRIVATE
DllGetClassObject PRIVATE
DllRegisterServer PRIVATE
DllUnregisterServer PRIVATE
--- NEW FILE: Component.rc ---
// Microsoft Visual C++ generated resource script.
//
#include "resource.h"
#define APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 2 resource.
//
#include "afxres.h"
/////////////////////////////////////////////////////////////////////////////
#undef APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
// English (U.S.) 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
/////////////////////////////////////////////////////////////////////////////
//
// TEXTINCLUDE
//
1 TEXTINCLUDE
BEGIN
"resource.h\0"
END
2 TEXTINCLUDE
BEGIN
"#include ""afxres.h""\r\n"
"\0"
END
3 TEXTINCLUDE
BEGIN
"1 TYPELIB ""GMEMergeComponent.tlb""\r\n"
"\0"
END
#endif // APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Version
//
VS_VERSION_INFO VERSIONINFO
FILEVERSION 1,0,0,1
PRODUCTVERSION 1,0,0,1
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x1L
#else
FILEFLAGS 0x0L
#endif
FILEOS 0x4L
FILETYPE 0x2L
FILESUBTYPE 0x0L
BEGIN
BLOCK "StringFileInfo"
BEGIN
BLOCK "040904B0"
BEGIN
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"
BEGIN
VALUE "Translation", 0x409, 1200
END
END
/////////////////////////////////////////////////////////////////////////////
//
// Icon
//
// Icon with lowest ID value placed first to ensure application icon
// remains consistent on all systems.
IDI_COMPICON ICON "compicon.ico"
/////////////////////////////////////////////////////////////////////////////
//
// String Table
//
STRINGTABLE
BEGIN
IDS_PROJNAME "Component"
END
#endif // English (U.S.) resources
/////////////////////////////////////////////////////////////////////////////
#ifndef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 3 resource.
//
1 TYPELIB "GMEMergeComponent.tlb"
/////////////////////////////////////////////////////////////////////////////
#endif // not APSTUDIO_INVOKED
More information about the GME-commit
mailing list