[GME-commit] GMESRC/GME/Console Console.rc, 1.3, 1.4 Console.vcproj, 1.7, 1.8 ConsoleCtl.cpp, 1.8, 1.9 ConsoleCtl.h, 1.5, 1.6 Resource.h, 1.3, 1.4 ScriptEdit.cpp, 1.8, 1.9 ScriptEdit.h, 1.7, 1.8

Log messages of CVS commits gme-commit at list.isis.vanderbilt.edu
Wed May 7 15:50:18 CDT 2008


Update of /project/gme-repository/GMESRC/GME/Console
In directory escher:/tmp/cvs-serv29624

Modified Files:
	Console.rc Console.vcproj ConsoleCtl.cpp ConsoleCtl.h 
	Resource.h ScriptEdit.cpp ScriptEdit.h 
Log Message:
Improvements ret/up/down.


CVS User: Zoltan Molnar, ISIS (zolmol)

Index: Console.vcproj
===================================================================
RCS file: /project/gme-repository/GMESRC/GME/Console/Console.vcproj,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** Console.vcproj	18 Apr 2008 18:08:18 -0000	1.7
--- Console.vcproj	7 May 2008 20:50:16 -0000	1.8
***************
*** 429,432 ****
--- 429,441 ----
  			Filter="ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe">
  			<File
+ 				RelativePath=".\res\btndn.bmp">
+ 			</File>
+ 			<File
+ 				RelativePath=".\res\btnret.bmp">
+ 			</File>
+ 			<File
+ 				RelativePath=".\res\btnup.bmp">
+ 			</File>
+ 			<File
  				RelativePath="res\cleancon.bmp">
  			</File>

Index: ScriptEdit.h
===================================================================
RCS file: /project/gme-repository/GMESRC/GME/Console/ScriptEdit.h,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** ScriptEdit.h	15 Apr 2008 20:04:57 -0000	1.7
--- ScriptEdit.h	7 May 2008 20:50:16 -0000	1.8
***************
*** 32,35 ****
--- 32,38 ----
  	inline CString& GetLoadedScript()                      { return m_loadedScript;       }
  	inline CString& GetLoadedScriptFileName()              { return m_loadedFileName;     }
+ 	void showPrev();
+ 	void showNext();
+ 	void returnHit();
  protected:
  	static const char* defPrompt;

Index: Resource.h
===================================================================
RCS file: /project/gme-repository/GMESRC/GME/Console/Resource.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** Resource.h	15 Apr 2008 20:04:57 -0000	1.3
--- Resource.h	7 May 2008 20:50:16 -0000	1.4
***************
*** 25,28 ****
--- 25,31 ----
  #define IDC_RECENT_SCRIPT4              119
  #define IDC_RECENT_SCRIPT5              120
+ #define IDC_PREV_COMMAND                121
+ #define IDC_NEXT_COMMAND                122
+ #define IDC_RETURN_COMMAND              123
  #define IDS_CONSOLE_PPG_CAPTION         200
  #define IDD_PROPPAGE_CONSOLE            200
***************
*** 30,33 ****
--- 33,39 ----
  #define IDB_EXECSCR                     212
  #define IDB_CLEANCON                    213
+ #define IDB_BTNUP                       214
+ #define IDB_BTNDN                       215
+ #define IDB_BTNRET                      216
  
  // Next default values for new objects
***************
*** 35,42 ****
  #ifdef APSTUDIO_INVOKED
  #ifndef APSTUDIO_READONLY_SYMBOLS
! #define _APS_NEXT_RESOURCE_VALUE        214
  #define _APS_NEXT_COMMAND_VALUE         32768
  #define _APS_NEXT_CONTROL_VALUE         201
! #define _APS_NEXT_SYMED_VALUE           121
  #endif
  #endif
--- 41,48 ----
  #ifdef APSTUDIO_INVOKED
  #ifndef APSTUDIO_READONLY_SYMBOLS
! #define _APS_NEXT_RESOURCE_VALUE        216
  #define _APS_NEXT_COMMAND_VALUE         32768
  #define _APS_NEXT_CONTROL_VALUE         201
