[GME-commit] GMESRC/Paradigms/MetaGME/MetaInterpreter2004/Asp AspectPage.cpp,1.2,1.3 AspectPage.h,1.3,1.4 AspectSpecDlg.cpp,1.7,1.8 AspectSpecDlg.h,1.3,1.4 AspectSpecTbl.cpp,1.3,1.4 NameSpecTbl.cpp,1.2,1.3

gme-commit at list.isis.vanderbilt.edu gme-commit at list.isis.vanderbilt.edu
Wed Sep 15 15:48:36 CDT 2004


Update of /var/lib/gme/GMESRC/Paradigms/MetaGME/MetaInterpreter2004/Asp
In directory braindrain:/tmp/cvs-serv8659/Asp

Modified Files:
	AspectPage.cpp AspectPage.h AspectSpecDlg.cpp AspectSpecDlg.h 
	AspectSpecTbl.cpp NameSpecTbl.cpp 
Log Message:
Improved aspect mapping dialog box. Bugs fixed.
In case when the aspect tabs are occupying to much space ( the number of tabs > 19) it is switched to scrolling tabs mode.


CVS User: zolmol

Index: AspectPage.cpp
===================================================================
RCS file: /var/lib/gme/GMESRC/Paradigms/MetaGME/MetaInterpreter2004/Asp/AspectPage.cpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** AspectPage.cpp	8 Mar 2004 22:22:59 -0000	1.2
--- AspectPage.cpp	15 Sep 2004 19:48:34 -0000	1.3
***************
*** 19,23 ****
  //IMPLEMENT_DYNCREATE(CAspectPage, CPropertyPage)
  
! CAspectPage::CAspectPage() : CPropertyPage(IDD_ASPECT_PAGE)
  {
  	//{{AFX_DATA_INIT(CAspectPage)
--- 19,28 ----
  //IMPLEMENT_DYNCREATE(CAspectPage, CPropertyPage)
  
! int CAspectPage::m_actHeight = 0;//static 
! int CAspectPage::m_actWidth = 0; //static
! 
! CAspectPage::CAspectPage() 
! 	: CPropertyPage(IDD_ASPECT_PAGE)
! 	, m_deflateVal(10)
  {
  	//{{AFX_DATA_INIT(CAspectPage)
***************
*** 34,37 ****
--- 39,44 ----
  	}
  	entries.RemoveAll();
+ 
+ 	m_actWidth = m_actHeight = 0;// reset the values
  }
  
***************
*** 46,49 ****
--- 53,57 ----
  
  BEGIN_MESSAGE_MAP(CAspectPage, CPropertyPage)
+ 	ON_WM_SIZE()
  	//{{AFX_MSG_MAP(CAspectPage)
  	//}}AFX_MSG_MAP
