ReactOS  0.4.12-dev-57-g7050ac4
mouse.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

void placeSelWin (void)
 
void startPaintingL (HDC hdc, LONG x, LONG y, COLORREF fg, COLORREF bg)
 
void whilePaintingL (HDC hdc, LONG x, LONG y, COLORREF fg, COLORREF bg)
 
void endPaintingL (HDC hdc, LONG x, LONG y, COLORREF fg, COLORREF bg)
 
void startPaintingR (HDC hdc, LONG x, LONG y, COLORREF fg, COLORREF bg)
 
void whilePaintingR (HDC hdc, LONG x, LONG y, COLORREF fg, COLORREF bg)
 
void endPaintingR (HDC hdc, LONG x, LONG y, COLORREF fg, COLORREF bg)
 

Function Documentation

◆ endPaintingL()

void endPaintingL ( HDC  hdc,
LONG  x,
LONG  y,
COLORREF  fg,
COLORREF  bg 
)

Definition at line 218 of file mouse.cpp.

Referenced by CImgAreaWindow::cancelDrawing(), CMainWindow::OnCommand(), and CImgAreaWindow::OnLButtonUp().

219 {
220  switch (toolsModel.GetActiveTool())
221  {
222  case TOOL_FREESEL:
223  {
225  if (selectionModel.PtStackSize() > 1)
226  {
229 
231 
232  placeSelWin();
233  selectionWindow.ShowWindow(SW_SHOW);
235  }
237  break;
238  }
239  case TOOL_RECTSEL:
242  {
246 
248 
249  placeSelWin();
250  selectionWindow.ShowWindow(SW_SHOW);
252  }
253  break;
254  case TOOL_TEXT:
257  {
259 
260  placeSelWin();
261  selectionWindow.ShowWindow(SW_SHOW);
263  }
264  break;
265  case TOOL_RUBBER:
267  break;
268  case TOOL_PEN:
269  Line(hdc, last.x, last.y, x, y, fg, 1);
270  SetPixel(hdc, x, y, fg);
271  break;
272  case TOOL_LINE:
274  if (GetAsyncKeyState(VK_SHIFT) < 0)
275  roundTo8Directions(start.x, start.y, x, y);
276  Line(hdc, start.x, start.y, x, y, fg, toolsModel.GetLineWidth());
277  break;
278  case TOOL_BEZIER:
279  pointSP++;
280  if (pointSP == 4)
281  pointSP = 0;
282  break;
283  case TOOL_RECT:
285  if (GetAsyncKeyState(VK_SHIFT) < 0)
286  regularize(start.x, start.y, x, y);
288  break;
289  case TOOL_SHAPE:
291  pointStack[pointSP].x = x;
292  pointStack[pointSP].y = y;
293  if ((pointSP > 0) && (GetAsyncKeyState(VK_SHIFT) < 0))
296  pointSP++;
297  if (pointSP >= 2)
298  {
299  if ((pointStack[0].x - x) * (pointStack[0].x - x) +
300  (pointStack[0].y - y) * (pointStack[0].y - y) <= toolsModel.GetLineWidth() * toolsModel.GetLineWidth() + 1)
301  {
303  pointSP = 0;
304  }
305  else
306  {
308  }
309  }
310  if (pointSP == 255)
311  pointSP--;
312  break;
313  case TOOL_ELLIPSE:
315  if (GetAsyncKeyState(VK_SHIFT) < 0)
316  regularize(start.x, start.y, x, y);
318  break;
319  case TOOL_RRECT:
321  if (GetAsyncKeyState(VK_SHIFT) < 0)
322  regularize(start.x, start.y, x, y);
324  break;
325  }
326 }
int GetLineWidth()
Definition: toolsmodel.cpp:27
ToolsModel toolsModel
Definition: main.cpp:18
void CopyPrevious(void)
Definition: history.cpp:45
#define TRUE
Definition: types.h:120
long y
Definition: polytest.cpp:48
#define TOOL_TEXT
Definition: definitions.h:144
long x
Definition: polytest.cpp:48
#define TOOL_RECT
Definition: definitions.h:147
POINT last
Definition: font.c:46
#define TOOL_LINE
Definition: definitions.h:145
void regularize(LONG x0, LONG y0, LONG &x1, LONG &y1)
Definition: mouse.cpp:25
void roundTo8Directions(LONG x0, LONG y0, LONG &x1, LONG &y1)
Definition: mouse.cpp:34
void Ellp(HDC hdc, LONG x1, LONG y1, LONG x2, LONG y2, COLORREF fg, COLORREF bg, int thickness, int style)
Definition: drawing.cpp:40
#define TOOL_RUBBER
Definition: definitions.h:137
int GetRubberRadius()
Definition: toolsmodel.cpp:82
#define TOOL_SHAPE
Definition: definitions.h:148
void CalculateContents(HDC hDCImage)
SelectionModel selectionModel
Definition: main.cpp:20
#define TOOL_PEN
Definition: definitions.h:141
short pointSP
Definition: mouse.cpp:53
INT INT y
Definition: msvc.h:62
void RRect(HDC hdc, LONG x1, LONG y1, LONG x2, LONG y2, COLORREF fg, COLORREF bg, int thickness, int style)
Definition: drawing.cpp:55
#define TOOL_BEZIER
Definition: definitions.h:146
#define VK_SHIFT
Definition: winuser.h:2156
HDC hdc
Definition: msvc.h:53
void DrawBackgroundPoly(HDC hDCImage, COLORREF crBg)
#define SW_SHOW
Definition: winuser.h:769
int GetShapeStyle()
Definition: toolsmodel.cpp:38
void Poly(HDC hdc, POINT *lpPoints, int nCount, COLORREF fg, COLORREF bg, int thickness, int style, BOOL closed, BOOL inverted)
Definition: drawing.cpp:70
FORCEINLINE VOID SetPixel(IN ULONG Left, IN ULONG Top, IN UCHAR Color)
Definition: vga.c:99
void DrawBackgroundRect(HDC hDCImage, COLORREF crBg)
void Erase(HDC hdc, LONG x1, LONG y1, LONG x2, LONG y2, COLORREF color, LONG radius)
Definition: drawing.cpp:117
#define TOOL_RRECT
Definition: definitions.h:150
void placeSelWin()
Definition: mouse.cpp:16
SHORT WINAPI GetAsyncKeyState(_In_ int)
ImageModel imageModel
Definition: main.cpp:32
#define TOOL_FREESEL
Definition: definitions.h:135
#define TOOL_ELLIPSE
Definition: definitions.h:149
#define TOOL_RECTSEL
Definition: definitions.h:136
void ForceRefreshSelectionContents()
Definition: selection.cpp:56
INT x
Definition: msvc.h:62
GLuint start
Definition: gl.h:1545
int GetActiveTool()
Definition: toolsmodel.cpp:60
BOOL IsSrcRectSizeNonzero()
void DrawSelection(HDC hDCImage, COLORREF crBg=0, BOOL bBgTransparent=FALSE)
void CalculateBoundingBoxAndContents(HDC hDCImage)
POINT pointStack[256]
Definition: mouse.cpp:52
void ResetToPrevious(void)
Definition: history.cpp:93
struct Line Line
struct Rect Rect
CSelectionWindow selectionWindow
Definition: main.cpp:70

