[GME-commit] GMESRC/GME/MgaUtil resource.h,1.28,1.29 MgaUtil.vcproj,1.1,1.2 AnnotationBrowserDlg.h,1.2,1.3 AnnotationBrowserDlg.cpp,1.3,1.4 AnnotationNode.cpp,1.4,1.5 AnnotationNode.h,1.2,1.3 AnnotationPanel.cpp,1.2,1.3

gme-commit at list.isis.vanderbilt.edu gme-commit at list.isis.vanderbilt.edu
Wed Jul 6 23:11:32 CDT 2005


Update of /project/gme-repository/GMESRC/GME/MgaUtil
In directory escher:/tmp/cvs-serv25309

Modified Files:
	resource.h MgaUtil.vcproj AnnotationBrowserDlg.h 
	AnnotationBrowserDlg.cpp AnnotationNode.cpp AnnotationNode.h 
	AnnotationPanel.cpp 
Log Message:
Annotation enhancements.


CVS User: Zoltan Molnar, ISIS (zolmol)

Index: AnnotationPanel.cpp
===================================================================
RCS file: /project/gme-repository/GMESRC/GME/MgaUtil/AnnotationPanel.cpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** AnnotationPanel.cpp	21 Nov 2001 01:57:00 -0000	1.2
--- AnnotationPanel.cpp	6 Jul 2005 22:11:29 -0000	1.3
***************
*** 5,8 ****
--- 5,9 ----
  #include "mgautil.h"
  #include "AnnotationPanel.h"
+ #include "resource.h"
  
  #ifdef _DEBUG
