00001
00002
00003
00004
00005
00007 #include "stdafx.h"
00008
00009 #include <ComHelp.h>
00010 #include <GMECOM.h>
00011 #include <Console.h>
00012 #include "ComponentConfig.h"
00013 #ifndef __INTELLISENSE__
00014 #import "progid:Mga.MgaMetaFolder" no_implementation auto_search no_namespace no_search_namespace
00015 #import "progid:Mga.MgaFolders" no_implementation auto_search no_namespace no_search_namespace
00016 #import "progid:Mga.MgaMetaFolder" implementation_only auto_search no_namespace no_search_namespace
00017 #import "progid:Mga.MgaFolders" implementation_only auto_search no_namespace no_search_namespace
00018 #else
00019
00020
00021 #ifdef _DEBUG
00022
00023 #include "Debug\Meta.tlh"
00024 #include "Debug\Mga.tlh"
00025 #else
00026 #include "Release\Meta.tlh"
00027 #include "Release\Mga.tlh"
00028 #endif
00029 #endif
00030
00031 #include "RawComponent.h"
00032
00033
00034
00035 STDMETHODIMP RawComponent::Initialize(struct IMgaProject *) {
00036 return S_OK;
00037 }
00038
00039
00040
00041 STDMETHODIMP RawComponent::Invoke(IMgaProject* gme, IMgaFCOs *models, long param) {
00042 #ifdef SUPPORT_OLD_INVOKE
00043 CComPtr<IMgaFCO> focus;
00044 CComVariant parval = param;
00045 return InvokeEx(gme, focus, selected, parvar);
00046 #else
00047 if(interactive) {
00048 AfxMessageBox(_T("This component does not support the obsolete invoke mechanism"));
00049 }
00050 return E_MGA_NOT_SUPPORTED;
00051 #endif
00052 }
00053
00054
00055
00056
00057 STDMETHODIMP RawComponent::InvokeEx( IMgaProject *project, IMgaFCO *currentobj,
00058 IMgaFCOs *selectedobjs, long param) {
00059 COMTRY {
00060 _bstr_t focusname = "<nothing>";
00061 IMgaTerritoryPtr terr;
00062 project->CreateTerritory(NULL, &terr, NULL);
00063 project->BeginTransaction(terr, TRANSACTION_GENERAL);
00064 try {
00065 if (currentobj)
00066 focusname = currentobj->Name;
00067 using namespace GMEConsole;
00068 Console::Out::WriteLine("Interpreter started...");
00069 AfxMessageBox(_T("RAW Com Component --- Plugin!!!! Sample (project: ") + project->Name +
00070 _T(", focus: ") + focusname);
00071 project->CommitTransaction();
00072 Console::Out::WriteLine(_T("Interpreter completed..."));
00073 } catch(...) { project->AbortTransaction(); throw; }
00074 } COMCATCH(;);
00075 }
00076
00077
00078
00079 STDMETHODIMP RawComponent::ObjectsInvokeEx( IMgaProject *project, IMgaObject *currentobj, IMgaObjects *selectedobjs, long param) {
00080 if(interactive) {
00081 AfxMessageBox(_T("The ObjectsInvoke method is not implemented"));
00082 }
00083 return E_MGA_NOT_SUPPORTED;
00084 }
00085
00086
00087
00088 STDMETHODIMP RawComponent::get_ComponentParameter(BSTR name, VARIANT *pVal) {
00089 return S_OK;
00090 }
00091
00092 STDMETHODIMP RawComponent::put_ComponentParameter(BSTR name, VARIANT newVal) {
00093 return S_OK;
00094 }
00095
00096
00097 #ifdef GME_ADDON
00098
00099
00100 STDMETHODIMP RawComponent::GlobalEvent(globalevent_enum event) {
00101 if(event == GLOBALEVENT_UNDO) {
00102 AfxMessageBox(_T("Undo"));
00103 }
00104 return S_OK;
00105 }
00106
00107 STDMETHODIMP RawComponent::ObjectEvent(IMgaObject * obj, unsigned long eventmask, VARIANT v) {
00108 if((eventmask & OBJEVENT_CREATED) && !(eventmask & OBJEVENT_DESTROYED)) {
00109 AfxMessageBox(_T("Object created: ObjID=") + obj->ID);
00110 }
00111 return S_OK;
00112 }
00113
00114 #endif