ReactOS  0.4.15-dev-4569-g032c50f
mouse.cpp
Go to the documentation of this file.
1 /*
2  * PROJECT: PAINT for ReactOS
3  * LICENSE: LGPL
4  * FILE: base/applications/mspaint/mouse.cpp
5  * PURPOSE: Things which should not be in the mouse event handler itself
6  * PROGRAMMERS: Benedikt Freisen
7  * Katayama Hirofumi MZ
8  */
9 
10 /* INCLUDES *********************************************************/
11 
12 #include "precomp.h"
13 
15 POINT ToolBase::pointStack[256] = { { 0 } };
16 
17 /* FUNCTIONS ********************************************************/
18 
19 void
21 {
25  selectionWindow.BringWindowToTop();
27 }
28 
29 void
31 {
32  if (abs(x1 - x0) >= abs(y1 - y0))
33  y1 = y0 + (y1 > y0 ? abs(x1 - x0) : -abs(x1 - x0));
34  else
35  x1 = x0 + (x1 > x0 ? abs(y1 - y0) : -abs(y1 - y0));
36 }
37 
38 void
40 {
41  if (abs(x1 - x0) >= abs(y1 - y0))
42  {
43  if (abs(y1 - y0) * 5 < abs(x1 - x0) * 2)
44  y1 = y0;
45  else
46  y1 = y0 + (y1 > y0 ? abs(x1 - x0) : -abs(x1 - x0));
47  }
48  else
49  {
50  if (abs(x1 - x0) * 5 < abs(y1 - y0) * 2)
51  x1 = x0;
52  else
53  x1 = x0 + (x1 > x0 ? abs(y1 - y0) : -abs(y1 - y0));
54  }
55 }
56 
58 {
61  return (abs(x1 - x0) <= cxThreshold) && (abs(y1 - y0) <= cyThreshold);
62 }
63 
65 {
66  start.x = last.x = x;
67  start.y = last.y = y;
68 }
69 
71 {
72  last.x = x;
73  last.y = y;
74 }
75 
77 {
78  pointSP = 0;
79  start.x = start.y = last.x = last.y = -1;
81  if (selectionWindow.IsWindow())
82  selectionWindow.ShowWindow(SW_HIDE);
83 }
84 
86 {
87  reset();
88 }
89 
91 {
92  reset();
93 }
94 
96 {
100 }
101 
103 {
104  m_hdc = NULL;
105 }
106 
107 /* TOOLS ********************************************************/
108 
109 // TOOL_FREESEL
111 {
113 
115  {
116  }
117 
118  void OnButtonDown(BOOL bLeftButton, LONG x, LONG y, BOOL bDoubleClick)
119  {
120  if (bLeftButton)
121  {
123  selectionWindow.ShowWindow(SW_HIDE);
126  }
127  m_bLeftButton = bLeftButton;
128  }
129 
130  void OnMouseMove(BOOL bLeftButton, LONG x, LONG y)
131  {
132  if (bLeftButton)
133  {
134  POINT pt = { x, y };
139  }
140  }
141 
142  void OnButtonUp(BOOL bLeftButton, LONG x, LONG y)
143  {
144  if (bLeftButton)
145  {
147  if (selectionModel.PtStackSize() > 2)
148  {
150  placeSelWin();
153  }
154  else
155  {
159  selectionWindow.ShowWindow(SW_HIDE);
160  }
161  }
162  }
163 
165  {
166  if (m_bLeftButton)
167  {
170  }
173  }
174 
176  {
177  if (m_bLeftButton)
182  }
183 };
184 
185 // TOOL_RECTSEL
187 {
189 
191  {
192  }
193 
194  void OnButtonDown(BOOL bLeftButton, LONG x, LONG y, BOOL bDoubleClick)
195  {
196  if (bLeftButton)
197  {
199  selectionWindow.ShowWindow(SW_HIDE);
201  }
202  m_bLeftButton = bLeftButton;
203  }
204 
205  void OnMouseMove(BOOL bLeftButton, LONG x, LONG y)
206  {
207  if (bLeftButton)
208  {
210  POINT pt = { x, y };
213  RectSel(m_hdc, start.x, start.y, pt.x, pt.y);
214  }
215  }
216 
217  void OnButtonUp(BOOL bLeftButton, LONG x, LONG y)
218  {
219  if (bLeftButton)
220  {
222  if (start.x == x && start.y == y)
225  placeSelWin();
229  else
230  selectionWindow.ShowWindow(SW_HIDE);
231  }
232  }
233 
235  {
236  if (m_bLeftButton)
237  {
240  }
243  }
244 
246  {
247  if (m_bLeftButton)
252  }
253 };
254 
256 {
258  {
259  }
260 
261  virtual void draw(BOOL bLeftButton, LONG x, LONG y) = 0;
262 
263  void OnButtonDown(BOOL bLeftButton, LONG x, LONG y, BOOL bDoubleClick)
264  {
266  draw(bLeftButton, x, y);
267  }
268 
269  void OnMouseMove(BOOL bLeftButton, LONG x, LONG y)
270  {
271  draw(bLeftButton, x, y);
272  }
273 
274  void OnButtonUp(BOOL bLeftButton, LONG x, LONG y)
275  {
276  draw(bLeftButton, x, y);
277  }
278 
280  {
281  OnButtonUp(FALSE, 0, 0);
284  }
285 };
286 
287 // TOOL_RUBBER
289 {
291  {
292  }
293 
294  virtual void draw(BOOL bLeftButton, LONG x, LONG y)
295  {
296  if (bLeftButton)
298  else
300  }
301 };
302 
303 // TOOL_FILL
305 {
307  {
308  }
309 
310  void OnButtonDown(BOOL bLeftButton, LONG x, LONG y, BOOL bDoubleClick)
311  {
313  Fill(m_hdc, x, y, bLeftButton ? m_fg : m_bg);
314  }
315 };
316 
317 // TOOL_COLOR
319 {
321  {
322  }
323 
324  void fetchColor(BOOL bLeftButton, LONG x, LONG y)
325  {
326  COLORREF rgbColor;
327 
328  if (0 <= x && x < imageModel.GetWidth() && 0 <= y && y < imageModel.GetHeight())
329  rgbColor = GetPixel(m_hdc, x, y);
330  else
331  rgbColor = RGB(255, 255, 255); // Outside is white
332 
333  if (bLeftButton)
334  paletteModel.SetFgColor(rgbColor);
335  else
336  paletteModel.SetBgColor(rgbColor);
337  }
338 
339  void OnMouseMove(BOOL bLeftButton, LONG x, LONG y)
340  {
341  fetchColor(bLeftButton, x, y);
342  }
343 
344  void OnButtonUp(BOOL bLeftButton, LONG x, LONG y)
345  {
346  fetchColor(bLeftButton, x, y);
348  }
349 };
350 
351 // TOOL_ZOOM
353 {
355  {
356  }
357 
358  void OnButtonDown(BOOL bLeftButton, LONG x, LONG y, BOOL bDoubleClick)
359  {
361  if (bLeftButton)
362  {
363  if (toolsModel.GetZoom() < MAX_ZOOM)
364  zoomTo(toolsModel.GetZoom() * 2, x, y);
365  }
366  else
367  {
368  if (toolsModel.GetZoom() > MIN_ZOOM)
369  zoomTo(toolsModel.GetZoom() / 2, x, y);
370  }
371  }
372 };
373 
374 // TOOL_PEN
376 {
378  {
379  }
380 
381  virtual void draw(BOOL bLeftButton, LONG x, LONG y)
382  {
383  COLORREF rgb = bLeftButton ? m_fg : m_bg;
384  Line(m_hdc, last.x, last.y, x, y, rgb, 1);
385  SetPixel(m_hdc, x, y, rgb);
386  }
387 };
388 
389 // TOOL_BRUSH
391 {
393  {
394  }
395 
396  virtual void draw(BOOL bLeftButton, LONG x, LONG y)
397  {
398  COLORREF rgb = bLeftButton ? m_fg : m_bg;
400  }
401 };
402 
403 // TOOL_AIRBRUSH
405 {
407  {
408  }
409 
410  virtual void draw(BOOL bLeftButton, LONG x, LONG y)
411  {
412  COLORREF rgb = bLeftButton ? m_fg : m_bg;
414  }
415 };
416 
417 // TOOL_TEXT
419 {
421  {
422  }
423 
425  {
427  POINT pt = { x, y };
430  RectSel(m_hdc, start.x, start.y, pt.x, pt.y);
431  }
432 
433  void OnButtonDown(BOOL bLeftButton, LONG x, LONG y, BOOL bDoubleClick)
434  {
435  if (!textEditWindow.IsWindow())
437 
439  UpdatePoint(x, y);
440  }
441 
442  void OnMouseMove(BOOL bLeftButton, LONG x, LONG y)
443  {
444  UpdatePoint(x, y);
445  }
446 
447  void OnButtonUp(BOOL bLeftButton, LONG x, LONG y)
448  {
450 
451  BOOL bTextBoxShown = ::IsWindowVisible(textEditWindow);
452  if (bTextBoxShown && textEditWindow.GetWindowTextLength() > 0)
453  {
454  CString szText;
455  textEditWindow.GetWindowText(szText);
456 
457  RECT rc;
460 
463  Text(m_hdc, rc.left, rc.top, rc.right, rc.bottom, m_fg, m_bg, szText,
465  }
466 
468  {
469  if (!fontsDialog.IsWindow())
470  fontsDialog.Create(mainWindow);
471 
472  fontsDialog.ShowWindow(SW_SHOWNOACTIVATE);
473  }
474 
475  if (!bTextBoxShown || selectionModel.IsSrcRectSizeNonzero())
476  {
477  RECT rc;
478  selectionModel.GetRect(&rc);
479 
480  // Enlarge if tool small
483  {
484  if (rc.right - rc.left < cxMin)
485  rc.right = rc.left + cxMin;
486  if (rc.bottom - rc.top < cyMin)
487  rc.bottom = rc.top + cyMin;
488  }
489  else
490  {
491  SetRect(&rc, x, y, x + cxMin, y + cyMin);
492  }
493 
494  if (!textEditWindow.IsWindow())
496 
497  textEditWindow.SetWindowText(NULL);
499  textEditWindow.ShowWindow(SW_SHOWNOACTIVATE);
500  textEditWindow.SetFocus();
501  }
502  else
503  {
504  textEditWindow.ShowWindow(SW_HIDE);
505  textEditWindow.SetWindowText(NULL);
506  }
507  }
508 
510  {
511  toolsModel.OnButtonDown(TRUE, -1, -1, TRUE);
512  toolsModel.OnButtonUp(TRUE, -1, -1);
515  }
516 };
517 
518 // TOOL_LINE
520 {
522  {
523  }
524 
525  virtual void draw(BOOL bLeftButton, LONG x, LONG y)
526  {
528  if (GetAsyncKeyState(VK_SHIFT) < 0)
529  roundTo8Directions(start.x, start.y, x, y);
530  COLORREF rgb = bLeftButton ? m_fg : m_bg;
532  }
533 };
534 
535 // TOOL_BEZIER
537 {
539 
541  {
542  }
543 
544  void draw(BOOL bLeftButton)
545  {
546  COLORREF rgb = (bLeftButton ? m_fg : m_bg);
547  switch (pointSP)
548  {
549  case 1:
552  break;
553  case 2:
555  break;
556  case 3:
558  break;
559  }
560  m_bLeftButton = bLeftButton;
561  }
562 
563  void OnButtonDown(BOOL bLeftButton, LONG x, LONG y, BOOL bDoubleClick)
564  {
565  pointStack[pointSP].x = x;
566  pointStack[pointSP].y = y;
567 
568  if (pointSP == 0)
569  {
571  pointSP++;
572  }
573  }
574 
575  void OnMouseMove(BOOL bLeftButton, LONG x, LONG y)
576  {
578  pointStack[pointSP].x = x;
579  pointStack[pointSP].y = y;
580  draw(bLeftButton);
581  }
582 
583  void OnButtonUp(BOOL bLeftButton, LONG x, LONG y)
584  {
586  draw(bLeftButton);
587  pointSP++;
588  if (pointSP == 4)
589  pointSP = 0;
590  }
591 
593  {
594  OnButtonUp(FALSE, 0, 0);
597  }
598 
600  {
601  if (pointSP)
602  {
604  --pointSP;
606  }
608  }
609 };
610 
611 // TOOL_RECT
613 {
615  {
616  }
617 
618  virtual void draw(BOOL bLeftButton, LONG x, LONG y)
619  {
621  if (GetAsyncKeyState(VK_SHIFT) < 0)
622  regularize(start.x, start.y, x, y);
623  if (bLeftButton)
625  else
627  }
628 };
629 
630 // TOOL_SHAPE
632 {
634 
636  {
637  }
638 
639  void draw(BOOL bLeftButton, LONG x, LONG y, BOOL bClosed = FALSE)
640  {
641  if (pointSP + 1 >= 2)
642  {
643  if (bLeftButton)
645  else
647  }
648  m_bLeftButton = bLeftButton;
649  }
650 
651  void OnButtonDown(BOOL bLeftButton, LONG x, LONG y, BOOL bDoubleClick)
652  {
653  pointStack[pointSP].x = x;
654  pointStack[pointSP].y = y;
655 
656  if (pointSP == 0 && !bDoubleClick)
657  {
659  draw(bLeftButton, x, y);
660  pointSP++;
661  }
662  else
663  {
664  draw(bLeftButton, x, y, bDoubleClick);
665  }
666  }
667 
668  void OnMouseMove(BOOL bLeftButton, LONG x, LONG y)
669  {
671  pointStack[pointSP].x = x;
672  pointStack[pointSP].y = y;
673  if ((pointSP > 0) && (GetAsyncKeyState(VK_SHIFT) < 0))
675  draw(bLeftButton, x, y, FALSE);
676  }
677 
678  void OnButtonUp(BOOL bLeftButton, LONG x, LONG y)
679  {
681  if ((pointSP > 0) && (GetAsyncKeyState(VK_SHIFT) < 0))
683 
684  if (nearlyEqualPoints(x, y, pointStack[0].x, pointStack[0].y))
685  {
686  pointSP--;
687  draw(bLeftButton, x, y, TRUE);
688  pointSP = 0;
689  }
690  else
691  {
692  pointSP++;
693  pointStack[pointSP].x = x;
694  pointStack[pointSP].y = y;
695  draw(bLeftButton, x, y, FALSE);
696  }
697 
698  if (pointSP == _countof(pointStack))
699  pointSP--;
700  }
701 
703  {
706  }
707 
709  {
710  if (pointSP)
711  {
713  --pointSP;
714  draw(m_bLeftButton, -1, -1, TRUE);
715  pointSP = 0;
716  }
717  else
718  {
720  }
722  }
723 };
724 
725 // TOOL_ELLIPSE
727 {
729  {
730  }
731 
732  virtual void draw(BOOL bLeftButton, LONG x, LONG y)
733  {
735  if (GetAsyncKeyState(VK_SHIFT) < 0)
736  regularize(start.x, start.y, x, y);
737  if (bLeftButton)
739  else
741  }
742 };
743 
744 // TOOL_RRECT
746 {
748  {
749  }
750 
751  virtual void draw(BOOL bLeftButton, LONG x, LONG y)
752  {
754  if (GetAsyncKeyState(VK_SHIFT) < 0)
755  regularize(start.x, start.y, x, y);
756  if (bLeftButton)
758  else
760  }
761 };
762 
763 /*static*/ ToolBase*
765 {
766  switch (type)
767  {
768  case TOOL_FREESEL: return new FreeSelTool();
769  case TOOL_RECTSEL: return new RectSelTool();
770  case TOOL_RUBBER: return new RubberTool();
771  case TOOL_FILL: return new FillTool();
772  case TOOL_COLOR: return new ColorTool();
773  case TOOL_ZOOM: return new ZoomTool();
774  case TOOL_PEN: return new PenTool();
775  case TOOL_BRUSH: return new BrushTool();
776  case TOOL_AIRBRUSH: return new AirBrushTool();
777  case TOOL_TEXT: return new TextTool();
778  case TOOL_LINE: return new LineTool();
779  case TOOL_BEZIER: return new BezierTool();
780  case TOOL_RECT: return new RectTool();
781  case TOOL_SHAPE: return new ShapeTool();
782  case TOOL_ELLIPSE: return new EllipseTool();
783  case TOOL_RRECT: return new RRectTool();
784  }
785  UNREACHABLE;
786  return NULL;
787 }
_In_ CLIPOBJ _In_ BRUSHOBJ _In_ LONG _In_ LONG y1
Definition: winddi.h:3706
BezierTool()
Definition: mouse.cpp:540
static POINT pointStack[256]
Definition: toolsmodel.h:40
GenericDrawTool(TOOLTYPE type)
Definition: mouse.cpp:257
#define abs(i)
Definition: fconv.c:206
static int Zoomed(int xy)
Definition: common.h:37
int PtStackSize() const
FORCEINLINE VOID SetPixel(_In_ ULONG Left, _In_ ULONG Top, _In_ UCHAR Color)
Definition: arm.h:50
ToolsModel toolsModel
Definition: main.cpp:18
void CopyPrevious(void)
Definition: history.cpp:47
AirBrushTool()
Definition: mouse.cpp:406
void DrawFramePoly(HDC hDCImage)
BOOL IsMoved() const
Definition: selection.h:19
void OnButtonUp(BOOL bLeftButton, LONG x, LONG y)
Definition: mouse.cpp:142
void Fill(HDC hdc, LONG x, LONG y, COLORREF color)
Definition: drawing.cpp:109
#define SW_SHOWNOACTIVATE
Definition: winuser.h:768
long y
Definition: polytest.cpp:48
static INT cyMin
Definition: eventvwr.c:4290
void RectSel(HDC hdc, LONG x1, LONG y1, LONG x2, LONG y2)
Definition: drawing.cpp:228
void SetFgColor(COLORREF newColor)
GLint x0
Definition: linetemp.h:95
void OnButtonUp(BOOL bLeftButton, LONG x, LONG y)
Definition: mouse.cpp:678
#define RGB(r, g, b)
Definition: precomp.h:62
void OnCancelDraw()
Definition: mouse.cpp:702
long x
Definition: polytest.cpp:48
LONG GetDestRectLeft() const
#define MAX_ZOOM
Definition: common.h:15
POINT last
Definition: font.c:46
#define TRUE
Definition: types.h:120
void regularize(LONG x0, LONG y0, LONG &x1, LONG &y1)
Definition: mouse.cpp:30
#define pt(x, y)
Definition: drawing.c:79
#define SW_HIDE
Definition: winuser.h:762
BOOL m_bLeftButton
Definition: mouse.cpp:188
void roundTo8Directions(LONG x0, LONG y0, LONG &x1, LONG &y1)
Definition: mouse.cpp:39
static INT cxMin
Definition: eventvwr.c:4290
virtual void draw(BOOL bLeftButton, LONG x, LONG y)
Definition: mouse.cpp:396
void OnCancelDraw()
Definition: mouse.cpp:175
_In_ CLIPOBJ _In_ BRUSHOBJ _In_ LONG x1
Definition: winddi.h:3706
void OnFinishDraw()
Definition: mouse.cpp:234
HDC m_hdc
Definition: toolsmodel.h:37
void PushToPtStack(LONG x, LONG y)
void Ellp(HDC hdc, LONG x1, LONG y1, LONG x2, LONG y2, COLORREF fg, COLORREF bg, int thickness, int style)
Definition: drawing.cpp:40
HWND Create(HWND hwndParent)
Definition: textedit.cpp:297
LONG top
Definition: windef.h:307
void OnButtonUp(BOOL bLeftButton, LONG x, LONG y)
Definition: mouse.cpp:217
virtual void draw(BOOL bLeftButton, LONG x, LONG y)
Definition: mouse.cpp:410
BrushTool()
Definition: mouse.cpp:392
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
void OnMouseMove(BOOL bLeftButton, LONG x, LONG y)
Definition: mouse.cpp:269
void CalculateContents(HDC hDCImage)
LineTool()
Definition: mouse.cpp:521
BOOL m_bLeftButton
Definition: mouse.cpp:112
FillTool()
Definition: mouse.cpp:306
SelectionModel selectionModel
Definition: main.cpp:20
void OnMouseMove(BOOL bLeftButton, LONG x, LONG y)
Definition: mouse.cpp:130
LONG left
Definition: windef.h:306
LONG GetDestRectWidth() const
void Replace(HDC hdc, LONG x1, LONG y1, LONG x2, LONG y2, COLORREF fg, COLORREF bg, LONG radius)
Definition: drawing.cpp:134
void Bezier(HDC hdc, POINT p1, POINT p2, POINT p3, POINT p4, COLORREF color, int thickness)
Definition: drawing.cpp:95
virtual void draw(BOOL bLeftButton, LONG x, LONG y)
Definition: mouse.cpp:751
int GetBrushStyle() const
Definition: toolsmodel.cpp:65
DWORD GetPixel(LPDIRECTDRAWSURFACE7 Surface, UINT x, UINT y)
Definition: blt.cpp:2
LONG right
Definition: windef.h:308
virtual void draw(BOOL bLeftButton, LONG x, LONG y)
Definition: mouse.cpp:618
void OnFinishDraw()
Definition: mouse.cpp:708
void GetRect(LPRECT prc) const
int32_t INT
Definition: typedefs.h:58
void OnButtonDown(BOOL bLeftButton, LONG x, LONG y, BOOL bDoubleClick)
Definition: toolsmodel.cpp:191
int GetRubberRadius() const
Definition: toolsmodel.cpp:124
COLORREF GetBgColor() const
COLORREF GetFgColor() const
HFONT GetFont() const
Definition: textedit.h:26
void OnButtonDown(BOOL bLeftButton, LONG x, LONG y, BOOL bDoubleClick)
Definition: mouse.cpp:358
#define CX_MINTEXTEDIT
Definition: textedit.h:11
FreeSelTool()
Definition: mouse.cpp:114
BOOL InvalidateRect(LPCRECT lpRect, BOOL bErase=TRUE)
Definition: atlwin.h:868
void draw(BOOL bLeftButton, LONG x, LONG y, BOOL bClosed=FALSE)
Definition: mouse.cpp:639
void SetBgColor(COLORREF newColor)
CImgAreaWindow imageArea
Definition: main.cpp:72
void RRect(HDC hdc, LONG x1, LONG y1, LONG x2, LONG y2, COLORREF fg, COLORREF bg, int thickness, int style)
Definition: drawing.cpp:55
struct Line Line
Definition: wdfdevice.h:4081
void OnFinishDraw()
Definition: mouse.cpp:599
void OnButtonDown(BOOL bLeftButton, LONG x, LONG y, BOOL bDoubleClick)
Definition: mouse.cpp:263
#define FALSE
Definition: types.h:117
unsigned int BOOL
Definition: ntddk_ex.h:94
long LONG
Definition: pedump.c:60
void OnButtonDown(BOOL bLeftButton, LONG x, LONG y, BOOL bDoubleClick)
Definition: mouse.cpp:433
HDC GetDC()
Definition: history.cpp:239
ShapeTool()
Definition: mouse.cpp:635
virtual void draw(BOOL bLeftButton, LONG x, LONG y)=0
void OnCancelDraw()
Definition: mouse.cpp:279
RectSelTool()
Definition: mouse.cpp:190
void OnMouseMove(BOOL bLeftButton, LONG x, LONG y)
Definition: mouse.cpp:668
virtual void OnCancelDraw()
Definition: mouse.cpp:85
#define VK_SHIFT
Definition: winuser.h:2182
void Brush(HDC hdc, LONG x1, LONG y1, LONG x2, LONG y2, COLORREF color, LONG style)
Definition: drawing.cpp:160
void UpdatePoint(LONG x, LONG y)
Definition: mouse.cpp:424
void endEvent()
Definition: mouse.cpp:102
#define SM_CXDRAG
Definition: winuser.h:1022
void OnButtonDown(BOOL bLeftButton, LONG x, LONG y, BOOL bDoubleClick)
Definition: mouse.cpp:118
void OnButtonUp(BOOL bLeftButton, LONG x, LONG y)
Definition: mouse.cpp:447
void OnButtonDown(BOOL bLeftButton, LONG x, LONG y, BOOL bDoubleClick)
Definition: mouse.cpp:194
BOOL GetEditRect(LPRECT prc) const
Definition: textedit.cpp:453
void Poly(HDC hdc, POINT *lpPoints, int nCount, COLORREF fg, COLORREF bg, int thickness, int style, BOOL closed, BOOL inverted)
Definition: drawing.cpp:70
TextTool()
Definition: mouse.cpp:420
DWORD ShowTextTool
Definition: registry.h:43
int GetWidth() const
Definition: history.cpp:215
static INT pointSP
Definition: toolsmodel.h:39
void OnMouseMove(BOOL bLeftButton, LONG x, LONG y)
Definition: mouse.cpp:575
static ToolBase * createToolObject(TOOLTYPE type)
Definition: mouse.cpp:764
int GetLineWidth() const
Definition: toolsmodel.cpp:43
void OnButtonUp(BOOL bLeftButton, LONG x, LONG y)
Definition: toolsmodel.cpp:207
void OnMouseMove(BOOL bLeftButton, LONG x, LONG y)
Definition: mouse.cpp:339
void fetchColor(BOOL bLeftButton, LONG x, LONG y)
Definition: mouse.cpp:324
COLORREF m_bg
Definition: toolsmodel.h:38
int GetShapeStyle() const
Definition: toolsmodel.cpp:54
void Erase(HDC hdc, LONG x1, LONG y1, LONG x2, LONG y2, COLORREF color, LONG radius)
Definition: drawing.cpp:117
DWORD COLORREF
Definition: windef.h:300
#define _countof(array)
Definition: sndvol32.h:68
#define MIN_ZOOM
Definition: common.h:14
int WINAPI GetSystemMetrics(_In_ int)
virtual void OnFinishDraw()
Definition: mouse.cpp:90
TOOLTYPE GetOldActiveTool() const
Definition: toolsmodel.cpp:81
int GetZoom() const
Definition: toolsmodel.cpp:148
void placeSelWin()
Definition: mouse.cpp:20
virtual void draw(BOOL bLeftButton, LONG x, LONG y)
Definition: mouse.cpp:381
void reset()
Definition: mouse.cpp:76
void ValidateEditRect(LPCRECT prc OPTIONAL)
Definition: textedit.cpp:459
#define GRIP_SIZE
Definition: common.h:13
void OnCancelDraw()
Definition: mouse.cpp:245
void OnButtonDown(BOOL bLeftButton, LONG x, LONG y, BOOL bDoubleClick)
Definition: mouse.cpp:310
void OnFinishDraw()
Definition: mouse.cpp:164
BOOL m_bLeftButton
Definition: mouse.cpp:633
void OnButtonDown(BOOL bLeftButton, LONG x, LONG y, BOOL bDoubleClick)
Definition: mouse.cpp:563
COLORREF m_fg
Definition: toolsmodel.h:38
EllipseTool()
Definition: mouse.cpp:728
BOOL IsSrcRectSizeNonzero() const
SHORT WINAPI GetAsyncKeyState(_In_ int)
ZoomTool()
Definition: mouse.cpp:354
ImageModel imageModel
Definition: main.cpp:32
BOOL zoomTo(int newZoom, int mouseX, int mouseY)
Definition: winproc.cpp:19
virtual void draw(BOOL bLeftButton, LONG x, LONG y)
Definition: mouse.cpp:732
void ForceRefreshSelectionContents()
Definition: selection.cpp:24
void OnMouseMove(BOOL bLeftButton, LONG x, LONG y)
Definition: mouse.cpp:205
RectTool()
Definition: mouse.cpp:614
LONG GetDestRectHeight() const
void OnButtonDown(BOOL bLeftButton, LONG x, LONG y, BOOL bDoubleClick)
Definition: mouse.cpp:651
void updateStartAndLast(LONG x, LONG y)
Definition: mouse.cpp:64
PenTool()
Definition: mouse.cpp:377
BOOL WINAPI SetRect(_Out_ LPRECT, _In_ int, _In_ int, _In_ int, _In_ int)
void beginEvent()
Definition: mouse.cpp:95
#define CY_MINTEXTEDIT
Definition: textedit.h:12
int GetHeight() const
Definition: history.cpp:220
PaletteModel paletteModel
Definition: main.cpp:28
void SetSrcRectSizeToZero()
_In_ ULONG _In_ ULONG rgb
Definition: winddi.h:3520
void OnFinishDraw()
Definition: mouse.cpp:509
CFontsDialog fontsDialog
Definition: dialogs.cpp:22
void SetActiveTool(TOOLTYPE nActiveTool)
Definition: toolsmodel.cpp:86
GLuint start
Definition: gl.h:1545
virtual void draw(BOOL bLeftButton, LONG x, LONG y)
Definition: mouse.cpp:525
GLint y0
Definition: linetemp.h:96
int GetAirBrushWidth() const
Definition: toolsmodel.cpp:113
#define NULL
Definition: types.h:112
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
virtual void draw(BOOL bLeftButton, LONG x, LONG y)
Definition: mouse.cpp:294
void OnButtonUp(BOOL bLeftButton, LONG x, LONG y)
Definition: mouse.cpp:274
void CalculateBoundingBoxAndContents(HDC hDCImage)
void Airbrush(HDC hdc, LONG x, LONG y, COLORREF color, LONG r)
Definition: drawing.cpp:149
ColorTool()
Definition: mouse.cpp:320
BOOL WINAPI IsWindowVisible(_In_ HWND)
LONG GetDestRectTop() const
#define UNREACHABLE
LONG bottom
Definition: windef.h:309
void Bound(POINT &pt)
Definition: history.cpp:305
void OnCancelDraw()
Definition: mouse.cpp:592
void updateLast(LONG x, LONG y)
Definition: mouse.cpp:70
RubberTool()
Definition: mouse.cpp:290
#define SM_CYDRAG
Definition: winuser.h:1023
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
TOOLTYPE
Definition: toolsmodel.h:11
CTextEditWindow textEditWindow
Definition: main.cpp:81
RegistrySettings registrySettings
Definition: main.cpp:30
void Undo(BOOL bClearRedo=FALSE)
Definition: history.cpp:60
void draw(BOOL bLeftButton)
Definition: mouse.cpp:544
BOOL m_bLeftButton
Definition: mouse.cpp:538
Arabic default style
Definition: afstyles.h:93
void OnButtonUp(BOOL bLeftButton, LONG x, LONG y)
Definition: mouse.cpp:583
void ResetToPrevious(void)
Definition: history.cpp:100
BOOL nearlyEqualPoints(INT x0, INT y0, INT x1, INT y1)
Definition: mouse.cpp:57
struct Rect Rect
CSelectionWindow selectionWindow
Definition: main.cpp:71
char * Text
Definition: combotst.c:136
BOOL IsBackgroundTransparent() const
Definition: toolsmodel.cpp:135
RRectTool()
Definition: mouse.cpp:747
void OnButtonUp(BOOL bLeftButton, LONG x, LONG y)
Definition: mouse.cpp:344
void InvalidateEditRect()
Definition: textedit.cpp:354
void SetSrcAndDestRectFromPoints(const POINT &ptFrom, const POINT &ptTo)
CMainWindow mainWindow
Definition: main.cpp:63
static int UnZoomed(int xy)
Definition: common.h:42
void OnMouseMove(BOOL bLeftButton, LONG x, LONG y)
Definition: mouse.cpp:442