forked from apex-hughin/CrimsonEditor
-
Notifications
You must be signed in to change notification settings - Fork 0
/
AskReplaceDialog.cpp
127 lines (106 loc) · 2.52 KB
/
AskReplaceDialog.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
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
// AskReplaceDialog.cpp : implementation file
//
#include "stdafx.h"
#include "resource.h"
#include "AskReplaceDialog.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CAskReplaceDialog dialog
CAskReplaceDialog::CAskReplaceDialog(CWnd* pParent /*=NULL*/)
: CDialog(CAskReplaceDialog::IDD, pParent)
{
//{{AFX_DATA_INIT(CAskReplaceDialog)
// NOTE: the ClassWizard will add member initialization here
//}}AFX_DATA_INIT
}
void CAskReplaceDialog::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CAskReplaceDialog)
// NOTE: the ClassWizard will add DDX and DDV calls here
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CAskReplaceDialog, CDialog)
//{{AFX_MSG_MAP(CAskReplaceDialog)
ON_BN_CLICKED(IDYES, OnYes)
ON_BN_CLICKED(IDNO, OnNo)
ON_BN_CLICKED(ID_ALL, OnAll)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CAskReplaceDialog message handlers
BOOL CAskReplaceDialog::OnInitDialog()
{
CDialog::OnInitDialog();
RECT rect; GetWindowRect( & rect );
int width = rect.right - rect.left;
int height = rect.bottom - rect.top;
rect.left = m_ptInitialPos.x;
rect.top = m_ptInitialPos.y;
rect.right = rect.left + width;
rect.bottom = rect.top + height;
MoveWindow( & rect );
return TRUE;
}
void CAskReplaceDialog::OnYes()
{
m_bReplaceAll = FALSE;
m_bSearchNext = TRUE;
m_bSearchPrev = FALSE;
CDialog::OnOK();
}
void CAskReplaceDialog::OnNo()
{
m_bReplaceAll = FALSE;
m_bSearchNext = TRUE;
m_bSearchPrev = FALSE;
CDialog::OnCancel();
}
void CAskReplaceDialog::OnAll()
{
m_bReplaceAll = TRUE;
m_bSearchNext = FALSE;
m_bSearchPrev = FALSE;
CDialog::OnCancel();
}
void CAskReplaceDialog::OnOK()
{
m_bReplaceAll = FALSE;
m_bSearchNext = FALSE;
m_bSearchPrev = FALSE;
CDialog::OnOK();
}
void CAskReplaceDialog::OnCancel()
{
m_bReplaceAll = FALSE;
m_bSearchNext = FALSE;
m_bSearchPrev = FALSE;
CDialog::OnCancel();
}
BOOL CAskReplaceDialog::PreTranslateMessage(MSG* pMsg)
{
switch( pMsg->message ) {
case WM_KEYDOWN:
switch( pMsg->wParam ) {
case VK_F3:
if( GetKeyState(VK_SHIFT) & 0xF0 ) {
m_bReplaceAll = FALSE;
m_bSearchNext = FALSE;
m_bSearchPrev = TRUE;
CDialog::OnCancel();
} else {
m_bReplaceAll = FALSE;
m_bSearchNext = TRUE;
m_bSearchPrev = FALSE;
CDialog::OnCancel();
}
break;
}
break;
}
return CDialog::PreTranslateMessage(pMsg);
}