ReactOS 0.4.15-dev-5666-gc548b97
CTextEditWindow Class Reference

#include <textedit.h>

Inheritance diagram for CTextEditWindow:
Collaboration diagram for CTextEditWindow:

Public Member Functions

 CTextEditWindow ()
 
HWND Create (HWND hwndParent)
 
void DoFillBack (HWND hwnd, HDC hDC)
 
void FixEditPos (LPCTSTR pszOldText)
 
void InvalidateEditRect ()
 
void UpdateFont ()
 
BOOL GetEditRect (LPRECT prc) const
 
void ValidateEditRect (LPCRECT prc OPTIONAL)
 
HFONT GetFont () const
 
 MESSAGE_HANDLER (WM_NCCALCSIZE, OnNCCalcSize)
 
 MESSAGE_HANDLER (WM_NCHITTEST, OnNCHitTest)
 
 MESSAGE_HANDLER (WM_SETCURSOR, OnSetCursor)
 
 MESSAGE_HANDLER (WM_MOVE, OnMove)
 
 MESSAGE_HANDLER (WM_SIZE, OnSize)
 
 MESSAGE_HANDLER (WM_LBUTTONDOWN, OnLButtonDown)
 
 MESSAGE_HANDLER (EM_SETSEL, OnSetSel)
 
 MESSAGE_HANDLER (WM_MOUSEWHEEL, OnMouseWheel)
 