◆ endPaintingR()

void endPaintingR ( HDC  hdc,
LONG  x,
LONG  y,
COLORREF  fg,
COLORREF  bg 
)

Definition at line 464 of file mouse.cpp.

Referenced by CImgAreaWindow::cancelDrawing(), and CImgAreaWindow::OnRButtonUp().

465 {
466  switch (toolsModel.GetActiveTool())
467  {
468  case TOOL_RUBBER:
469  Replace(hdc, last.x, last.y, x, y, fg, bg, toolsModel.GetRubberRadius());
470  break;
471  case TOOL_PEN:
472  Line(hdc, last.x, last.y, x, y, bg, 1);
473  SetPixel(hdc, x, y, bg);
474  break;
475  case TOOL_LINE:
477  if (GetAsyncKeyState(VK_SHIFT) < 0)
478  roundTo8Directions(start.x, start.y, x, y);
479  Line(hdc, start.x, start.y, x, y, bg, toolsModel.GetLineWidth());
480  break;
481  case TOOL_BEZIER:
482  pointSP++;
483  if (pointSP == 4)
484  pointSP = 0;
485  break;
486  case TOOL_RECT:
488  if (GetAsyncKeyState(VK_SHIFT) < 0)
489  regularize(start.x, start.y, x, y);
491  break;
492  case TOOL_SHAPE:
494  pointStack[pointSP].x = x;
495  pointStack[pointSP].y = y;
496  if ((pointSP > 0) && (GetAsyncKeyState(VK_SHIFT) < 0))
499  pointSP++;
500  if (pointSP >= 2)
501  {
502  if ((pointStack[0].x - x) * (pointStack[0].x - x) +
503  (pointStack[0].y - y) * (pointStack[0].y - y) <= toolsModel.GetLineWidth() * toolsModel.GetLineWidth() + 1)
504  {
506  pointSP = 0;
507  }
508  else
509  {
511  }
512  }
513  if (pointSP == 255)
514  pointSP--;
515  break;
516  case TOOL_ELLIPSE:
518  if (GetAsyncKeyState(VK_SHIFT) < 0)
519  regularize(start.x, start.y, x, y);
521  break;
522  case TOOL_RRECT:
524  if (GetAsyncKeyState(VK_SHIFT) < 0)
525  regularize(start.x, start.y, x, y);
527  break;
528  }
529 }
int GetLineWidth()
Definition: toolsmodel.cpp:27
ToolsModel toolsModel
Definition: main.cpp:18
#define TRUE
Definition: types.h:120
long y
Definition: polytest.cpp:48
long x
Definition: polytest.cpp:48
#define TOOL_RECT
Definition: definitions.h:147
POINT last
Definition: font.c:46
#define TOOL_LINE
Definition: definitions.h:145
void regularize(LONG x0, LONG y0, LONG &x1, LONG &y1)
Definition: mouse.cpp:25
void roundTo8Directions(LONG x0, LONG y0, LONG &x1, LONG &y1)
Definition: mouse.cpp:34
void Ellp(HDC hdc, LONG x1, LONG y1, LONG x2, LONG y2, COLORREF fg, COLORREF bg, int thickness, int style)
Definition: drawing.cpp:40
#define TOOL_RUBBER
Definition: definitions.h:137
int GetRubberRadius()
Definition: toolsmodel.cpp:82
#define TOOL_SHAPE
Definition: definitions.h:148
void Replace(HDC hdc, LONG x1, LONG y1, LONG x2, LONG y2, COLORREF fg, COLORREF bg, LONG radius)
Definition: drawing.cpp:134
#define TOOL_PEN
Definition: definitions.h:141
short pointSP
Definition: mouse.cpp:53
INT INT y
Definition: msvc.h:62
void RRect(HDC hdc, LONG x1, LONG y1, LONG x2, LONG y2, COLORREF fg, COLORREF bg, int thickness, int style)
Definition: drawing.cpp:55
#define TOOL_BEZIER
Definition: definitions.h:146
#define VK_SHIFT
Definition: winuser.h:2156
HDC hdc
Definition: msvc.h:53
int GetShapeStyle()
Definition: toolsmodel.cpp:38
void Poly(HDC hdc, POINT *lpPoints, int nCount, COLORREF fg, COLORREF bg, int thickness, int style, BOOL closed, BOOL inverted)
Definition: drawing.cpp:70
FORCEINLINE VOID SetPixel(IN ULONG Left, IN ULONG Top, IN UCHAR Color)
Definition: vga.c:99
#define TOOL_RRECT
Definition: definitions.h:150
SHORT WINAPI GetAsyncKeyState(_In_ int)
ImageModel imageModel
Definition: main.cpp:32
#define TOOL_ELLIPSE
Definition: definitions.h:149
INT x
Definition: msvc.h:62
GLuint start
Definition: gl.h:1545
int GetActiveTool()
Definition: toolsmodel.cpp:60
POINT pointStack[256]
Definition: mouse.cpp:52
void ResetToPrevious(void)
Definition: history.cpp:93
struct Line Line
struct Rect Rect

