ReactOS 0.4.15-dev-7958-gcd0bb1a
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 OnToolsModelZoomChanged (UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
 

Private Attributes

CWindow trackbarZoom
 
HICON m_hNontranspIcon
 
HICON m_hTranspIcon
 

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:308
LONG bottom
Definition: windef.h:309
LONG top
Definition: windef.h:307
LONG left
Definition: windef.h:306
#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:183
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
void __cdecl srand(_In_ unsigned int _Seed)
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:921
#define COLOR_HIGHLIGHT
Definition: winuser.h:926
HBRUSH WINAPI GetSysColorBrush(_In_ int)
#define COLOR_HIGHLIGHTTEXT
Definition: winuser.h:927

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:112
pKey DeleteObject()
static INT getBoxRects(RECT rects[3], LPCRECT prc, LPPOINT ppt=NULL)
DWORD COLORREF
Definition: windef.h:300
HGDIOBJ WINAPI GetStockObject(_In_ int)
HGDIOBJ WINAPI SelectObject(_In_ HDC, _In_ HGDIOBJ)
Definition: dc.c:1539
#define NULL_BRUSH
Definition: wingdi.h:901
BOOL WINAPI Rectangle(_In_ HDC, _In_ int, _In_ int, _In_ int, _In_ int)
HPEN WINAPI CreatePen(_In_ int, _In_ int, _In_ COLORREF)
#define PS_SOLID
Definition: wingdi.h:586
#define COLOR_APPWORKSPACE
Definition: winuser.h:925

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:123
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:194
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:249
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:2028

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:84
#define TBS_VERT
Definition: commctrl.h:2016
#define TBM_SETRANGE
Definition: commctrl.h:2037
#define TBM_SETPOS
Definition: commctrl.h:2036
#define TBS_AUTOTICKS
Definition: commctrl.h:2015
#define TRACKBAR_CLASS
Definition: commctrl.h:2013
#define DEFAULT_ZOOM_TRACK
#define MAX_ZOOM_TRACK
#define MIN_ZOOM_TRACK
#define MAKELPARAM(l, h)
Definition: winuser.h:4008
#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:2203
#define LR_DEFAULTCOLOR
Definition: winuser.h:1087
#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:2053

◆ OnLButtonDown()

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

Definition at line 404 of file toolsettings.cpp.

405{
407
408 CRect rect1, rect2;
409 calculateTwoBoxes(rect1, rect2);
410 RECT rects[12];
411
412 INT iItem;
413 switch (toolsModel.GetActiveTool())
414 {
415 case TOOL_FREESEL:
416 case TOOL_RECTSEL:
417 case TOOL_TEXT:
418 iItem = getTransRects(rects, &rect1, &pt);
419 if (iItem != -1)
421 break;
422 case TOOL_RUBBER:
423 iItem = getRubberRects(rects, &rect1, &pt);
424 if (iItem != -1)
425 toolsModel.SetRubberRadius(iItem + 2);
426 break;
427 case TOOL_BRUSH:
428 iItem = getBrushRects(rects, &rect1, &pt);
429 if (iItem != -1)
430 {
431 const BrushStyleAndWidth& data = c_BrushPresets[iItem];
434 }
435 break;
436 case TOOL_AIRBRUSH:
437 iItem = getAirBrushRects(rects, &rect1, &pt);
438 if (iItem != -1)
440 break;
441 case TOOL_LINE:
442 case TOOL_BEZIER:
443 iItem = getLineRects(rects, &rect1, &pt);
444 if (iItem != -1)
445 toolsModel.SetLineWidth(iItem + 1);
446 break;
447 case TOOL_RECT:
448 case TOOL_SHAPE:
449 case TOOL_ELLIPSE:
450 case TOOL_RRECT:
451 iItem = getBoxRects(rects, &rect1, &pt);
452 if (iItem != -1)
454
455 iItem = getLineRects(rects, &rect2, &pt);
456 if (iItem != -1)
457 toolsModel.SetLineWidth(iItem + 1);
458 break;
459 case TOOL_FILL:
460 case TOOL_COLOR:
461 case TOOL_ZOOM:
462 case TOOL_PEN:
463 break;
464 }
465
466 ::SetCapture(::GetParent(m_hWnd));
467 return 0;
468}
void SetBrushStyle(BrushStyle nBrushStyle)
Definition: toolsmodel.cpp:128
void SetAirBrushRadius(INT nAirBrushRadius)
Definition: toolsmodel.cpp:188
void SetShapeStyle(int nShapeStyle)
Definition: toolsmodel.cpp:117
void SetRubberRadius(int nRubberRadius)
Definition: toolsmodel.cpp:199
void SetBackgroundTransparent(BOOL bTransparent)
Definition: toolsmodel.cpp:254
TOOLTYPE GetActiveTool() const
Definition: toolsmodel.cpp:134
void SetBrushWidth(INT nBrushWidth)
Definition: toolsmodel.cpp:75
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:3159

◆ 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_FILL:
395 case TOOL_COLOR:
396 case TOOL_ZOOM:
397 case TOOL_PEN:
398 break;
399 }
400 EndPaint(&ps);
401 return 0;
402}
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:92
#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

◆ OnToolsModelSettingsChanged()

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

Definition at line 477 of file toolsettings.cpp.

478{
479 Invalidate();
480 return 0;
481}

◆ OnToolsModelToolChanged()

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

Definition at line 470 of file toolsettings.cpp.

471{
472 Invalidate();
474 return 0;
475}
BOOL ShowWindow(int nCmdShow)
Definition: atlwin.h:1333
WPARAM wParam
Definition: combotst.c:138
#define SW_HIDE
Definition: winuser.h:768
#define SW_SHOW
Definition: winuser.h:775

◆ OnToolsModelZoomChanged()

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

Definition at line 483 of file toolsettings.cpp.

484{
485 int tbPos = MIN_ZOOM_TRACK;
486 int tempZoom = toolsModel.GetZoom();
487
488 while (tempZoom > MIN_ZOOM)
489 {
490 tbPos++;
491 tempZoom = tempZoom >> 1;
492 }
493
495 return 0;
496}
#define MIN_ZOOM
Definition: precomp.h:44
int GetZoom() const
Definition: toolsmodel.cpp:261

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:10
void __cdecl Format(UINT nFormatID,...)
Definition: cstringt.h:818
VOID zoomTo(INT newZoom, LONG left=0, LONG top=0)
Definition: canvas.cpp:107
LRESULT OnToolsModelZoomChanged(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
#define L(x)
Definition: ntvdm.h:50
#define INT
Definition: polytest.cpp:20
#define TBM_GETPOS
Definition: commctrl.h:2031
#define SB_SETTEXT
Definition: commctrl.h:1949
LONG_PTR LPARAM
Definition: windef.h:208
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185

Member Data Documentation

◆ m_hNontranspIcon

HICON CToolSettingsWindow::m_hNontranspIcon
private

Definition at line 31 of file toolsettings.h.

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

◆ m_hTranspIcon

HICON CToolSettingsWindow::m_hTranspIcon
private

Definition at line 32 of file toolsettings.h.

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

◆ trackbarZoom

CWindow CToolSettingsWindow::trackbarZoom
private

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