-
Notifications
You must be signed in to change notification settings - Fork 30
/
Copy pathCRorEditView.cpp
168 lines (130 loc) · 3.49 KB
/
CRorEditView.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
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
#include "stdafx.h"
#include "editcmd.h"
#include "CRorEditView.h"
#include "CRorTextBuffer.h"
#ifndef __AFXPRIV_H__
#pragma message("Include <afxpriv.h> in your stdafx.h to avoid this message")
#include <afxpriv.h>
#endif
#ifndef __AFXOLE_H__
#pragma message("Include <afxole.h> in your stdafx.h to avoid this message")
#include <afxole.h>
#endif
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
#define DRAG_BORDER_X 5
#define DRAG_BORDER_Y 5
/////////////////////////////////////////////////////////////////////////////
// CRorEditView
IMPLEMENT_DYNCREATE(CRorEditView, CRorTextView)
CRorEditView::CRorEditView()
{
AFX_ZERO_INIT_OBJECT(CRorTextView);
}
CRorEditView::~CRorEditView()
{
}
BEGIN_MESSAGE_MAP(CRorEditView, CRorTextView)
//{{AFX_MSG_MAP(CRorEditView)
ON_WM_CHAR()
ON_WM_CREATE()
ON_WM_DESTROY()
ON_WM_LBUTTONDOWN()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CRorEditView message handlers
void CRorEditView::ResetView()
{
CRorTextView::ResetView();
}
BOOL CRorEditView::QueryEditable()
{
return FALSE;
}
void CRorEditView::OnChar(UINT nChar, UINT nRepCnt, UINT nFlags)
{
CRorTextView::OnChar(nChar, nRepCnt, nFlags);
if (nChar == 'i' || nChar == 'I')
{
static bool f = false;
f=!f;
if (f)
{
this->ResetView();
this->DeleteAll();
this->LocateTextBuffer()->m_xml.Clear();
g_EXE2C->prtout_itn(&this->m_pTextBuffer->m_xml);
this->Invalidate();
}
else
{
this->ResetView();
this->DeleteAll();
this->LocateTextBuffer()->m_xml.Clear();
g_EXE2C->prtout_cpp(&this->m_pTextBuffer->m_xml);
this->Invalidate();
}
return;
}
if ((::GetAsyncKeyState(VK_LBUTTON) & 0x8000) != 0 ||
(::GetAsyncKeyState(VK_RBUTTON) & 0x8000) != 0)
return;
BOOL bTranslated = FALSE;
if (nChar == VK_RETURN)
{
return;
}
if (nChar > 31)
{
}
}
int CRorEditView::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
if (CRorTextView::OnCreate(lpCreateStruct) == -1)
return -1;
return 0;
}
void CRorEditView::OnDestroy()
{
CRorTextView::OnDestroy();
}
/*void CRorEditView::OnDropSource(DROPEFFECT de)
{
if (! IsDraggingText())
return;
ASSERT_VALIDTEXTPOS(m_ptDraggedTextBegin);
ASSERT_VALIDTEXTPOS(m_ptDraggedTextEnd);
if (de == DROPEFFECT_MOVE)
{
m_pTextBuffer->DeleteText(this, m_ptDraggedTextBegin.y, m_ptDraggedTextBegin.x, m_ptDraggedTextEnd.y,
m_ptDraggedTextEnd.x, CE_ACTION_DRAGDROP); // [JRT]
}
} */
void CRorEditView::UpdateView()
{
//CRorTextView *pSource, CUpdateContext *pContext, DWORD dwFlags, int nLineIndex /*= -1*/
CRorTextView *pSource = NULL;
CUpdateContext *pContext = NULL;
DWORD dwFlags = UPDATE_RESET;
int nLineIndex = -1; /*= -1*/
CRorTextView::UpdateView(); //pSource, pContext, dwFlags, nLineIndex);
}
void CRorEditView::OnLButtonDown(UINT nFlags, CPoint point)
{
// TODO: Add your message handler code here and/or call default
// LPCTSTR pszLineChars = GetLineChars(point.y);
CRorTextView::OnLButtonDown(nFlags, point);
}
void CRorEditView::DeleteAll()
{
//add by bookaa
if (m_pTextBuffer)
{
m_pTextBuffer->FreeAll();
m_pTextBuffer->InitNew();
}
}