[GME-commit]
GMESRC/GME/Gme GMEView.cpp,1.169,1.170 GUIObject.cpp,1.50,1.51
GUIObject.h,1.23,1.24
gme-commit at list.isis.vanderbilt.edu
gme-commit at list.isis.vanderbilt.edu
Thu Jul 7 00:09:13 CDT 2005
Update of /project/gme-repository/GMESRC/GME/Gme
In directory escher:/tmp/cvs-serv28025
Modified Files:
GMEView.cpp GUIObject.cpp GUIObject.h
Log Message:
Annotation enhancements.
CVS User: Zoltan Molnar, ISIS (zolmol)
Index: GMEView.cpp
===================================================================
RCS file: /project/gme-repository/GMESRC/GME/Gme/GMEView.cpp,v
retrieving revision 1.169
retrieving revision 1.170
diff -C2 -d -r1.169 -r1.170
*** GMEView.cpp 28 Jun 2005 15:56:13 -0000 1.169
--- GMEView.cpp 6 Jul 2005 23:09:11 -0000 1.170
***************
*** 1447,1452 ****
CComPtr<IMgaRegNode> anNode;
anNode = MGACOLL_ITER;
! CGuiAnnotator *annotator = new CGuiAnnotator(currentModel, anNode, this, guiMeta->NumberOfAspects());
! annList.AddTail(annotator);
}
MGACOLL_ITERATE_END;
--- 1447,1456 ----
CComPtr<IMgaRegNode> anNode;
anNode = MGACOLL_ITER;
! bool arch = !isSubType && isType; // archetype if not subtype and not instance (type)
! if( arch || !arch && CGuiAnnotator::Showable( anNode ))
! {
! CGuiAnnotator *annotator = new CGuiAnnotator(currentModel, anNode, this, guiMeta->NumberOfAspects());
! annList.AddTail(annotator);
! }
}
MGACOLL_ITERATE_END;
***************
*** 2445,2449 ****
while(pos) {
CGuiAnnotator *ann = annotatorList.GetNext(pos);
! COMTHROW(ann->rootNode->RemoveTree());
}
CommitTransaction();
--- 2449,2456 ----
while(pos) {
CGuiAnnotator *ann = annotatorList.GetNext(pos);
! if( ann->IsSpecial())
! COMTHROW( CGuiAnnotator::Hide( ann->rootNode));
! else
! COMTHROW(ann->rootNode->RemoveTree());
}
CommitTransaction();
***************
*** 2557,2561 ****
--- 2564,2575 ----
PasteAnnotations(currentModel, regNodes, newRegNodes, (drag && move));
+ long l;
+ CComPtr<IMgaFCOs> interrfcos;
+ COMTHROW(terry->OpenFCOs( fcos, &interrfcos));
+ COMTHROW( interrfcos->get_Count( &l));
+
CComPtr<IMgaFCOs> newFcos;
+ if( l > 0)
+ {
if ((drag && move) || (!reference && !derive)) {
CComPtr<IMgaMetaRoles> newRoles;
***************
*** 2752,2755 ****
--- 2766,2770 ----
else
VERIFY(false); // shouldn't be here!
+ } // endif l > 0
if(drag && !ref) {
***************
*** 2758,2762 ****
CGuiConnectionList newConnections;
CGuiAnnotatorList newAnns;
! CreateGuiObjects(newFcos,newGuiFcos,newConnections);
POSITION fpos = newGuiFcos.GetHeadPosition();
while (fpos) {
--- 2773,2777 ----
CGuiConnectionList newConnections;
CGuiAnnotatorList newAnns;
! if( newFcos) CreateGuiObjects(newFcos,newGuiFcos,newConnections);
POSITION fpos = newGuiFcos.GetHeadPosition();
while (fpos) {
***************
*** 4275,4288 ****
{
CGMEEventLogger::LogGMEEvent("CGMEView::OnEditNudgedown in "+path+name+"\r\n");
! if(!isType)
! return;
try {
BeginTransaction();
! if(CGuiObject::NudgeObjects(selected,0,1)) {
router.NudgeObjects(selected,0,1);
! CGuiAnnotator::NudgeAnnotations(selectedAnnotations,0,1);
! // currentModel->SetConnectionLabels();
! Invalidate();
! }
CommitTransaction();
}
--- 4290,4301 ----
{
CGMEEventLogger::LogGMEEvent("CGMEView::OnEditNudgedown in "+path+name+"\r\n");
!
try {
BeginTransaction();
! CGuiAnnotator::NudgeAnnotations(selectedAnnotations,0,1);
! if(isType && CGuiObject::NudgeObjects(selected,0,1))
router.NudgeObjects(selected,0,1);
! Invalidate();
!
CommitTransaction();
}
***************
*** 4301,4314 ****
{
CGMEEventLogger::LogGMEEvent("CGMEView::OnEditNudgeleft in "+path+name+"\r\n");
! if(!isType)
! return;
try {
BeginTransaction();
! if(CGuiObject::NudgeObjects(selected,-1,0)) {
router.NudgeObjects(selected,-1,0);
! CGuiAnnotator::NudgeAnnotations(selectedAnnotations,-1,0);
! // currentModel->SetConnectionLabels();
! Invalidate();
! }
CommitTransaction();
}
--- 4314,4324 ----
{
CGMEEventLogger::LogGMEEvent("CGMEView::OnEditNudgeleft in "+path+name+"\r\n");
!
try {
BeginTransaction();
! CGuiAnnotator::NudgeAnnotations(selectedAnnotations,-1,0);
! if(isType && CGuiObject::NudgeObjects(selected,-1,0))
router.NudgeObjects(selected,-1,0);
! Invalidate();
CommitTransaction();
}
***************
*** 4327,4340 ****
{
CGMEEventLogger::LogGMEEvent("CGMEView::OnEditNudgeright in "+path+name+"\r\n");
! if(!isType)
! return;
try {
BeginTransaction();
! if(CGuiObject::NudgeObjects(selected,1,0)) {
router.NudgeObjects(selected,1,0);
! CGuiAnnotator::NudgeAnnotations(selectedAnnotations,1,0);
! // currentModel->SetConnectionLabels();
! Invalidate();
! }
CommitTransaction();
}
--- 4337,4347 ----
{
CGMEEventLogger::LogGMEEvent("CGMEView::OnEditNudgeright in "+path+name+"\r\n");
!
try {
BeginTransaction();
! CGuiAnnotator::NudgeAnnotations(selectedAnnotations,1,0);
! if(isType && CGuiObject::NudgeObjects(selected,1,0))
router.NudgeObjects(selected,1,0);
! Invalidate();
CommitTransaction();
}
***************
*** 4353,4366 ****
{
CGMEEventLogger::LogGMEEvent("CGMEView::OnEditNudgeup in "+path+name+"\r\n");
! if(!isType)
! return;
try {
BeginTransaction();
! if(CGuiObject::NudgeObjects(selected,0,-1)) {
router.NudgeObjects(selected,0,-1);
! CGuiAnnotator::NudgeAnnotations(selectedAnnotations,0,-1);
! // currentModel->SetConnectionLabels();
! Invalidate();
! }
CommitTransaction();
}
--- 4360,4370 ----
{
CGMEEventLogger::LogGMEEvent("CGMEView::OnEditNudgeup in "+path+name+"\r\n");
!
try {
BeginTransaction();
! CGuiAnnotator::NudgeAnnotations(selectedAnnotations,0,-1);
! if(isType && CGuiObject::NudgeObjects(selected,0,-1))
router.NudgeObjects(selected,0,-1);
! Invalidate();
CommitTransaction();
}
***************
*** 4404,4420 ****
{
CGMEEventLogger::LogGMEEvent("CGMEView::OnEditDelete in "+path+name+"\r\n");
if(!isType)
return;
GMEEVENTLOG_GUIOBJS(selected);
DeleteObjects(selected);
- GMEEVENTLOG_GUIANNOTATORS(selectedAnnotations);
- DeleteAnnotations(selectedAnnotations);
selected.RemoveAll();
- selectedAnnotations.RemoveAll();
}
void CGMEView::OnUpdateEditDelete(CCmdUI* pCmdUI)
{
! pCmdUI->Enable(isType && ((!selected.IsEmpty()) || (!selectedAnnotations.IsEmpty())));
}
--- 4408,4430 ----
{
CGMEEventLogger::LogGMEEvent("CGMEView::OnEditDelete in "+path+name+"\r\n");
+
+ GMEEVENTLOG_GUIANNOTATORS(selectedAnnotations);
+ DeleteAnnotations(selectedAnnotations);
+ selectedAnnotations.RemoveAll();
+
if(!isType)
return;
+
GMEEVENTLOG_GUIOBJS(selected);
DeleteObjects(selected);
selected.RemoveAll();
}
void CGMEView::OnUpdateEditDelete(CCmdUI* pCmdUI)
{
! if( !selected.IsEmpty())
! pCmdUI->Enable( isType);
! else
! pCmdUI->Enable(!selectedAnnotations.IsEmpty());
}
***************
*** 4628,4643 ****
{
CGMEEventLogger::LogGMEEvent("CGMEView::OnEditCut in "+path+name+"\r\n");
! if(isType && selected.GetCount() + selectedAnnotations.GetCount() > 0) {
! GMEEVENTLOG_GUIOBJS(selected);
GMEEVENTLOG_GUIANNOTATORS(selectedAnnotations);
CPoint pt = CPoint(0,0);
CRectList rects,annRects;
! CGuiObject::GetRectList(selected,rects);
CGuiAnnotator::GetRectList(selectedAnnotations,annRects);
CGMEDataDescriptor desc(rects,annRects,pt,pt);
GetDocument()->CopyToClipboard(&selected,&selectedAnnotations,&desc,this);
! DeleteObjects(selected);
DeleteAnnotations(selectedAnnotations);
! selected.RemoveAll();
selectedAnnotations.RemoveAll();
}
--- 4638,4653 ----
{
CGMEEventLogger::LogGMEEvent("CGMEView::OnEditCut in "+path+name+"\r\n");
! if(selected.GetCount() + selectedAnnotations.GetCount() > 0) {
! if(isType) GMEEVENTLOG_GUIOBJS(selected);
GMEEVENTLOG_GUIANNOTATORS(selectedAnnotations);
CPoint pt = CPoint(0,0);
CRectList rects,annRects;
! if(isType) CGuiObject::GetRectList(selected,rects);
CGuiAnnotator::GetRectList(selectedAnnotations,annRects);
CGMEDataDescriptor desc(rects,annRects,pt,pt);
GetDocument()->CopyToClipboard(&selected,&selectedAnnotations,&desc,this);
! if(isType) DeleteObjects(selected);
DeleteAnnotations(selectedAnnotations);
! if(isType) selected.RemoveAll();
selectedAnnotations.RemoveAll();
}
***************
*** 4646,4650 ****
void CGMEView::OnUpdateEditCut(CCmdUI* pCmdUI)
{
! pCmdUI->Enable(isType && selected.GetCount() + selectedAnnotations.GetCount() > 0);
}
--- 4656,4663 ----
void CGMEView::OnUpdateEditCut(CCmdUI* pCmdUI)
{
! if( !selectedAnnotations.IsEmpty() && selected.IsEmpty())
! pCmdUI->Enable( TRUE); // allow if annotations are selected only
! else
! pCmdUI->Enable(isType && selected.GetCount() + selectedAnnotations.GetCount() > 0);
}
***************
*** 4812,4816 ****
void CGMEView::OnUpdateCntxCut(CCmdUI* pCmdUI)
{
! pCmdUI->Enable(isType);
}
--- 4825,4832 ----
void CGMEView::OnUpdateCntxCut(CCmdUI* pCmdUI)
{
! if( contextAnnotation)
! pCmdUI->Enable( TRUE);
! else
! pCmdUI->Enable(isType);
}
***************
*** 4828,4832 ****
contextSelection = 0;
}
! if(isType && contextAnnotation) {
CGMEEventLogger::LogGMEEvent(" "+contextAnnotation->GetName()+"/r/n");
CGuiAnnotatorList list;
--- 4844,4848 ----
contextSelection = 0;
}
! if( contextAnnotation) {
CGMEEventLogger::LogGMEEvent(" "+contextAnnotation->GetName()+"/r/n");
CGuiAnnotatorList list;
***************
*** 4839,4843 ****
void CGMEView::OnUpdateCntxDelete(CCmdUI* pCmdUI)
{
! pCmdUI->Enable(isType);
}
--- 4855,4862 ----
void CGMEView::OnUpdateCntxDelete(CCmdUI* pCmdUI)
{
! if( contextAnnotation && !contextSelection)
! pCmdUI->Enable(TRUE);
! else
! pCmdUI->Enable(isType);
}
Index: GUIObject.h
===================================================================
RCS file: /project/gme-repository/GMESRC/GME/Gme/GUIObject.h,v
retrieving revision 1.23
retrieving revision 1.24
diff -C2 -d -r1.23 -r1.24
*** GUIObject.h 19 Jul 2004 15:22:58 -0000 1.23
--- GUIObject.h 6 Jul 2005 23:09:11 -0000 1.24
***************
*** 108,111 ****
--- 108,112 ----
void SetAspect(int a) { parentAspect = (a < numParentAspects ? a : 0); }
bool IsVisible(int aspect = -1);
+ bool IsSpecial() { return special; }
void Draw(CDC * pDC);
void GrayOut(bool set = true);
***************
*** 124,127 ****
--- 125,130 ----
static void FindUpperLeft(CGuiAnnotatorList &anns,int &left,int &top);
static void ShiftAnnotations(CGuiAnnotatorList &annList,CPoint &shiftBy);
+ static bool Showable( CComPtr<IMgaRegNode> &mRootNode);
+ static int Hide( CComPtr<IMgaRegNode> &mRootNode);
public:
***************
*** 136,139 ****
--- 139,144 ----
CComPtr<IMgaDecorator> *decorators;
CRect *locations;
+ bool special;
+
};
Index: GUIObject.cpp
===================================================================
RCS file: /project/gme-repository/GMESRC/GME/Gme/GUIObject.cpp,v
retrieving revision 1.50
retrieving revision 1.51
diff -C2 -d -r1.50 -r1.51
*** GUIObject.cpp 26 Jan 2005 17:28:27 -0000 1.50
--- GUIObject.cpp 6 Jul 2005 23:09:11 -0000 1.51
***************
*** 377,380 ****
--- 377,381 ----
grayedOut = false;
view = vw;
+ special = false;
decorators = new CComPtr<IMgaDecorator>[numAsp];
***************
*** 386,389 ****
--- 387,395 ----
name = bName;
+ long st; // if main node status is inherited it means it is a special node
+ COMTHROW(rootNode->get_Status( &st));
+ if( st > ATTSTATUS_HERE)
+ special = true;
+
id = view->name + ":" + name; // Fake id
***************
*** 704,707 ****
--- 710,787 ----
}
}
+
+ // static
+ int CGuiAnnotator::Hide(CComPtr<IMgaRegNode> &mRootNode )
+ {
+ CComBSTR val;
+ COMTHROW(mRootNode->get_Value( &val));
+ COMTHROW(mRootNode->put_Value( val));
+ // thus we made the value of the annotator defined 'HERE'
+ // which will decide whether an annotation regnode is virtual (inherited) or not
+
+ CComBSTR bstr("1");
+ CComPtr<IMgaRegNode> hideNode;
+ CComBSTR hideNm(AN_HIDDEN);
+ COMTHROW(mRootNode->get_SubNodeByName( hideNm, &hideNode));
+ COMTHROW( hideNode->put_Value( bstr));
+
+ return S_OK;
+ }
+
+ // static
+ bool CGuiAnnotator::Showable( CComPtr<IMgaRegNode> &mRootNode )
+ { // decides whether an annotation should be displayed in case of a subtype/instance
+ // Subtype/instance may have: owned annotations (not present in the ancestor) -> main status = ATTSTATUS_HERE
+ // inherited annotations -> main status = ATTSTATUS_INHERITED1,2,...
+ // inherited, but modified annotations -> main status = ATTSTATUS_HERE
+ try {
+ CComBSTR bName;
+ COMTHROW(mRootNode->get_Name(&bName));
+
+ // if value of rootnode defined HERE, then show it only iff 'hide' not set
+ long status;
+ COMTHROW(mRootNode->get_Status(&status));
+ if( status == ATTSTATUS_HERE)
+ {
+ bool hidden_set = false;
+ CComPtr<IMgaRegNode> hideNode;
+ CComBSTR hideNm(AN_HIDDEN);
+ COMTHROW(mRootNode->get_SubNodeByName( hideNm, &hideNode));
+ if (hideNode)
+ {
+ long hideStatus;
+ COMTHROW( hideNode->get_Status( &hideStatus));
+ if( hideStatus != ATTSTATUS_UNDEFINED) // meta, here or inherited
+ {
+ CComBSTR bstr;
+ COMTHROW( hideNode->get_Value( &bstr));
+ if( bstr == "1")
+ hidden_set = true;
+ }
+ }
+
+ return !hidden_set;
+ }
+
+ // the value of mRootNode is inherited (is NOT HERE)
+ CComPtr<IMgaRegNode> inheritNode;
+ CComBSTR inhName(AN_INHERITABLE);
+ COMTHROW(mRootNode->get_SubNodeByName( inhName, &inheritNode));
+
+ if (inheritNode) {
+ CComBSTR bstr;
+ COMTHROW(inheritNode->get_Value( &bstr));
+ if (bstr == "1") // if "inheritable" is 1 show it
+ return true;
+ }
+ }
+ catch(hresult_exception &e) {
+ throw hresult_exception(e.hr);
+ return false;
+ }
+
+ return false;
+ }
+
////////////////////////////////////
// Virtual methods of CGuiAnnotator
More information about the GME-commit
mailing list