! #define _APS_NEXT_SYMED_VALUE           124
  #endif
  #endif

Index: Console.rc
===================================================================
RCS file: /project/gme-repository/GMESRC/GME/Console/Console.rc,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** Console.rc	18 Apr 2008 18:08:18 -0000	1.3
--- Console.rc	7 May 2008 20:50:16 -0000	1.4
***************
*** 105,108 ****
--- 105,111 ----
  IDB_EXECSCR             BITMAP                  "res\\execscr.bmp"
  IDB_CLEANCON            BITMAP                  "res\\cleancon.bmp"
+ IDB_BTNUP               BITMAP                  "res\\btnup.bmp"
+ IDB_BTNDN               BITMAP                  "res\\btndn.bmp"
+ IDB_BTNRET              BITMAP                  "res\\btnret.bmp"
  
  /////////////////////////////////////////////////////////////////////////////

Index: ConsoleCtl.h
===================================================================
RCS file: /project/gme-repository/GMESRC/GME/Console/ConsoleCtl.h,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** ConsoleCtl.h	15 Apr 2008 20:04:57 -0000	1.5
--- ConsoleCtl.h	7 May 2008 20:50:16 -0000	1.6
***************
*** 42,45 ****
--- 42,48 ----
  	CButton	    m_exeButton;
  	CButton     m_clrButton;
+ 	CButton     m_upButton;
+ 	CButton     m_dnButton;
+ 	CButton     m_retButton;
  	CString     m_recent1;
  	CString     m_recent2;
***************
*** 62,66 ****
--- 65,74 ----
  	afx_msg void rlrScript();
  	afx_msg void selectEngine();
+ 	afx_msg void prevCommand();
+ 	afx_msg void nextCommand();
+ 	afx_msg void retCommand();
  	afx_msg void loadRecent( UINT);
+ 	afx_msg BOOL OnToolTipNotify(UINT id, NMHDR *pNMHDR, LRESULT *pResult);
+ 
  	//}}AFX_MSG
  	DECLARE_MESSAGE_MAP()

Index: ConsoleCtl.cpp
===================================================================
RCS file: /project/gme-repository/GMESRC/GME/Console/ConsoleCtl.cpp,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -d -r1.8 -r1.9
*** ConsoleCtl.cpp	18 Apr 2008 18:08:18 -0000	1.8
--- ConsoleCtl.cpp	7 May 2008 20:50:16 -0000	1.9
***************
*** 37,41 ****
--- 37,45 ----
  	ON_COMMAND( IDC_CLEARCONSOLE_COMMAND, Clear)
  	ON_COMMAND( IDC_SELECTENGINE_COMMAND, selectEngine)
+ 	ON_COMMAND( IDC_PREV_COMMAND, prevCommand)
+ 	ON_COMMAND( IDC_NEXT_COMMAND, nextCommand)
+ 	ON_COMMAND( IDC_RETURN_COMMAND, retCommand)
  	ON_COMMAND_RANGE( IDC_RECENT_SCRIPT1, IDC_RECENT_SCRIPT5, loadRecent)
+ 	ON_NOTIFY_EX( TTN_NEEDTEXT, 0, OnToolTipNotify)
  END_MESSAGE_MAP()
  
***************
*** 163,166 ****
--- 167,216 ----
  }
  