◆ placeSelWin()

void placeSelWin ( void  )

Definition at line 16 of file mouse.cpp.

Referenced by endPaintingL(), CMainWindow::InsertSelectionFromHBITMAP(), CSelectionWindow::OnCaptureChanged(), and CSelectionWindow::OnLButtonUp().

17 {
20  selectionWindow.BringWindowToTop();
22 }
ToolsModel toolsModel
Definition: main.cpp:18
#define TRUE
Definition: types.h:120
SelectionModel selectionModel
Definition: main.cpp:20
int GetZoom()
Definition: toolsmodel.cpp:104
BOOL InvalidateRect(LPCRECT lpRect, BOOL bErase=TRUE)
Definition: atlwin.h:825
CImgAreaWindow imageArea
Definition: main.cpp:71
smooth NULL
Definition: ftsmooth.c:416
CSelectionWindow selectionWindow
Definition: main.cpp:70

◆ startPaintingL()

void startPaintingL ( HDC  hdc,
LONG  x,
LONG  y,
COLORREF  fg,
COLORREF  bg 
)

Definition at line 56 of file mouse.cpp.

Referenced by CMainWindow::OnCommand(), and CImgAreaWindow::OnLButtonDown().

57 {
58  start.x = x;
59  start.y = y;
60  last.x = x;
61  last.y = y;
62  switch (toolsModel.GetActiveTool())
63  {
64  case TOOL_FREESEL:
65  selectionWindow.ShowWindow(SW_HIDE);
68  break;
69  case TOOL_LINE:
70  case TOOL_RECT:
71  case TOOL_ELLIPSE:
72  case TOOL_RRECT:
74  break;
75  case TOOL_RECTSEL:
76  case TOOL_TEXT:
78  selectionWindow.ShowWindow(SW_HIDE);
80  break;
81  case TOOL_RUBBER:
83  Erase(hdc, x, y, x, y, bg, toolsModel.GetRubberRadius());
84  break;
85  case TOOL_FILL:
87  Fill(hdc, x, y, fg);
88  break;
89  case TOOL_PEN:
91  SetPixel(hdc, x, y, fg);
92  break;
93  case TOOL_BRUSH:
95  Brush(hdc, x, y, x, y, fg, toolsModel.GetBrushStyle());
96  break;
97  case TOOL_AIRBRUSH:
100  break;
101  case TOOL_BEZIER:
102  pointStack[pointSP].x = x;
103  pointStack[pointSP].y = y;
104  if (pointSP == 0)
105  {
107  pointSP++;
108  }
109  break;
110  case TOOL_SHAPE:
111  pointStack[pointSP].x = x;
112  pointStack[pointSP].y = y;
113  if (pointSP + 1 >= 2)
115  if (pointSP == 0)
116  {
118  pointSP++;
119  }
120  break;
121  }
122 }
int GetLineWidth()
Definition: toolsmodel.cpp:27
#define TOOL_FILL
Definition: definitions.h:138
ToolsModel toolsModel
Definition: main.cpp:18
void CopyPrevious(void)
Definition: history.cpp:45
void Fill(HDC hdc, LONG x, LONG y, COLORREF color)
Definition: drawing.cpp:109
long y
Definition: polytest.cpp:48
#define TOOL_TEXT
Definition: definitions.h:144
long x
Definition: polytest.cpp:48
#define TOOL_RECT
Definition: definitions.h:147
POINT last
Definition: font.c:46
#define TOOL_LINE
Definition: definitions.h:145
#define SW_HIDE
Definition: winuser.h:762
void PushToPtStack(LONG x, LONG y)
#define TOOL_RUBBER
Definition: definitions.h:137
int GetRubberRadius()
Definition: toolsmodel.cpp:82
#define TOOL_SHAPE
Definition: definitions.h:148
SelectionModel selectionModel
Definition: main.cpp:20
#define TOOL_PEN
Definition: definitions.h:141
short pointSP
Definition: mouse.cpp:53
INT INT y
Definition: msvc.h:62
#define TOOL_BEZIER
Definition: definitions.h:146
int GetAirBrushWidth()
Definition: toolsmodel.cpp:71
HDC hdc
Definition: msvc.h:53
void Brush(HDC hdc, LONG x1, LONG y1, LONG x2, LONG y2, COLORREF color, LONG style)
Definition: drawing.cpp:160
#define TOOL_AIRBRUSH
Definition: definitions.h:143
int GetShapeStyle()
Definition: toolsmodel.cpp:38
void Poly(HDC hdc, POINT *lpPoints, int nCount, COLORREF fg, COLORREF bg, int thickness, int style, BOOL closed, BOOL inverted)
Definition: drawing.cpp:70
FORCEINLINE VOID SetPixel(IN ULONG Left, IN ULONG Top, IN UCHAR Color)
Definition: vga.c:99
void Erase(HDC hdc, LONG x1, LONG y1, LONG x2, LONG y2, COLORREF color, LONG radius)
Definition: drawing.cpp:117
#define TOOL_RRECT
Definition: definitions.h:150
ImageModel imageModel
Definition: main.cpp:32
#define TOOL_FREESEL
Definition: definitions.h:135
#define TOOL_BRUSH
Definition: definitions.h:142
#define TOOL_ELLIPSE
Definition: definitions.h:149
#define TOOL_RECTSEL
Definition: definitions.h:136
void SetSrcRectSizeToZero()
INT x
Definition: msvc.h:62
GLuint start
Definition: gl.h:1545
int GetActiveTool()
Definition: toolsmodel.cpp:60
int GetBrushStyle()
Definition: toolsmodel.cpp:49
void Airbrush(HDC hdc, LONG x, LONG y, COLORREF color, LONG r)
Definition: drawing.cpp:149
POINT pointStack[256]
Definition: mouse.cpp:52
CSelectionWindow selectionWindow
Definition: main.cpp:70