***************
*** 64,74 ****
  {
  	CPropertyPage::OnInitDialog();
! 	
  	// TODO: Add extra initialization here
  
  	CRect loc;
! 	this->GetClientRect(&loc);
! 	loc.DeflateRect(10, 10);
! 	aspectTable.Create(WS_CHILD|WS_VISIBLE|WS_BORDER/*|LVS_EDITLABELS*/|LVS_REPORT|LVS_SINGLESEL, loc, this, 1);
  	POSITION pos = entries.GetHeadPosition();
  	while (pos) {
--- 72,82 ----
  {
  	CPropertyPage::OnInitDialog();
! 
  	// TODO: Add extra initialization here
  
  	CRect loc;
! 	calcPlace( loc);
! 
! 	aspectTable.Create(WS_CHILD|WS_VISIBLE|WS_BORDER|LVS_REPORT|LVS_SINGLESEL|LVS_NOSORTHEADER, loc, this, 1);
  	POSITION pos = entries.GetHeadPosition();
  	while (pos) {
***************
*** 125,126 ****
--- 133,173 ----
  	CPropertyPage::OnOK();
  }
+ 
+ void CAspectPage::OnSize( UINT ntype, int cx, int cy)
+ {
+ 	// this methods captures the size of the remaining area
+ 	// after the stacking tabs have been drawn, so that 
+ 	// the initial page needs to be resized accordingly
+ 	//
+ 	// this method is called several times, first is called
+ 	// with larger cy values (close to the total size of the window)
+ 	// but after the tabs were drawn the it is called with a smaller
+ 	// cy value
+ 
+ 	CPropertyPage::OnSize( ntype, cx, cy);
+ 	if ( m_actHeight == 0) m_actHeight = cy;
+ 	
+ 	m_actHeight = cy<m_actHeight?cy:m_actHeight;//minimum
+ 	m_actWidth = cx;
+ 
+ }
+ 
+ void CAspectPage::calcPlace( CRect &loc)
+ {
+ 	//this->GetClientRect(&loc);
+ 	loc.left = loc.top = 0;
+ 	loc.bottom = m_actHeight;
+ 	loc.right = m_actWidth;
+ 
+ 	loc.DeflateRect( m_deflateVal, m_deflateVal);
+ }
+ 
+ void CAspectPage::resizeTableToFitIn()
+ {
+ 	CRect loc;
+ 	calcPlace( loc);
+ 	aspectTable.SetWindowPos( 0, loc.left, loc.top, // ignored values
+ 		loc.right - loc.left, loc.bottom - loc.top,
+ 		SWP_SHOWWINDOW|SWP_NOZORDER|SWP_NOMOVE);
+ }
+ 

Index: AspectPage.h
===================================================================
RCS file: /var/lib/gme/GMESRC/Paradigms/MetaGME/MetaInterpreter2004/Asp/AspectPage.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** AspectPage.h	8 Mar 2004 22:22:59 -0000	1.3
--- AspectPage.h	15 Sep 2004 19:48:34 -0000	1.4
***************
*** 41,44 ****
--- 41,49 ----
  	CAspectPage() ;
  	~CAspectPage();
+ 	static int m_actHeight; // the height of the user area (since stacking tabs may occupy a huge amount of place)
+ 	static int m_actWidth;	// do not forget to reset to 0 upon destruction
+ 	const int m_deflateVal;
+ 	void resizeTableToFitIn();
+ 	void calcPlace( CRect& loc);
  
  // Dialog Data
***************
*** 62,65 ****
--- 67,72 ----
  	CAspectSpecTbl aspectTable;
  	CString	aspectName;
+ 
+ 	afx_msg void OnSize( UINT, int, int );
  	// Generated message map functions
  	//{{AFX_MSG(CAspectPage)

Index: AspectSpecDlg.cpp
===================================================================
RCS file: /var/lib/gme/GMESRC/Paradigms/MetaGME/MetaInterpreter2004/Asp/AspectSpecDlg.cpp,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** AspectSpecDlg.cpp	30 Jul 2004 00:10:23 -0000	1.7
--- AspectSpecDlg.cpp	15 Sep 2004 19:48:34 -0000	1.8
***************
*** 24,37 ****
  
  CAspectSpecDlg::CAspectSpecDlg(UINT nIDCaption, CWnd* pParentWnd, UINT iSelectPage)
! 	:CPropertySheet(nIDCaption, pParentWnd, iSelectPage)
  {
- 	lastID = 0;
  	m_psh.dwFlags |= PSH_NOAPPLYNOW;
  }
  
  CAspectSpecDlg::CAspectSpecDlg(LPCTSTR pszCaption, CWnd* pParentWnd, UINT iSelectPage)
! 	:CPropertySheet(pszCaption, pParentWnd, iSelectPage)
  {
- 	lastID = 0;
  	m_psh.dwFlags |= PSH_NOAPPLYNOW;
  }
--- 24,39 ----
  
  CAspectSpecDlg::CAspectSpecDlg(UINT nIDCaption, CWnd* pParentWnd, UINT iSelectPage)
! 	: CPropertySheet(nIDCaption, pParentWnd, iSelectPage)
! 	, lastID( 0)
! 	, countPages( 0)
  {
  	m_psh.dwFlags |= PSH_NOAPPLYNOW;
  }
  
  CAspectSpecDlg::CAspectSpecDlg(LPCTSTR pszCaption, CWnd* pParentWnd, UINT iSelectPage)
! 	: CPropertySheet(pszCaption, pParentWnd, iSelectPage)
! 	, lastID( 0)
! 	, countPages( 0)
  {
  	m_psh.dwFlags |= PSH_NOAPPLYNOW;
  }
***************
*** 50,53 ****
--- 52,56 ----
  
  BEGIN_MESSAGE_MAP(CAspectSpecDlg, CPropertySheet)
+ 	ON_WM_CREATE()
  	//{{AFX_MSG_MAP(CAspectSpecDlg)
  		// NOTE - the ClassWizard will add and remove mapping macros here.
***************
*** 79,82 ****
--- 82,86 ----
  		AddPage(aspectPage);
  		aspectPages.AddTail(aspectPage);
+ 		++countPages;
  	}
  
***************
*** 134,141 ****
  BOOL CAspectSpecDlg::OnInitDialog() 
  {
  	BOOL bResult = CPropertySheet::OnInitDialog();
  
! 	
! 	// TODO: Add your specialized code here
  	CTabCtrl* tab = GetTabControl();
  	int count = tab->GetItemCount();
--- 138,147 ----
  BOOL CAspectSpecDlg::OnInitDialog() 
  {
+ 	// this will call the OnInitDialog of the first PropertyPage
  	BOOL bResult = CPropertySheet::OnInitDialog();
  
! 	// this portion may modify the layout of tabs (the number of rows they occupy)
! 	// since the tabnames may be longer then expected
! 	// so the first page needs to be resized after this 
  	CTabCtrl* tab = GetTabControl();
  	int count = tab->GetItemCount();
***************
*** 144,151 ****
  		TC_ITEM tcItem; 
  		tcItem.mask = TCIF_TEXT; 
! 		tcItem.pszText = aspectNames.GetNext(pos).GetBuffer(255); 
  		tab->SetItem(i, &tcItem ); 
  	}
! 	
  	return bResult;
  }
--- 150,182 ----
  		TC_ITEM tcItem; 
  		tcItem.mask = TCIF_TEXT; 
! 		tcItem.pszText = aspectNames.GetNext(pos).GetBuffer(255);
  		tab->SetItem(i, &tcItem ); 
  	}
! 
! 	SetActivePage(0); // activates the first page, and calls AspectPage::OnSize with the updated size (lower than the previous)
! 
! 	// resizing of controls on the first page
! 	CAspectPage *firstpage;
! 	POSITION pos1 = aspectPages.GetHeadPosition();
! 	if( pos1){
! 		firstpage = aspectPages.GetNext(pos1);
! 		firstpage->resizeTableToFitIn();
! 	}
! 
! 
  	return bResult;
+ }
+ 
+ int CAspectSpecDlg::OnCreate(LPCREATESTRUCT lpCreateStruct)
+ {
+ 	// Set for Scrolling Tabs style if the #of pages exceeds 19
+ 	// otherwise the tabs with long aspect names could occupy the whole window area
+ 	// if 19 aspects with really long names existed still fitted into the window
+ 	// and space left for 3 items
+ 	// that is why we enable the ScrollingTabs in case the number of pages > 19
+ 	// unfortunately the length of the names is not calculated
+ 	EnableStackedTabs( countPages <= 19);
+ 
+ 	// Call the base class
+ 	return CPropertySheet::OnCreate(lpCreateStruct);
  }