+ // creates a 3d look and feel around a textbox, 
+ // so that it resembles an edit field much likely
+ CRect has3dLook(CDC* pdc, CRect rc)
+ {
+ 	rc.bottom += 1;
+ 	rc.right  += 1;
+ 	pdc->SelectStockObject( NULL_PEN);
+ 
+ 	pdc->SelectStockObject( LTGRAY_BRUSH);
+ 	pdc->Rectangle( rc); // background painted for the area
+ 
+ 	int decr_x = 3;                           // will deflate with this constants
+ 	int decr_y = (rc.Height()-20)/2;
+ 	rc.bottom -= decr_y;   rc.right -= decr_x;
+ 	rc.top    += decr_y;   rc.left  += decr_x;
+ 
+ 	pdc->SelectStockObject( WHITE_BRUSH);
+ 	pdc->Rectangle( rc); // the biggest rect
+ 	
+ 	pdc->SelectStockObject( GRAY_BRUSH);
+ 	rc.bottom -= 1; rc.right -= 1;
+ 	pdc->Rectangle( rc); // the 2nd biggest rect (inverse cascaded compared to the white rc)
+ 
+ 	pdc->SelectStockObject( LTGRAY_BRUSH);
+ 	rc.top += 1; rc.left += 1;
+ 	pdc->Rectangle( rc); // cascaded compared to the white rc
+ 
+ 	pdc->SelectStockObject( BLACK_BRUSH);
+ 	rc.bottom -= 1; rc.right -= 1;
+ 	pdc->Rectangle( rc);
+ 
+ 	rc.DeflateRect( 1, 1, 1, 1);
+ 	return rc;
+ }
+ 
+ // centeres a rectangle inside another one, so that a 
+ // square with p_bt_size side will sit in the center
+ CRect centered( const CRect& p_rcIn, int p_vertic_size, int p_horiz_size, int p_bt_size)
+ {
+ 	CRect rc( p_rcIn);
+ 	rc.top += (p_vertic_size - p_bt_size)/2;
+ 	rc.bottom -= (p_vertic_size - p_bt_size)/2;
+ 	rc.left += (p_horiz_size - p_bt_size)/2;
+ 	rc.right -= (p_horiz_size - p_bt_size)/2;
+ 	return rc;
+ }
  
  /////////////////////////////////////////////////////////////////////////////