***************
*** 62,66 ****
  	ctrl = prnt->GetDlgItem(IDC_STATIC_COLOR);
  	if (ctrl->GetSafeHwnd()) {
! 		CRect origRect(13,101,13+19,101+8);
  		prnt->MapDialogRect(&origRect);
  		ClientToScreen(&origRect);
--- 63,67 ----
  	ctrl = prnt->GetDlgItem(IDC_STATIC_COLOR);
  	if (ctrl->GetSafeHwnd()) {
! 		CRect origRect(13,101+16,13+19,101+8+16);
  		prnt->MapDialogRect(&origRect);
  		ClientToScreen(&origRect);
***************
*** 71,75 ****
  	ctrl = prnt->GetDlgItem(IDC_STATIC_BGCOLOR);
  	if (ctrl->GetSafeHwnd()) {
! 		CRect origRect(13,119,13+40,119+8);
  		prnt->MapDialogRect(&origRect);
  		ClientToScreen(&origRect);
--- 72,76 ----
  	ctrl = prnt->GetDlgItem(IDC_STATIC_BGCOLOR);
  	if (ctrl->GetSafeHwnd()) {
! 		CRect origRect(13,119+16,13+40,119+8+16);
  		prnt->MapDialogRect(&origRect);
  		ClientToScreen(&origRect);
***************
*** 80,84 ****
  	ctrl = prnt->GetDlgItem(IDC_STATIC_FONT);
  	if (ctrl->GetSafeHwnd()) {
! 		CRect origRect(13,138,13+17,138+8);
  		prnt->MapDialogRect(&origRect);
  		ClientToScreen(&origRect);
--- 81,85 ----
  	ctrl = prnt->GetDlgItem(IDC_STATIC_FONT);
  	if (ctrl->GetSafeHwnd()) {
! 		CRect origRect(13,138+16,13+17,138+8+16);
  		prnt->MapDialogRect(&origRect);
  		ClientToScreen(&origRect);
***************
*** 112,118 ****
  	}
  
! 	ctrl = prnt->GetDlgItem(IDC_COMBO_COLOR);
  	if (ctrl->GetSafeHwnd()) {
! 		CRect origRect(58,98,38+135,98+14);
  		CRect origRect2(192,98,200,98+14);
  		prnt->MapDialogRect(&origRect);
--- 113,146 ----
  	}
  
! 	// inheritable checkbox
! 	ctrl = prnt->GetDlgItem(IDC_CHECK1);
  	if (ctrl->GetSafeHwnd()) {
! 		CRect origRect(13,98,13+55,98+14);
! 		//CRect origRect2(192,98,200,98+14);
! 		prnt->MapDialogRect(&origRect);
! 		//prnt->MapDialogRect(&origRect2);
! 		//origRect.right = cx - (origRect2.right - origRect2.left);
! 		ClientToScreen(&origRect);
! 		prnt->ScreenToClient(&origRect);
! 		ctrl->MoveWindow(&origRect);
! 	}
! 
! 	// reDerive 
! 	ctrl = prnt->GetDlgItem(IDC_REDERIVEBUTTON);
! 	if (ctrl->GetSafeHwnd()) {
! 		CRect origRect(13+55+10,98,13+55+10+54,98+14);
! 		//CRect origRect2(192,98,200,98+14);
! 		prnt->MapDialogRect(&origRect);
! 		//prnt->MapDialogRect(&origRect2);
! 		//origRect.right = cx - (origRect2.right - origRect2.left);
! 		ClientToScreen(&origRect);
! 		prnt->ScreenToClient(&origRect);
! 		ctrl->MoveWindow(&origRect);
! 	}
! 
! 	// showHide
! 	ctrl = prnt->GetDlgItem(IDC_SHOWHIDEBUTTON);
! 	if (ctrl->GetSafeHwnd()) {
! 		CRect origRect(13+55+10+54+10,98,13+55+10+54+10+54,98+14);
  		CRect origRect2(192,98,200,98+14);
  		prnt->MapDialogRect(&origRect);
***************
*** 124,131 ****
  	}
  
  	ctrl = prnt->GetDlgItem(IDC_COMBO_BGCOLOR);
  	if (ctrl->GetSafeHwnd()) {
! 		CRect origRect(58,116,38+135,116+14);
! 		CRect origRect2(192,116,200,116+14);
  		prnt->MapDialogRect(&origRect);
  		prnt->MapDialogRect(&origRect2);
--- 152,171 ----
  	}
  
+ 	ctrl = prnt->GetDlgItem(IDC_COMBO_COLOR);
+ 	if (ctrl->GetSafeHwnd()) {
+ 		CRect origRect(58,98+16,38+135,98+14+16);
+ 		CRect origRect2(192,98+16,200,98+14+16);
+ 		prnt->MapDialogRect(&origRect);
+ 		prnt->MapDialogRect(&origRect2);
+ 		origRect.right = cx - (origRect2.right - origRect2.left);
+ 		ClientToScreen(&origRect);
+ 		prnt->ScreenToClient(&origRect);
+ 		ctrl->MoveWindow(&origRect);
+ 	}
+ 
  	ctrl = prnt->GetDlgItem(IDC_COMBO_BGCOLOR);
  	if (ctrl->GetSafeHwnd()) {
! 		CRect origRect(58,116+16,38+135,116+14+16);
! 		CRect origRect2(192,116+16,200,116+14+16);
  		prnt->MapDialogRect(&origRect);
  		prnt->MapDialogRect(&origRect2);
***************
*** 138,143 ****
  	ctrl = prnt->GetDlgItem(IDC_EDIT_FONT);
  	if (ctrl->GetSafeHwnd()) {
! 		CRect origRect(58,135,58+115,135+14);
! 		CRect origRect2(167,135,200,135+14);
  		prnt->MapDialogRect(&origRect);
  		prnt->MapDialogRect(&origRect2);
--- 178,183 ----
  	ctrl = prnt->GetDlgItem(IDC_EDIT_FONT);
  	if (ctrl->GetSafeHwnd()) {
! 		CRect origRect(58,135+16,58+115,135+14+16);
! 		CRect origRect2(167,135+16,200,135+14+16);
  		prnt->MapDialogRect(&origRect);
  		prnt->MapDialogRect(&origRect2);
***************
*** 150,155 ****
  	ctrl = prnt->GetDlgItem(IDC_BUTTON_FONT);
  	if (ctrl->GetSafeHwnd()) {
! 		CRect origRect(173,135,173+20,135+14);
! 		CRect origRect2(192,135,200,135+14);
  		prnt->MapDialogRect(&origRect);
  		int sx = origRect.right - origRect.left;
--- 190,195 ----
  	ctrl = prnt->GetDlgItem(IDC_BUTTON_FONT);
  	if (ctrl->GetSafeHwnd()) {
! 		CRect origRect(173,135+16,173+20,135+14+16);
! 		CRect origRect2(192,135+16,200,135+14+16);
  		prnt->MapDialogRect(&origRect);
  		int sx = origRect.right - origRect.left;
***************
*** 164,170 ****
  	ctrl = prnt->GetDlgItem(IDC_STATIC_VISIBILITY);
  	if (ctrl->GetSafeHwnd()) {
! 		CRect origRect(3,151,3+190,151+70);
! 		CRect origRect2(197,151,200,151+70);
! 		CRect origRect3(3,234,3+190, 234+3);
  		prnt->MapDialogRect(&origRect);
  		prnt->MapDialogRect(&origRect2);
--- 204,210 ----
  	ctrl = prnt->GetDlgItem(IDC_STATIC_VISIBILITY);
  	if (ctrl->GetSafeHwnd()) {
! 		CRect origRect(3,151+16,3+190,151+70+16);
! 		CRect origRect2(197,151+16,200,151+70+16);
! 		CRect origRect3(3,234+16,3+190, 234+3+16);
  		prnt->MapDialogRect(&origRect);
  		prnt->MapDialogRect(&origRect2);
***************
*** 179,185 ****
  	ctrl = prnt->GetDlgItem(IDC_LIST_ASPECT);
  	if (ctrl->GetSafeHwnd()) {
! 		CRect origRect(7,160,7+120,160+55);
! 		CRect origRect2(130,160,200,160+55);
! 		CRect origRect3(7,215,7+120, 215+7);
  		prnt->MapDialogRect(&origRect);
  		prnt->MapDialogRect(&origRect2);
--- 219,225 ----
  	ctrl = prnt->GetDlgItem(IDC_LIST_ASPECT);
  	if (ctrl->GetSafeHwnd()) {
! 		CRect origRect(7,160+16,7+120,160+55+16);
! 		CRect origRect2(130,160+16,200,160+55+16);
! 		CRect origRect3(7,215+16,7+120, 215+7+16);
  		prnt->MapDialogRect(&origRect);
  		prnt->MapDialogRect(&origRect2);
***************
*** 194,199 ****
  	ctrl = prnt->GetDlgItem(IDC_STATIC_XCOORD);
  	if (ctrl->GetSafeHwnd()) {
! 		CRect origRect(141,168,141+8,168+8);
! 		CRect origRect2(148,168,200,168+8);
  		prnt->MapDialogRect(&origRect);
  		int sx = origRect.right - origRect.left;
--- 234,239 ----
  	ctrl = prnt->GetDlgItem(IDC_STATIC_XCOORD);
  	if (ctrl->GetSafeHwnd()) {
! 		CRect origRect(141,168+16,141+8,168+8+16);
! 		CRect origRect2(148,168+16,200,168+8+16);
  		prnt->MapDialogRect(&origRect);
  		int sx = origRect.right - origRect.left;
***************
*** 208,213 ****
  	ctrl = prnt->GetDlgItem(IDC_STATIC_YCOORD);
  	if (ctrl->GetSafeHwnd()) {
! 		CRect origRect(141,190,141+8,190+8);
! 		CRect origRect2(148,190,200,190+8);
  		prnt->MapDialogRect(&origRect);
  		int sx = origRect.right - origRect.left;
--- 248,253 ----
  	ctrl = prnt->GetDlgItem(IDC_STATIC_YCOORD);
  	if (ctrl->GetSafeHwnd()) {
! 		CRect origRect(141,190+16,141+8,190+8+16);
! 		CRect origRect2(148,190+16,200,190+8+16);
  		prnt->MapDialogRect(&origRect);
  		int sx = origRect.right - origRect.left;
***************
*** 222,227 ****
  	ctrl = prnt->GetDlgItem(IDC_EDIT_XCOORD);
  	if (ctrl->GetSafeHwnd()) {
! 		CRect origRect(151,164,151+40,164+14);
! 		CRect origRect2(190,164,200,164+14);
  		prnt->MapDialogRect(&origRect);
  		int sx = origRect.right - origRect.left;
--- 262,267 ----
  	ctrl = prnt->GetDlgItem(IDC_EDIT_XCOORD);
  	if (ctrl->GetSafeHwnd()) {
! 		CRect origRect(151,164+16,151+40,164+14+16);
! 		CRect origRect2(190,164+16,200,164+14+16);
  		prnt->MapDialogRect(&origRect);
  		int sx = origRect.right - origRect.left;
***************
*** 236,241 ****
  	ctrl = prnt->GetDlgItem(IDC_EDIT_YCOORD);
  	if (ctrl->GetSafeHwnd()) {
! 		CRect origRect(151,185,151+40,185+14);
! 		CRect origRect2(190,185,200,185+14);
  		prnt->MapDialogRect(&origRect);
  		int sx = origRect.right - origRect.left;
--- 276,281 ----
  	ctrl = prnt->GetDlgItem(IDC_EDIT_YCOORD);
  	if (ctrl->GetSafeHwnd()) {
! 		CRect origRect(151,185+16,151+40,185+14+16);
! 		CRect origRect2(190,185+16,200,185+14+16);
  		prnt->MapDialogRect(&origRect);
  		int sx = origRect.right - origRect.left;
***************
*** 250,255 ****
  	ctrl = prnt->GetDlgItem(IDC_CHECK_DEFPOS);
  	if (ctrl->GetSafeHwnd()) {
! 		CRect origRect(141,205,141+53,205+10);
! 		CRect origRect2(193,205,200,205+10);
  		prnt->MapDialogRect(&origRect);
  		int sx = origRect.right - origRect.left;
--- 290,295 ----
  	ctrl = prnt->GetDlgItem(IDC_CHECK_DEFPOS);
  	if (ctrl->GetSafeHwnd()) {
! 		CRect origRect(141,205+16,141+53,205+10+16);
! 		CRect origRect2(193,205+16,200,205+10+16);
  		prnt->MapDialogRect(&origRect);
  		int sx = origRect.right - origRect.left;

Index: MgaUtil.vcproj
===================================================================
RCS file: /project/gme-repository/GMESRC/GME/MgaUtil/MgaUtil.vcproj,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** MgaUtil.vcproj	26 Jan 2005 17:30:53 -0000	1.1
--- MgaUtil.vcproj	6 Jul 2005 22:11:29 -0000	1.2
***************
*** 1251,1254 ****
--- 1251,1257 ----
  	</Files>
  	<Globals>
+ 		<Global
+ 			Name="RESOURCE_FILE"
+ 			Value="MgaUtil.rc"/>
  	</Globals>
  </VisualStudioProject>

Index: AnnotationBrowserDlg.h
===================================================================
RCS file: /project/gme-repository/GMESRC/GME/MgaUtil/AnnotationBrowserDlg.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** AnnotationBrowserDlg.h	21 Nov 2001 01:57:00 -0000	1.2
--- AnnotationBrowserDlg.h	6 Jul 2005 22:11:29 -0000	1.3
***************
*** 82,85 ****
--- 82,92 ----
  	//}}AFX_MSG
  	DECLARE_MESSAGE_MAP()
+ 
+ public:
+ 	CButton m_inheritable;
+ 	CButton m_showHideBtn;
+ 	CButton m_rederiveBtn;
+ 	afx_msg void OnBnClickedShowhidebutton();
+ 	afx_msg void OnBnClickedRederivebutton();
  };
  

Index: AnnotationNode.h
===================================================================
RCS file: /project/gme-repository/GMESRC/GME/MgaUtil/AnnotationNode.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** AnnotationNode.h	21 Nov 2001 01:57:00 -0000	1.2
--- AnnotationNode.h	6 Jul 2005 22:11:29 -0000	1.3
***************
*** 37,40 ****
--- 37,47 ----
  	CString m_text;
  	CString m_name;
+ 	bool m_virtual;         // if status of the main regnode is 'inherited'
+ 	bool m_canBeRederived;  // the "broken_deriv" entry signals that 
+ 	                        // the annotation was once inherited, 
+ 	                        // so it could be rederived
+ 	
+ 	bool m_inheritable;     // can be shown in subtypes/instances
+ 	bool m_hidden;          // hide inherited annotation in this subtype/instance only
  	CAnnotationAspectArray	m_aspects;
  
***************
*** 50,53 ****
--- 57,63 ----
  	static void InitializeClass();
  	static bool classIsInitialized;
+ 	static bool     defCanBeRederived;
+ 	static bool     defInheritable;
+ 	static bool     defHidden;
  	static LOGFONT	defFont;
  	static COLORREF	defColor;

Index: AnnotationNode.cpp
===================================================================
RCS file: /project/gme-repository/GMESRC/GME/MgaUtil/AnnotationNode.cpp,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** AnnotationNode.cpp	30 Sep 2003 13:28:16 -0000	1.4
--- AnnotationNode.cpp	6 Jul 2005 22:11:29 -0000	1.5
***************
*** 23,26 ****
--- 23,29 ----
  COLORREF CAnnotationNode::defBgcolor;
  bool CAnnotationNode::classIsInitialized = false;
+ bool CAnnotationNode::defInheritable     = false;
+ bool CAnnotationNode::defHidden          = false;
+ bool CAnnotationNode::defCanBeRederived  = false;
  
  CAnnotationNode::CAnnotationNode(const CComPtr<IMgaRegNode> &regNode)
***************
*** 34,37 ****
--- 37,71 ----
  void CAnnotationNode::Read(CAnnotationBrowserDlg *dlg)
  {
+ 	// virtual: if status of m_regNode is 'inherited'
+ 	try {
+ 		m_virtual = false;
+ 		long st;
+ 		COMTHROW( m_regNode->get_Status( &st));
+ 		if( st > ATTSTATUS_HERE) // -1: meta, 0: here, >=1: inherited
+ 			m_virtual = true;
+ 	} 
+ 	catch (hresult_exception &) {
+ 		ASSERT(("Error while reading annotation from registry.", false));
+ 		m_virtual = false;
+ 	}
+ 
+ 	// it can be rederived if 'broken deriv' entry present with '1'
+ 	try {
+ 		m_canBeRederived = defCanBeRederived;
+ 		CComBSTR bstr;
+ 		CComPtr<IMgaRegNode> lfNode;
+ 		CComBSTR lfName(AN_BROKEN_DERIV);
+ 		COMTHROW(m_regNode->get_SubNodeByName(lfName, &lfNode));
+ 		if (lfNode != NULL) {
+ 			COMTHROW(lfNode->get_Value(&bstr));
+ 			if( bstr == "1")
+ 				m_canBeRederived = true;
+ 		}
+ 	} 
+ 	catch (hresult_exception &) {
+ 		m_canBeRederived = defCanBeRederived;
+ 	}
+ 
+ 
  	// Annotation name
  	try {
***************
*** 57,60 ****
--- 91,128 ----
  	}
  
+ 	// 'Inheritable'
+ 	try {
+ 		m_inheritable = defInheritable;
+ 		CComBSTR bstr;
+ 		CComPtr<IMgaRegNode> lfNode;
+ 		CComBSTR lfName(AN_INHERITABLE);
+ 		COMTHROW(m_regNode->get_SubNodeByName(lfName, &lfNode));
+ 		if (lfNode != NULL) {
+ 			COMTHROW(lfNode->get_Value(&bstr));
+ 			if( bstr == "1")
+ 				m_inheritable = true;
+ 		}
+ 	} 
+ 	catch (hresult_exception &) {
+ 		m_inheritable = defInheritable;
+ 	}
+ 
+ 	// 'Hidden'
+ 	try {
+ 		m_hidden = defHidden;
+ 		CComBSTR bstr;
+ 		CComPtr<IMgaRegNode> lfNode;
+ 		CComBSTR lfName(AN_HIDDEN);
+ 		COMTHROW(m_regNode->get_SubNodeByName(lfName, &lfNode));
+ 		if (lfNode != NULL) {
+ 			COMTHROW(lfNode->get_Value(&bstr));
+ 			if( bstr == "1")
+ 				m_hidden = true;
+ 		}
+ 	} 
+ 	catch (hresult_exception &) {
+ 		m_hidden = defHidden;
+ 	}
+ 
  	// Font
  	try {
***************
*** 184,192 ****
  void CAnnotationNode::Write(CAnnotationBrowserDlg *dlg)
  {
  	// Drop previous node, start new one
  	try {
  		CComPtr<IMgaRegNode> parentNode;
  		COMTHROW(m_regNode->get_ParentNode(&parentNode));
! 		COMTHROW(m_regNode->RemoveTree());
  
  		bool collision = true;
--- 252,280 ----
  void CAnnotationNode::Write(CAnnotationBrowserDlg *dlg)
  {
+ 	// it will notify if we just broke an annotation inheritance relationship (if text in the derived becomes different than the base's text)
+ 	bool broken_inheritance = false;
+ 
  	// Drop previous node, start new one
  	try {
  		CComPtr<IMgaRegNode> parentNode;
  		COMTHROW(m_regNode->get_ParentNode(&parentNode));
! 
! 		// get the old text, used later to check if subtypes/instances break the derivation chain of the annotation
! 		CComBSTR bstr1;
! 		COMTHROW(m_regNode->get_Value(&bstr1));
! 		CString old_m_text = bstr1;
! 		old_m_text.Replace("\n", "\r\n");
! 
! 		if(!m_virtual) COMTHROW(m_regNode->RemoveTree()); // remove the old node if it was HERE, because we will write a new node there
! 		else // virtual node: still inherited
! 		{ 
! 			// keep the derivation chain if the text has not been changed
! 			if( old_m_text == m_text)
! 				return;
! 			else// This value will only signal that the chain is broken.
! 				// By writing under the same node into a subtype's registry
! 				// we can hide the inherited value with a HERE value.
! 				broken_inheritance = true;
! 		}
  
  		bool collision = true;
***************
*** 201,205 ****
  			}
  			else {
! 				m_name += _T("Copy");
  			}
  		}
--- 289,299 ----
  			}
  			else {
! 				if(broken_inheritance // if we broke right now the inheritance
! 				 || m_canBeRederived) // or it was broken in the past
! 					collision = false;// don't signal a 'collision' since we
! 				                      // have to hide the old (i)nherited value
! 				                      // with a (h)ere value
! 				else
! 					m_name += _T("Copy");
  			}
  		}
***************
*** 219,222 ****
--- 313,361 ----
  	catch (hresult_exception &) {
  		ASSERT(("Error while writing annotation to registry.", false));
+ 	}
+ 
+ 	// Store 'broken derivation' preference (if text has been altered in the subtyped object's annotation)
+ 	// either broken in the past (canBeRederived) or broken right now(broken_inh)
+ 	if( m_canBeRederived || broken_inheritance) {
+ 		try {
+ 			CComBSTR bstr("1");
+ 			CComPtr<IMgaRegNode> lfNode;
+ 			CComBSTR lfName(AN_BROKEN_DERIV);
+ 			COMTHROW(m_regNode->get_SubNodeByName(lfName, &lfNode));
+ 			COMTHROW(lfNode->put_Value(bstr));
+ 		}
+ 		catch (hresult_exception &) {
+ 			ASSERT(("Error while writing annotation to registry.", false));
+ 		}
+ 	}
+ 
+ 	// Store 'inheritable' preference
+ 	{
+ 		try {
+ 			CString str(m_inheritable?"1":"0");
+ 			CComBSTR bstr(str);
+ 			CComPtr<IMgaRegNode> lfNode;
+ 			CComBSTR lfName(AN_INHERITABLE);
+ 			COMTHROW(m_regNode->get_SubNodeByName(lfName, &lfNode));
+ 			COMTHROW(lfNode->put_Value(bstr));
+ 		}
+ 		catch (hresult_exception &) {
+ 			ASSERT(("Error while writing annotation to registry.", false));
+ 		}
+ 	}
+ 
+ 	// Store 'hidden' preference
+ 	{
+ 		try {
+ 			CString str(m_hidden?"1":"0");
+ 			CComBSTR bstr(str);
+ 			CComPtr<IMgaRegNode> lfNode;
+ 			CComBSTR lfName(AN_HIDDEN);
+ 			COMTHROW(m_regNode->get_SubNodeByName(lfName, &lfNode));
+ 			COMTHROW(lfNode->put_Value(bstr));
+ 		}
+ 		catch (hresult_exception &) {
+ 			ASSERT(("Error while writing annotation to registry.", false));
+ 		}
  	}
  

Index: AnnotationBrowserDlg.cpp
===================================================================
RCS file: /project/gme-repository/GMESRC/GME/MgaUtil/AnnotationBrowserDlg.cpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** AnnotationBrowserDlg.cpp	13 Oct 2004 15:17:55 -0000	1.3
--- AnnotationBrowserDlg.cpp	6 Jul 2005 22:11:29 -0000	1.4
***************
*** 6,9 ****
--- 6,10 ----
  #include "AnnotationBrowserDlg.h"
  #include "..\Annotator\AnnotationDefs.h"
+ #include "resource.h"
  
  #ifdef _DEBUG
***************
*** 13,16 ****
--- 14,19 ----
  #endif
  
+ const char * show_str = "Show";
+ const char * hide_str = "Hide";
  /////////////////////////////////////////////////////////////////////////////
  // CAnnotationBrowserDlg dialog
***************
*** 61,64 ****
--- 64,70 ----
  	DDX_Text(pDX, IDC_EDIT_YCOORD, m_aaYCoord);
  	//}}AFX_DATA_MAP
+ 	DDX_Control(pDX, IDC_CHECK1, m_inheritable);
+ 	DDX_Control(pDX, IDC_SHOWHIDEBUTTON, m_showHideBtn);
+ 	DDX_Control(pDX, IDC_REDERIVEBUTTON, m_rederiveBtn);
  }
  
***************
*** 72,75 ****
--- 78,83 ----
  	ON_BN_CLICKED(IDC_CHECK_DEFPOS, OnCheckDefpos)
  	//}}AFX_MSG_MAP
+ 	ON_BN_CLICKED(IDC_SHOWHIDEBUTTON, OnBnClickedShowhidebutton)
+ 	ON_BN_CLICKED(IDC_REDERIVEBUTTON, OnBnClickedRederivebutton)
  END_MESSAGE_MAP()
  
***************
*** 274,278 ****
  		COMTHROW(m_model->get_RegistryNode(annRootName, &annRootNode));
  		CComPtr<IMgaRegNodes> subNodes;
! 		COMTHROW(annRootNode->get_SubNodes(VARIANT_FALSE, &subNodes));
  		MGACOLL_ITERATE(IMgaRegNode, subNodes) {
  			CComPtr<IMgaRegNode> subNode;
--- 282,286 ----
  		COMTHROW(m_model->get_RegistryNode(annRootName, &annRootNode));
  		CComPtr<IMgaRegNodes> subNodes;
! 		COMTHROW(annRootNode->get_SubNodes(VARIANT_TRUE, &subNodes));//get all nodes (inheriteds also)
  		MGACOLL_ITERATE(IMgaRegNode, subNodes) {
  			CComPtr<IMgaRegNode> subNode;
***************
*** 327,330 ****
--- 335,347 ----
  	node->m_name = m_anName;
  	node->m_text = m_anText;
+ 
+ 	// set inheritable if checkbutton is checked
+ 	node->m_inheritable  = (m_inheritable.GetCheck() == BST_CHECKED);
+ 
+ 	// set hidden attr iff window text is 'show'
+ 	CString tx;
+ 	m_showHideBtn.GetWindowText( tx);
+ 	node->m_hidden = tx == show_str;
+ 
  	memcpy(&(node->m_logfont), &m_anLogFont, sizeof(LOGFONT));
  	node->m_color = m_colorbtn.currentcolor;
***************
*** 364,367 ****
--- 381,395 ----
  	m_anName = node->m_name;
  	m_anText = node->m_text;
+ 
+ 	// inheritable checkbox
+ 	m_inheritable.SetCheck( node->m_inheritable? BST_CHECKED:BST_UNCHECKED );
+ 	
+ 	// rederive btn
+ 	m_rederiveBtn.EnableWindow(node->m_canBeRederived || node->m_virtual);
+ 	
+ 	// show/hide btn
+ 	m_showHideBtn.SetWindowText(node->m_hidden?show_str:hide_str);
+ 	m_showHideBtn.EnableWindow(node->m_canBeRederived || node->m_virtual);// show only in case of subtype/instance
+ 
  	memcpy(&m_anLogFont, &(node->m_logfont), sizeof(LOGFONT));
  	m_colorbtn.currentcolor = node->m_color;
***************
*** 438,440 ****
--- 466,494 ----
  	GetDlgItem(IDC_EDIT_XCOORD)->EnableWindow(check->GetCheck() > 0 ? FALSE : TRUE);
  	GetDlgItem(IDC_EDIT_YCOORD)->EnableWindow(check->GetCheck() > 0 ? FALSE : TRUE);		
+ }
+ 
+ void CAnnotationBrowserDlg::OnBnClickedShowhidebutton()
+ {
+ 	// swap 'show' and 'hide'
+ 	CString tx;
+ 	m_showHideBtn.GetWindowText( tx);
+ 	m_showHideBtn.SetWindowText( tx == show_str?hide_str:show_str);
+ }
+ 
+ void CAnnotationBrowserDlg::OnBnClickedRederivebutton()
+ {
+ 	POSITION pos = m_wndAnnotationList.GetFirstSelectedItemPosition();
+ 	if (pos) {
+ 		// the actually selected item
+ 		int nItem = m_wndAnnotationList.GetNextSelectedItem(pos);
+ 		CAnnotationNode *node = (CAnnotationNode *)m_wndAnnotationList.GetItemData(nItem);
+ 		
+ 		// rederive by clearing the node contents
+ 		if(node && !node->m_virtual) COMTHROW(node->m_regNode->RemoveTree());
+ 		
+ 		// read back the values from node->regNode, this time (i)nherited values are read
+ 		node->Read( this);
+ 		
+ 		LoadNodeToPanel(node);
+ 	}
  }

Index: resource.h
===================================================================
RCS file: /project/gme-repository/GMESRC/GME/MgaUtil/resource.h,v
retrieving revision 1.28
retrieving revision 1.29
diff -C2 -d -r1.28 -r1.29
*** resource.h	21 Jun 2005 19:40:38 -0000	1.28
--- resource.h	6 Jul 2005 22:11:29 -0000	1.29
***************
*** 193,196 ****
--- 193,198 ----
  #define IDC_LABELAVOIDANCE              2258
  #define IDC_INVERT                      2259
+ #define IDC_SHOWHIDEBUTTON              2260
+ #define IDC_REDERIVEBUTTON              2261
  #define ID_CNTX_ADDNODE                 32774
  #define ID_CNTX_CLEARNODE               32775
***************
*** 204,208 ****
  #define _APS_NEXT_RESOURCE_VALUE        2070
  #define _APS_NEXT_COMMAND_VALUE         32778
! #define _APS_NEXT_CONTROL_VALUE         2260
  #define _APS_NEXT_SYMED_VALUE           2091
  #endif
--- 206,210 ----
  #define _APS_NEXT_RESOURCE_VALUE        2070
  #define _APS_NEXT_COMMAND_VALUE         32778
! #define _APS_NEXT_CONTROL_VALUE         2262
  #define _APS_NEXT_SYMED_VALUE           2091
  #endif



More information about the GME-commit mailing list