[commit] r1217 - in tags/Release_10.11.24: . GME/Gme GME/Interfaces GME/Mga
GMESRC Repository Notifications
gme-commit at list.isis.vanderbilt.edu
Fri Mar 25 15:36:13 CDT 2011
Author: ksmyth
Date: Fri Mar 25 15:36:12 2011
New Revision: 1217
Log:
Fix compilation errors: merge from trunk 1071,1072,1073,1085
Modified:
tags/Release_10.11.24/ (props changed)
tags/Release_10.11.24/GME/Gme/GMEApp.cpp
tags/Release_10.11.24/GME/Interfaces/InterfaceVersion.h
tags/Release_10.11.24/GME/Interfaces/Mga.idl
tags/Release_10.11.24/GME/Mga/MgaAttribute.cpp
tags/Release_10.11.24/GME/Mga/MgaFCO.cpp
tags/Release_10.11.24/GME/Mga/MgaFCO.h
tags/Release_10.11.24/GME/Mga/MgaFolder.cpp
tags/Release_10.11.24/GME/Mga/MgaProject.cpp
Modified: tags/Release_10.11.24/GME/Gme/GMEApp.cpp
==============================================================================
--- tags/Release_10.11.24/GME/Gme/GMEApp.cpp Wed Mar 23 10:43:55 2011 (r1216)
+++ tags/Release_10.11.24/GME/Gme/GMEApp.cpp Fri Mar 25 15:36:12 2011 (r1217)
@@ -2492,7 +2492,14 @@
void CGMEApp::OnUpdateEditRedo(CCmdUI* pCmdUI)
{
- pCmdUI->Enable(IsUndoPossible() ? TRUE : FALSE);
+ if(guiMetaProject != NULL) {
+ short undoSize;
+ short redoSize;
+ mgaProject->UndoRedoSize(&undoSize,&redoSize);
+ pCmdUI->Enable(redoSize > 0);
+ }
+ else
+ pCmdUI->Enable(FALSE);
}
void CGMEApp::OnUpdateEditClearUndo(CCmdUI* pCmdUI)
Modified: tags/Release_10.11.24/GME/Interfaces/InterfaceVersion.h
==============================================================================
--- tags/Release_10.11.24/GME/Interfaces/InterfaceVersion.h Wed Mar 23 10:43:55 2011 (r1216)
+++ tags/Release_10.11.24/GME/Interfaces/InterfaceVersion.h Fri Mar 25 15:36:12 2011 (r1217)
@@ -4,7 +4,7 @@
// CHECKSUM Core.idl = B6534C3E
// CHECKSUM Meta.idl = DF870113
-// CHECKSUM Mga.idl = 71217380
+// CHECKSUM Mga.idl = A0838069
// CHECKSUM MgaUtil.idl = B850E056
// CHECKSUM MgaDecorator.idl = 14706DCC
// CHECKSUM Gme.idl = B603BECA
@@ -17,6 +17,6 @@
// -- keep them in sync
// -- never decrease it
cpp_quote("#ifndef INTERFACE_VERSION")
-cpp_quote("#define INTERFACE_VERSION 0x000200E6")
+cpp_quote("#define INTERFACE_VERSION 0x000200E7")
cpp_quote("#endif //INTERFACE_VERSION")
-#define INTERFACE_VERSION 0x000200E6
+#define INTERFACE_VERSION 0x000200E7
Modified: tags/Release_10.11.24/GME/Interfaces/Mga.idl
==============================================================================
--- tags/Release_10.11.24/GME/Interfaces/Mga.idl Wed Mar 23 10:43:55 2011 (r1216)
+++ tags/Release_10.11.24/GME/Interfaces/Mga.idl Fri Mar 25 15:36:12 2011 (r1217)
@@ -87,6 +87,7 @@
typedef enum globalevent_enum {
GLOBALEVENT_OPEN_PROJECT, // include create
GLOBALEVENT_CLOSE_PROJECT,
+ GLOBALEVENT_SAVE_PROJECT,
GLOBALEVENT_NEW_TERRITORY,
GLOBALEVENT_DESTROY_TERRITORY, // any territory has been destroyed (includes destroy by release)
GLOBALEVENT_COMMIT_TRANSACTION,
@@ -118,7 +119,11 @@
[ helpstring("The object has been destroyed (limited access is available)")]
OBJEVENT_DESTROYED = 0x40000000,
[ helpstring("The object is going to be deleted.")]
- OBJEVENT_PRE_DESTROYED = 0x20000000,
+ OBJEVENT_PRE_DESTROYED = 0x20000000,
+[ helpstring("Status of attribute/registry node is going to change.")]
+ OBJEVENT_PRE_STATUS = 0x10000000,
+[ helpstring("The object is being copied.")]
+ OBJEVENT_COPIED = 0x08000000,
[ helpstring("Attribute changed")]
OBJEVENT_ATTR = 0x00000001,
[ helpstring("Registry changed")]
Modified: tags/Release_10.11.24/GME/Mga/MgaAttribute.cpp
==============================================================================
--- tags/Release_10.11.24/GME/Mga/MgaAttribute.cpp Wed Mar 23 10:43:55 2011 (r1216)
+++ tags/Release_10.11.24/GME/Mga/MgaAttribute.cpp Fri Mar 25 15:36:12 2011 (r1217)
@@ -147,27 +147,40 @@
}
+class attrnotifytask : public DeriveTreeTask {
+ bool Do(CoreObj self, std::vector<CoreObj> *peers = NULL) {
+ ObjForCore(self)->SelfMark(OBJEVENT_ATTR);
+ return true;
+ }
+};
+
+
STDMETHODIMP CMgaAttribute::Clear() {
COMTRY_IN_TRANSACTION {
fco->CheckWrite();
CoreObjs attrs = fco->self[ATTRID_ATTRPARENT+ATTRID_COLLECTION];
ITERATE_THROUGH(attrs) {
if(mref == ITER[ATTRID_META]) {
+ // lph: Pre-Notification PRE_STATUS (the attribute is being changed to its default value)
+ CComQIPtr<IMgaMetaAttribute> ma(mgaproject->FindMetaRef(mref));
+ CComBSTR name;
+ COMTHROW(ma->get_Name(&name));
+ CComBSTR desc = "ATTR,";
+ desc.Append(name);
+ desc.Append(",Cleared");
+ fco->PreNotify(OBJEVENT_PRE_STATUS, CComVariant(desc));
+ //---------------------------------------------------------------------------------------
COMTHROW(ITER->Delete());
load_status = ATTSTATUS_INVALID;
+ // lph: added notification of attribute mod
+ attrnotifytask().DoWithDeriveds(fco->self);
+ //-----------------------------------------
break;
}
}
} COMCATCH_IN_TRANSACTION(;);
}
-class attrnotifytask : public DeriveTreeTask {
- bool Do(CoreObj self, std::vector<CoreObj> *peers = NULL) {
- ObjForCore(self)->SelfMark(OBJEVENT_ATTR);
- return true;
- }
-};
-
STDMETHODIMP CMgaAttribute::put_Value(VARIANT newVal) {
COMTRY_IN_TRANSACTION {
@@ -188,6 +201,15 @@
load_status = ATTSTATUS_INVALID;
valueobj = NULL;
COMTHROW(mgaproject->dataproject->CreateObject(DTID_ATTRTYPESBASE+attrtyp, &valueobj.ComPtr()));
+ // lph: Pre-Notification PRE_STATUS (the attribute is being changed from its default value)
+ CComQIPtr<IMgaMetaAttribute> ma(mgaproject->FindMetaRef(mref));
+ CComBSTR name;
+ COMTHROW(ma->get_Name(&name));
+ CComBSTR desc = "ATTR,";
+ desc.Append(name);
+ desc.Append(",Defined");
+ fco->PreNotify(OBJEVENT_PRE_STATUS, CComVariant(desc));
+ //-----------------------------------------------------------------------------------------
valueobj[ATTRID_META]=mref;
valueobj[ATTRID_ATTRPARENT]=fco->self;
load_status = ATTSTATUS_HERE;
@@ -854,6 +876,12 @@
long dummy;
valueobj <<= findregvalueobj(fco->self, mypath, dummy, false);
if(valueobj) {
+ // lph: Pre-Notification PRE_STATUS (the registry node is being destroyed)
+ CComBSTR desc = "REGISTRY,";
+ desc.Append(mypath);
+ desc.Append(",Removed");
+ fco->PreNotify(OBJEVENT_PRE_STATUS, CComVariant(desc));
+ //--------------------------------------------------------------------------
RegistryChildrenRemove(valueobj);
COMTHROW(valueobj->Delete());
load_status = ATTSTATUS_INVALID;
Modified: tags/Release_10.11.24/GME/Mga/MgaFCO.cpp
==============================================================================
--- tags/Release_10.11.24/GME/Mga/MgaFCO.cpp Wed Mar 23 10:43:55 2011 (r1216)
+++ tags/Release_10.11.24/GME/Mga/MgaFCO.cpp Fri Mar 25 15:36:12 2011 (r1217)
@@ -829,7 +829,107 @@
} COMCATCH(;)
}
+//-------------------------------------------------------------------------------------
+// lph: Change description for ATTR, REGISTRY and PROPERTIES notifications
+typedef std::vector<CComVariant> ModificationsVector;
+
+void getRegistryModifications(CoreObj &cobj, CComBSTR &path, ModificationsVector &mv) {
+ CComVariant current = cobj[ATTRID_REGNODEVALUE];
+ CComVariant previous;
+ COMTHROW(cobj->get_PreviousAttrValue(ATTRID_REGNODEVALUE, &previous));
+ if (previous != current) {
+ CComBSTR label = "REGISTRY:";
+ label.Append(path);
+ CComVariant ident = label;
+ mv.push_back(ident);
+ mv.push_back(previous);
+ }
+ ITERATE_THROUGH(cobj[ATTRID_REGNOWNER+ATTRID_COLLECTION]) {
+ CComBSTR cname = ITER[ATTRID_NAME];
+ CComBSTR cpath = path;
+ cpath.Append("/");
+ cpath.Append(cname);
+ getRegistryModifications(ITER, cpath, mv);
+ }
+}
+
+HRESULT get_Modifications(FCO *fco, unsigned long changemask, CComVariant *mods) {
+ ModificationsVector modifications;
+ if (changemask & OBJEVENT_REGISTRY) {
+ ITERATE_THROUGH(fco->self[ATTRID_REGNOWNER+ATTRID_COLLECTION]) {
+ CComBSTR path = ITER[ATTRID_NAME];
+ getRegistryModifications(ITER, path, modifications);
+ }
+ }
+ if (changemask & OBJEVENT_ATTR) {
+ CComPtr<IMgaMetaFCO> mfco;
+ COMTHROW(fco->get_Meta(&mfco));
+ ITERATE_THROUGH(fco->self[ATTRID_ATTRPARENT+ATTRID_COLLECTION]) {
+ CComPtr<IMgaMetaAttribute> ma;
+ COMTHROW(mfco->get_AttributeByRef(ITER[ATTRID_META], &ma));
+ attval_enum vt;
+ COMTHROW(ma->get_ValueType(&vt));
+ if (vt == ATTVAL_ENUM) vt = ATTVAL_STRING;
+ attrid_type aid = ATTRID_ATTRTYPESBASE + vt;
+ CComVariant current = ITER[aid];
+ static const VARTYPE vartypes[] = { VT_NULL, VT_BSTR, VT_I4, VT_R8, VT_BOOL, VT_DISPATCH, VT_BSTR };
+ if(vartypes[vt] != current.vt) {
+ COMTHROW(current.ChangeType(vartypes[vt]));
+ }
+ CComVariant previous;
+ COMTHROW(ITER->get_PreviousAttrValue(aid, &previous));
+ if(vartypes[vt] != previous.vt) {
+ COMTHROW(previous.ChangeType(vartypes[vt]));
+ }
+ if (previous != current) {
+ CComBSTR name;
+ COMTHROW(ma->get_Name(&name));
+ CComBSTR label = "ATTR:";
+ label.Append(name);
+ CComVariant ident = label;
+ modifications.push_back(ident);
+ modifications.push_back(previous);
+ }
+ }
+ }
+ if (changemask & OBJEVENT_PROPERTIES) {
+ CComVariant name = fco->self[ATTRID_NAME];
+ CComVariant pname;
+ fco->self->get_PreviousAttrValue(ATTRID_NAME, &pname);
+ if (pname != name) {
+ CComVariant ident = "PROPERTIES:Name";
+ modifications.push_back(ident);
+ modifications.push_back(pname);
+ }
+/* lph: possibly necessary, but not yet
+ CComVariant perm = fco->self[ATTRID_PERMISSIONS];
+ CComVariant pperm;
+ COMTHROW(fco->self->get_PreviousAttrValue(ATTRID_PERMISSIONS, &pperm));
+ if (pperm != perm) {
+ CComVariant ident = "PROPERTIES:Permissions";
+ modifications.push_back(ident);
+ modifications.push_back(pperm);
+ }
+*/
+ }
+ if (modifications.size() > 0) {
+ SAFEARRAY *pVariantsArray = NULL;
+ SAFEARRAYBOUND rgsabound[1];
+ rgsabound[0].lLbound = 0;
+ rgsabound[0].cElements = modifications.size();
+ pVariantsArray = SafeArrayCreate(VT_VARIANT, 1, rgsabound);
+ for (LONG i=0; i<LONG(modifications.size()); i++) {
+ SafeArrayPutElement(pVariantsArray, &i, &modifications[i]);
+ }
+ CComVariant varOut;
+ varOut.vt = VT_ARRAY | VT_VARIANT;
+ varOut.parray = pVariantsArray;
+ varOut.Detach(mods);
+ }
+ return S_OK;
+}
+//-------------------------------------------------------------------------------------
#define REQUIRE_NOTIFICATION_SUCCESS 1 // return with error if addons/rwhandlers fail
@@ -841,7 +941,9 @@
if(chmask & OBJEVENT_DESTROYED) chmask = OBJEVENT_DESTROYED;
CMgaProject::addoncoll::iterator ai, abeg = mgaproject->alladdons.begin(), aend = mgaproject->alladdons.end();
if(abeg != aend) {
- CComVariant nil;
+ CComVariant mods;
+ if(!(chmask & OBJEVENT_CREATED) && (chmask & (OBJEVENT_REGISTRY+OBJEVENT_ATTR+OBJEVENT_PROPERTIES)))
+ COMTHROW(get_Modifications(this, chmask, &mods));
COMTHROW(mgaproject->pushterr(*mgaproject->reserveterr));
for(ai = abeg; ai != aend; ) {
CComPtr<CMgaAddOn> t = *ai++; // it is important to incr ii here, while obj
@@ -852,9 +954,9 @@
getinterface(&tt);
#if(REQUIRE_NOTIFICATION_SUCCESS)
- COMTHROW(t->handler->ObjectEvent(tt, mmask, nil));
+ COMTHROW(t->handler->ObjectEvent(tt, mmask, mods));
#else
- if((s = t->handler->ObjectEvent(tt, mmask, nil)) != S_OK) {
+ if((s = t->handler->ObjectEvent(tt, mmask, mods)) != S_OK) {
ASSERT(("Notification failed", false));
}
#endif
Modified: tags/Release_10.11.24/GME/Mga/MgaFCO.h
==============================================================================
--- tags/Release_10.11.24/GME/Mga/MgaFCO.h Wed Mar 23 10:43:55 2011 (r1216)
+++ tags/Release_10.11.24/GME/Mga/MgaFCO.h Fri Mar 25 15:36:12 2011 (r1217)
@@ -340,6 +340,7 @@
// PreDelete Notification by Tihamer for the PAMS SynchTool
void PreDeleteNotify();
+
public:
class NoAddRefCoreObj : public CoreObj { // CoreObj, but non-addref/release-ing
public:
@@ -597,6 +598,9 @@
void objforgetchange();
void removeterrfromlist(CMgaTerritory *t);
+ // lph: notification service for precursory object events (used by PRE_DESTROYED and PRE_STATUS)
+ HRESULT PreNotify(unsigned long changemask, CComVariant param);
+
template <class Q>
void getinterface(Q **p, CMgaTerritory *terr = NULL) {
CComPtr<IMgaObject> zz;
Modified: tags/Release_10.11.24/GME/Mga/MgaFolder.cpp
==============================================================================
--- tags/Release_10.11.24/GME/Mga/MgaFolder.cpp Wed Mar 23 10:43:55 2011 (r1216)
+++ tags/Release_10.11.24/GME/Mga/MgaFolder.cpp Fri Mar 25 15:36:12 2011 (r1217)
@@ -76,6 +76,7 @@
std::vector<CoreObj> nobjs(cnt);
MGACOLL_ITERATE(IMgaFolder, copylist) {
CoreObj oldobj = CoreObj(MGACOLL_ITER);
+ ObjForCore(oldobj)->SelfMark(OBJEVENT_COPIED);
ObjTreeCopyFoldersToo(mgaproject, oldobj, nobjs[i], crealist); // copy
assignnewchild(nobjs[i]);
Modified: tags/Release_10.11.24/GME/Mga/MgaProject.cpp
==============================================================================
--- tags/Release_10.11.24/GME/Mga/MgaProject.cpp Wed Mar 23 10:43:55 2011 (r1216)
+++ tags/Release_10.11.24/GME/Mga/MgaProject.cpp Fri Mar 25 15:36:12 2011 (r1217)
@@ -544,6 +544,7 @@
//if(!(ppp & LOCKING_READ)) self[ATTRID_MDATE] = Now();
// BGY: this modifies the root every save time, which is bad for the
// xmlbackend (it always tries to check out the root)
+ GlobalNotify(GLOBALEVENT_SAVE_PROJECT);
COMTHROW(CommitTransaction());
} catch(hresult_exception &) {
t->Flush();
@@ -1338,6 +1339,10 @@
}
COMTHROW(CommitNotify());
COMTHROW(dataproject->PopTerritory());
+ short nestedCount;
+ dataproject->get_NestedTransactionCount(&nestedCount);
+ if (nestedCount == 1 && !read_only)
+ COMTHROW(GlobalNotify(GLOBALEVENT_COMMIT_TRANSACTION));
COMTHROW(dataproject->CommitTransaction(read_only ? TRANSTYPE_READFIRST: TRANSTYPE_FIRST));
baseterr = activeterr= NULL;
read_only = false;
@@ -1591,7 +1596,7 @@
CComPtr<IMgaTerritory> t;
COMTHROW(CreateTerritory(NULL, &t));
COMTHROW(BeginTransaction(t, TRANSACTION_READ_ONLY));
- GlobalNotify(GLOBALEVENT_UNDO);
+ GlobalNotify(GLOBALEVENT_REDO);
COMTHROW(CommitTransaction());
}
}
More information about the gme-commit
mailing list