◆ startPaintingR()

void startPaintingR ( HDC  hdc,
LONG  x,
LONG  y,
COLORREF  fg,
COLORREF  bg 
)

Definition at line 329 of file mouse.cpp.

Referenced by CImgAreaWindow::OnRButtonDown().

330 {
331  start.x = x;
332  start.y = y;
333  last.x = x;
334  last.y = y;
335  switch (toolsModel.GetActiveTool())
336  {
337  case TOOL_FREESEL:
338  case TOOL_TEXT:
339  case TOOL_LINE:
340  case TOOL_RECT:
341  case TOOL_ELLIPSE:
342  case TOOL_RRECT:
344  break;
345  case TOOL_RUBBER:
347  Replace(hdc, x, y, x, y, fg, bg, toolsModel.GetRubberRadius());
348  break;
349  case TOOL_FILL:
351  Fill(hdc, x, y, bg);
352  break;
353  case TOOL_PEN:
355  SetPixel(hdc, x, y, bg);
356  break;
357  case TOOL_BRUSH:
359  Brush(hdc, x, y, x, y, bg, toolsModel.GetBrushStyle());
360  break;
361  case TOOL_AIRBRUSH:
364  break;
365  case TOOL_BEZIER:
366  pointStack[pointSP].x = x;
367  pointStack[pointSP].y = y;
368  if (pointSP == 0)
369  {
371  pointSP++;
372  }
373  break;
374  case TOOL_SHAPE:
375  pointStack[pointSP].x = x;
376  pointStack[pointSP].y = y;
377  if (pointSP + 1 >= 2)
379  if (pointSP == 0)
380  {
382  pointSP++;
383  }
384  break;
385  }
386 }
int GetLineWidth()
Definition: toolsmodel.cpp:27
#define TOOL_FILL
Definition: definitions.h:138
ToolsModel toolsModel
Definition: main.cpp:18
void CopyPrevious(void)
Definition: history.cpp:45
void Fill(HDC hdc, LONG x, LONG y, COLORREF color)
Definition: drawing.cpp:109
long y
Definition: polytest.cpp:48
#define TOOL_TEXT
Definition: definitions.h:144
long x
Definition: polytest.cpp:48
#define TOOL_RECT
Definition: definitions.h:147
POINT last
Definition: font.c:46
#define TOOL_LINE
Definition: definitions.h:145
#define TOOL_RUBBER
Definition: definitions.h:137
int GetRubberRadius()
Definition: toolsmodel.cpp:82
#define TOOL_SHAPE
Definition: definitions.h:148
void Replace(HDC hdc, LONG x1, LONG y1, LONG x2, LONG y2, COLORREF fg, COLORREF bg, LONG radius)
Definition: drawing.cpp:134
#define TOOL_PEN
Definition: definitions.h:141
short pointSP
Definition: mouse.cpp:53
INT INT y
Definition: msvc.h:62
#define TOOL_BEZIER
Definition: definitions.h:146
int GetAirBrushWidth()
Definition: toolsmodel.cpp:71
HDC hdc
Definition: msvc.h:53
void Brush(HDC hdc, LONG x1, LONG y1, LONG x2, LONG y2, COLORREF color, LONG style)
Definition: drawing.cpp:160
#define TOOL_AIRBRUSH
Definition: definitions.h:143
int GetShapeStyle()
Definition: toolsmodel.cpp:38
void Poly(HDC hdc, POINT *lpPoints, int nCount, COLORREF fg, COLORREF bg, int thickness, int style, BOOL closed, BOOL inverted)
Definition: drawing.cpp:70
FORCEINLINE VOID SetPixel(IN ULONG Left, IN ULONG Top, IN UCHAR Color)
Definition: vga.c:99
#define TOOL_RRECT
Definition: definitions.h:150
ImageModel imageModel
Definition: main.cpp:32
#define TOOL_FREESEL
Definition: definitions.h:135
#define TOOL_BRUSH
Definition: definitions.h:142
#define TOOL_ELLIPSE
Definition: definitions.h:149
INT x
Definition: msvc.h:62
GLuint start
Definition: gl.h:1545
int GetActiveTool()
Definition: toolsmodel.cpp:60
int GetBrushStyle()
Definition: toolsmodel.cpp:49
void Airbrush(HDC hdc, LONG x, LONG y, COLORREF color, LONG r)
Definition: drawing.cpp:149
POINT pointStack[256]
Definition: mouse.cpp:52

