[GME-commit] GMESRC/GME/ObjectInspector Attribute.cpp,1.13,1.14 Attribute.h,1.4,1.5 ObjectInspectorCtl.cpp,1.33,1.34

gme-commit at list.isis.vanderbilt.edu gme-commit at list.isis.vanderbilt.edu
Mon Jul 19 11:23:01 CDT 2004


Update of /var/lib/gme/GMESRC/GME/ObjectInspector
In directory braindrain:/tmp/cvs-serv3811/GME/ObjectInspector

Modified Files:
	Attribute.cpp Attribute.h ObjectInspectorCtl.cpp 
Log Message:
Enhanced handling of project properties

CVS User: volgy

Index: Attribute.cpp
===================================================================
RCS file: /var/lib/gme/GMESRC/GME/ObjectInspector/Attribute.cpp,v
retrieving revision 1.13
retrieving revision 1.14
diff -C2 -d -r1.13 -r1.14
*** Attribute.cpp	2 Mar 2004 21:51:28 -0000	1.13
--- Attribute.cpp	19 Jul 2004 15:22:59 -0000	1.14
***************
*** 15,18 ****
--- 15,24 ----
  #endif
  
+ enum project_attributes {PROJECT_AUTHOR, PROJECT_VERSION, PROJECT_COMMENT};
+ TCHAR *project_attribute_tooltips[] = {
+ 	_T("Author(s) of the project"),
+ 	_T("Current version string"),
+ 	_T("Arbitrary comments"),
+ };
  // Split Function
  inline void str_split( CString str, CStringArray &returnArray)
***************
*** 145,148 ****
--- 151,230 ----
  }
  
+ // Must be in transaction
+ void CAttribute::CreateList(CComPtr<IMgaProject> ccpProject, CArray<CListItem,CListItem&> &ListItemArray)
+ {
+ 	m_MetaAttributePtrList.RemoveAll();
+ 	ListItemArray.RemoveAll();
+ 
+ 	if(ccpProject == NULL) return;
+ 
+ 
+ 	{
+ 		CListItem ListItem;
+ 
+ 		ListItem.strName = "Author";
+ 		ListItem.dwKeyValue = PROJECT_AUTHOR;
+ 		ListItem.bIsDefault = false;
+ 		ListItem.bIsDifferentValue = false;
+ 		ListItem.strToolTip = project_attribute_tooltips[PROJECT_AUTHOR];
+ 
+ 		CComBSTR bstr;
+ 		COMTHROW(ccpProject->get_Author(&bstr));
+ 		CString strValue(bstr);
+ 		ListItem.Value.SetStringValue(strValue);
+ 
+ 		ListItem.DefValue.SetStringValue("");
+ 		
+ 		ListItemArray.Add(ListItem);
+ 	}
+ 
+ 	{
+ 		CListItem ListItem;
+ 
+ 		ListItem.strName = "Version";
+ 		ListItem.dwKeyValue = PROJECT_VERSION;
+ 		ListItem.bIsDefault = false;
+ 		ListItem.bIsDifferentValue = false;
+ 		ListItem.strToolTip = project_attribute_tooltips[PROJECT_VERSION];
+ 
+ 		CComBSTR bstr;
+ 		COMTHROW(ccpProject->get_Version(&bstr));
+ 		CString strValue(bstr);
+ 		ListItem.Value.SetStringValue(strValue);
+ 
+ 		ListItem.DefValue.SetStringValue("1.0");
+ 		
+ 		ListItemArray.Add(ListItem);
+ 	}
+ 
+ 	{
+ 		CListItem ListItem;
+ 
+ 		ListItem.strName = "Comment";
+ 		ListItem.dwKeyValue = PROJECT_COMMENT;
+ 		ListItem.bIsDefault = false;
+ 		ListItem.bIsDifferentValue = false;
+ 		ListItem.strToolTip = project_attribute_tooltips[PROJECT_COMMENT];
+ 
+ 		// Setting value
+ 		CComBSTR bstr;
+ 		COMTHROW(ccpProject->get_Comment(&bstr));
+ 		CString strValue(bstr);
+ 		CStringArray strValueArray;
+ 		str_split(strValue, strValueArray);
+ 		ListItem.Value.SetStringValue(strValueArray,6);
+ 
+ 		// Setting default value
+ 		CString strDefValue = "";
+ 		CStringArray strDefValueArray;
+ 		strDefValueArray.Add(strDefValue);
+ 		ListItem.DefValue.SetStringValue(strDefValueArray,6);
+ 		
+ 		ListItemArray.Add(ListItem);
+ 	}
+ 
+ 
+ }
+ 
  bool CAttribute::CreateListItem(CListItem &ListItem, const CComVariant &ccvtValue, bool bIsDirty, bool bIsDefault, DWORD dwKey)
  {
***************
*** 401,403 ****
--- 483,507 ----
  		}
  	}	
