1 //####COPYRIGHTBEGIN####
3 // ----------------------------------------------------------------------------
4 // Copyright (C) 1998, 1999, 2000 Red Hat, Inc.
6 // This program is part of the eCos host tools.
8 // This program is free software; you can redistribute it and/or modify it
9 // under the terms of the GNU General Public License as published by the Free
10 // Software Foundation; either version 2 of the License, or (at your option)
13 // This program is distributed in the hope that it will be useful, but WITHOUT
14 // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
15 // FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
18 // You should have received a copy of the GNU General Public License along with
19 // this program; if not, write to the Free Software Foundation, Inc.,
20 // 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
22 // ----------------------------------------------------------------------------
24 //####COPYRIGHTEND####
25 // FindDialog.cpp : implementation file
28 //===========================================================================
29 //#####DESCRIPTIONBEGIN####
36 // Description: This overrides CFindDialog functions to customize the dialog
37 // for use in the configuration tool.
44 //####DESCRIPTIONEND####
46 //===========================================================================
49 #include "FindDialog.h"
50 #include "ConfigTool.h"
51 #include "ConfigToolDoc.h"
57 static char THIS_FILE[] = __FILE__;
60 /////////////////////////////////////////////////////////////////////////////
64 CFindDialog::CFindDialog()
65 : CFindReplaceDialog()
67 //{{AFX_DATA_INIT(CFindDialog)
68 // NOTE: the ClassWizard will add member initialization here
71 extern HINSTANCE heCosInstance;
72 m_fr.hInstance=heCosInstance;
74 m_fr.Flags |= FR_ENABLETEMPLATE;
75 m_fr.lpTemplateName=MAKEINTRESOURCE(IDD_FINDREPLACE);
78 CFindDialog::~CFindDialog()
82 void CFindDialog::DoDataExchange(CDataExchange* pDX)
84 CFindReplaceDialog::DoDataExchange(pDX);
85 //{{AFX_DATA_MAP(CFindDialog)
86 // NOTE: the ClassWizard will add DDX and DDV calls here
90 BOOL CFindDialog::OnInitDialog()
92 CFindReplaceDialog::OnInitDialog();
93 CComboBox *pCombo=(CComboBox *)GetDlgItem(IDC_SEARCHCOMBO);
94 pCombo->AddString(_T("Macro names"));
95 pCombo->AddString(_T("Item names"));
96 pCombo->AddString(_T("Short descriptions"));
97 pCombo->AddString(_T("Current Values"));
98 pCombo->AddString(_T("Default Values"));
99 pCombo->SetCurSel(m_nFindPos);
100 return TRUE; // return TRUE unless you set the focus to a control
101 // EXCEPTION: OCX Property Pages should return FALSE
104 BEGIN_MESSAGE_MAP(CFindDialog, CFindReplaceDialog)
105 //{{AFX_MSG_MAP(CFindDialog)
106 ON_CBN_SELCHANGE(IDC_SEARCHCOMBO, OnSelchangeSearchcombo)
110 /////////////////////////////////////////////////////////////////////////////
111 // CFindDialog message handlers
113 void CFindDialog::OnSelchangeSearchcombo()
115 m_nFindPos=(WhereType)((CComboBox *)GetDlgItem(IDC_SEARCHCOMBO))->GetCurSel();
118 BOOL CFindDialog::Create(LPCTSTR lpszFindWhat, DWORD dwFlags, WhereType where, CWnd* pParentWnd)
121 m_nIDHelp = AFX_IDD_FIND;
122 m_fr.Flags |= dwFlags;
124 ASSERT_VALID(pParentWnd);
125 m_fr.hwndOwner = pParentWnd->m_hWnd;
126 ASSERT(m_fr.hwndOwner != NULL); // must have a parent for modeless dialog
128 m_fr.wFindWhatLen = sizeof(m_szFindWhat);
130 int n=min(sizeof(m_szFindWhat)-1,_tcslen(lpszFindWhat));
131 _tcsncpy(m_szFindWhat, lpszFindWhat, n);
132 m_szFindWhat[n]=_TCHAR('\0');
134 AfxHookWindowCreate(this);
135 HWND hWnd = ::FindText(&m_fr);
136 if (!AfxUnhookWindowCreate()){
140 ASSERT(hWnd == NULL || hWnd == m_hWnd);