***************
*** 170,196 ****
  			CDC* pdc, const CRect& rcBounds, const CRect& rcInvalid)
  {
  	if (m_browser.GetSafeHwnd()) {
  		bool  anything_loaded = !m_edit.GetLoadedScript().IsEmpty();
! 		CRect rect = rcBounds;
! 		rect.bottom -= 20; 
! 		// move browser
! 		m_browser.MoveWindow(rect, TRUE);
! 		CRect erect = rcBounds;
! 		erect.top = rect.bottom;
! 		// place 'Clear'
! 		CRect crect = erect;
! 		crect.left = crect.right - 16;
! 		m_clrButton.MoveWindow( crect, TRUE);
  
! 		erect.right -= 16;
! 		erect.left += anything_loaded? 40: 20;
! 		// move input control too 
! 		m_edit.MoveWindow(erect, TRUE);
  
  		if( anything_loaded) {
! 			erect.right = erect.left;
! 			erect.left -= 20;
! 			// place and show 'Execute' button
! 			m_exeButton.MoveWindow( erect, TRUE);
  			m_exeButton.ShowWindow(SW_SHOW);
  		}
--- 220,264 ----
  			CDC* pdc, const CRect& rcBounds, const CRect& rcInvalid)
  {
+ 	const int vertic_size   = 26;
+ 	const int horiz_size    = 26;
+ 	const int bt_size       = 20;
+ 	int       hori2_size    = GetSystemMetrics(SM_CXVSCROLL)-1;// the width of the scrollbar above it
+ 	const int prnx_size     = 19; // width of the prev/next buttons
+ 
  	if (m_browser.GetSafeHwnd()) {
  		bool  anything_loaded = !m_edit.GetLoadedScript().IsEmpty();
! 		CRect rcBrwsr, rcExtra, rcExtra2;  // browser rect, extra rect
! 		rcExtra2 = rcBrwsr = rcExtra = rcBounds;
  
! 		rcExtra2.left -= 1; rcExtra2.bottom += 1;
! 		pdc->SelectStockObject( LTGRAY_BRUSH);
! 		pdc->Rectangle( rcExtra2);         // light gray background for the whole region
! 
! 
! 		rcBrwsr.bottom -= vertic_size;     // take from the browser's space 30 lines
! 		rcExtra.top = rcBrwsr.bottom;      // extra is the remaining space
! 		rcBrwsr.bottom -= 1;               // use less space for the browser to have a divide
! 
! 
! 		pdc->SelectStockObject( BLACK_PEN);
! 		pdc->SelectStockObject( GRAY_BRUSH);
! 		rcExtra2.top = rcBrwsr.bottom;
! 		rcExtra2.bottom = rcExtra2.top+1;
! 		pdc->Rectangle( rcExtra2);         // a divider line between the browser and scripting 
  
+ 		// place browser
+ 		m_browser.MoveWindow( rcBrwsr, TRUE);
+ 
+ 		// place the generic command button
+ 		CRect rcLoad( rcExtra);                     // load btn rect
+ 		rcLoad.right = rcLoad.left + horiz_size;
+ 		
+ 		m_cmdButton.MoveWindow( centered( rcLoad, vertic_size, horiz_size, bt_size), TRUE);
+ 
+ 		// place and show/hide 'Execute' button based on bool (anything_loaded)
  		if( anything_loaded) {
! 			rcLoad.OffsetRect( horiz_size, 0);
! 			
! 			m_exeButton.MoveWindow( centered( rcLoad, vertic_size, horiz_size, bt_size), TRUE);
  			m_exeButton.ShowWindow(SW_SHOW);
  		}
***************
*** 199,206 ****
  		}
  
! 		erect.right = erect.left;
! 		erect.left -= 20;
! 		// place the generic command button
! 		m_cmdButton.MoveWindow( erect, TRUE);
  	}
  	else {
--- 267,307 ----
  		}
  
! 		// place 'Clear'
! 		CRect rcClean = rcExtra;                    // clear btn rect
! 		rcClean.left = rcClean.right - hori2_size;
! 		
! 		CRect rcClrBtn(rcClean);
! 		rcClrBtn.top += (vertic_size-bt_size)/2;    // center the button in the rcClean rectangle vertically
! 		rcClrBtn.bottom -= (vertic_size-bt_size)/2;
! 		rcClrBtn.right -= 2;
! 
! 		m_clrButton.MoveWindow( rcClrBtn, TRUE);
! 
! 		// place 'Return'
! 		rcClean.right = rcClean.left; rcClean.left -= horiz_size;
! 
! 		m_retButton.MoveWindow( centered( rcClean, vertic_size, horiz_size, bt_size), TRUE);
! 
! 		// place history prev/next button pair to the left of Clean
! 		rcClean.right = rcClean.left; rcClean.left -= prnx_size;
! 		rcClean.bottom = rcClean.top + static_cast<int>(vertic_size/2);
! 		CRect rcUDBtn( rcClean);
! 		rcUDBtn.DeflateRect( 0, 2, 0, 0);
! 		m_upButton.MoveWindow( rcUDBtn, TRUE);
! 
! 		rcClean.top = rcClean.bottom;
! 		rcClean.bottom = rcExtra.bottom;//rcClean.OffsetRect( 0, vertic_size - static_cast<int>(vertic_size/2));
! 		rcUDBtn = rcClean;
! 		rcUDBtn.DeflateRect( 0, 1, 0, 2);
! 		m_dnButton.MoveWindow( rcUDBtn, TRUE);
! 		
! 		CRect rcRemain = rcExtra; // remaining rect
! 		rcRemain.left = rcLoad.right;         // left side
! 		rcRemain.right= rcClean.left;         // right side
! 
! 		rcRemain = has3dLook( pdc, rcRemain);
! 
! 		// move input control too 
! 		m_edit.MoveWindow(rcRemain, TRUE);
  	}
  	else {
***************
*** 302,315 ****
  	bool ret = m_edit.Init(this);
  
! 	CBitmap bm1, bm2, bm3;
  	bm1.LoadMappedBitmap(IDB_LOADSCR);//IDB_CONSOLE);
  	bm2.LoadMappedBitmap(IDB_EXECSCR);
  	bm3.LoadMappedBitmap(IDB_CLEANCON);
  
! 	CSize bm1Size, bm2Size, bm3Size;
  	BITMAP bmStruct;
  	if (bm1.GetBitmap(&bmStruct)) bm1Size.cx = bmStruct.bmWidth, bm1Size.cy = bmStruct.bmHeight;
  	if (bm2.GetBitmap(&bmStruct)) bm2Size.cx = bmStruct.bmWidth, bm2Size.cy = bmStruct.bmHeight;
  	if (bm3.GetBitmap(&bmStruct)) bm3Size.cx = bmStruct.bmWidth, bm3Size.cy = bmStruct.bmHeight;
  
  	rect.bottom = rect.right = 100;
--- 403,422 ----
  	bool ret = m_edit.Init(this);
  
! 	CBitmap bm1, bm2, bm3, bmu, bmd, bmr;
  	bm1.LoadMappedBitmap(IDB_LOADSCR);//IDB_CONSOLE);
  	bm2.LoadMappedBitmap(IDB_EXECSCR);
  	bm3.LoadMappedBitmap(IDB_CLEANCON);
+ 	bmu.LoadMappedBitmap(IDB_BTNUP);
+ 	bmd.LoadMappedBitmap(IDB_BTNDN);
+ 	bmr.LoadMappedBitmap(IDB_BTNRET);
  
! 	CSize bm1Size, bm2Size, bm3Size, bmuSize, bmdSize, bmrSize;
  	BITMAP bmStruct;
  	if (bm1.GetBitmap(&bmStruct)) bm1Size.cx = bmStruct.bmWidth, bm1Size.cy = bmStruct.bmHeight;
  	if (bm2.GetBitmap(&bmStruct)) bm2Size.cx = bmStruct.bmWidth, bm2Size.cy = bmStruct.bmHeight;
  	if (bm3.GetBitmap(&bmStruct)) bm3Size.cx = bmStruct.bmWidth, bm3Size.cy = bmStruct.bmHeight;
+ 	if (bmu.GetBitmap(&bmStruct)) bmuSize.cx = bmStruct.bmWidth, bmuSize.cy = bmStruct.bmHeight;
+ 	if (bmd.GetBitmap(&bmStruct)) bmdSize.cx = bmStruct.bmWidth, bmdSize.cy = bmStruct.bmHeight;
+ 	if (bmr.GetBitmap(&bmStruct)) bmrSize.cx = bmStruct.bmWidth, bmrSize.cy = bmStruct.bmHeight;
  
  	rect.bottom = rect.right = 100;
***************
*** 330,336 ****
--- 437,461 ----
  	m_clrButton.SetBitmap(bm3);
  
+ 	CRect rec2 = rect;
+ 	//rec2.right = rec2.left + 40; rec2.bottom = rec2.top + 16;
+ 	rec2.right = rec2.left + 19;//bmuSize.cx + 3; 
+ 	rec2.bottom = rec2.top + 16;//bmuSize.cy + 3;
+ 	m_upButton.Create( _T("Prev"), WS_CHILD|WS_VISIBLE|BS_BITMAP, rec2, this, IDC_PREV_COMMAND);
+ 	m_upButton.SetBitmap( bmu);
+ 
+ 	m_dnButton.Create( _T("Next"), WS_CHILD|WS_VISIBLE|BS_BITMAP, rec2, this, IDC_NEXT_COMMAND);
+ 	m_dnButton.SetBitmap( bmd);
+ 
+ 	m_retButton.Create( _T("Return"), WS_CHILD|WS_VISIBLE|BS_BITMAP, rec2, this, IDC_RETURN_COMMAND);
+ 	m_retButton.SetBitmap( bmr);
+ 
  	bm1.Detach();
  	bm2.Detach();
  	bm3.Detach();
+ 	bmu.Detach();
+ 	bmd.Detach();
+ 	bmr.Detach();
+ 
+ 	EnableToolTips();
  
  	return 0;
***************
*** 523,526 ****
--- 648,652 ----
  
  	Message( CString( "Loaded script: ") + p_fileName, MSG_INFO);
+ 	Invalidate();
  }
  
