[GME-commit] GMESRC/GME/Search MButton.cpp,NONE,1.1 MButton.h,NONE,1.1 MComboBox.cpp,NONE,1.1 MComboBox.h,NONE,1.1 MEdit.cpp,NONE,1.1 MEdit.h,NONE,1.1 MListCtrl.cpp,NONE,1.1 MListCtrl.h,NONE,1.1 Input.cpp,1.2,1.3 Input.h,1.1,1.2 Search.rc,1.11,1.12 Search.vcproj,1.2,1.3 SearchAlg.cpp,1.10,1.11 SearchDlg.cpp,1.19,1.20 SearchDlg.h,1.10,1.11 StdAfx.h,1.3,1.4

gme-commit at list.isis.vanderbilt.edu gme-commit at list.isis.vanderbilt.edu
Mon Dec 4 18:19:25 CST 2006


Update of /project/gme-repository/GMESRC/GME/Search
In directory escher:/tmp/cvs-serv4144

Modified Files:
	Input.cpp Input.h Search.rc Search.vcproj SearchAlg.cpp 
	SearchDlg.cpp SearchDlg.h StdAfx.h 
Added Files:
	MButton.cpp MButton.h MComboBox.cpp MComboBox.h MEdit.cpp 
	MEdit.h MListCtrl.cpp MListCtrl.h 
Log Message:
Modified Files:
 	Input.cpp Input.h SearchAlg.cpp 
 	SearchDlg.cpp SearchDlg.h
Reason: MatchCase option added, Tab and other shortcuts work now.

Added Files:
 	MButton.cpp MButton.h MComboBox.cpp MComboBox.h MEdit.cpp 
 	MEdit.h MListCtrl.cpp MListCtrl.h 

Reason: TAB and other shortcuts implemented by subclassing dlg items.

CVS User: Zoltan Molnar, ISIS (zolmol)

--- NEW FILE: MEdit.h ---
#pragma once


// CMEdit

class CMEdit : public CEdit
{
	DECLARE_DYNAMIC(CMEdit)

public:
	CMEdit();
	virtual ~CMEdit();

protected:
	DECLARE_MESSAGE_MAP()
public:
	afx_msg void OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags);
};

Index: Input.h
===================================================================
RCS file: /project/gme-repository/GMESRC/GME/Search/Input.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** Input.h	13 Dec 2002 19:46:00 -0000	1.1
--- Input.h	4 Dec 2006 18:19:23 -0000	1.2
***************
*** 25,29 ****
  	void GetInput(CString name, CString role, CString kind, CString attrname, int attrtype,
  				CString attrval, BOOL spl, BOOL mod, BOOL atom, BOOL ref, BOOL set, BOOL full, 
! 				 IMgaFCO *root, int searchscope);
  
  	/// The name of the object the user is searching for.
--- 25,29 ----
  	void GetInput(CString name, CString role, CString kind, CString attrname, int attrtype,
  				CString attrval, BOOL spl, BOOL mod, BOOL atom, BOOL ref, BOOL set, BOOL full, 
! 				 IMgaFCO *root, int searchscope, BOOL caseMatch);
  
  	/// The name of the object the user is searching for.
***************
*** 60,63 ****
--- 60,66 ----
  	/// The variable used for determining the Search Type - Global(0) or Local(1)
  	int doGlobalSearch;
+ 
+ 	/// Does the user want caseMatching search
+ 	BOOL getCaseIgnored;
  };
  

Index: SearchAlg.cpp
===================================================================
RCS file: /project/gme-repository/GMESRC/GME/Search/SearchAlg.cpp,v
retrieving revision 1.10
retrieving revision 1.11
diff -C2 -d -r1.10 -r1.11
*** SearchAlg.cpp	1 Apr 2003 19:26:35 -0000	1.10
--- SearchAlg.cpp	4 Dec 2006 18:19:23 -0000	1.11
***************
*** 74,77 ****
--- 74,82 ----
  				COMTHROW( MGACOLL_ITER->get_ObjType( &rret) );
  
