Mercurial > ecos
comparison host/tools/configtool/common/win32/FindDialog.cpp @ 76:435cced73e2f ecos-v1_3_1-release
eCos v1.3.1 merged from eCos master repository on 2000-03-27-23:22:51-BST
| author | jlarmour |
|---|---|
| date | Tue, 28 Mar 2000 14:10:45 +0000 |
| parents | |
| children | 74dbf4c3f2e1 |
comparison
equal
deleted
inserted
replaced
| 75:41bf073c0c32 | 76:435cced73e2f |
|---|---|
| 1 //####COPYRIGHTBEGIN#### | |
| 2 // | |
| 3 // ---------------------------------------------------------------------------- | |
| 4 // Copyright (C) 1998, 1999, 2000 Red Hat, Inc. | |
| 5 // | |
| 6 // This program is part of the eCos host tools. | |
| 7 // | |
| 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) | |
| 11 // any later version. | |
| 12 // | |
| 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 | |
| 16 // more details. | |
| 17 // | |
| 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. | |
| 21 // | |
| 22 // ---------------------------------------------------------------------------- | |
| 23 // | |
| 24 //####COPYRIGHTEND#### | |
| 25 // FindDialog.cpp : implementation file | |
| 26 // | |
| 27 // | |
| 28 //=========================================================================== | |
| 29 //#####DESCRIPTIONBEGIN#### | |
| 30 // | |
| 31 // Author(s): sdf | |
| 32 // Contact(s): sdf | |
| 33 // Date: 1998/08/11 | |
| 34 // Version: 0.01 | |
| 35 // Purpose: | |
| 36 // Description: This overrides CFindDialog functions to customize the dialog | |
| 37 // for use in the configuration tool. | |
| 38 // Requires: | |
| 39 // Provides: | |
| 40 // See also: | |
| 41 // Known bugs: | |
| 42 // Usage: | |
| 43 // | |
| 44 //####DESCRIPTIONEND#### | |
| 45 // | |
| 46 //=========================================================================== | |
| 47 | |
| 48 #include "stdafx.h" | |
| 49 #include "FindDialog.h" | |
| 50 #include "ConfigTool.h" | |
| 51 #include "ConfigToolDoc.h" | |
| 52 #include <afxpriv.h> | |
| 53 | |
| 54 #ifdef _DEBUG | |
| 55 #define new DEBUG_NEW | |
| 56 #undef THIS_FILE | |
| 57 static char THIS_FILE[] = __FILE__; | |
| 58 #endif | |
| 59 | |
| 60 ///////////////////////////////////////////////////////////////////////////// | |
| 61 // CFindDialog dialog | |
| 62 | |
| 63 | |
| 64 CFindDialog::CFindDialog() | |
| 65 : CFindReplaceDialog() | |
| 66 { | |
| 67 //{{AFX_DATA_INIT(CFindDialog) | |
| 68 // NOTE: the ClassWizard will add member initialization here | |
| 69 //}}AFX_DATA_INIT | |
| 70 #ifdef PLUGIN | |
| 71 extern HINSTANCE heCosInstance; | |
| 72 m_fr.hInstance=heCosInstance; | |
| 73 #endif | |
| 74 m_fr.Flags |= FR_ENABLETEMPLATE; | |
| 75 m_fr.lpTemplateName=MAKEINTRESOURCE(IDD_FINDREPLACE); | |
| 76 } | |
| 77 | |
| 78 CFindDialog::~CFindDialog() | |
| 79 { | |
| 80 } | |
| 81 | |
| 82 void CFindDialog::DoDataExchange(CDataExchange* pDX) | |
| 83 { | |
| 84 CFindReplaceDialog::DoDataExchange(pDX); | |
| 85 //{{AFX_DATA_MAP(CFindDialog) | |
| 86 // NOTE: the ClassWizard will add DDX and DDV calls here | |
| 87 //}}AFX_DATA_MAP | |
| 88 } | |
| 89 | |
| 90 BOOL CFindDialog::OnInitDialog() | |
| 91 { | |
| 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 | |
| 102 } | |
| 103 | |
| 104 BEGIN_MESSAGE_MAP(CFindDialog, CFindReplaceDialog) | |
| 105 //{{AFX_MSG_MAP(CFindDialog) | |
| 106 ON_CBN_SELCHANGE(IDC_SEARCHCOMBO, OnSelchangeSearchcombo) | |
| 107 //}}AFX_MSG_MAP | |
| 108 END_MESSAGE_MAP() | |
| 109 | |
| 110 ///////////////////////////////////////////////////////////////////////////// | |
| 111 // CFindDialog message handlers | |
| 112 | |
| 113 void CFindDialog::OnSelchangeSearchcombo() | |
| 114 { | |
| 115 m_nFindPos=(WhereType)((CComboBox *)GetDlgItem(IDC_SEARCHCOMBO))->GetCurSel(); | |
| 116 } | |
| 117 | |
| 118 BOOL CFindDialog::Create(LPCTSTR lpszFindWhat, DWORD dwFlags, WhereType where, CWnd* pParentWnd) | |
| 119 { | |
| 120 m_nFindPos=where; | |
| 121 m_nIDHelp = AFX_IDD_FIND; | |
| 122 m_fr.Flags |= dwFlags; | |
| 123 | |
| 124 ASSERT_VALID(pParentWnd); | |
| 125 m_fr.hwndOwner = pParentWnd->m_hWnd; | |
| 126 ASSERT(m_fr.hwndOwner != NULL); // must have a parent for modeless dialog | |
| 127 | |
| 128 m_fr.wFindWhatLen = sizeof(m_szFindWhat); | |
| 129 | |
| 130 int n=min(sizeof(m_szFindWhat)-1,_tcslen(lpszFindWhat)); | |
| 131 _tcsncpy(m_szFindWhat, lpszFindWhat, n); | |
| 132 m_szFindWhat[n]=_TCHAR('\0'); | |
| 133 | |
| 134 AfxHookWindowCreate(this); | |
| 135 HWND hWnd = ::FindText(&m_fr); | |
| 136 if (!AfxUnhookWindowCreate()){ | |
| 137 PostNcDestroy(); | |
| 138 } | |
| 139 | |
| 140 ASSERT(hWnd == NULL || hWnd == m_hWnd); | |
| 141 return hWnd != NULL; | |
| 142 } |