+ }
+ 
+ void CAttribute::WriteItemToMga(CListItem ListItem, CComPtr<IMgaProject> ccpProject)
+ {
+ 	CString strValue;
+ 	ListItem.Value.toString(strValue);
+ 	strValue.Replace("\r\n","\n");
+ 	CComBSTR bstrValue(strValue);
+ 
+ 	switch (ListItem.dwKeyValue) {
+ 	case PROJECT_AUTHOR:
+ 		COMTHROW(ccpProject->put_Author(bstrValue));
+ 		break;
+ 	case PROJECT_VERSION:
+ 		COMTHROW(ccpProject->put_Version(bstrValue));
+ 		break;
+ 	case PROJECT_COMMENT:
+ 		COMTHROW(ccpProject->put_Comment(bstrValue));
+ 		break;
+ 	default:
+ 		break;
+ 	}
  }

Index: Attribute.h
===================================================================
RCS file: /var/lib/gme/GMESRC/GME/ObjectInspector/Attribute.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** Attribute.h	27 May 2002 04:44:00 -0000	1.4
--- Attribute.h	19 Jul 2004 15:22:59 -0000	1.5
***************
*** 22,26 ****
--- 22,28 ----
  	virtual ~CAttribute();
  	void CreateList(const CMgaFCOPtrList& MgaFCOPtrList,CArray<CListItem,CListItem&> &ListItemArray);
+ 	void CreateList(CComPtr<IMgaProject> ccpProject, CArray<CListItem,CListItem&> &ListItemArray);
  	void WriteItemToMga(CListItem ListItem,const CMgaFCOPtrList& MgaFCOPtrList);
+ 	void WriteItemToMga(CListItem ListItem, CComPtr<IMgaProject> ccpProject);
  	
  private:

Index: ObjectInspectorCtl.cpp
===================================================================
RCS file: /var/lib/gme/GMESRC/GME/ObjectInspector/ObjectInspectorCtl.cpp,v
retrieving revision 1.33
retrieving revision 1.34
diff -C2 -d -r1.33 -r1.34
*** ObjectInspectorCtl.cpp	7 Jan 2004 15:05:18 -0000	1.33
--- ObjectInspectorCtl.cpp	19 Jul 2004 15:22:59 -0000	1.34
***************
*** 526,535 ****
  	
  	if(!m_FolderList.IsEmpty())
! 	{		
! 		CMgaFCOPtrList EmptyFCOList;
! 		EmptyFCOList.RemoveAll();
! 		
! 		m_inspectorDlg.ShowPanel(INSP_ATTR_PANEL,false);	
! 		m_Attribute.CreateList(EmptyFCOList,ListItemArray);
  	}
  	else
--- 526,547 ----
  	
  	if(!m_FolderList.IsEmpty())
! 	{	
! 		CComPtr<IMgaFolder> ccpMgaFolder = m_FolderList.GetHead();
! 		objtype_enum oeType;
! 		CComPtr<IMgaObject> ccpParent;
! 		COMTHROW(ccpMgaFolder->GetParent(&ccpParent,&oeType));
! 
! 		if ((nCount == 0) && (m_FolderList.GetCount() == 1) || (ccpParent == NULL)) {
! 			// Root Folder - Show project attributes
! 			m_inspectorDlg.ShowPanel(INSP_ATTR_PANEL,true);
! 			m_Attribute.CreateList(m_project, ListItemArray);
! 		}
! 		else {
! 			CMgaFCOPtrList EmptyFCOList;
! 			EmptyFCOList.RemoveAll();
! 			
! 			m_inspectorDlg.ShowPanel(INSP_ATTR_PANEL,false);	
! 			m_Attribute.CreateList(EmptyFCOList,ListItemArray);
! 		}
  	}
  	else
***************
*** 819,823 ****
  
  		// Writing change to MGA
! 		m_Attribute.WriteItemToMga(ListItem,m_FCOList);
  
  		if(!bInTransaction)
--- 831,840 ----
  
  		// Writing change to MGA
! 		if (m_FCOList.IsEmpty()) {
! 			m_Attribute.WriteItemToMga(ListItem,m_project);
! 		}
! 		else {
! 			m_Attribute.WriteItemToMga(ListItem,m_FCOList);
! 		}
  
  		if(!bInTransaction)



More information about the GME-commit mailing list