***************
*** 609,611 ****
  	case IDC_RECENT_SCRIPT5: LoadScript( m_recent5);break;
  	}
! }
\ No newline at end of file
--- 735,793 ----
  	case IDC_RECENT_SCRIPT5: LoadScript( m_recent5);break;
  	}
! }
! 
! void CConsoleCtrl::prevCommand()
! {
! 	m_edit.showPrev();
! }
! 
! void CConsoleCtrl::nextCommand()
! {
! 	m_edit.showNext();
! }
! 
! void CConsoleCtrl::retCommand()
! {
! 	m_edit.returnHit();
! }
! 
! BOOL CConsoleCtrl::OnToolTipNotify(UINT id, NMHDR *pNMHDR, LRESULT *pResult)
! {
! 	// need to handle both ANSI and UNICODE versions of the message
! 	TOOLTIPTEXTA* pTTTA = (TOOLTIPTEXTA*)pNMHDR;
! 	TOOLTIPTEXTW* pTTTW = (TOOLTIPTEXTW*)pNMHDR;
! 	UINT            nID = pNMHDR->idFrom;
! 	
! 	CString tip;
! 
! 	if( pNMHDR->code == TTN_NEEDTEXTA && (pTTTA->uFlags & TTF_IDISHWND) ||
! 	    pNMHDR->code == TTN_NEEDTEXTW && (pTTTW->uFlags & TTF_IDISHWND))
! 	{
! 		// idFrom is actually the HWND of the tool
! 		nID = ::GetDlgCtrlID((HWND)nID);
! 	}
! 
! 	if( nID != 0) // will be zero on a separator
! 	{
! 		//tip.Format("Control ID = %d", nID);
! 		switch( nID)
! 		{
! 			      case IDC_RETURN_COMMAND:       tip = "Executes the command typed into the edit field";
! 			break;case IDC_RUNSCRIPT_COMMAND:    tip = "Executes " + m_edit.GetLoadedScriptFileName();
! 			break;case IDC_MENU_COMMAND:         tip = "Load scripts and access recent scripts";
! 			break;case IDC_CLEARCONSOLE_COMMAND: tip = "Clear the console";
! 			break;case IDC_PREV_COMMAND:         tip = "Previous command in history";
! 			break;case IDC_NEXT_COMMAND:         tip = "Next command in history";
! 			break;case IDD_EDIT:                 tip = "Enter a command here";
! 		}
! 	}
! 
! 	if( pNMHDR->code == TTN_NEEDTEXTA)
! 		lstrcpyn(pTTTA->szText, tip, sizeof(pTTTA->szText));
! 	else
! 		::MultiByteToWideChar( CP_ACP , 0, tip, -1, pTTTW->szText, sizeof(pTTTW->szText));
! 
! 	*pResult = 0;
! 	return TRUE;    // message was handled
! }
! 

Index: ScriptEdit.cpp
===================================================================
RCS file: /project/gme-repository/GMESRC/GME/Console/ScriptEdit.cpp,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -d -r1.8 -r1.9
*** ScriptEdit.cpp	15 Apr 2008 20:04:57 -0000	1.8
--- ScriptEdit.cpp	7 May 2008 20:50:16 -0000	1.9
***************
*** 52,56 ****
  }
  
! void CScriptEdit::OnKeyUp( UINT nChar, UINT nRepCnt, UINT nFlags )
  {
  	static int lastup = -1;
--- 52,71 ----
  }
  
! void CScriptEdit::showPrev()
! {
! 	OnKeyUp( VK_UP, 0, 0);
! }
! 
! void CScriptEdit::showNext()
! {
! 	OnKeyUp( VK_DOWN, 0, 0);
! }
! 
! void CScriptEdit::returnHit()
! {
! 	OnKeyUp( VK_RETURN, 0, 0);
! }
! 
! void CScriptEdit::OnKeyUp( UINT nChar, UINT /*nRepCnt*/, UINT /*nFlags*/ )
  {
  	static int lastup = -1;



More information about the GME-commit mailing list