-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathFindDialog.cpp
111 lines (90 loc) · 2.54 KB
/
FindDialog.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
// FindDialog.cpp : implementation file
//
#include "stdafx.h"
#include "AlegrDiff.h"
#include "FindDialog.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CMyFindDialog dialog
CMyFindDialog::CMyFindDialog(CWnd* pParent /*=NULL*/)
: CUiUpdatedDlg(CMyFindDialog::IDD, pParent)
, m_SearchScope(0)
{
//{{AFX_DATA_INIT(CMyFindDialog)
m_bCaseSensitive = FALSE;
m_bWholeWord = FALSE;
m_FindDown = -1;
//}}AFX_DATA_INIT
}
void CMyFindDialog::DoDataExchange(CDataExchange* pDX)
{
CUiUpdatedDlg::DoDataExchange(pDX);
CThisApp * pApp = GetApp();
//{{AFX_DATA_MAP(CMyFindDialog)
DDX_Control(pDX, IDC_COMBO_FIND, m_FindCombo);
DDX_Check(pDX, IDC_CHECK_CASE, m_bCaseSensitive);
DDX_Radio(pDX, IDC_RADIO_UP, m_FindDown);
//}}AFX_DATA_MAP
m_FindCombo.SetExtendedUI(TRUE);
if (-1 != m_SearchScope)
{
if (0 == m_SearchScope)
{
EnableDlgItem(IDC_CHECK_WHOLE_WORD, FALSE);
CheckDlgButton(IDC_CHECK_WHOLE_WORD, FALSE);
}
else
{
DDX_Check(pDX, IDC_CHECK_WHOLE_WORD, m_bWholeWord);
}
}
else
{
// disable the controls
DDX_Check(pDX, IDC_CHECK_WHOLE_WORD, m_bWholeWord);
}
if ( ! pDX->m_bSaveAndValidate)
{
pApp->m_FindHistory.LoadCombo( & m_FindCombo);
}
DDX_CBString(pDX, IDC_COMBO_FIND, m_sFindCombo);
if (! pDX->m_bSaveAndValidate)
{
OnEditchangeComboFind();
}
}
BEGIN_MESSAGE_MAP(CMyFindDialog, CUiUpdatedDlg)
//{{AFX_MSG_MAP(CMyFindDialog)
ON_CBN_EDITCHANGE(IDC_COMBO_FIND, OnEditchangeComboFind)
//}}AFX_MSG_MAP
ON_BN_CLICKED(IDC_CHECK_WHOLE_WORD, OnBnClickedCheckWholeWord)
ON_CBN_SELCHANGE(IDC_COMBO_FIND, OnEditchangeComboFind)
ON_CBN_SELENDOK(IDC_COMBO_FIND, OnEditchangeComboFind)
ON_CBN_SELENDCANCEL(IDC_COMBO_FIND, OnEditchangeComboFind)
ON_CBN_CLOSEUP(IDC_COMBO_FIND, OnEditchangeComboFind)
ON_UPDATE_COMMAND_UI(IDC_CHECK_WHOLE_WORD, OnUpdateCheckWholeWord)
ON_UPDATE_COMMAND_UI(IDOK, OnUpdateOk)
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CMyFindDialog message handlers
void CMyFindDialog::OnEditchangeComboFind()
{
NeedUpdateControls();
}
void CMyFindDialog::OnUpdateCheckWholeWord(CCmdUI* pCmdUI)
{
pCmdUI->Enable(0 != m_SearchScope);
CheckDlgButton(IDC_CHECK_WHOLE_WORD, m_bWholeWord && 0 != m_SearchScope);
}
void CMyFindDialog::OnUpdateOk(CCmdUI* pCmdUI)
{
pCmdUI->Enable(0 != m_FindCombo.GetWindowTextLength());
}
void CMyFindDialog::OnBnClickedCheckWholeWord()
{
m_bWholeWord = IsDlgButtonChecked(IDC_CHECK_WHOLE_WORD);
}