◆ whilePaintingL()

void whilePaintingL ( HDC  hdc,
LONG  x,
LONG  y,
COLORREF  fg,
COLORREF  bg 
)

Definition at line 125 of file mouse.cpp.

Referenced by CMainWindow::OnCommand(), and CImgAreaWindow::OnMouseMove().

126 {
127  switch (toolsModel.GetActiveTool())
128  {
129  case TOOL_FREESEL:
130  if (selectionModel.PtStackSize() == 1)
135  break;
136  case TOOL_RECTSEL:
137  case TOOL_TEXT:
138  {
139  POINT temp;
141  temp.x = max(0, min(x, imageModel.GetWidth()));
142  temp.y = max(0, min(y, imageModel.GetHeight()));
144  RectSel(hdc, start.x, start.y, temp.x, temp.y);
145  break;
146  }
147  case TOOL_RUBBER:
149  break;
150  case TOOL_PEN:
151  Line(hdc, last.x, last.y, x, y, fg, 1);
152  break;
153  case TOOL_BRUSH:
154  Brush(hdc, last.x, last.y, x, y, fg, toolsModel.GetBrushStyle());
155  break;
156  case TOOL_AIRBRUSH:
158  break;
159  case TOOL_LINE:
161  if (GetAsyncKeyState(VK_SHIFT) < 0)
162  roundTo8Directions(start.x, start.y, x, y);
163  Line(hdc, start.x, start.y, x, y, fg, toolsModel.GetLineWidth());
164  break;
165  case TOOL_BEZIER:
167  pointStack[pointSP].x = x;
168  pointStack[pointSP].y = y;
169  switch (pointSP)
170  {
171  case 1:
172  Line(hdc, pointStack[0].x, pointStack[0].y, pointStack[1].x, pointStack[1].y, fg,
174  break;
175  case 2:
177  break;
178  case 3:
180  break;
181  }
182  break;
183  case TOOL_RECT:
185  if (GetAsyncKeyState(VK_SHIFT) < 0)
186  regularize(start.x, start.y, x, y);
187  Rect(hdc, start.x, start.y, x, y, fg, bg, toolsModel.GetLineWidth(), toolsModel.GetShapeStyle());
188  break;
189  case TOOL_SHAPE:
191  pointStack[pointSP].x = x;
192  pointStack[pointSP].y = y;
193  if ((pointSP > 0) && (GetAsyncKeyState(VK_SHIFT) < 0))
196  if (pointSP + 1 >= 2)
198  break;
199  case TOOL_ELLIPSE:
201  if (GetAsyncKeyState(VK_SHIFT) < 0)
202  regularize(start.x, start.y, x, y);
203  Ellp(hdc, start.x, start.y, x, y, fg, bg, toolsModel.GetLineWidth(), toolsModel.GetShapeStyle());
204  break;
205  case TOOL_RRECT:
207  if (GetAsyncKeyState(VK_SHIFT) < 0)
208  regularize(start.x, start.y, x, y);
209  RRect(hdc, start.x, start.y, x, y, fg, bg, toolsModel.GetLineWidth(), toolsModel.GetShapeStyle());
210  break;
211  }
212 
213  last.x = x;
214  last.y = y;
215 }
int GetLineWidth()
Definition: toolsmodel.cpp:27
ToolsModel toolsModel
Definition: main.cpp:18
void CopyPrevious(void)
Definition: history.cpp:45
#define max(a, b)
Definition: svc.c:63
void DrawFramePoly(HDC hDCImage)
long y
Definition: polytest.cpp:48
#define TOOL_TEXT
Definition: definitions.h:144
void RectSel(HDC hdc, LONG x1, LONG y1, LONG x2, LONG y2)
Definition: drawing.cpp:228
long x
Definition: polytest.cpp:48
#define TOOL_RECT
Definition: definitions.h:147
POINT last
Definition: font.c:46
#define TOOL_LINE
Definition: definitions.h:145
void regularize(LONG x0, LONG y0, LONG &x1, LONG &y1)
Definition: mouse.cpp:25
void roundTo8Directions(LONG x0, LONG y0, LONG &x1, LONG &y1)
Definition: mouse.cpp:34
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
#define TOOL_RUBBER
Definition: definitions.h:137
int GetRubberRadius()
Definition: toolsmodel.cpp:82
#define TOOL_SHAPE
Definition: definitions.h:148
SelectionModel selectionModel
Definition: main.cpp:20
void Bezier(HDC hdc, POINT p1, POINT p2, POINT p3, POINT p4, COLORREF color, int thickness)
Definition: drawing.cpp:95
#define TOOL_PEN
Definition: definitions.h:141
short pointSP
Definition: mouse.cpp:53
INT INT y
Definition: msvc.h:62
void RRect(HDC hdc, LONG x1, LONG y1, LONG x2, LONG y2, COLORREF fg, COLORREF bg, int thickness, int style)
Definition: drawing.cpp:55
#define TOOL_BEZIER
Definition: definitions.h:146
#define VK_SHIFT
Definition: winuser.h:2156
int GetAirBrushWidth()
Definition: toolsmodel.cpp:71
HDC hdc
Definition: msvc.h:53
void Brush(HDC hdc, LONG x1, LONG y1, LONG x2, LONG y2, COLORREF color, LONG style)
Definition: drawing.cpp:160
#define TOOL_AIRBRUSH
Definition: definitions.h:143
int GetShapeStyle()
Definition: toolsmodel.cpp:38
void Poly(HDC hdc, POINT *lpPoints, int nCount, COLORREF fg, COLORREF bg, int thickness, int style, BOOL closed, BOOL inverted)
Definition: drawing.cpp:70
void Erase(HDC hdc, LONG x1, LONG y1, LONG x2, LONG y2, COLORREF color, LONG radius)
Definition: drawing.cpp:117
#define TOOL_RRECT
Definition: definitions.h:150
int GetWidth()
Definition: history.cpp:195
int GetHeight()
Definition: history.cpp:200
SHORT WINAPI GetAsyncKeyState(_In_ int)
ImageModel imageModel
Definition: main.cpp:32
#define TOOL_FREESEL
Definition: definitions.h:135
static stack_node_t temp
Definition: rpn.c:18
#define TOOL_BRUSH
Definition: definitions.h:142
#define TOOL_ELLIPSE
Definition: definitions.h:149
#define TOOL_RECTSEL
Definition: definitions.h:136
INT x
Definition: msvc.h:62
GLuint start
Definition: gl.h:1545
int GetActiveTool()
Definition: toolsmodel.cpp:60
int GetBrushStyle()
Definition: toolsmodel.cpp:49
#define min(a, b)
Definition: monoChain.cc:55
void Airbrush(HDC hdc, LONG x, LONG y, COLORREF color, LONG r)
Definition: drawing.cpp:149
POINT pointStack[256]
Definition: mouse.cpp:52
void ResetToPrevious(void)
Definition: history.cpp:93
struct Line Line
struct Rect Rect
void SetSrcAndDestRectFromPoints(POINT &ptFrom, POINT &ptTo)

◆ whilePaintingR()

void whilePaintingR ( HDC  hdc,
LONG  x,
LONG  y,
COLORREF  fg,
COLORREF  bg 
)

Definition at line 389 of file mouse.cpp.

Referenced by CImgAreaWindow::OnMouseMove().

390 {
391  switch (toolsModel.GetActiveTool())
392  {
393  case TOOL_RUBBER:
394  Replace(hdc, last.x, last.y, x, y, fg, bg, toolsModel.GetRubberRadius());
395  break;
396  case TOOL_PEN:
397  Line(hdc, last.x, last.y, x, y, bg, 1);
398  break;
399  case TOOL_BRUSH:
400  Brush(hdc, last.x, last.y, x, y, bg, toolsModel.GetBrushStyle());
401  break;
402  case TOOL_AIRBRUSH:
404  break;
405  case TOOL_LINE:
407  if (GetAsyncKeyState(VK_SHIFT) < 0)
408  roundTo8Directions(start.x, start.y, x, y);
409  Line(hdc, start.x, start.y, x, y, bg, toolsModel.GetLineWidth());
410  break;
411  case TOOL_BEZIER:
413  pointStack[pointSP].x = x;
414  pointStack[pointSP].y = y;
415  switch (pointSP)
416  {
417  case 1:
418  Line(hdc, pointStack[0].x, pointStack[0].y, pointStack[1].x, pointStack[1].y, bg,
420  break;
421  case 2:
423  break;
424  case 3:
426  break;
427  }
428  break;
429  case TOOL_RECT:
431  if (GetAsyncKeyState(VK_SHIFT) < 0)
432  regularize(start.x, start.y, x, y);
433  Rect(hdc, start.x, start.y, x, y, bg, fg, toolsModel.GetLineWidth(), toolsModel.GetShapeStyle());
434  break;
435  case TOOL_SHAPE:
437  pointStack[pointSP].x = x;
438  pointStack[pointSP].y = y;
439  if ((pointSP > 0) && (GetAsyncKeyState(VK_SHIFT) < 0))
442  if (pointSP + 1 >= 2)
444  break;
445  case TOOL_ELLIPSE:
447  if (GetAsyncKeyState(VK_SHIFT) < 0)
448  regularize(start.x, start.y, x, y);
449  Ellp(hdc, start.x, start.y, x, y, bg, fg, toolsModel.GetLineWidth(), toolsModel.GetShapeStyle());
450  break;
451  case TOOL_RRECT:
453  if (GetAsyncKeyState(VK_SHIFT) < 0)
454  regularize(start.x, start.y, x, y);
455  RRect(hdc, start.x, start.y, x, y, bg, fg, toolsModel.GetLineWidth(), toolsModel.GetShapeStyle());
456  break;
457  }
458 
459  last.x = x;
460  last.y = y;
461 }
int GetLineWidth()
Definition: toolsmodel.cpp:27
ToolsModel toolsModel
Definition: main.cpp:18
long y
Definition: polytest.cpp:48
long x
Definition: polytest.cpp:48
#define TOOL_RECT
Definition: definitions.h:147
POINT last
Definition: font.c:46
#define TOOL_LINE
Definition: definitions.h:145
void regularize(LONG x0, LONG y0, LONG &x1, LONG &y1)
Definition: mouse.cpp:25
void roundTo8Directions(LONG x0, LONG y0, LONG &x1, LONG &y1)
Definition: mouse.cpp:34
void Ellp(HDC hdc, LONG x1, LONG y1, LONG x2, LONG y2, COLORREF fg, COLORREF bg, int thickness, int style)
Definition: drawing.cpp:40
#define TOOL_RUBBER
Definition: definitions.h:137
int GetRubberRadius()
Definition: toolsmodel.cpp:82
#define TOOL_SHAPE
Definition: definitions.h:148
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
#define TOOL_PEN
Definition: definitions.h:141
short pointSP
Definition: mouse.cpp:53
INT INT y
Definition: msvc.h:62
void RRect(HDC hdc, LONG x1, LONG y1, LONG x2, LONG y2, COLORREF fg, COLORREF bg, int thickness, int style)
Definition: drawing.cpp:55
#define TOOL_BEZIER
Definition: definitions.h:146
#define VK_SHIFT
Definition: winuser.h:2156
int GetAirBrushWidth()
Definition: toolsmodel.cpp:71
HDC hdc
Definition: msvc.h:53
void Brush(HDC hdc, LONG x1, LONG y1, LONG x2, LONG y2, COLORREF color, LONG style)
Definition: drawing.cpp:160
#define TOOL_AIRBRUSH
Definition: definitions.h:143
int GetShapeStyle()
Definition: toolsmodel.cpp:38
void Poly(HDC hdc, POINT *lpPoints, int nCount, COLORREF fg, COLORREF bg, int thickness, int style, BOOL closed, BOOL inverted)
Definition: drawing.cpp:70
#define TOOL_RRECT
Definition: definitions.h:150
SHORT WINAPI GetAsyncKeyState(_In_ int)
ImageModel imageModel
Definition: main.cpp:32
#define TOOL_BRUSH
Definition: definitions.h:142
#define TOOL_ELLIPSE
Definition: definitions.h:149
INT x
Definition: msvc.h:62
GLuint start
Definition: gl.h:1545
int GetActiveTool()
Definition: toolsmodel.cpp:60
int GetBrushStyle()
Definition: toolsmodel.cpp:49
void Airbrush(HDC hdc, LONG x, LONG y, COLORREF color, LONG r)
Definition: drawing.cpp:149
POINT pointStack[256]
Definition: mouse.cpp:52
void ResetToPrevious(void)
Definition: history.cpp:93
struct Line Line
struct Rect Rect