Index: AspectSpecDlg.h
===================================================================
RCS file: /var/lib/gme/GMESRC/Paradigms/MetaGME/MetaInterpreter2004/Asp/AspectSpecDlg.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** AspectSpecDlg.h	8 Mar 2004 22:22:59 -0000	1.3
--- AspectSpecDlg.h	15 Sep 2004 19:48:34 -0000	1.4
***************
*** 38,41 ****
--- 38,42 ----
  	CStringList	aspectNames;
  	int	lastID;
+ 	int countPages;
  	
  
***************
*** 60,63 ****
--- 61,65 ----
  	// Generated message map functions
  protected:
+ 	afx_msg int OnCreate( LPCREATESTRUCT lpCreateStruct );
  	//{{AFX_MSG(CAspectSpecDlg)
  		// NOTE - the ClassWizard will add and remove member functions here.

Index: AspectSpecTbl.cpp
===================================================================
RCS file: /var/lib/gme/GMESRC/Paradigms/MetaGME/MetaInterpreter2004/Asp/AspectSpecTbl.cpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** AspectSpecTbl.cpp	8 Mar 2004 22:22:59 -0000	1.3
--- AspectSpecTbl.cpp	15 Sep 2004 19:48:34 -0000	1.4
***************
*** 158,161 ****
--- 158,167 ----
  	DWORD dwStyle = WS_BORDER|WS_CHILD|WS_VISIBLE
  					|CBS_DROPDOWNLIST|CBS_DISABLENOSCROLL;
+ 	if( rect.bottom > rcClient.bottom + 4*height) // by zolmol
+ 	{
+ 		rect.bottom = rcClient.bottom + 4*height;//close to the propertypage's bottom
+ 		dwStyle |= WS_VSCROLL; // enable scrollbar
+ 	} // end zolmol
+ 
  	CComboBox *pList = new CInPlaceList(nItem, nCol, &lstItems, nSel);
  	pList->Create( dwStyle, rect, this, IDC_IPEDIT );

Index: NameSpecTbl.cpp
===================================================================
RCS file: /var/lib/gme/GMESRC/Paradigms/MetaGME/MetaInterpreter2004/Asp/NameSpecTbl.cpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** NameSpecTbl.cpp	9 Aug 2004 16:11:37 -0000	1.2
--- NameSpecTbl.cpp	15 Sep 2004 19:48:34 -0000	1.3
***************
*** 169,172 ****
--- 169,178 ----
  	DWORD dwStyle = WS_BORDER|WS_CHILD|WS_VISIBLE
  					|CBS_DROPDOWNLIST|CBS_DISABLENOSCROLL;
+ 	if( rect.bottom > rcClient.bottom + 4*height) // by zolmol
+ 	{
+ 		rect.bottom = rcClient.bottom + 4*height;//close to the page's bottom
+ 		dwStyle |= WS_VSCROLL; // enable scrollbar
+ 	} // end zolmol
+ 
  	CComboBox *pList = new CInPlaceList(nItem, nCol, &lstItems, nSel);
  	pList->Create( dwStyle, rect, this, IDC_IPEDIT );



More information about the GME-commit mailing list