ReactOS 0.4.15-dev-6656-gbbb33a6
mouse.cpp
Go to the documentation of this file.
1/*
2 * PROJECT: PAINT for ReactOS
3 * LICENSE: LGPL-2.0-or-later (https://spdx.org/licenses/LGPL-2.0-or-later)
4 * PURPOSE: Things which should not be in the mouse event handler itself
5 * COPYRIGHT: Copyright 2015 Benedikt Freisen <b.freisen@gmx.net>
6 * Copyright 2021 Katayama Hirofumi MZ <katayama.hirofumi.mz@gmail.com>
7 */
8
9/* INCLUDES *********************************************************/
10
11#include "precomp.h"
12
14POINT ToolBase::s_pointStack[256] = { { 0 } };
15
16/* FUNCTIONS ********************************************************/
17
18void
20{
21 if (abs(x1 - x0) >= abs(y1 - y0))
22 y1 = y0 + (y1 > y0 ? abs(x1 - x0) : -abs(x1 - x0));
23 else
24 x1 = x0 + (x1 > x0 ? abs(y1 - y0) : -abs(y1 - y0));
25}
26
27void
29{
30 if (abs(x1 - x0) >= abs(y1 - y0))
31 {
32 if (abs(y1 - y0) * 5 < abs(x1 - x0) * 2)
33 y1 = y0;
34 else
35 y1 = y0 + (y1 > y0 ? abs(x1 - x0) : -abs(x1 - x0));
36 }
37 else
38 {
39 if (abs(x1 - x0) * 5 < abs(y1 - y0) * 2)
40 x1 = x0;
41 else
42 x1 = x0 + (x1 > x0 ? abs(y1 - y0) : -abs(y1 - y0));
43 }
44}
45
47{
50 return (abs(x1 - x0) <= cxThreshold) && (abs(y1 - y0) <= cyThreshold);
51}
52
54{
55 g_ptStart.x = g_ptEnd.x = x;
56 g_ptStart.y = g_ptEnd.y = y;
57}
58
60{
61 g_ptEnd.x = x;
62 g_ptEnd.y = y;
63}
64
66{
67 s_pointSP = 0;
71 {
74 }
75}
76
78{
79 reset();
81}
82
84{
85 reset();
87}
88
90{
94}
95
97{
98 m_hdc = NULL;
99}
100
102{
104 return;
105
106 RECT rcSelection = selectionModel.m_rc;
107 canvasWindow.ImageToCanvas(rcSelection);
108
109 ::InflateRect(&rcSelection, GRIP_SIZE, GRIP_SIZE);
110 drawSizeBoxes(hdc, &rcSelection, TRUE);
111}
112
113/* TOOLS ********************************************************/
114
115// TOOL_FREESEL
117{
119
121 {
122 }
123
125 {
127 {
130 }
131
133 {
135 }
136 }
137
139 {
141 }
142
143 void OnButtonDown(BOOL bLeftButton, LONG x, LONG y, BOOL bDoubleClick) override
144 {
146 if (bLeftButton)
147 {
150 POINT pt = { x, y };
152 }
153 m_bLeftButton = bLeftButton;
154 }
155
156 void OnMouseMove(BOOL bLeftButton, LONG x, LONG y) override
157 {
158 if (bLeftButton)
159 {
160 POINT pt = { x, y };
164 }
165 }
166
167 void OnButtonUp(BOOL bLeftButton, LONG x, LONG y) override
168 {
169 if (bLeftButton)
170 {
171 if (selectionModel.PtStackSize() > 2)
172 {
175 }
176 else
177 {
180 }
182 }
183 else
184 {
185 POINT pt = { x, y };
186 canvasWindow.ClientToScreen(&pt);
188 }
189 }
190
191 void OnFinishDraw() override
192 {
195 }
196
197 void OnCancelDraw() override
198 {
201 }
202};
203
204// TOOL_RECTSEL
206{
208
210 {
211 }
212
214 {
216 {
219 }
220
222 {
224 if (!::IsRectEmpty(&rc))
225 RectSel(hdc, rc.left, rc.top, rc.right, rc.bottom);
226 }
227 }
228
230 {
232 }
233
234 void OnButtonDown(BOOL bLeftButton, LONG x, LONG y, BOOL bDoubleClick) override
235 {
237 if (bLeftButton)
238 {
240 }
241 m_bLeftButton = bLeftButton;
242 }
243
244 void OnMouseMove(BOOL bLeftButton, LONG x, LONG y) override
245 {
246 if (bLeftButton)
247 {
248 POINT pt = { x, y };
252 }
253 }
254
255 void OnButtonUp(BOOL bLeftButton, LONG x, LONG y) override
256 {
257 POINT pt = { x, y };
258 if (bLeftButton)
259 {
264 }
265 else
266 {
267 canvasWindow.ClientToScreen(&pt);
269 }
270 }
271
272 void OnFinishDraw() override
273 {
276 }
277
278 void OnCancelDraw() override
279 {
282 }
283};
284
286{
289
291 {
292 }
293
294 void OnButtonDown(BOOL bLeftButton, LONG x, LONG y, BOOL bDoubleClick) override
295 {
296 m_bLeftButton = bLeftButton;
298 g_ptStart.x = g_ptEnd.x = x;
299 g_ptStart.y = g_ptEnd.y = y;
301 }
302
303 void OnMouseMove(BOOL bLeftButton, LONG x, LONG y) override
304 {
305 g_ptEnd.x = x;
306 g_ptEnd.y = y;
308 }
309
310 void OnButtonUp(BOOL bLeftButton, LONG x, LONG y) override
311 {
312 g_ptEnd.x = x;
313 g_ptEnd.y = y;
318 }
319
320 void OnFinishDraw() override
321 {
324 }
325
326 void OnCancelDraw() override
327 {
330 }
331};
332
334{
336 {
337 }
338
339 virtual void draw(BOOL bLeftButton, LONG x, LONG y) = 0;
340
341 void OnButtonDown(BOOL bLeftButton, LONG x, LONG y, BOOL bDoubleClick) override
342 {
344 g_ptStart.x = g_ptEnd.x = x;
345 g_ptStart.y = g_ptEnd.y = y;
347 }
348
349 void OnMouseMove(BOOL bLeftButton, LONG x, LONG y) override
350 {
351 draw(bLeftButton, x, y);
353 }
354
355 void OnButtonUp(BOOL bLeftButton, LONG x, LONG y) override
356 {
357 draw(bLeftButton, x, y);
358 OnFinishDraw();
359 }
360
361 void OnFinishDraw() override
362 {
364 }
365
366 void OnCancelDraw() override
367 {
368 OnButtonUp(FALSE, 0, 0);
371 }
372};
373
374// TOOL_RUBBER
376{
378 {
379 }
380
381 void draw(BOOL bLeftButton, LONG x, LONG y) override
382 {
383 if (bLeftButton)
385 else
387 g_ptEnd.x = x;
388 g_ptEnd.y = y;
389 }
390};
391
392// TOOL_FILL
394{
396 {
397 }
398
399 void OnButtonDown(BOOL bLeftButton, LONG x, LONG y, BOOL bDoubleClick) override
400 {
402 Fill(m_hdc, x, y, bLeftButton ? m_fg : m_bg);
403 }
404};
405
406// TOOL_COLOR
408{
410 {
411 }
412
413 void fetchColor(BOOL bLeftButton, LONG x, LONG y)
414 {
415 COLORREF rgbColor;
416
417 if (0 <= x && x < imageModel.GetWidth() && 0 <= y && y < imageModel.GetHeight())
418 rgbColor = GetPixel(m_hdc, x, y);
419 else
420 rgbColor = RGB(255, 255, 255); // Outside is white
421
422 if (bLeftButton)
423 paletteModel.SetFgColor(rgbColor);
424 else
425 paletteModel.SetBgColor(rgbColor);
426 }
427
428 void OnMouseMove(BOOL bLeftButton, LONG x, LONG y) override
429 {
430 fetchColor(bLeftButton, x, y);
431 }
432
433 void OnButtonUp(BOOL bLeftButton, LONG x, LONG y) override
434 {
435 fetchColor(bLeftButton, x, y);
437 }
438};
439
440// TOOL_ZOOM
442{
444 {
445 }
446
447 void OnButtonDown(BOOL bLeftButton, LONG x, LONG y, BOOL bDoubleClick) override
448 {
450 if (bLeftButton)
451 {
453 zoomTo(toolsModel.GetZoom() * 2, x, y);
454 }
455 else
456 {
458 zoomTo(toolsModel.GetZoom() / 2, x, y);
459 }
460 }
461};
462
463// TOOL_PEN
465{
467 {
468 }
469
470 void draw(BOOL bLeftButton, LONG x, LONG y) override
471 {
472 COLORREF rgb = bLeftButton ? m_fg : m_bg;
473 Line(m_hdc, g_ptEnd.x, g_ptEnd.y, x, y, rgb, 1);
474 ::SetPixelV(m_hdc, x, y, rgb);
475 g_ptEnd.x = x;
476 g_ptEnd.y = y;
477 }
478};
479
480// TOOL_BRUSH
482{
484 {
485 }
486
487 void draw(BOOL bLeftButton, LONG x, LONG y) override
488 {
489 COLORREF rgb = bLeftButton ? m_fg : m_bg;
491 g_ptEnd.x = x;
492 g_ptEnd.y = y;
493 }
494};
495
496// TOOL_AIRBRUSH
498{
500 {
501 }
502
503 void draw(BOOL bLeftButton, LONG x, LONG y) override
504 {
505 COLORREF rgb = bLeftButton ? m_fg : m_bg;
507 }
508};
509
510// TOOL_TEXT
512{
514 {
515 }
516
518 {
520 {
522 if (!::IsRectEmpty(&rc))
523 RectSel(hdc, rc.left, rc.top, rc.right, rc.bottom);
524 }
525 }
526
528 {
529 POINT pt = { x, y };
533 }
534
535 void OnButtonDown(BOOL bLeftButton, LONG x, LONG y, BOOL bDoubleClick) override
536 {
537 if (!textEditWindow.IsWindow())
539
540 UpdatePoint(x, y);
541 }
542
543 void OnMouseMove(BOOL bLeftButton, LONG x, LONG y) override
544 {
545 UpdatePoint(x, y);
546 }
547
549 {
550 CString szText;
551 textEditWindow.GetWindowText(szText);
552
553 RECT rc;
556 ::InflateRect(&rc, -GRIP_SIZE / 2, -GRIP_SIZE / 2);
557
558 // Draw the text
560 Text(hdc, rc.left, rc.top, rc.right, rc.bottom, m_fg, m_bg, szText,
562 }
563
564 void quit()
565 {
566 if (textEditWindow.IsWindow())
567 textEditWindow.ShowWindow(SW_HIDE);
569 }
570
571 void OnButtonUp(BOOL bLeftButton, LONG x, LONG y) override
572 {
573 POINT pt = { x, y };
576
577 BOOL bTextBoxShown = ::IsWindowVisible(textEditWindow);
578 if (bTextBoxShown)
579 {
580 if (textEditWindow.GetWindowTextLength() > 0)
581 {
583 draw(m_hdc);
584 }
586 {
587 quit();
588 return;
589 }
590 }
591
593 {
594 if (!fontsDialog.IsWindow())
595 fontsDialog.Create(mainWindow);
596
597 fontsDialog.ShowWindow(SW_SHOWNOACTIVATE);
598 }
599
601
602 // Enlarge if tool small
605 {
606 SetRect(&rc, x, y, x + cxMin, y + cyMin);
607 }
608 else
609 {
610 if (rc.right - rc.left < cxMin)
611 rc.right = rc.left + cxMin;
612 if (rc.bottom - rc.top < cyMin)
613 rc.bottom = rc.top + cyMin;
614 }
615
616 if (!textEditWindow.IsWindow())
618
619 textEditWindow.SetWindowText(NULL);
622 textEditWindow.SetFocus();
623 }
624
625 void OnFinishDraw() override
626 {
627 if (textEditWindow.GetWindowTextLength() > 0)
628 {
630 draw(m_hdc);
631 }
632 quit();
634 }
635
636 void OnCancelDraw() override
637 {
638 quit();
640 }
641};
642
643// TOOL_LINE
645{
647 {
648 }
649
651 {
652 if (!m_bDrawing)
653 return;
654 if (GetAsyncKeyState(VK_SHIFT) < 0)
658 }
659};
660
661// TOOL_BEZIER
663{
666
668 {
669 }
670
672 {
673 if (!m_bDrawing)
674 return;
675
677 switch (s_pointSP)
678 {
679 case 1:
682 break;
683 case 2:
685 break;
686 case 3:
688 break;
689 }
690 }
691
692 void OnButtonDown(BOOL bLeftButton, LONG x, LONG y, BOOL bDoubleClick) override
693 {
694 m_bLeftButton = bLeftButton;
695
696 if (!m_bDrawing)
697 {
701 ++s_pointSP;
702 }
703 else
704 {
705 ++s_pointSP;
708 }
709
711 }
712
713 void OnMouseMove(BOOL bLeftButton, LONG x, LONG y) override
714 {
718 }
719
720 void OnButtonUp(BOOL bLeftButton, LONG x, LONG y) override
721 {
724 if (s_pointSP >= 3)
725 {
726 OnFinishDraw();
727 return;
728 }
730 }
731
732 void OnCancelDraw() override
733 {
736 }
737
738 void OnFinishDraw() override
739 {
744 }
745};
746
747// TOOL_RECT
749{
751 {
752 }
753
755 {
756 if (!m_bDrawing)
757 return;
758 if (GetAsyncKeyState(VK_SHIFT) < 0)
760 if (m_bLeftButton)
762 else
764 }
765};
766
767// TOOL_SHAPE
769{
772
774 {
775 }
776
778 {
779 if (s_pointSP <= 0)
780 return;
781
782 if (m_bLeftButton)
784 else
786 }
787
788 void OnButtonDown(BOOL bLeftButton, LONG x, LONG y, BOOL bDoubleClick) override
789 {
790 m_bLeftButton = bLeftButton;
792
793 if ((s_pointSP > 0) && (GetAsyncKeyState(VK_SHIFT) < 0))
795
798
799 if (s_pointSP && bDoubleClick)
800 {
801 OnFinishDraw();
802 return;
803 }
804
805 if (s_pointSP == 0)
806 {
807 s_pointSP++;
810 }
811
813 }
814
815 void OnMouseMove(BOOL bLeftButton, LONG x, LONG y) override
816 {
817 if ((s_pointSP > 0) && (GetAsyncKeyState(VK_SHIFT) < 0))
819
822
824 }
825
826 void OnButtonUp(BOOL bLeftButton, LONG x, LONG y) override
827 {
828 if ((s_pointSP > 0) && (GetAsyncKeyState(VK_SHIFT) < 0))
830
833 {
834 OnFinishDraw();
835 return;
836 }
837 else
838 {
839 s_pointSP++;
842 }
843
845 s_pointSP--;
846
848 }
849
850 void OnCancelDraw() override
851 {
853 }
854
855 void OnFinishDraw() override
856 {
857 if (s_pointSP)
858 {
859 --s_pointSP;
860 m_bClosed = TRUE;
861
864 }
865
867 s_pointSP = 0;
868
870 }
871};
872
873// TOOL_ELLIPSE
875{
877 {
878 }
879
881 {
882 if (!m_bDrawing)
883 return;
884 if (GetAsyncKeyState(VK_SHIFT) < 0)
886 if (m_bLeftButton)
888 else
890 }
891};
892
893// TOOL_RRECT
895{
897 {
898 }
899
901 {
902 if (!m_bDrawing)
903 return;
904 if (GetAsyncKeyState(VK_SHIFT) < 0)
906 if (m_bLeftButton)
908 else
910 }
911};
912
913/*static*/ ToolBase*
915{
916 switch (type)
917 {
918 case TOOL_FREESEL: return new FreeSelTool();
919 case TOOL_RECTSEL: return new RectSelTool();
920 case TOOL_RUBBER: return new RubberTool();
921 case TOOL_FILL: return new FillTool();
922 case TOOL_COLOR: return new ColorTool();
923 case TOOL_ZOOM: return new ZoomTool();
924 case TOOL_PEN: return new PenTool();
925 case TOOL_BRUSH: return new BrushTool();
926 case TOOL_AIRBRUSH: return new AirBrushTool();
927 case TOOL_TEXT: return new TextTool();
928 case TOOL_LINE: return new LineTool();
929 case TOOL_BEZIER: return new BezierTool();
930 case TOOL_RECT: return new RectTool();
931 case TOOL_SHAPE: return new ShapeTool();
932 case TOOL_ELLIPSE: return new EllipseTool();
933 case TOOL_RRECT: return new RRectTool();
934 }
936 return NULL;
937}
Arabic default style
Definition: afstyles.h:94
#define GRIP_SIZE
Definition: common.h:12
#define MAX_ZOOM
Definition: common.h:14
#define MIN_ZOOM
Definition: common.h:13
BOOL zoomTo(int newZoom, int mouseX, int mouseY)
Definition: winproc.cpp:45
CFontsDialog fontsDialog
Definition: dialogs.cpp:21
void updateLast(LONG x, LONG y)
Definition: mouse.cpp:59
BOOL nearlyEqualPoints(INT x0, INT y0, INT x1, INT y1)
Definition: mouse.cpp:46
void regularize(LONG x0, LONG y0, LONG &x1, LONG &y1)
Definition: mouse.cpp:19
void roundTo8Directions(LONG x0, LONG y0, LONG &x1, LONG &y1)
Definition: mouse.cpp:28
void updateStartAndLast(LONG x, LONG y)
Definition: mouse.cpp:53
DWORD GetPixel(LPDIRECTDRAWSURFACE7 Surface, UINT x, UINT y)
Definition: blt.cpp:2
CCanvasWindow canvasWindow
Definition: canvas.cpp:10
BOOL m_drawing
Definition: canvas.h:41
VOID ImageToCanvas(POINT &pt)
Definition: canvas.cpp:53
VOID TrackPopupMenu(POINT ptScreen, INT iSubMenu)
Definition: winproc.cpp:1076
BOOL IsRectEmpty() const
Definition: atltypes.h:351
BOOL GetEditRect(LPRECT prc) const
Definition: textedit.cpp:377
void InvalidateEditRect()
Definition: textedit.cpp:281
HWND Create(HWND hwndParent)
Definition: textedit.cpp:224
HFONT GetFont() const
Definition: textedit.h:25
void ValidateEditRect(LPCRECT prc OPTIONAL)
Definition: textedit.cpp:383
int GetWidth() const
Definition: history.cpp:194
void Undo(BOOL bClearRedo=FALSE)
Definition: history.cpp:48
void NotifyImageChanged()
Definition: history.cpp:15
int GetHeight() const
Definition: history.cpp:199
HDC GetDC()
Definition: history.cpp:212
void Clamp(POINT &pt) const
Definition: history.cpp:256
void PushImageForUndo(HBITMAP hbm=NULL)
Definition: history.cpp:106
COLORREF GetBgColor() const
void SetFgColor(COLORREF newColor)
void SetBgColor(COLORREF newColor)
COLORREF GetFgColor() const
DWORD ShowTextTool
Definition: registry.h:41
void DrawBackgroundPoly(HDC hDCImage, COLORREF crBg)
void PushToPtStack(POINT pt)
void BuildMaskFromPtStack()
int PtStackSize() const
COLORREF m_rgbBack
void DrawFramePoly(HDC hDCImage)
BOOL IsLanded() const
void DrawSelection(HDC hDCImage, COLORREF crBg=0, BOOL bBgTransparent=FALSE)
void SetRectFromPoints(const POINT &ptFrom, const POINT &ptTo)
void DrawBackgroundRect(HDC hDCImage, COLORREF crBg)
int GetZoom() const
Definition: toolsmodel.cpp:148
int GetAirBrushWidth() const
Definition: toolsmodel.cpp:114
int GetLineWidth() const
Definition: toolsmodel.cpp:47
int GetShapeStyle() const
Definition: toolsmodel.cpp:58
TOOLTYPE GetOldActiveTool() const
Definition: toolsmodel.cpp:85
void SetActiveTool(TOOLTYPE nActiveTool)
Definition: toolsmodel.cpp:90
int GetBrushStyle() const
Definition: toolsmodel.cpp:69
BOOL IsBackgroundTransparent() const
Definition: toolsmodel.cpp:136
int GetRubberRadius() const
Definition: toolsmodel.cpp:125
char * Text
Definition: combotst.c:136
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define pt(x, y)
Definition: drawing.c:79
void RectSel(HDC hdc, LONG x1, LONG y1, LONG x2, LONG y2)
Definition: drawing.cpp:241
void Bezier(HDC hdc, POINT p1, POINT p2, POINT p3, POINT p4, COLORREF color, int thickness)
Definition: drawing.cpp:94
void Ellp(HDC hdc, LONG x1, LONG y1, LONG x2, LONG y2, COLORREF fg, COLORREF bg, int thickness, int style)
Definition: drawing.cpp:39
void Poly(HDC hdc, POINT *lpPoints, int nCount, COLORREF fg, COLORREF bg, int thickness, int style, BOOL closed, BOOL inverted)
Definition: drawing.cpp:69
void RRect(HDC hdc, LONG x1, LONG y1, LONG x2, LONG y2, COLORREF fg, COLORREF bg, int thickness, int style)
Definition: drawing.cpp:54
void Replace(HDC hdc, LONG x1, LONG y1, LONG x2, LONG y2, COLORREF fg, COLORREF bg, LONG radius)
Definition: drawing.cpp:133
void Erase(HDC hdc, LONG x1, LONG y1, LONG x2, LONG y2, COLORREF color, LONG radius)
Definition: drawing.cpp:116
void Airbrush(HDC hdc, LONG x, LONG y, COLORREF color, LONG r)
Definition: drawing.cpp:154
void Fill(HDC hdc, LONG x, LONG y, COLORREF color)
Definition: drawing.cpp:108
#define RGB(r, g, b)
Definition: precomp.h:62
static INT cxMin
Definition: eventvwr.c:4312
static INT cyMin
Definition: eventvwr.c:4312
#define abs(i)
Definition: fconv.c:206
unsigned int BOOL
Definition: ntddk_ex.h:94
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
ToolsModel toolsModel
Definition: toolsmodel.cpp:10
POINT g_ptEnd
Definition: globalvar.h:14
ImageModel imageModel
Definition: history.cpp:11
RegistrySettings registrySettings
Definition: registry.cpp:14
SelectionModel selectionModel
CMainWindow mainWindow
Definition: main.cpp:22
CTextEditWindow textEditWindow
Definition: textedit.cpp:12
PaletteModel paletteModel
POINT g_ptStart
Definition: main.cpp:13
GLint y0
Definition: linetemp.h:96
GLint x0
Definition: linetemp.h:95
HDC hdc
Definition: main.c:9
static HDC
Definition: imagelist.c:92
#define UNREACHABLE
long LONG
Definition: pedump.c:60
VOID drawSizeBoxes(HDC hdc, LPCRECT prcBase, BOOL bDrawFrame, LPCRECT prcPaint)
Definition: sizebox.cpp:103
#define _countof(array)
Definition: sndvol32.h:68
void draw(BOOL bLeftButton, LONG x, LONG y) override
Definition: mouse.cpp:503
AirBrushTool()
Definition: mouse.cpp:499
BOOL m_bDrawing
Definition: mouse.cpp:665
void OnButtonUp(BOOL bLeftButton, LONG x, LONG y) override
Definition: mouse.cpp:720
void OnButtonDown(BOOL bLeftButton, LONG x, LONG y, BOOL bDoubleClick) override
Definition: mouse.cpp:692
BezierTool()
Definition: mouse.cpp:667
void OnFinishDraw() override
Definition: mouse.cpp:738
BOOL m_bLeftButton
Definition: mouse.cpp:664
void OnCancelDraw() override
Definition: mouse.cpp:732
void OnMouseMove(BOOL bLeftButton, LONG x, LONG y) override
Definition: mouse.cpp:713
void OnDrawOverlayOnImage(HDC hdc)
Definition: mouse.cpp:671
void draw(BOOL bLeftButton, LONG x, LONG y) override
Definition: mouse.cpp:487
BrushTool()
Definition: mouse.cpp:483
void fetchColor(BOOL bLeftButton, LONG x, LONG y)
Definition: mouse.cpp:413
void OnButtonUp(BOOL bLeftButton, LONG x, LONG y) override
Definition: mouse.cpp:433
void OnMouseMove(BOOL bLeftButton, LONG x, LONG y) override
Definition: mouse.cpp:428
ColorTool()
Definition: mouse.cpp:409
void OnDrawOverlayOnImage(HDC hdc) override
Definition: mouse.cpp:880
EllipseTool()
Definition: mouse.cpp:876
void OnButtonDown(BOOL bLeftButton, LONG x, LONG y, BOOL bDoubleClick) override
Definition: mouse.cpp:399
FillTool()
Definition: mouse.cpp:395
void OnMouseMove(BOOL bLeftButton, LONG x, LONG y) override
Definition: mouse.cpp:156
void OnButtonUp(BOOL bLeftButton, LONG x, LONG y) override
Definition: mouse.cpp:167
void OnCancelDraw() override
Definition: mouse.cpp:197
FreeSelTool()
Definition: mouse.cpp:120
void OnDrawOverlayOnCanvas(HDC hdc) override
Definition: mouse.cpp:138
void OnFinishDraw() override
Definition: mouse.cpp:191
void OnButtonDown(BOOL bLeftButton, LONG x, LONG y, BOOL bDoubleClick) override
Definition: mouse.cpp:143
BOOL m_bLeftButton
Definition: mouse.cpp:118
void OnDrawOverlayOnImage(HDC hdc) override
Definition: mouse.cpp:124
void OnDrawOverlayOnImage(HDC hdc) override
Definition: mouse.cpp:650
LineTool()
Definition: mouse.cpp:646
Definition: ncftp.h:79
void draw(BOOL bLeftButton, LONG x, LONG y) override
Definition: mouse.cpp:470
PenTool()
Definition: mouse.cpp:466
RRectTool()
Definition: mouse.cpp:896
void OnDrawOverlayOnImage(HDC hdc) override
Definition: mouse.cpp:900
void OnButtonUp(BOOL bLeftButton, LONG x, LONG y) override
Definition: mouse.cpp:255
RectSelTool()
Definition: mouse.cpp:209
BOOL m_bLeftButton
Definition: mouse.cpp:207
void OnFinishDraw() override
Definition: mouse.cpp:272
void OnCancelDraw() override
Definition: mouse.cpp:278
void OnMouseMove(BOOL bLeftButton, LONG x, LONG y) override
Definition: mouse.cpp:244
void OnButtonDown(BOOL bLeftButton, LONG x, LONG y, BOOL bDoubleClick) override
Definition: mouse.cpp:234
void OnDrawOverlayOnImage(HDC hdc) override
Definition: mouse.cpp:213
void OnDrawOverlayOnCanvas(HDC hdc) override
Definition: mouse.cpp:229
RectTool()
Definition: mouse.cpp:750
void OnDrawOverlayOnImage(HDC hdc) override
Definition: mouse.cpp:754
void draw(BOOL bLeftButton, LONG x, LONG y) override
Definition: mouse.cpp:381
RubberTool()
Definition: mouse.cpp:377
BOOL m_bClosed
Definition: mouse.cpp:771
void OnCancelDraw() override
Definition: mouse.cpp:850
void OnButtonUp(BOOL bLeftButton, LONG x, LONG y) override
Definition: mouse.cpp:826
void OnFinishDraw() override
Definition: mouse.cpp:855
void OnDrawOverlayOnImage(HDC hdc)
Definition: mouse.cpp:777
ShapeTool()
Definition: mouse.cpp:773
BOOL m_bLeftButton
Definition: mouse.cpp:770
void OnMouseMove(BOOL bLeftButton, LONG x, LONG y) override
Definition: mouse.cpp:815
void OnButtonDown(BOOL bLeftButton, LONG x, LONG y, BOOL bDoubleClick) override
Definition: mouse.cpp:788
void OnMouseMove(BOOL bLeftButton, LONG x, LONG y) override
Definition: mouse.cpp:349
void OnCancelDraw() override
Definition: mouse.cpp:366
void OnButtonDown(BOOL bLeftButton, LONG x, LONG y, BOOL bDoubleClick) override
Definition: mouse.cpp:341
void OnButtonUp(BOOL bLeftButton, LONG x, LONG y) override
Definition: mouse.cpp:355
void OnFinishDraw() override
Definition: mouse.cpp:361
virtual void draw(BOOL bLeftButton, LONG x, LONG y)=0
SmoothDrawTool(TOOLTYPE type)
Definition: mouse.cpp:335
void OnButtonDown(BOOL bLeftButton, LONG x, LONG y, BOOL bDoubleClick) override
Definition: mouse.cpp:535
void OnDrawOverlayOnImage(HDC hdc) override
Definition: mouse.cpp:517
TextTool()
Definition: mouse.cpp:513
void OnCancelDraw() override
Definition: mouse.cpp:636
void OnFinishDraw() override
Definition: mouse.cpp:625
void quit()
Definition: mouse.cpp:564
void OnMouseMove(BOOL bLeftButton, LONG x, LONG y) override
Definition: mouse.cpp:543
void UpdatePoint(LONG x, LONG y)
Definition: mouse.cpp:527
void OnButtonUp(BOOL bLeftButton, LONG x, LONG y) override
Definition: mouse.cpp:571
void draw(HDC hdc)
Definition: mouse.cpp:548
void endEvent()
Definition: mouse.cpp:96
static POINT s_pointStack[256]
Definition: toolsmodel.h:39
HDC m_hdc
Definition: toolsmodel.h:36
void OnDrawSelectionOnCanvas(HDC hdc)
Definition: mouse.cpp:101
virtual void OnCancelDraw()
Definition: mouse.cpp:77
void reset()
Definition: mouse.cpp:65
virtual void OnFinishDraw()
Definition: mouse.cpp:83
static ToolBase * createToolObject(TOOLTYPE type)
Definition: mouse.cpp:914
COLORREF m_fg
Definition: toolsmodel.h:37
virtual void OnDrawOverlayOnImage(HDC hdc)
Definition: toolsmodel.h:51
static INT s_pointSP
Definition: toolsmodel.h:38
void beginEvent()
Definition: mouse.cpp:89
COLORREF m_bg
Definition: toolsmodel.h:37
TwoPointDrawTool(TOOLTYPE type)
Definition: mouse.cpp:290
void OnCancelDraw() override
Definition: mouse.cpp:326
void OnMouseMove(BOOL bLeftButton, LONG x, LONG y) override
Definition: mouse.cpp:303
void OnFinishDraw() override
Definition: mouse.cpp:320
void OnButtonUp(BOOL bLeftButton, LONG x, LONG y) override
Definition: mouse.cpp:310
void OnButtonDown(BOOL bLeftButton, LONG x, LONG y, BOOL bDoubleClick) override
Definition: mouse.cpp:294
BOOL m_bLeftButton
Definition: mouse.cpp:287
void OnButtonDown(BOOL bLeftButton, LONG x, LONG y, BOOL bDoubleClick) override
Definition: mouse.cpp:447
ZoomTool()
Definition: mouse.cpp:443
long y
Definition: polytest.cpp:48
long x
Definition: polytest.cpp:48
LONG right
Definition: windef.h:308
LONG bottom
Definition: windef.h:309
LONG top
Definition: windef.h:307
LONG left
Definition: windef.h:306
#define CY_MINTEXTEDIT
Definition: textedit.h:11
#define CX_MINTEXTEDIT
Definition: textedit.h:10
static int UnZoomed(int xy)
Definition: toolsmodel.h:127
TOOLTYPE
Definition: toolsmodel.h:11
@ TOOL_AIRBRUSH
Definition: toolsmodel.h:20
@ TOOL_COLOR
Definition: toolsmodel.h:16
@ TOOL_SHAPE
Definition: toolsmodel.h:25
@ TOOL_RUBBER
Definition: toolsmodel.h:14
@ TOOL_BRUSH
Definition: toolsmodel.h:19
@ TOOL_RECT
Definition: toolsmodel.h:24
@ TOOL_BEZIER
Definition: toolsmodel.h:23
@ TOOL_FILL
Definition: toolsmodel.h:15
@ TOOL_TEXT
Definition: toolsmodel.h:21
@ TOOL_PEN
Definition: toolsmodel.h:18
@ TOOL_LINE
Definition: toolsmodel.h:22
@ TOOL_FREESEL
Definition: toolsmodel.h:12
@ TOOL_ZOOM
Definition: toolsmodel.h:17
@ TOOL_ELLIPSE
Definition: toolsmodel.h:26
@ TOOL_RRECT
Definition: toolsmodel.h:27
@ TOOL_RECTSEL
Definition: toolsmodel.h:13
int32_t INT
Definition: typedefs.h:58
_In_ CLIPOBJ _In_ BRUSHOBJ _In_ LONG _In_ LONG y1
Definition: winddi.h:3709
_In_ ULONG _In_ ULONG rgb
Definition: winddi.h:3521
_In_ CLIPOBJ _In_ BRUSHOBJ _In_ LONG x1
Definition: winddi.h:3708
DWORD COLORREF
Definition: windef.h:300
BOOL WINAPI SetPixelV(_In_ HDC, _In_ int, _In_ int, _In_ COLORREF)
#define SW_HIDE
Definition: winuser.h:762
#define SM_CXDRAG
Definition: winuser.h:1022
#define SW_SHOWNOACTIVATE
Definition: winuser.h:768
BOOL WINAPI IsRectEmpty(_In_ LPCRECT)
#define VK_SHIFT
Definition: winuser.h:2192
SHORT WINAPI GetAsyncKeyState(_In_ int)
BOOL WINAPI InflateRect(_Inout_ LPRECT, _In_ int, _In_ int)
#define SM_CYDRAG
Definition: winuser.h:1023
BOOL WINAPI IsWindowVisible(_In_ HWND)
int WINAPI GetSystemMetrics(_In_ int)
BOOL WINAPI SetRect(_Out_ LPRECT, _In_ int, _In_ int, _In_ int, _In_ int)