LRESULT OnCreate (UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
 
LRESULT OnClose (UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
 
LRESULT OnToolsModelToolChanged (UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
 
LRESULT OnToolsModelSettingsChanged (UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
 
LRESULT OnToolsModelZoomChanged (UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
 
LRESULT OnPaletteModelColorChanged (UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
 
LRESULT OnChar (UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
 
LRESULT OnKeyDown (UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
 
LRESULT OnLButtonDown (UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
 
LRESULT OnEraseBkGnd (UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
 
LRESULT OnPaint (UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
 
LRESULT OnNCPaint (UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
 
LRESULT OnNCCalcSize (UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
 
LRESULT OnNCHitTest (UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
 
LRESULT OnSetCursor (UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
 
LRESULT OnMove (UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
 
LRESULT OnSize (UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
 
LRESULT OnSetSel (UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
 
LRESULT OnMouseWheel (UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
 

Protected Member Functions

INT DoHitTest (RECT &rc, POINT pt)
 
void DrawGrip (HDC hDC, RECT &rc)
 
void Reposition ()
 

Protected Attributes

HWND m_hwndParent
 
HFONT m_hFont
 
HFONT m_hFontZoomed
 
LONG m_nAppIsMovingOrSizing
 
RECT m_rc
 

Detailed Description

Definition at line 14 of file textedit.h.

Constructor & Destructor Documentation

◆ CTextEditWindow()

CTextEditWindow::CTextEditWindow ( )

Definition at line 17 of file textedit.cpp.

18{
20}
HFONT m_hFontZoomed
Definition: textedit.h:73
LONG m_nAppIsMovingOrSizing
Definition: textedit.h:74
HFONT m_hFont
Definition: textedit.h:72
#define NULL
Definition: types.h:112
BOOL WINAPI SetRectEmpty(_Out_ LPRECT)

Member Function Documentation

◆ Create()

HWND CTextEditWindow::Create ( HWND  hwndParent)

Definition at line 297 of file textedit.cpp.

298{
300
303 HWND hwnd = ::CreateWindowEx(0, WC_EDIT, NULL, style, 0, 0, 0, 0,
305 if (hwnd)
306 {
307#undef SubclassWindow // Don't use this macro
309
310 UpdateFont();
311
312 PostMessage(WM_SIZE, 0, 0);
313 }
314
315 return m_hWnd;
316}
Arabic default style
Definition: afstyles.h:94
HWND m_hwndParent
Definition: textedit.h:71
void UpdateFont()
Definition: textedit.cpp:402
static HWND hwndParent
Definition: cryptui.c:300
unsigned long DWORD
Definition: ntddk_ex.h:95
HINSTANCE hProgInstance
Definition: main.cpp:50
#define WS_CHILD
Definition: pedump.c:617
#define ES_AUTOVSCROLL
Definition: pedump.c:671
#define ES_WANTRETURN
Definition: pedump.c:676
#define ES_LEFT
Definition: pedump.c:664
#define ES_MULTILINE
Definition: pedump.c:667
#define WS_THICKFRAME
Definition: pedump.c:630
#define WC_EDIT
Definition: commctrl.h:4689
_In_ LONG _In_ HWND hwnd
Definition: winddi.h:4023
#define SubclassWindow(hwnd, lpfn)
Definition: windowsx.h:542
#define CreateWindowEx
Definition: winuser.h:5745
#define WM_SIZE
Definition: winuser.h:1601
#define PostMessage
Definition: winuser.h:5822

Referenced by TextTool::OnButtonDown(), and TextTool::OnButtonUp().

◆ DoFillBack()

void CTextEditWindow::DoFillBack ( HWND  hwnd,
HDC  hDC 
)

Definition at line 318 of file textedit.cpp.

319{
321 return;
322
323 RECT rc;
324 SendMessage(EM_GETRECT, 0, (LPARAM)&rc);
325 MapWindowPoints(hwnd, (LPPOINT)&rc, 2);
326
328 FillRect(hDC, &rc, hbr);
329 DeleteObject(hbr);
330}
static HDC hDC
Definition: 3dtext.c:33
COLORREF GetBgColor() const
BOOL IsBackgroundTransparent() const
Definition: toolsmodel.cpp:135
pKey DeleteObject()
ToolsModel toolsModel
Definition: main.cpp:18
PaletteModel paletteModel
Definition: main.cpp:28
LONG_PTR LPARAM
Definition: windef.h:208
int WINAPI FillRect(HDC, LPCRECT, HBRUSH)
HBRUSH WINAPI CreateSolidBrush(_In_ COLORREF)
#define EM_GETRECT
Definition: winuser.h:1986
int WINAPI MapWindowPoints(_In_opt_ HWND hWndFrom, _In_opt_ HWND hWndTo, _Inout_updates_(cPoints) LPPOINT lpPoints, _In_ UINT cPoints)
#define SendMessage
Definition: winuser.h:5833

◆ DoHitTest()

INT CTextEditWindow::DoHitTest ( RECT rc,
POINT  pt 
)
protected

Definition at line 37 of file textedit.cpp.

38{
39 RECT rcGrip;
40
41 SetRect(&rcGrip, RECT0);
42 if (PtInRect(&rcGrip, pt))
43 return HTTOPLEFT;
44 SetRect(&rcGrip, RECT1);
45 if (PtInRect(&rcGrip, pt))
46 return HTTOP;
47 SetRect(&rcGrip, RECT2);
48 if (PtInRect(&rcGrip, pt))
49 return HTTOPRIGHT;
50
51 SetRect(&rcGrip, RECT3);
52 if (PtInRect(&rcGrip, pt))
53 return HTLEFT;
54 SetRect(&rcGrip, RECT4);
55 if (PtInRect(&rcGrip, pt))
56 return HTRIGHT;
57
58 SetRect(&rcGrip, RECT5);
59 if (PtInRect(&rcGrip, pt))
60 return HTBOTTOMLEFT;
61 SetRect(&rcGrip, RECT6);
62 if (PtInRect(&rcGrip, pt))
63 return HTBOTTOM;
64 SetRect(&rcGrip, RECT7);
65 if (PtInRect(&rcGrip, pt))
66 return HTBOTTOMRIGHT;
67
68 // On border line?
69 RECT rcInner = rc;
70 InflateRect(&rcInner, -3, -3);
71 if (!PtInRect(&rcInner, pt) && PtInRect(&rc, pt))
72 return HTCAPTION;
73
74 return HTCLIENT;
75}
#define pt(x, y)
Definition: drawing.c:79
#define RECT4
Definition: textedit.cpp:32
#define RECT7
Definition: textedit.cpp:35
#define RECT5
Definition: textedit.cpp:33
#define RECT3
Definition: textedit.cpp:31
#define RECT2
Definition: textedit.cpp:30
#define RECT1
Definition: textedit.cpp:29
#define RECT6
Definition: textedit.cpp:34
#define RECT0
Definition: textedit.cpp:28
#define HTTOPRIGHT
Definition: winuser.h:2482
#define HTCAPTION
Definition: winuser.h:2466
#define HTTOPLEFT
Definition: winuser.h:2481
#define HTBOTTOM
Definition: winuser.h:2483
BOOL WINAPI PtInRect(_In_ LPCRECT, _In_ POINT)
#define HTRIGHT
Definition: winuser.h:2479
#define HTCLIENT
Definition: winuser.h:2465
#define HTBOTTOMRIGHT
Definition: winuser.h:2485
#define HTBOTTOMLEFT
Definition: winuser.h:2484
#define HTTOP
Definition: winuser.h:2480
#define HTLEFT
Definition: winuser.h:2477
BOOL WINAPI InflateRect(_Inout_ LPRECT, _In_ int, _In_ int)
BOOL WINAPI SetRect(_Out_ LPRECT, _In_ int, _In_ int, _In_ int, _In_ int)

Referenced by OnNCHitTest().

◆ DrawGrip()

void CTextEditWindow::DrawGrip ( HDC  hDC,
RECT rc 
)
protected

Definition at line 77 of file textedit.cpp.

78{
81 HGDIOBJ hPenOld = SelectObject(hDC, hPen);
82 InflateRect(&rc, -1, -1);
83 Rectangle(hDC, rc.left, rc.top, rc.right, rc.bottom);
84 InflateRect(&rc, 1, 1);
85 SelectObject(hDC, hPenOld);
86 SelectObject(hDC, hbrOld);
87 DeleteObject(hPen);
88
89 RECT rcGrip;
90 HBRUSH hbrHighlight = GetSysColorBrush(COLOR_HIGHLIGHT);
91
92 SetRect(&rcGrip, RECT0);
93 FillRect(hDC, &rcGrip, hbrHighlight);
94 SetRect(&rcGrip, RECT1);
95 FillRect(hDC, &rcGrip, hbrHighlight);
96 SetRect(&rcGrip, RECT2);
97 FillRect(hDC, &rcGrip, hbrHighlight);
98
99 SetRect(&rcGrip, RECT3);
100 FillRect(hDC, &rcGrip, hbrHighlight);
101 SetRect(&rcGrip, RECT4);
102 FillRect(hDC, &rcGrip, hbrHighlight);
103
104 SetRect(&rcGrip, RECT5);
105 FillRect(hDC, &rcGrip, hbrHighlight);
106 SetRect(&rcGrip, RECT6);
107 FillRect(hDC, &rcGrip, hbrHighlight);
108 SetRect(&rcGrip, RECT7);
109 FillRect(hDC, &rcGrip, hbrHighlight);
110}
LONG right
Definition: windef.h:308
LONG bottom
Definition: windef.h:309
LONG top
Definition: windef.h:307
LONG left
Definition: windef.h:306
HGDIOBJ WINAPI GetStockObject(_In_ int)
#define PS_DOT
Definition: wingdi.h:588
HGDIOBJ WINAPI SelectObject(_In_ HDC, _In_ HGDIOBJ)
Definition: dc.c:1539
#define NULL_BRUSH
Definition: wingdi.h:901
BOOL WINAPI Rectangle(_In_ HDC, _In_ int, _In_ int, _In_ int, _In_ int)
HPEN WINAPI CreatePen(_In_ int, _In_ int, _In_ COLORREF)
DWORD WINAPI GetSysColor(_In_ int)
#define COLOR_HIGHLIGHT
Definition: winuser.h:920
HBRUSH WINAPI GetSysColorBrush(_In_ int)

Referenced by OnNCPaint(), and OnPaint().

◆ FixEditPos()

void CTextEditWindow::FixEditPos ( LPCTSTR  pszOldText)

Definition at line 112 of file textedit.cpp.

113{
114 CString szText;
115 GetWindowText(szText);
116
117 RECT rcParent;
118 ::GetWindowRect(m_hwndParent, &rcParent);
119
120 RECT rc, rcWnd, rcText;
121 GetWindowRect(&rcWnd);
122 rcText = rcWnd;
123
124 HDC hDC = GetDC();
125 if (hDC)
126 {
130 szText += TEXT("x"); // This is a trick to enable the last newlines
131 const UINT uFormat = DT_LEFT | DT_TOP | DT_EDITCONTROL | DT_NOPREFIX | DT_NOCLIP |
133 DrawText(hDC, szText, -1, &rcText, uFormat | DT_CALCRECT);
134 if (tm.tmDescent > 0)
135 rcText.bottom += tm.tmDescent;
136 ReleaseDC(hDC);
137 }
138
139 UnionRect(&rc, &rcText, &rcWnd);
141
142 rcWnd = rc;
143 ::GetClientRect(m_hwndParent, &rcParent);
144 IntersectRect(&rc, &rcParent, &rcWnd);
145
147 MoveWindow(rc.left, rc.top, rc.right - rc.left, rc.bottom - rc.top, FALSE);
149
152
154}
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define TEXT(s)
Definition: k32.h:26
static HDC
Definition: imagelist.c:92
unsigned int UINT
Definition: ndis.h:50
#define DefWindowProc
Definition: ros2win.h:31
Definition: time.h:68
#define GetTextMetrics
Definition: wingdi.h:4474
int WINAPI ReleaseDC(_In_opt_ HWND, _In_ HDC)
#define DT_NOPREFIX
Definition: winuser.h:537
#define WM_HSCROLL
Definition: winuser.h:1733
#define WM_VSCROLL
Definition: winuser.h:1734
BOOL WINAPI GetWindowRect(_In_ HWND, _Out_ LPRECT)
#define SB_LEFT
Definition: winuser.h:575
#define DT_NOCLIP
Definition: winuser.h:536
#define DrawText
Definition: winuser.h:5761
#define DT_LEFT
Definition: winuser.h:534
BOOL WINAPI GetClientRect(_In_ HWND, _Out_ LPRECT)
#define DT_TOP
Definition: winuser.h:542
#define DT_WORDBREAK
Definition: winuser.h:544
BOOL WINAPI IntersectRect(_Out_ LPRECT, _In_ LPCRECT, _In_ LPCRECT)
HDC WINAPI GetDC(_In_opt_ HWND)
#define GetWindowText
Definition: winuser.h:5788
#define SB_TOP
Definition: winuser.h:578
BOOL WINAPI InvalidateRect(_In_opt_ HWND, _In_opt_ LPCRECT, _In_ BOOL)
#define DT_EXPANDTABS
Definition: winuser.h:532
#define DT_CALCRECT
Definition: winuser.h:526
BOOL WINAPI UnionRect(_Out_ LPRECT, _In_ LPCRECT, _In_ LPCRECT)
#define DT_EDITCONTROL
Definition: winuser.h:528
BOOL WINAPI MoveWindow(_In_ HWND, _In_ int, _In_ int, _In_ int, _In_ int, _In_ BOOL)

Referenced by OnChar(), OnKeyDown(), and UpdateFont().

◆ GetEditRect()

BOOL CTextEditWindow::GetEditRect ( LPRECT  prc) const

Definition at line 453 of file textedit.cpp.

454{
455 *prc = m_rc;
456 return TRUE;
457}
_Out_ LPRECT prc
Definition: ntgdi.h:1658

Referenced by TextTool::OnButtonUp().

◆ GetFont()

HFONT CTextEditWindow::GetFont ( ) const
inline

Definition at line 26 of file textedit.h.

26{ return m_hFont; }

Referenced by TextTool::OnButtonUp().

◆ InvalidateEditRect()

void CTextEditWindow::InvalidateEditRect ( )

Definition at line 354 of file textedit.cpp.

355{
356 RECT rc;
357 GetWindowRect(&rc);
360
361 GetClientRect(&rc);
363 rc.left = UnZoomed(rc.left);
364 rc.top = UnZoomed(rc.top);
365 rc.right = UnZoomed(rc.right);
366 rc.bottom = UnZoomed(rc.bottom);
367 m_rc = rc;
368}
static int UnZoomed(int xy)
Definition: common.h:42
CImgAreaWindow imageArea
Definition: main.cpp:72

Referenced by TextTool::OnButtonUp(), OnMove(), OnSetSel(), and OnSize().

◆ MESSAGE_HANDLER() [1/8]

CTextEditWindow::MESSAGE_HANDLER ( EM_SETSEL  ,
OnSetSel   
)

◆ MESSAGE_HANDLER() [2/8]

CTextEditWindow::MESSAGE_HANDLER ( WM_LBUTTONDOWN  ,
OnLButtonDown   
)

◆ MESSAGE_HANDLER() [3/8]

CTextEditWindow::MESSAGE_HANDLER ( WM_MOUSEWHEEL  ,
OnMouseWheel   
)

◆ MESSAGE_HANDLER() [4/8]

CTextEditWindow::MESSAGE_HANDLER ( WM_MOVE  ,
OnMove   
)

◆ MESSAGE_HANDLER() [5/8]

CTextEditWindow::MESSAGE_HANDLER ( WM_NCCALCSIZE  ,
OnNCCalcSize   
)

◆ MESSAGE_HANDLER() [6/8]

CTextEditWindow::MESSAGE_HANDLER ( WM_NCHITTEST  ,
OnNCHitTest   
)

◆ MESSAGE_HANDLER() [7/8]

CTextEditWindow::MESSAGE_HANDLER ( WM_SETCURSOR  ,
OnSetCursor   
)

◆ MESSAGE_HANDLER() [8/8]

CTextEditWindow::MESSAGE_HANDLER ( WM_SIZE  ,
OnSize   
)

◆ OnChar()

LRESULT CTextEditWindow::OnChar ( UINT  nMsg,
WPARAM  wParam,
LPARAM  lParam,
BOOL bHandled 
)

Definition at line 156 of file textedit.cpp.

157{
158 if (wParam == VK_TAB)
159 return 0; // FIXME: Tabs
160
161 CString szText;
162 GetWindowText(szText);
163
165 FixEditPos(szText);
166
167 return ret;
168}
void FixEditPos(LPCTSTR pszOldText)
Definition: textedit.cpp:112
WPARAM wParam
Definition: combotst.c:138
LPARAM lParam
Definition: combotst.c:139
int ret
LONG_PTR LRESULT
Definition: windef.h:209
#define VK_TAB
Definition: winuser.h:2189

◆ OnClose()

LRESULT CTextEditWindow::OnClose ( UINT  nMsg,
WPARAM  wParam,
LPARAM  lParam,
BOOL bHandled 
)

Definition at line 338 of file textedit.cpp.

339{
341 if (m_hFont)
342 {
344 m_hFont = NULL;
345 }
346 if (m_hFontZoomed)
347 {
350 }
351 return 0;
352}
#define SW_HIDE
Definition: winuser.h:762
BOOL WINAPI ShowWindow(_In_ HWND, _In_ int)

◆ OnCreate()

LRESULT CTextEditWindow::OnCreate ( UINT  nMsg,
WPARAM  wParam,
LPARAM  lParam,
BOOL bHandled 
)

Definition at line 332 of file textedit.cpp.

333{
334 UpdateFont();
335 return 0;
336}

◆ OnEraseBkGnd()

LRESULT CTextEditWindow::OnEraseBkGnd ( UINT  nMsg,
WPARAM  wParam,
LPARAM  lParam,
BOOL bHandled 
)

Definition at line 194 of file textedit.cpp.

195{
196 HDC hDC = (HDC)wParam;
198 {
199 RECT rc;
200 GetClientRect(&rc);
202 FillRect(hDC, &rc, hbr);
203 DeleteObject(hbr);
204 }
206 return TRUE;
207}
COLORREF GetFgColor() const
COLORREF WINAPI SetTextColor(_In_ HDC, _In_ COLORREF)
Definition: text.c:918

◆ OnKeyDown()

LRESULT CTextEditWindow::OnKeyDown ( UINT  nMsg,
WPARAM  wParam,
LPARAM  lParam,
BOOL bHandled 
)

Definition at line 170 of file textedit.cpp.

171{
172 if (wParam == VK_ESCAPE)
173 {
175 return 0;
176 }
177
178 CString szText;
179 GetWindowText(szText);
180
182 FixEditPos(szText);
183 return ret;
184}
void OnCancelDraw()
Definition: toolsmodel.cpp:215
#define VK_ESCAPE
Definition: winuser.h:2204

◆ OnLButtonDown()

LRESULT CTextEditWindow::OnLButtonDown ( UINT  nMsg,
WPARAM  wParam,
LPARAM  lParam,
BOOL bHandled 
)

Definition at line 186 of file textedit.cpp.

187{
191 return ret;
192}

◆ OnMouseWheel()

LRESULT CTextEditWindow::OnMouseWheel ( UINT  nMsg,
WPARAM  wParam,
LPARAM  lParam,
BOOL bHandled 
)

Definition at line 508 of file textedit.cpp.

509{
510 return ::SendMessage(GetParent(), nMsg, wParam, lParam);
511}
HWND WINAPI GetParent(_In_ HWND)

◆ OnMove()

LRESULT CTextEditWindow::OnMove ( UINT  nMsg,
WPARAM  wParam,
LPARAM  lParam,
BOOL bHandled 
)

Definition at line 266 of file textedit.cpp.

267{
269
270 if (m_nAppIsMovingOrSizing == 0)
271 {
272 Reposition();
274 }
275 return ret;
276}
void InvalidateEditRect()
Definition: textedit.cpp:354
void Reposition()
Definition: textedit.cpp:471

◆ OnNCCalcSize()

LRESULT CTextEditWindow::OnNCCalcSize ( UINT  nMsg,
WPARAM  wParam,
LPARAM  lParam,
BOOL bHandled 
)

Definition at line 242 of file textedit.cpp.

243{
244 return 0; // No frame.
245}

◆ OnNCHitTest()

LRESULT CTextEditWindow::OnNCHitTest ( UINT  nMsg,
WPARAM  wParam,
LPARAM  lParam,
BOOL bHandled 
)

Definition at line 247 of file textedit.cpp.

248{
250 RECT rc;
251 GetWindowRect(&rc);
252 return DoHitTest(rc, pt);
253}
INT DoHitTest(RECT &rc, POINT pt)
Definition: textedit.cpp:37
#define GET_Y_LPARAM(lp)
Definition: windowsx.h:300
#define GET_X_LPARAM(lp)
Definition: windowsx.h:299

◆ OnNCPaint()

LRESULT CTextEditWindow::OnNCPaint ( UINT  nMsg,
WPARAM  wParam,
LPARAM  lParam,
BOOL bHandled 
)

Definition at line 226 of file textedit.cpp.

227{
228 RECT rc;
229 GetWindowRect(&rc);
230
232 if (hDC)
233 {
234 OffsetRect(&rc, -rc.left, -rc.top);
235 DrawGrip(hDC, rc);
236 ReleaseDC(hDC);
237 }
238
239 return 0;
240}
void DrawGrip(HDC hDC, RECT &rc)
Definition: textedit.cpp:77
#define DCX_WINDOW
Definition: winuser.h:2103
HDC WINAPI GetDCEx(_In_opt_ HWND, _In_opt_ HRGN, _In_ DWORD)
#define DCX_PARENTCLIP
Definition: winuser.h:2105
BOOL WINAPI OffsetRect(_Inout_ LPRECT, _In_ int, _In_ int)

◆ OnPaint()

LRESULT CTextEditWindow::OnPaint ( UINT  nMsg,
WPARAM  wParam,
LPARAM  lParam,
BOOL bHandled 
)

Definition at line 209 of file textedit.cpp.

210{
211 RECT rc;
212 GetClientRect(&rc);
213
215
216 HDC hDC = GetDC();
217 if (hDC)
218 {
219 DrawGrip(hDC, rc);
220 ReleaseDC(hDC);
221 }
222
223 return 0;
224}

◆ OnPaletteModelColorChanged()

LRESULT CTextEditWindow::OnPaletteModelColorChanged ( UINT  nMsg,
WPARAM  wParam,
LPARAM  lParam,
BOOL bHandled 
)

Definition at line 370 of file textedit.cpp.

371{
372 UpdateFont();
373 return 0;
374}

◆ OnSetCursor()

LRESULT CTextEditWindow::OnSetCursor ( UINT  nMsg,
WPARAM  wParam,
LPARAM  lParam,
BOOL bHandled 
)

Definition at line 255 of file textedit.cpp.

256{
257 UINT nHitTest = LOWORD(lParam);
258 if (nHitTest == HTCAPTION)
259 {
261 return FALSE;
262 }
263 return DefWindowProc(nMsg, wParam, lParam);
264}
#define LOWORD(l)
Definition: pedump.c:82
HCURSOR WINAPI SetCursor(_In_opt_ HCURSOR)
#define IDC_SIZEALL
Definition: winuser.h:691
#define LoadCursor
Definition: winuser.h:5802

◆ OnSetSel()

LRESULT CTextEditWindow::OnSetSel ( UINT  nMsg,
WPARAM  wParam,
LPARAM  lParam,
BOOL bHandled 
)

Definition at line 444 of file textedit.cpp.

445{
450 return ret;
451}

◆ OnSize()

LRESULT CTextEditWindow::OnSize ( UINT  nMsg,
WPARAM  wParam,
LPARAM  lParam,
BOOL bHandled 
)

Definition at line 278 of file textedit.cpp.

279{
281
282 RECT rc;
283 GetClientRect(&rc);
286
287 if (m_nAppIsMovingOrSizing == 0)
288 {
289 Reposition();
291 }
292
293 return ret;
294}
#define MAKELONG(a, b)
Definition: typedefs.h:249
#define EC_RIGHTMARGIN
Definition: winuser.h:2597
#define EM_SETRECTNP
Definition: winuser.h:2007
#define EC_LEFTMARGIN
Definition: winuser.h:2596
#define EM_SETMARGINS
Definition: winuser.h:2002

◆ OnToolsModelSettingsChanged()

LRESULT CTextEditWindow::OnToolsModelSettingsChanged ( UINT  nMsg,
WPARAM  wParam,
LPARAM  lParam,
BOOL bHandled 
)

Definition at line 376 of file textedit.cpp.

377{
378 UpdateFont();
379 return 0;
380}

◆ OnToolsModelToolChanged()

LRESULT CTextEditWindow::OnToolsModelToolChanged ( UINT  nMsg,
WPARAM  wParam,
LPARAM  lParam,
BOOL bHandled 
)

Definition at line 389 of file textedit.cpp.

390{
391 if (wParam == TOOL_TEXT)
392 {
393 UpdateFont();
394 }
395 else
396 {
398 }
399 return 0;
400}
@ TOOL_TEXT
Definition: toolsmodel.h:22

◆ OnToolsModelZoomChanged()

LRESULT CTextEditWindow::OnToolsModelZoomChanged ( UINT  nMsg,
WPARAM  wParam,
LPARAM  lParam,
BOOL bHandled 
)

Definition at line 382 of file textedit.cpp.

383{
384 UpdateFont();
386 return 0;
387}
void ValidateEditRect(LPCRECT prc OPTIONAL)
Definition: textedit.cpp:459

◆ Reposition()

void CTextEditWindow::Reposition ( )
protected

Definition at line 471 of file textedit.cpp.

472{
473 RECT rc, rcImage;
474 GetWindowRect(&rc);
475
477 imageArea.GetClientRect(&rcImage);
478
479 if (rc.bottom > rcImage.bottom)
480 {
481 rc.top = rcImage.bottom - (rc.bottom - rc.top);
482 rc.bottom = rcImage.bottom;
483 }
484
485 if (rc.right > rcImage.right)
486 {
487 rc.left = rcImage.right - (rc.right - rc.left);
488 rc.right = rcImage.right;
489 }
490
491 if (rc.left < 0)
492 {
493 rc.right += -rc.left;
494 rc.left = 0;
495 }
496
497 if (rc.top < 0)
498 {
499 rc.bottom += -rc.top;
500 rc.top = 0;
501 }
502
504 MoveWindow(rc.left, rc.top, rc.right - rc.left, rc.bottom - rc.top, TRUE);
506}
BOOL GetClientRect(LPRECT lpRect) const
Definition: atlwin.h:535

Referenced by OnMove(), and OnSize().

◆ UpdateFont()

void CTextEditWindow::UpdateFont ( )

Definition at line 402 of file textedit.cpp.

403{
404 if (m_hFont)
405 {
407 m_hFont = NULL;
408 }
409 if (m_hFontZoomed)
410 {
413 }
414
415 LOGFONT lf;
416 ZeroMemory(&lf, sizeof(lf));
417 lf.lfCharSet = DEFAULT_CHARSET; // registrySettings.CharSet; // Ignore
422
423 HDC hdc = GetDC();
424 if (hdc)
425 {
426 INT nFontSize = registrySettings.PointSize;
427 lf.lfHeight = -MulDiv(nFontSize, GetDeviceCaps(hdc, LOGPIXELSY), 72);
428 ReleaseDC(hdc);
429 }
430
432
433 lf.lfHeight = Zoomed(lf.lfHeight);
435
438
440
441 Invalidate();
442}
static int Zoomed(int xy)
Definition: common.h:37
DWORD PointSize
Definition: registry.h:36
CString strFontName
Definition: registry.h:35
DWORD Underline
Definition: registry.h:39
RegistrySettings registrySettings
Definition: main.cpp:30
HDC hdc
Definition: main.c:9
INT WINAPI MulDiv(INT nNumber, INT nNumerator, INT nDenominator)
Definition: muldiv.c:25
#define _countof(array)
Definition: sndvol32.h:68
BYTE lfUnderline
Definition: dimm.idl:48
BYTE lfItalic
Definition: dimm.idl:47
LONG lfHeight
Definition: dimm.idl:42
BYTE lfCharSet
Definition: dimm.idl:50
LONG lfWeight
Definition: dimm.idl:46
CHAR lfFaceName[LF_FACESIZE]
Definition: dimm.idl:55
int32_t INT
Definition: typedefs.h:58
#define lstrcpyn
Definition: winbase.h:3746
#define ZeroMemory
Definition: winbase.h:1670
#define SetWindowFont(hwnd, hfont, fRedraw)
Definition: windowsx.h:533
int WINAPI GetDeviceCaps(_In_opt_ HDC, _In_ int)
#define FW_BOLD
Definition: wingdi.h:378
#define LOGPIXELSY
Definition: wingdi.h:719
#define DEFAULT_CHARSET
Definition: wingdi.h:384
#define FW_NORMAL
Definition: wingdi.h:373
#define CreateFontIndirect
Definition: wingdi.h:4444

Referenced by Create(), OnCreate(), OnPaletteModelColorChanged(), OnToolsModelSettingsChanged(), OnToolsModelToolChanged(), and OnToolsModelZoomChanged().

◆ ValidateEditRect()

void CTextEditWindow::ValidateEditRect ( LPCRECT prc  OPTIONAL)

Definition at line 459 of file textedit.cpp.

460{
461 if (prc)
462 m_rc = *prc;
465
467 MoveWindow(x0, y0, x1 - x0, y1 - y0, TRUE);
469}
GLint y0
Definition: linetemp.h:96
GLint x0
Definition: linetemp.h:95
_In_ CLIPOBJ _In_ BRUSHOBJ _In_ LONG _In_ LONG y1
Definition: winddi.h:3709
_In_ CLIPOBJ _In_ BRUSHOBJ _In_ LONG x1
Definition: winddi.h:3708

Referenced by TextTool::OnButtonUp(), and OnToolsModelZoomChanged().

Member Data Documentation

◆ m_hFont

HFONT CTextEditWindow::m_hFont
protected

Definition at line 72 of file textedit.h.

Referenced by GetFont(), OnClose(), and UpdateFont().

◆ m_hFontZoomed

HFONT CTextEditWindow::m_hFontZoomed
protected

Definition at line 73 of file textedit.h.

Referenced by FixEditPos(), OnClose(), and UpdateFont().

◆ m_hwndParent

HWND CTextEditWindow::m_hwndParent
protected

Definition at line 71 of file textedit.h.

Referenced by Create(), FixEditPos(), and InvalidateEditRect().

◆ m_nAppIsMovingOrSizing

LONG CTextEditWindow::m_nAppIsMovingOrSizing
protected

Definition at line 74 of file textedit.h.

Referenced by FixEditPos(), OnMove(), OnSize(), Reposition(), and ValidateEditRect().

◆ m_rc

RECT CTextEditWindow::m_rc
protected

Definition at line 75 of file textedit.h.

Referenced by CTextEditWindow(), GetEditRect(), InvalidateEditRect(), and ValidateEditRect().


The documentation for this class was generated from the following files: