ReactOS 0.4.17-dev-357-ga8f14ff
CToolSettingsWindow Class Reference

#include <toolsettings.h>

Inheritance diagram for CToolSettingsWindow:
Collaboration diagram for CToolSettingsWindow:

Public Member Functions

BOOL DoCreate (HWND hwndParent)
 

Private Member Functions

VOID drawTrans (HDC hdc, LPCRECT prc)
 
VOID drawRubber (HDC hdc, LPCRECT prc)
 
VOID drawBrush (HDC hdc, LPCRECT prc)
 
VOID drawLine (HDC hdc, LPCRECT prc)
 
VOID drawBox (HDC hdc, LPCRECT prc)
 
VOID drawAirBrush (HDC hdc, LPCRECT prc)
 
VOID calculateTwoBoxes (CRect &rect1, CRect &rect2)
 
LRESULT OnCreate (UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
 
LRESULT OnDestroy (UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
 
LRESULT OnVScroll (UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
 
LRESULT OnPaint (UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
 
LRESULT OnLButtonDown (UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
 
LRESULT OnNotify (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 OnToolsModelColorPicked (UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
 
LRESULT OnToolsModelZoomChanged (UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
 

Private Attributes

CWindow trackbarZoom
 
HICON m_hNontranspIcon
 
HICON m_hTranspIcon
 
COLORREF m_rgbPickColor = CLR_INVALID
 

Detailed Description

Definition at line 10 of file toolsettings.h.

Member Function Documentation

◆ calculateTwoBoxes()

VOID CToolSettingsWindow::calculateTwoBoxes ( CRect rect1,
CRect rect2 
)
private

Definition at line 337 of file toolsettings.cpp.

338{
339 CRect rcClient;
340 GetClientRect(&rcClient);
341 rcClient.InflateRect(-MARGIN1, -MARGIN1);
342
343 INT yCenter = (rcClient.top + rcClient.bottom) / 2;
344 rect1.SetRect(rcClient.left, rcClient.top, rcClient.right, yCenter);
345 rect2.SetRect(rcClient.left, yCenter, rcClient.right, rcClient.bottom);
346
347 rect1.InflateRect(-MARGIN2, -MARGIN2);
348 rect2.InflateRect(-MARGIN2, -MARGIN2);
349}
void InflateRect(int x, int y) noexcept
Definition: atltypes.h:323
void SetRect(int x1, int y1, int x2, int y2) noexcept
Definition: atltypes.h:423
RECT rect2
Definition: edittest.c:51
LONG right
Definition: windef.h:108
LONG bottom
Definition: windef.h:109
LONG top
Definition: windef.h:107
LONG left
Definition: windef.h:106
#define MARGIN2
#define MARGIN1
int32_t INT
Definition: typedefs.h:58
BOOL WINAPI GetClientRect(_In_ HWND, _Out_ LPRECT)

Referenced by OnCreate(), OnLButtonDown(), and OnPaint().

◆ DoCreate()

BOOL CToolSettingsWindow::DoCreate ( HWND  hwndParent)

Definition at line 32 of file toolsettings.cpp.

33{
34 RECT toolSettingsWindowPos =
35 {
38 };
39 return !!Create(toolBoxContainer, toolSettingsWindowPos, NULL, WS_CHILD | WS_VISIBLE);
40}
CToolBox toolBoxContainer
Definition: toolbox.cpp:11
@ Create
Definition: registry.c:563
#define NULL
Definition: types.h:112
#define WS_CHILD
Definition: pedump.c:617
#define WS_VISIBLE
Definition: pedump.c:620
#define Y_TOOLSETTINGS
#define CY_TOOLSETTINGS
#define CX_TOOLSETTINGS
#define X_TOOLSETTINGS

Referenced by CToolBox::OnCreate().

◆ drawAirBrush()

VOID CToolSettingsWindow::drawAirBrush ( HDC  hdc,
LPCRECT  prc 
)
private

Definition at line 209 of file toolsettings.cpp.

210{
211 RECT rects[4];
212 getAirBrushRects(rects, prc);
213
214 srand(0);
215 for (size_t i = 0; i < 4; ++i)
216 {
217 RECT& rc = rects[i];
218 INT x = (rc.left + rc.right) / 2;
219 INT y = (rc.top + rc.bottom) / 2;
221 if (bHigh)
222 {
224
225 for (int k = 0; k < 3; ++k)
227 }
228 else
229 {
230 for (int k = 0; k < 3; ++k)
232 }
233 }
234}
ToolsModel toolsModel
Definition: toolsmodel.cpp:10
INT GetAirBrushRadius() const
Definition: toolsmodel.cpp:191
_ACRTIMP void __cdecl srand(unsigned int)
Definition: misc.c:50
void Airbrush(HDC hdc, LONG x, LONG y, COLORREF color, LONG r)
Definition: drawing.cpp:153
unsigned int BOOL
Definition: ntddk_ex.h:94
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
HDC hdc
Definition: main.c:9
int k
Definition: mpi.c:3369
_Out_ LPRECT prc
Definition: ntgdi.h:1658
static const BYTE s_AirRadius[4]
static INT getAirBrushRects(RECT rects[4], LPCRECT prc, LPPOINT ppt=NULL)
int WINAPI FillRect(HDC, LPCRECT, HBRUSH)
DWORD WINAPI GetSysColor(_In_ int)
#define COLOR_WINDOWTEXT
Definition: winuser.h:932
#define COLOR_HIGHLIGHT
Definition: winuser.h:937
HBRUSH WINAPI GetSysColorBrush(_In_ int)
#define COLOR_HIGHLIGHTTEXT
Definition: winuser.h:938

Referenced by OnPaint().

◆ drawBox()

VOID CToolSettingsWindow::drawBox ( HDC  hdc,
LPCRECT  prc 
)
private

Definition at line 241 of file toolsettings.cpp.

242{
243 CRect rects[3];
244 getBoxRects(rects, prc);
245
246 for (INT iItem = 0; iItem < 3; ++iItem)
247 {
248 CRect& rcItem = rects[iItem];
249
250 if (toolsModel.GetShapeStyle() == iItem)
252
253 rcItem.InflateRect(-5, -5);
254
255 if (iItem <= 1)
256 {
257 COLORREF rgbPen;
258 if (toolsModel.GetShapeStyle() == iItem)
260 else
262 HGDIOBJ hOldBrush;
263 if (iItem == 0)
265 else
267 HGDIOBJ hOldPen = ::SelectObject(hdc, ::CreatePen(PS_SOLID, 1, rgbPen));
268 ::Rectangle(hdc, rcItem.left, rcItem.top, rcItem.right, rcItem.bottom);
270 ::SelectObject(hdc, hOldBrush);
271 }
272 else
273 {
274 if (toolsModel.GetShapeStyle() == iItem)
276 else
277 ::FillRect(hdc, &rcItem, ::GetSysColorBrush(COLOR_WINDOWTEXT));
278 }
279 }
280}
int GetShapeStyle() const
Definition: toolsmodel.cpp:119
pKey DeleteObject()
static INT getBoxRects(RECT rects[3], LPCRECT prc, LPPOINT ppt=NULL)
DWORD COLORREF
Definition: windef.h:100
HGDIOBJ WINAPI GetStockObject(_In_ int)
HGDIOBJ WINAPI SelectObject(_In_ HDC, _In_ HGDIOBJ)
Definition: dc.c:1546
#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)
#define PS_SOLID
Definition: wingdi.h:586
#define COLOR_APPWORKSPACE
Definition: winuser.h:936

Referenced by OnPaint().

◆ drawBrush()

VOID CToolSettingsWindow::drawBrush ( HDC  hdc,
LPCRECT  prc 
)
private

Definition at line 131 of file toolsettings.cpp.

132{
133 RECT rects[12];
134 getBrushRects(rects, prc);
135
136 for (INT i = 0; i < 12; i++)
137 {
138 RECT rcItem = rects[i];
139 INT x = (rcItem.left + rcItem.right) / 2, y = (rcItem.top + rcItem.bottom) / 2;
140
141 INT iColor;
143 if (data.width == toolsModel.GetBrushWidth() && data.style == toolsModel.GetBrushStyle())
144 {
146 ::FillRect(hdc, &rcItem, (HBRUSH)(COLOR_HIGHLIGHT + 1));
147 }
148 else
149 {
151 }
152
153 Brush(hdc, x, y, x, y, ::GetSysColor(iColor), data.style, data.width);
154 }
155}
BrushStyle GetBrushStyle() const
Definition: toolsmodel.cpp:130
INT GetBrushWidth() const
Definition: toolsmodel.cpp:70
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
static INT getBrushRects(RECT rects[12], LPCRECT prc, LPPOINT ppt=NULL)
static const BrushStyleAndWidth c_BrushPresets[]
_In_ ULONG iColor
Definition: xlateobj.h:17

Referenced by OnPaint().

◆ drawLine()

VOID CToolSettingsWindow::drawLine ( HDC  hdc,
LPCRECT  prc 
)
private

Definition at line 162 of file toolsettings.cpp.

163{
164 RECT rects[5];
165 getLineRects(rects, prc);
166
167 for (INT i = 0; i < 5; i++)
168 {
169 INT penWidth = i + 1;
170 CRect rcLine = rects[i];
171 rcLine.InflateRect(-2, 0);
172 rcLine.top = (rcLine.top + rcLine.bottom - penWidth) / 2;
173 rcLine.bottom = rcLine.top + penWidth;
174 if (toolsModel.GetLineWidth() == penWidth)
175 {
178 }
179 else
180 {
182 }
183 }
184}
int GetLineWidth() const
Definition: toolsmodel.cpp:46
static INT getLineRects(RECT rects[5], LPCRECT prc, LPPOINT ppt=NULL)

Referenced by OnPaint().

◆ drawRubber()

VOID CToolSettingsWindow::drawRubber ( HDC  hdc,
LPCRECT  prc 
)
private

Definition at line 85 of file toolsettings.cpp.

86{
87 RECT rects[4], rcRubber;
88 getRubberRects(rects, prc);
89 INT xCenter = (prc->left + prc->right) / 2;
90 for (INT i = 0; i < 4; i++)
91 {
92 INT iColor, radius = i + 2;
93 if (toolsModel.GetRubberRadius() == radius)
94 {
97 }
98 else
99 {
101 }
102
103 INT yCenter = (rects[i].top + rects[i].bottom) / 2;
104 rcRubber.left = xCenter - radius;
105 rcRubber.top = yCenter - radius;
106 rcRubber.right = rcRubber.left + radius * 2;
107 rcRubber.bottom = rcRubber.top + radius * 2;
109 }
110}
int GetRubberRadius() const
Definition: toolsmodel.cpp:202
static INT getRubberRects(RECT rects[4], LPCRECT prc, LPPOINT ppt=NULL)

Referenced by OnPaint().

◆ drawTrans()

VOID CToolSettingsWindow::drawTrans ( HDC  hdc,
LPCRECT  prc 
)
private

Definition at line 68 of file toolsettings.cpp.

69{
70 RECT rc[2];
71 getTransRects(rc, prc);
72
76 ::DrawIconEx(hdc, rc[1].left, rc[1].top, m_hTranspIcon,
78}
BOOL IsBackgroundTransparent() const
Definition: toolsmodel.cpp:258
GLdouble GLdouble GLdouble GLdouble top
Definition: glext.h:10859
GLint left
Definition: glext.h:7726
#define CY_TRANS_ICON
#define CX_TRANS_ICON
static INT getTransRects(RECT rects[2], LPCRECT prc, LPPOINT ppt=NULL)
#define DI_NORMAL
Definition: wingdi.h:72
BOOL WINAPI DrawIconEx(_In_ HDC, _In_ int, _In_ int, _In_ HICON, _In_ int, _In_ int, _In_ UINT, _In_opt_ HBRUSH, _In_ UINT)
Definition: cursoricon.c:2397

Referenced by OnPaint().

◆ OnCreate()

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

Definition at line 282 of file toolsettings.cpp.

283{
284 /* preloading the draw transparent/nontransparent icons for later use */
289
290 CRect trackbarZoomPos, rect2;
291 calculateTwoBoxes(trackbarZoomPos, rect2);
292 trackbarZoomPos.InflateRect(-1, -1);
293
294 trackbarZoom.Create(TRACKBAR_CLASS, m_hWnd, trackbarZoomPos, NULL, WS_CHILD | TBS_VERT | TBS_AUTOTICKS);
297 return 0;
298}
HINSTANCE g_hinstExe
Definition: main.cpp:17
#define IDI_NONTRANSPARENT
Definition: resource.h:18
#define IDI_TRANSPARENT
Definition: resource.h:17
HWND Create(LPCTSTR lpstrWndClass, HWND hWndParent, _U_RECT rect=NULL, LPCTSTR szWindowName=NULL, DWORD dwStyle=0, DWORD dwExStyle=0, _U_MENUorID MenuOrID=0U, LPVOID lpCreateParam=NULL)
Definition: atlwin.h:417
LRESULT SendMessage(UINT message, WPARAM wParam=0, LPARAM lParam=0)
Definition: atlwin.h:1116
VOID calculateTwoBoxes(CRect &rect1, CRect &rect2)
#define TRUE
Definition: types.h:120
static HICON
Definition: imagelist.c:80
#define TBS_VERT
Definition: commctrl.h:2021
#define TBM_SETRANGE
Definition: commctrl.h:2042
#define TBM_SETPOS
Definition: commctrl.h:2041
#define TBS_AUTOTICKS
Definition: commctrl.h:2020
#define TRACKBAR_CLASS
Definition: commctrl.h:2018
#define DEFAULT_ZOOM_TRACK
#define MAX_ZOOM_TRACK
#define MIN_ZOOM_TRACK
#define MAKELPARAM(l, h)
Definition: winuser.h:4116
#define IMAGE_ICON
Definition: winuser.h:212
HANDLE WINAPI LoadImageW(_In_opt_ HINSTANCE hInst, _In_ LPCWSTR name, _In_ UINT type, _In_ int cx, _In_ int cy, _In_ UINT fuLoad)
Definition: cursoricon.c:2572
#define LR_DEFAULTCOLOR
Definition: winuser.h:1098
#define MAKEINTRESOURCEW(i)
Definition: winuser.h:582

◆ OnDestroy()

LRESULT CToolSettingsWindow::OnDestroy ( UINT  nMsg,
WPARAM  wParam,
LPARAM  lParam,
BOOL bHandled 
)
private

Definition at line 300 of file toolsettings.cpp.

301{
304 return 0;
305}
BOOL WINAPI DestroyIcon(_In_ HICON)
Definition: cursoricon.c:2422

◆ OnLButtonDown()

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

Definition at line 411 of file toolsettings.cpp.

412{
414
415 CRect rect1, rect2;
416 calculateTwoBoxes(rect1, rect2);
417 RECT rects[12];
418
419 INT iItem;
420 switch (toolsModel.GetActiveTool())
421 {
422 case TOOL_FREESEL:
423 case TOOL_RECTSEL:
424 case TOOL_TEXT:
425 iItem = getTransRects(rects, &rect1, &pt);
426 if (iItem != -1)
428 break;
429 case TOOL_RUBBER:
430 iItem = getRubberRects(rects, &rect1, &pt);
431 if (iItem != -1)
432 toolsModel.SetRubberRadius(iItem + 2);
433 break;
434 case TOOL_BRUSH:
435 iItem = getBrushRects(rects, &rect1, &pt);
436 if (iItem != -1)
437 {
438 const BrushStyleAndWidth& data = c_BrushPresets[iItem];
441 }
442 break;
443 case TOOL_AIRBRUSH:
444 iItem = getAirBrushRects(rects, &rect1, &pt);
445 if (iItem != -1)
447 break;
448 case TOOL_LINE:
449 case TOOL_BEZIER:
450 iItem = getLineRects(rects, &rect1, &pt);
451 if (iItem != -1)
452 toolsModel.SetLineWidth(iItem + 1);
453 break;
454 case TOOL_RECT:
455 case TOOL_SHAPE:
456 case TOOL_ELLIPSE:
457 case TOOL_RRECT:
458 iItem = getBoxRects(rects, &rect1, &pt);
459 if (iItem != -1)
461
462 iItem = getLineRects(rects, &rect2, &pt);
463 if (iItem != -1)
464 toolsModel.SetLineWidth(iItem + 1);
465 break;
466 case TOOL_FILL:
467 case TOOL_COLOR:
468 case TOOL_ZOOM:
469 case TOOL_PEN:
470 break;
471 }
472
473 ::SetCapture(::GetParent(m_hWnd));
474 return 0;
475}
void SetBrushStyle(BrushStyle nBrushStyle)
Definition: toolsmodel.cpp:135
void SetAirBrushRadius(INT nAirBrushRadius)
Definition: toolsmodel.cpp:196
void SetShapeStyle(int nShapeStyle)
Definition: toolsmodel.cpp:124
void SetRubberRadius(int nRubberRadius)
Definition: toolsmodel.cpp:207
void SetBackgroundTransparent(BOOL bTransparent)
Definition: toolsmodel.cpp:263
TOOLTYPE GetActiveTool() const
Definition: toolsmodel.cpp:142
void SetBrushWidth(INT nBrushWidth)
Definition: toolsmodel.cpp:81
void SetLineWidth(int nLineWidth)
Definition: toolsmodel.cpp:51
LPARAM lParam
Definition: combotst.c:139
#define pt(x, y)
Definition: drawing.c:79
@ 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
#define GET_Y_LPARAM(lp)
Definition: windowsx.h:300
#define GET_X_LPARAM(lp)
Definition: windowsx.h:299
HWND WINAPI SetCapture(_In_ HWND hWnd)
HWND WINAPI GetParent(_In_ HWND)

◆ OnNotify()

LRESULT CToolSettingsWindow::OnNotify ( UINT  nMsg,
WPARAM  wParam,
LPARAM  lParam,
BOOL bHandled 
)
private

Definition at line 326 of file toolsettings.cpp.

327{
328 NMHDR *pnmhdr = (NMHDR*)lParam;
329 if (pnmhdr->code == NM_CUSTOMDRAW)
330 {
331 NMCUSTOMDRAW *pCustomDraw = (NMCUSTOMDRAW*)pnmhdr;
332 pCustomDraw->uItemState &= ~CDIS_FOCUS; // Do not draw the focus
333 }
334 return 0;
335}
#define NM_CUSTOMDRAW
Definition: commctrl.h:137
UINT code
Definition: winuser.h:3267

◆ OnPaint()

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

Definition at line 351 of file toolsettings.cpp.

352{
353 CRect rect1, rect2;
354 calculateTwoBoxes(rect1, rect2);
355
356 PAINTSTRUCT ps;
357 HDC hdc = BeginPaint(&ps);
358
361
364
365 rect1.InflateRect(-MARGIN2, -MARGIN2);
366 rect2.InflateRect(-MARGIN2, -MARGIN2);
367 switch (toolsModel.GetActiveTool())
368 {
369 case TOOL_FREESEL:
370 case TOOL_RECTSEL:
371 case TOOL_TEXT:
372 drawTrans(hdc, &rect1);
373 break;
374 case TOOL_RUBBER:
375 drawRubber(hdc, &rect1);
376 break;
377 case TOOL_BRUSH:
378 drawBrush(hdc, &rect1);
379 break;
380 case TOOL_AIRBRUSH:
381 drawAirBrush(hdc, &rect1);
382 break;
383 case TOOL_LINE:
384 case TOOL_BEZIER:
385 drawLine(hdc, &rect1);
386 break;
387 case TOOL_RECT:
388 case TOOL_SHAPE:
389 case TOOL_ELLIPSE:
390 case TOOL_RRECT:
391 drawBox(hdc, &rect1);
392 drawLine(hdc, &rect2);
393 break;
394 case TOOL_COLOR:
396 {
397 HBRUSH hbr = CreateSolidBrush(m_rgbPickColor);
398 FillRect(hdc, &rect1, hbr);
399 DeleteObject(hbr);
400 }
401 break;
402 case TOOL_FILL:
403 case TOOL_ZOOM:
404 case TOOL_PEN:
405 break;
406 }
407 EndPaint(&ps);
408 return 0;
409}
COLORREF m_rgbPickColor
Definition: toolsettings.h:34
VOID drawBrush(HDC hdc, LPCRECT prc)
VOID drawBox(HDC hdc, LPCRECT prc)
VOID drawLine(HDC hdc, LPCRECT prc)
VOID drawAirBrush(HDC hdc, LPCRECT prc)
VOID drawRubber(HDC hdc, LPCRECT prc)
VOID drawTrans(HDC hdc, LPCRECT prc)
static HDC
Definition: imagelist.c:88
#define CLR_INVALID
Definition: wingdi.h:883
HBRUSH WINAPI CreateSolidBrush(_In_ COLORREF)
#define BDR_SUNKENOUTER
Definition: winuser.h:443
#define BF_MIDDLE
Definition: winuser.h:468
BOOL WINAPI DrawEdge(_In_ HDC, _Inout_ LPRECT, _In_ UINT, _In_ UINT)
BOOL WINAPI EndPaint(_In_ HWND, _In_ const PAINTSTRUCT *)
HDC WINAPI BeginPaint(_In_ HWND, _Out_ LPPAINTSTRUCT)
#define BF_RECT
Definition: winuser.h:462

◆ OnToolsModelColorPicked()

LRESULT CToolSettingsWindow::OnToolsModelColorPicked ( UINT  nMsg,
WPARAM  wParam,
LPARAM  lParam,
BOOL bHandled 
)
private

Definition at line 491 of file toolsettings.cpp.

492{
494 Invalidate();
495 return 0;
496}
WPARAM wParam
Definition: combotst.c:138

◆ OnToolsModelSettingsChanged()

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

Definition at line 485 of file toolsettings.cpp.

486{
487 Invalidate();
488 return 0;
489}

◆ OnToolsModelToolChanged()

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

Definition at line 477 of file toolsettings.cpp.

478{
480 Invalidate();
482 return 0;
483}
BOOL ShowWindow(int nCmdShow)
Definition: atlwin.h:1333
#define SW_HIDE
Definition: winuser.h:779
#define SW_SHOW
Definition: winuser.h:786

◆ OnToolsModelZoomChanged()

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

Definition at line 498 of file toolsettings.cpp.

499{
500 int tbPos = MIN_ZOOM_TRACK;
501 int tempZoom = toolsModel.GetZoom();
502
503 while (tempZoom > MIN_ZOOM)
504 {
505 tbPos++;
506 tempZoom = tempZoom >> 1;
507 }
508
510 return 0;
511}
#define MIN_ZOOM
Definition: precomp.h:44
int GetZoom() const
Definition: toolsmodel.cpp:270

Referenced by OnVScroll().

◆ OnVScroll()

LRESULT CToolSettingsWindow::OnVScroll ( UINT  nMsg,
WPARAM  wParam,
LPARAM  lParam,
BOOL bHandled 
)
private

Definition at line 307 of file toolsettings.cpp.

308{
310 canvasWindow.zoomTo(MIN_ZOOM << trackPos);
311
312 INT zoomRate = toolsModel.GetZoom();
313
314 CStringW strZoom;
315 if (zoomRate % 10 == 0)
316 strZoom.Format(L"%d%%", zoomRate / 10);
317 else
318 strZoom.Format(L"%d.%d%%", zoomRate / 10, zoomRate % 10);
319
321
322 OnToolsModelZoomChanged(nMsg, wParam, lParam, bHandled);
323 return 0;
324}
HWND g_hStatusBar
Definition: main.cpp:23
CCanvasWindow canvasWindow
Definition: canvas.cpp:11
void __cdecl Format(UINT nFormatID,...)
Definition: cstringt.h:818
VOID zoomTo(INT newZoom, LONG left=0, LONG top=0)
Definition: canvas.cpp:253
LRESULT OnToolsModelZoomChanged(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
#define L(x)
Definition: resources.c:13
LONG_PTR LPARAM
Definition: minwindef.h:175
#define INT
Definition: polytest.cpp:20
#define TBM_GETPOS
Definition: commctrl.h:2036
#define SB_SETTEXT
Definition: commctrl.h:1954
const uint16_t * LPCWSTR
Definition: typedefs.h:57
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)

Member Data Documentation

◆ m_hNontranspIcon

HICON CToolSettingsWindow::m_hNontranspIcon
private

Definition at line 32 of file toolsettings.h.

Referenced by drawTrans(), OnCreate(), and OnDestroy().

◆ m_hTranspIcon

HICON CToolSettingsWindow::m_hTranspIcon
private

Definition at line 33 of file toolsettings.h.

Referenced by drawTrans(), OnCreate(), and OnDestroy().

◆ m_rgbPickColor

COLORREF CToolSettingsWindow::m_rgbPickColor = CLR_INVALID
private

Definition at line 34 of file toolsettings.h.

Referenced by OnPaint(), OnToolsModelColorPicked(), and OnToolsModelToolChanged().

◆ trackbarZoom

CWindow CToolSettingsWindow::trackbarZoom
private

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