+ 				if( filter.getCaseIgnored) // case ignored, make role lowercase
+ 				{
+ 					partName.MakeLower();
+ 				}
+ 
  				if((rret == OBJTYPE_ATOM)  && (filter.objRole.Match(partName)) )
  				{
***************
*** 104,107 ****
--- 109,117 ----
  				COMTHROW( MGACOLL_ITER->get_ObjType( &rret) );
  
+ 				if( filter.getCaseIgnored) // case ignored, make role lowercase
+ 				{
+ 					partName.MakeLower();
+ 				}
+ 
  				if((rret == OBJTYPE_REFERENCE)  && (filter.objRole.Match(partName)) )
  				{
***************
*** 134,137 ****
--- 144,152 ----
  				COMTHROW( MGACOLL_ITER->get_ObjType( &rret) );
  
+ 				if( filter.getCaseIgnored) // case ignored, make role lowercase
+ 				{
+ 					partName.MakeLower();
+ 				}
+ 
  				if((rret == OBJTYPE_SET)  && (filter.objRole.Match(partName)) )
  				{
***************
*** 164,167 ****
--- 179,187 ----
  				COMTHROW( MGACOLL_ITER->get_ObjType( &rret) );
  
+ 				if( filter.getCaseIgnored) // case ignored, make role lowercase
+ 				{
+ 					partName.MakeLower();
+ 				}
+ 
  				if((rret == OBJTYPE_MODEL)  && (filter.objRole.Match(partName)) )
  				{
***************
*** 368,371 ****
--- 388,397 ----
  		CString kindName = bstrKindName;
  
+ 		if( filter.getCaseIgnored) // case ignored, make values lowercase
+ 		{
+ 			name.MakeLower();
+ 			kindName.MakeLower();
+ 		}
+ 
  		if( (filter.objName.Match(name)) && (filter.objKind.Match(kindName))  )		
  		{
***************
*** 404,407 ****
--- 430,439 ----
  		CString kindName = bstrKindName;
  
+ 		if( filter.getCaseIgnored) // case ignored, make values lowercase
+ 		{
+ 			name.MakeLower();
+ 			kindName.MakeLower();
+ 		}
+ 
  		if( (filter.objName.Match(name)) && (filter.objKind.Match(kindName))  )		
  		{
***************
*** 448,451 ****
--- 480,489 ----
  		CString kindName = bstrKindName;
  
+ 		if( filter.getCaseIgnored) // case ignored, make values lowercase
+ 		{
+ 			name.MakeLower();
+ 			kindName.MakeLower();
+ 		}
+ 
  		if( (filter.objName.Match(name)) && (filter.objKind.Match(kindName))  )		
  		{
***************
*** 483,486 ****
--- 521,530 ----
  		CString kindName = bstrKindName;
  
+ 		if( filter.getCaseIgnored) // case ignored, make values lowercase
+ 		{
+ 			name.MakeLower();
+ 			kindName.MakeLower();
+ 		}
+ 
  		if( (filter.objName.Match(name)) && (filter.objKind.Match(kindName))  )		
  		{
***************
*** 558,563 ****
  	{
  		CString attrib = attriblist.GetNext(strpos);
  
! 		if(filter.objAttrName.Match(attrib))
  		{
  			if(!filter.objVal.IsEmpty())
--- 602,613 ----
  	{
  		CString attrib = attriblist.GetNext(strpos);
+ 		CString attrib_altered = attrib;
  
! 		if( filter.getCaseIgnored) // case ignored, make attrib name lowercase
! 		{
! 			attrib_altered.MakeLower();
! 		}
! 
! 		if(filter.objAttrName.Match(attrib_altered))
  		{
  			if(!filter.objVal.IsEmpty())
***************
*** 574,580 ****
  				switch(filter.getAttrType)
  				{
! 					case ATTVAL_STRING:		
! 											COMTHROW( cObj->get_StrAttrByName((CBstrIn)attrib, bstrS) ); 
  											actval_str = bstrS;
  											if(filter.objVal == actval_str)
  												found = true;
--- 624,640 ----
  				switch(filter.getAttrType)
  				{
! 					case ATTVAL_STRING:		if(! SUCCEEDED( cObj->get_StrAttrByName((CBstrIn)attrib, bstrS) ) ) found = false;
! 											//COMTHROW( cObj->get_StrAttrByName((CBstrIn)attrib, bstrS) ); 
  											actval_str = bstrS;
+ 											if( filter.getCaseIgnored) // case ignored, make attrib value lowercase
+ 											{
+ 												actval_str.MakeLower();
+ 											}
+ 
+ 											if(filter.objAttrVal.Match( actval_str))
+ 												found = true;
+ 											// the lines above allow partially specified values to match
+ 											// by Zolmol
+ 
  											if(filter.objVal == actval_str)
  												found = true;

Index: SearchDlg.cpp
===================================================================
RCS file: /project/gme-repository/GMESRC/GME/Search/SearchDlg.cpp,v
retrieving revision 1.19
retrieving revision 1.20
diff -C2 -d -r1.19 -r1.20
*** SearchDlg.cpp	5 May 2006 19:15:34 -0000	1.19
--- SearchDlg.cpp	4 Dec 2006 18:19:23 -0000	1.20
***************
*** 51,54 ****
--- 51,63 ----
  	CDialog::DoDataExchange(pDX);
  	//{{AFX_DATA_MAP(CSearchDlg)
+ 	DDX_Control(pDX, IDC_CHECK_LOCATE, m_chkLocateCtrl);
+ 	DDX_Control(pDX, IDC_CHECK_CASESENS, m_chkMatchCaseCtrl);
+ 	DDX_Control(pDX, IDC_CHECKFULLWORD, m_chkFullWordCtrl);
+ 	DDX_Control(pDX, IDC_EDITNAME, m_edtNameCtrl);
+ 	DDX_Control(pDX, IDC_EDITKIND, m_edtKindNameCtrl);
+ 	DDX_Control(pDX, IDC_EDITROLE, m_edtRoleNameCtrl);
+ 	DDX_Control(pDX, IDC_EDITATTRNAME, m_edtAttrNameCtrl);
+ 	DDX_Control(pDX, IDC_EDITATTRVALU, m_edtAttrValueCtrl);
+ 	DDX_Control(pDX, IDC_CHECKSPLSEARCH, m_chkSplSearchCtrl);
  	DDX_Control(pDX, IDC_STATICREF, m_stcRefCtrl);
  	DDX_Control(pDX, IDC_CHECKREF, m_chkRefCtrl);
***************
*** 243,247 ****
  		CInput inp;
  		inp.GetInput(m_edtName,m_edtRoleName,m_edtKindName,m_edtAttrName,m_cmbCtrl.GetCurSel(),m_edtAttrValue,
! 						m_chkSplSearch,m_chkMod,m_chkAtom,m_chkRef,m_chkSet,m_chkFullWord,NULL,0);
  
  		
--- 252,256 ----
  		CInput inp;
  		inp.GetInput(m_edtName,m_edtRoleName,m_edtKindName,m_edtAttrName,m_cmbCtrl.GetCurSel(),m_edtAttrValue,
! 						m_chkSplSearch,m_chkMod,m_chkAtom,m_chkRef,m_chkSet,m_chkFullWord,NULL,0,m_chkMatchCase);
  
  		
***************
*** 381,385 ****
  {
  	
! 	long count = 0;
  	if( results) COMTHROW(results->get_Count(&count));
  
--- 390,394 ----
  {
  	
! 	this->itemClicked(); *pResult = 0;/*long count = 0;
  	if( results) COMTHROW(results->get_Count(&count));
  
***************
*** 422,426 ****
  
  		*pResult = 0;
! 	}
  
  }
--- 431,435 ----
  
  		*pResult = 0;
! 	}*/
  
  }
***************
*** 429,433 ****
  {
  
! 	long count = 0;
  	if( results) COMTHROW(results->get_Count(&count));
  
--- 438,442 ----
  {
  
! 	this->itemDblClicked(); *pResult = 0;/*long count = 0;
  	if( results) COMTHROW(results->get_Count(&count));
  
***************
*** 490,494 ****
  
  		*pResult = 0;
! 	}
  
  }
--- 499,503 ----
  
  		*pResult = 0;
! 	}*/
  
  }
***************
*** 558,560 ****
--- 567,692 ----
  	CDialog::OnSizing(fwSide, pRect);
  	// GMESearch::OnSizing() responsible for preventing shrinking the window too much
+ }
+ 
+ void CSearchDlg::clickGo()
+ {
+ 	this->OnButtonGo();
+ }
+ 
+ void CSearchDlg::itemClicked()
+ {
+ 	long count = 0;
+ 	if( results) COMTHROW(results->get_Count(&count));
+ 
+ 	if(count > 0 ) //don't want to grab stuff out of an empty list
+ 	{
+ 
+ 		CWnd::UpdateData(TRUE);
+ 
+ 		CSearchCtrl *TheCtrl = GetCtrl();
+ 		try
+ 		{
+ 			TheCtrl->BeginTransaction();
+ 
+ 			long selected = m_lstResults.GetSelectionMark() + 1; //IMgaFCOs 1 based, GetSelectionMark 0 based
+ 			CComPtr<IMgaFCO> selectedFCO;
+ 			// selected might be 0 because GeSelectionMark might have returned -1
+ 			if( selected >= 1 && selected <= count)
+ 			{
+ 				COMTHROW(results->get_Item(selected,&selectedFCO)); // crashed probably when called with 0
+ 				
+ 				//want to be able to search for references to this object in the special search
+ 				CBstr bstr;
+ 				CString name;
+ 				COMTHROW( selectedFCO->get_Name(bstr));
+ 				name = CString( bstr) + " References";
+ 				m_stcRefCtrl.SetWindowText(name);
+ 				m_stcRefCtrl.ShowWindow(TRUE);
+ 				specialSearchFCO = selectedFCO;
+ 			}
+ 			
+ 			//CComPtr<IMgaObject> selectedObject = (IMgaObject *)(selectedFCO.p); // WAS this the scapegoat?
+ 			CComQIPtr<IMgaObject> selectedObject( selectedFCO);
+ 			TheCtrl->CommitTransaction();
+ 			if( selectedObject) TheCtrl->ClickOnObject(selectedObject);
+ 		}
+ 		catch( ...)
+ 		{
+ 			TheCtrl->AbortTransaction();
+ 		}
+ 	}
+ }
+ 
+ void CSearchDlg::itemDblClicked()
+ {
+ 	long count = 0;
+ 	if( results) COMTHROW(results->get_Count(&count));
+ 
+ 
+ 	if(count > 0 ) //don't want to grab stuff out of an empty list
+ 	{
+ 		CWnd::UpdateData(TRUE);
+ 
+ 		CSearchCtrl *TheCtrl = GetCtrl();
+ 		try
+ 		{
+ 			// non-model children of Folders can't be shown, only located
+ 			bool must_do_locate = false;
+ 
+ 			TheCtrl->BeginTransaction();
+ 
+ 			long selected = m_lstResults.GetSelectionMark() + 1; //IMgaFCOs 1 based, GetSelectionMark 0 based
+ 			CComPtr<IMgaFCO> selectedFCO;
+ 			// selected might be 0 because GeSelectionMark might have returned -1
+ 			if( selected >= 1 && selected <= count)
+ 			{
+ 				COMTHROW(results->get_Item(selected,&selectedFCO)); // crashed probably when called with 0
+ 
+ 				CComPtr<IMgaFolder> parent;
+ 				COMTHROW( selectedFCO->get_ParentFolder( &parent));
+ 				if( parent)
+ 				{
+ 					objtype_enum objtp;
+ 					COMTHROW( selectedFCO->get_ObjType( &objtp));
+ 					if( objtp != OBJTYPE_MODEL)
+ 						must_do_locate = true; // can't show it otherwise 
+ 				}
+ 
+ 				
+ 
+ 				//want to be able to search for references to this object in the special search
+ 				CBstr bstr;
+ 				CString name;
+ 				COMTHROW( selectedFCO->get_Name(bstr));
+ 				name = CString( bstr) + " References";
+ 				m_stcRefCtrl.SetWindowText(name);
+ 				m_stcRefCtrl.ShowWindow(TRUE);
+ 				specialSearchFCO = selectedFCO;
+ 			}
+ 			
+ 			//CComPtr<IMgaObject> selectedObject = (IMgaObject *)(selectedFCO.p); // WAS this the scapegoat?
+ 			CComQIPtr<IMgaObject> selectedObject( selectedFCO);
+ 			TheCtrl->CommitTransaction();
+ 			if( selectedObject)
+ 			{
+ 				if( m_chkLocate || must_do_locate) TheCtrl->LocateMgaObject(selectedObject);
+ 				else             TheCtrl->DblClickOnObject(selectedObject);
+ 			}
+ 
+ 		}
+ 		catch(...)
+ 		{
+ 			TheCtrl->AbortTransaction();
+ 		}
+ 
+ 	}
+ }
+ 
+ void CSearchDlg::tabPressed( CWnd * pOriginator, bool bShift /*= false*/)
+ {
+ 	CWnd *nxt = 0;
+ 	nxt = GetNextDlgTabItem( pOriginator, bShift);
+ 	if( nxt) {
+ 		nxt->SetFocus();
+ 	}
  }

Index: Search.rc
===================================================================
RCS file: /project/gme-repository/GMESRC/GME/Search/Search.rc,v
retrieving revision 1.11
retrieving revision 1.12
diff -C2 -d -r1.11 -r1.12
*** Search.rc	2 May 2006 22:05:59 -0000	1.11
--- Search.rc	4 Dec 2006 18:19:23 -0000	1.12
***************
*** 132,138 ****
  FONT 8, "MS Sans Serif", 0, 0, 0x0
  BEGIN
-     LTEXT           "Name:",IDC_STATICNAME,29,18,22,8
      EDITTEXT        IDC_EDITNAME,55,16,78,14,ES_AUTOHSCROLL
-     PUSHBUTTON      "&Search",IDC_BUTTON_GO,10,107,50,14
      EDITTEXT        IDC_EDITROLE,55,31,77,14,ES_AUTOHSCROLL
      EDITTEXT        IDC_EDITKIND,55,45,77,14,ES_AUTOHSCROLL
--- 132,136 ----
***************
*** 155,163 ****
                      BS_AUTOCHECKBOX | WS_TABSTOP,65,104,94,10
      CONTROL         "Match Case",IDC_CHECK_CASESENS,"Button",BS_AUTOCHECKBOX | 
!                     NOT WS_VISIBLE | WS_TABSTOP,161,104,54,10
      CONTROL         "Locate in Browser",IDC_CHECK_LOCATE,"Button",
                      BS_AUTOCHECKBOX | WS_TABSTOP,65,115,96,10
      CONTROL         "List1",IDC_LISTRESULTS,"SysListView32",LVS_REPORT | 
                      WS_BORDER | WS_TABSTOP,7,126,223,100
      GROUPBOX        "Search Criteria",IDC_STATICCRIT,7,7,223,58
      LTEXT           "Role Name:",IDC_STATICROLE,13,32,41,9
--- 153,163 ----
                      BS_AUTOCHECKBOX | WS_TABSTOP,65,104,94,10
      CONTROL         "Match Case",IDC_CHECK_CASESENS,"Button",BS_AUTOCHECKBOX | 
!                     WS_TABSTOP,161,104,54,10
      CONTROL         "Locate in Browser",IDC_CHECK_LOCATE,"Button",
                      BS_AUTOCHECKBOX | WS_TABSTOP,65,115,96,10
+     PUSHBUTTON      "&Search",IDC_BUTTON_GO,10,107,50,14
      CONTROL         "List1",IDC_LISTRESULTS,"SysListView32",LVS_REPORT | 
                      WS_BORDER | WS_TABSTOP,7,126,223,100
+     LTEXT           "Name:",IDC_STATICNAME,29,18,22,8
      GROUPBOX        "Search Criteria",IDC_STATICCRIT,7,7,223,58
      LTEXT           "Role Name:",IDC_STATICROLE,13,32,41,9

--- NEW FILE: MComboBox.h ---
#pragma once


// CMComboBox

class CMComboBox : public CComboBox
{
	DECLARE_DYNAMIC(CMComboBox)

public:
	CMComboBox();
	virtual ~CMComboBox();

protected:
	DECLARE_MESSAGE_MAP()
public:
	afx_msg void OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags);
};

--- NEW FILE: MButton.cpp ---
// MButton.cpp : implementation file
//

#include "stdafx.h"
#include "Search.h"
#include ".\mbutton.h"
#include "SearchDlg.h"
#include "SearchCtl.h"


// CMButton

IMPLEMENT_DYNAMIC(CMButton, CButton)
CMButton::CMButton()
{
}

CMButton::~CMButton()
{
}


BEGIN_MESSAGE_MAP(CMButton, CButton)
	ON_WM_KEYDOWN()
END_MESSAGE_MAP()



// CMButton message handlers


void CMButton::OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags)
{
	// TODO: Add your message handler code here and/or call default
	if( nChar == VK_TAB)
	{
		CSearchDlg* dlg = (CSearchDlg*) GetParent();
		if( dlg) dlg->tabPressed( this, ::GetKeyState( VK_SHIFT) < 0);
	}
	else if( nChar == VK_ESCAPE)
	{
		CSearchDlg *dlg = (CSearchDlg *) GetParent();
		if( dlg) dlg->getMyParent()->WantToBeClosed();
	}

	CButton::OnKeyDown(nChar, nRepCnt, nFlags);
}

--- NEW FILE: MListCtrl.h ---
#pragma once


// CMListCtrl

class CMListCtrl : public CListCtrl
{
	DECLARE_DYNAMIC(CMListCtrl)

public:
	CMListCtrl();
	virtual ~CMListCtrl();

protected:
	DECLARE_MESSAGE_MAP()
public:
	afx_msg void OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags);
};

Index: Input.cpp
===================================================================
RCS file: /project/gme-repository/GMESRC/GME/Search/Input.cpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** Input.cpp	7 Feb 2003 15:11:24 -0000	1.2
--- Input.cpp	4 Dec 2006 18:19:23 -0000	1.3
***************
*** 32,37 ****
  void CInput::GetInput(CString name, CString role, CString kind, CString attrname, int attrtype, 
  					  CString attrval, BOOL spl, BOOL mod, BOOL atom, BOOL ref, BOOL set, BOOL full, 
! 					  IMgaFCO *root, int searchscope)
  {
  
  	if (full)
--- 32,46 ----
  void CInput::GetInput(CString name, CString role, CString kind, CString attrname, int attrtype, 
  					  CString attrval, BOOL spl, BOOL mod, BOOL atom, BOOL ref, BOOL set, BOOL full, 
! 					  IMgaFCO *root, int searchscope, BOOL bMatchCase)
  {
+ 	getCaseIgnored = !bMatchCase;
+ 	if( getCaseIgnored)
+ 	{
+ 		name.MakeLower();
+ 		role.MakeLower();
+ 		kind.MakeLower();
+ 		attrname.MakeLower();
+ 		attrval.MakeLower();
+ 	}
  
  	if (full)

--- NEW FILE: MListCtrl.cpp ---
// MListCtrl.cpp : implementation file
//

#include "stdafx.h"
#include "Search.h"
#include ".\mlistctrl.h"
#include "SearchDlg.h"
#include "SearchCtl.h"


// CMListCtrl

IMPLEMENT_DYNAMIC(CMListCtrl, CListCtrl)
CMListCtrl::CMListCtrl()
{
}

CMListCtrl::~CMListCtrl()
{
}


BEGIN_MESSAGE_MAP(CMListCtrl, CListCtrl)
	ON_WM_KEYDOWN()
END_MESSAGE_MAP()



// CMListCtrl message handlers


void CMListCtrl::OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags)
{
	// TODO: Add your message handler code here and/or call default
	if( nChar == VK_DOWN || nChar == VK_UP)
	{
		// update to that item:
		CSearchDlg* dlg = (CSearchDlg*) GetParent();
		if( dlg) dlg->itemClicked();
	}
	if( nChar == VK_RETURN)
	{
		// show selected item:
		CSearchDlg* dlg = (CSearchDlg*) GetParent();
		if( dlg) dlg->itemDblClicked();
	}
	else if( nChar == VK_TAB)
	{
		CSearchDlg* dlg = (CSearchDlg*) GetParent();
		if( dlg) dlg->tabPressed( this, ::GetKeyState( VK_SHIFT) < 0);
	}
	else if( nChar == VK_ESCAPE)
	{
		CSearchDlg *dlg = (CSearchDlg *) GetParent();
		if( dlg) dlg->getMyParent()->WantToBeClosed();
	}

	CListCtrl::OnKeyDown(nChar, nRepCnt, nFlags);
}

Index: StdAfx.h
===================================================================
RCS file: /project/gme-repository/GMESRC/GME/Search/StdAfx.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** StdAfx.h	26 Jan 2005 17:31:00 -0000	1.3
--- StdAfx.h	4 Dec 2006 18:19:23 -0000	1.4
***************
*** 39,42 ****
--- 39,43 ----
  
  #include "..\Mga\MgaLib.h"
+ #include <afxwin.h>
  
  //{{AFX_INSERT_LOCATION}}

--- NEW FILE: MButton.h ---
#pragma once


// CMButton

class CMButton : public CButton
{
	DECLARE_DYNAMIC(CMButton)

public:
	CMButton();
	virtual ~CMButton();

protected:
	DECLARE_MESSAGE_MAP()
public:
	afx_msg void OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags);
};

Index: Search.vcproj
===================================================================
RCS file: /project/gme-repository/GMESRC/GME/Search/Search.vcproj,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** Search.vcproj	17 Mar 2006 15:48:47 -0000	1.2
--- Search.vcproj	4 Dec 2006 18:19:23 -0000	1.3
***************
*** 235,238 ****
--- 235,250 ----
  			</File>
  			<File
+ 				RelativePath=".\MButton.cpp">
+ 			</File>
+ 			<File
+ 				RelativePath=".\MComboBox.cpp">
+ 			</File>
+ 			<File
+ 				RelativePath=".\MEdit.cpp">
+ 			</File>
+ 			<File
+ 				RelativePath=".\MListCtrl.cpp">
+ 			</File>
+ 			<File
  				RelativePath="RegExp.cpp">
  				<FileConfiguration
***************
*** 450,453 ****
--- 462,477 ----
  			<File
  				RelativePath="Input.h">
+ 			</File>
+ 			<File
+ 				RelativePath=".\MButton.h">
+ 			</File>
+ 			<File
+ 				RelativePath=".\MComboBox.h">
+ 			</File>
+ 			<File
+ 				RelativePath=".\MEdit.h">
+ 			</File>
+ 			<File
+ 				RelativePath=".\MListCtrl.h">
  			</File>
  			<File

--- NEW FILE: MComboBox.cpp ---
// MComboBox.cpp : implementation file
//

#include "stdafx.h"
#include "Search.h"
#include ".\mcombobox.h"
#include "SearchDlg.h"
#include "SearchCtl.h"


// MComboBox

IMPLEMENT_DYNAMIC(CMComboBox, CComboBox)
CMComboBox::CMComboBox()
{
}

CMComboBox::~CMComboBox()
{
}


BEGIN_MESSAGE_MAP(CMComboBox, CComboBox)
	ON_WM_KEYDOWN()
END_MESSAGE_MAP()



// MComboBox message handlers


void CMComboBox::OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags)
{
	if( nChar == VK_TAB)
	{
		CWnd* nxt = 0;
		CSearchDlg* dlg = (CSearchDlg*) GetParent();
		if( dlg) nxt = dlg->GetNextDlgTabItem( this, ::GetKeyState( VK_SHIFT) < 0);
		if( nxt) {
			nxt->SetFocus();
			return;
		}
	}
	else if( nChar == VK_ESCAPE)
	{
		CSearchDlg *dlg = (CSearchDlg *) GetParent();
		if( dlg) dlg->getMyParent()->WantToBeClosed();
	}
	// TODO: Add your message handler code here and/or call default

	CComboBox::OnKeyDown(nChar, nRepCnt, nFlags);
}

Index: SearchDlg.h
===================================================================
RCS file: /project/gme-repository/GMESRC/GME/Search/SearchDlg.h,v
retrieving revision 1.10
retrieving revision 1.11
diff -C2 -d -r1.10 -r1.11
*** SearchDlg.h	2 May 2006 22:05:59 -0000	1.10
--- SearchDlg.h	4 Dec 2006 18:19:23 -0000	1.11
***************
*** 9,13 ****
  
  #include "ComHelp.h"
! 
  // SearchDlg.h : header file
  //
--- 9,16 ----
  
  #include "ComHelp.h"
! #include "MEdit.h"
! #include "MButton.h"
! #include "MComboBox.h"
! #include "MListCtrl.h"
  // SearchDlg.h : header file
  //
***************
*** 30,45 ****
  	void DisableSearch();					// must disable search functions
  
  // Dialog Data
  	//{{AFX_DATA(CSearchDlg)
  	enum { IDD = IDD_SEARCH_DIALOG };
  	CStatic	m_stcRefCtrl;
- 	CButton	m_chkRefCtrl;
  	CProgressCtrl	m_pgsSearch;
! 	CButton	m_chkAtomCtrl;
! 	CButton	m_chkSetCtrl;
! 	CButton	m_chkModCtrl;
! 	CComboBox	m_cmbCtrl;
! 	CButton	m_btnGO;
! 	CListCtrl	m_lstResults;
  	CString	m_edtName;
  	CString	m_edtKindName;
--- 33,48 ----
  	void DisableSearch();					// must disable search functions
  
+ 	inline CSearchCtrl* getMyParent() { return GetCtrl(); }
+ 	void clickGo();
+ 	void itemDblClicked();
+ 	void itemClicked();
+ 	void tabPressed( CWnd* pOriginator, bool bShift = false);
+ 
  // Dialog Data
  	//{{AFX_DATA(CSearchDlg)
  	enum { IDD = IDD_SEARCH_DIALOG };
  	CStatic	m_stcRefCtrl;
  	CProgressCtrl	m_pgsSearch;
! 
  	CString	m_edtName;
  	CString	m_edtKindName;
***************
*** 57,60 ****
--- 60,81 ----
  	BOOL	m_chkMatchCase;
  	CString	m_stcRef;
+ 
+ 	CMButton	m_chkSplSearchCtrl;
+ 	CMButton	m_chkLocateCtrl;
+ 	CMButton	m_chkMatchCaseCtrl;
+ 	CMButton	m_chkFullWordCtrl;
+ 	CMButton	m_chkRefCtrl;
+ 	CMButton	m_chkAtomCtrl;
+ 	CMButton	m_chkSetCtrl;
+ 	CMButton	m_chkModCtrl;
+ 	CMComboBox	m_cmbCtrl;
+ 	CMButton	m_btnGO;
+ 	CMListCtrl	m_lstResults;
+ 	CMEdit	m_edtNameCtrl;
+ 	CMEdit	m_edtKindNameCtrl;
+ 	CMEdit	m_edtRoleNameCtrl;
+ 	CMEdit	m_edtAttrNameCtrl;
+ 	CMEdit	m_edtAttrValueCtrl;
+ 
  	//}}AFX_DATA
  

--- NEW FILE: MEdit.cpp ---
// MEdit.cpp : implementation file
//

#include "stdafx.h"
#include "Search.h"
#include ".\medit.h"
#include "SearchDlg.h"
#include "SearchCtl.h"

// CMEdit

IMPLEMENT_DYNAMIC(CMEdit, CEdit)
CMEdit::CMEdit()
{
}

CMEdit::~CMEdit()
{
}


BEGIN_MESSAGE_MAP(CMEdit, CEdit)
	ON_WM_KEYDOWN()
END_MESSAGE_MAP()



// CMEdit message handlers


void CMEdit::OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags)
{
	CSearchDlg* dlg = (CSearchDlg*) GetParent();
	if( dlg) {
		if( nChar == VK_TAB)
		{
			dlg->tabPressed( this, ::GetKeyState( VK_SHIFT) < 0);
		}
		else if( nChar == VK_RETURN)
		{
			CWnd* nxt = 0;
			nxt = &dlg->m_lstResults;//nxt = &dlg->m_btnGO;
			if( nxt) 
			{
				dlg->clickGo();
				nxt->SetFocus();
				return;
			}
		}
		else if( nChar == VK_ESCAPE)
		{
			dlg->getMyParent()->WantToBeClosed();
		}
	}

	CEdit::OnKeyDown(nChar, nRepCnt, nFlags);
}



More information about the GME-commit mailing list