ReactOS 0.4.15-dev-5666-gc548b97
CToolSettingsWindow Class Reference

#include <toolsettings.h>

Inheritance diagram for CToolSettingsWindow:
Collaboration diagram for CToolSettingsWindow:

Public Member Functions

LRESULT OnCreate (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 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)
 

Public Attributes

CWindow trackbarZoom
 

Detailed Description

Definition at line 11 of file toolsettings.h.

Member Function Documentation

◆ OnCreate()

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

Definition at line 16 of file toolsettings.cpp.

17{
18 RECT trackbarZoomPos = {1, 1, 1 + 40, 1 + 64};
22 return 0;
23}
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:411
LRESULT SendMessage(UINT message, WPARAM wParam=0, LPARAM lParam=0)
Definition: atlwin.h:1110
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define WS_CHILD
Definition: pedump.c:617
#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
LONG_PTR LPARAM
Definition: windef.h:208
UINT_PTR WPARAM
Definition: windef.h:207
#define MAKELPARAM(l, h)
Definition: winuser.h:3998

◆ OnLButtonDown()

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

Definition at line 187 of file toolsettings.cpp.

188{
189 int x = GET_X_LPARAM(lParam);
190 int y = GET_Y_LPARAM(lParam);
191 switch (toolsModel.GetActiveTool())
192 {
193 case TOOL_FREESEL:
194 case TOOL_RECTSEL:
195 case TOOL_TEXT:
196 if ((y > 1) && (y < 64))
198 break;
199 case TOOL_RUBBER:
200 if ((y > 1) && (y < 62))
201 toolsModel.SetRubberRadius((y - 2) / 15 + 2);
202 break;
203 case TOOL_BRUSH:
204 if ((x > 1) && (x < 40) && (y > 1) && (y < 62))
205 toolsModel.SetBrushStyle((y - 2) / 15 * 3 + (x - 2) / 13);
206 break;
207 case TOOL_AIRBRUSH:
208 if (y < 62)
209 {
210 if (y < 30)
211 {
212 if (x < 20)
214 else
216 }
217 else
218 {
219 if (x < 15)
221 else
223 }
224 }
225 break;
226 case TOOL_LINE:
227 case TOOL_BEZIER:
228 if (y <= 62)
229 toolsModel.SetLineWidth((y - 2) / 12 + 1);
230 break;
231 case TOOL_RECT:
232 case TOOL_SHAPE:
233 case TOOL_ELLIPSE:
234 case TOOL_RRECT:
235 if (y <= 60)
236 toolsModel.SetShapeStyle((y - 2) / 20);
237 if ((y >= 70) && (y <= 132))
238 toolsModel.SetLineWidth((y - 72) / 12 + 1);
239 break;
240 case TOOL_FILL:
241 case TOOL_COLOR:
242 case TOOL_ZOOM:
243 case TOOL_PEN:
244 break;
245 }
246 return 0;
247}
void SetAirBrushWidth(int nAirBrushWidth)
Definition: toolsmodel.cpp:118
void SetShapeStyle(int nShapeStyle)
Definition: toolsmodel.cpp:59
void SetRubberRadius(int nRubberRadius)
Definition: toolsmodel.cpp:129
void SetBrushStyle(int nBrushStyle)
Definition: toolsmodel.cpp:70
void SetBackgroundTransparent(BOOL bTransparent)
Definition: toolsmodel.cpp:140
TOOLTYPE GetActiveTool() const
Definition: toolsmodel.cpp:76
void SetLineWidth(int nLineWidth)
Definition: toolsmodel.cpp:48
LPARAM lParam
Definition: combotst.c:139
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
ToolsModel toolsModel
Definition: main.cpp:18
@ TOOL_AIRBRUSH
Definition: toolsmodel.h:21
@ TOOL_COLOR
Definition: toolsmodel.h:17
@ TOOL_SHAPE
Definition: toolsmodel.h:26
@ TOOL_RUBBER
Definition: toolsmodel.h:15
@ TOOL_BRUSH
Definition: toolsmodel.h:20
@ TOOL_RECT
Definition: toolsmodel.h:25
@ TOOL_BEZIER
Definition: toolsmodel.h:24
@ TOOL_FILL
Definition: toolsmodel.h:16
@ TOOL_TEXT
Definition: toolsmodel.h:22
@ TOOL_PEN
Definition: toolsmodel.h:19
@ TOOL_LINE
Definition: toolsmodel.h:23
@ TOOL_FREESEL
Definition: toolsmodel.h:13
@ TOOL_ZOOM
Definition: toolsmodel.h:18
@ TOOL_ELLIPSE
Definition: toolsmodel.h:27
@ TOOL_RRECT
Definition: toolsmodel.h:28
@ TOOL_RECTSEL
Definition: toolsmodel.h:14
#define GET_Y_LPARAM(lp)
Definition: windowsx.h:300
#define GET_X_LPARAM(lp)
Definition: windowsx.h:299

◆ OnPaint()

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

Definition at line 34 of file toolsettings.cpp.

35{
36 PAINTSTRUCT ps;
37 RECT rect1 = { 0, 0, 42, 66 };
38 RECT rect2 = { 0, 70, 42, 136 };
39
40 HDC hdc = BeginPaint(&ps);
43 switch (toolsModel.GetActiveTool())
44 {
45 case TOOL_FREESEL:
46 case TOOL_RECTSEL:
47 case TOOL_TEXT:
48 {
49 HPEN oldPen = (HPEN) SelectObject(hdc, CreatePen(PS_NULL, 0, 0));
53 DrawIconEx(hdc, 1, 2, hNontranspIcon, 40, 30, 0, NULL, DI_NORMAL);
54 DrawIconEx(hdc, 1, 33, hTranspIcon, 40, 30, 0, NULL, DI_NORMAL);
55 break;
56 }
57 case TOOL_RUBBER:
58 {
59 int i;
60 HPEN oldPen = (HPEN) SelectObject(hdc, CreatePen(PS_NULL, 0, 0));
61 for(i = 0; i < 4; i++)
62 {
63 if (toolsModel.GetRubberRadius() == i + 2)
64 {
66 Rectangle(hdc, 14, i * 15 + 2, 29, i * 15 + 17);
68 }
69 else
71 Rectangle(hdc, 19 - i, i * 14 + 7, 24 + i, i * 16 + 12);
72 }
74 break;
75 }
76 case TOOL_BRUSH:
77 {
78 int i;
79 HPEN oldPen = (HPEN) SelectObject(hdc, CreatePen(PS_NULL, 0, 0));
81 Rectangle(hdc, toolsModel.GetBrushStyle() % 3 * 13 + 2, toolsModel.GetBrushStyle() / 3 * 15 + 2, toolsModel.GetBrushStyle() % 3 * 13 + 15,
82 toolsModel.GetBrushStyle() / 3 * 15 + 17);
84 for(i = 0; i < 12; i++)
85 Brush(hdc, i % 3 * 13 + 7, i / 3 * 15 + 8, i % 3 * 13 + 7, i / 3 * 15 + 8,
87 break;
88 }
89 case TOOL_AIRBRUSH:
90 {
91 HPEN oldPen = (HPEN) SelectObject(hdc, CreatePen(PS_NULL, 0, 0));
94 {
95 case 5:
96 Rectangle(hdc, 2, 2, 21, 31);
97 break;
98 case 8:
99 Rectangle(hdc, 20, 2, 41, 31);
100 break;
101 case 3:
102 Rectangle(hdc, 2, 30, 16, 61);
103 break;
104 case 12:
105 Rectangle(hdc, 15, 30, 41, 61);
106 break;
107 }
108 Airbrush(hdc, 10, 15,
110 Airbrush(hdc, 30, 15,
112 Airbrush(hdc, 8, 45,
114 Airbrush(hdc, 27, 45,
116 DeleteObject(SelectObject(hdc, oldPen));
117 break;
118 }
119 case TOOL_LINE:
120 case TOOL_BEZIER:
121 {
122 int i;
123 HPEN oldPen = (HPEN) SelectObject(hdc, CreatePen(PS_NULL, 0, 0));
124 for(i = 0; i < 5; i++)
125 {
126 if (toolsModel.GetLineWidth() == i + 1)
127 {
129 Rectangle(hdc, 2, i * 12 + 2, 41, i * 12 + 14);
131 }
132 else
134 Rectangle(hdc, 5, i * 12 + 6, 38, i * 12 + 8 + i);
135 }
136 DeleteObject(SelectObject(hdc, oldPen));
137 break;
138 }
139 case TOOL_RECT:
140 case TOOL_SHAPE:
141 case TOOL_ELLIPSE:
142 case TOOL_RRECT:
143 {
144 int i;
145 HPEN oldPen = (HPEN) SelectObject(hdc, CreatePen(PS_NULL, 0, 0));
146 for(i = 0; i < 3; i++)
147 {
148 if (toolsModel.GetShapeStyle() == i)
149 {
151 Rectangle(hdc, 2, i * 20 + 2, 41, i * 20 + 22);
152 }
153 }
154 Rect(hdc, 5, 6, 37, 16,
157 Rect(hdc, 5, 26, 37, 36,
161 1, 1);
162 for(i = 0; i < 5; i++)
163 {
164 if (toolsModel.GetLineWidth() == i + 1)
165 {
167 Rectangle(hdc, 2, i * 12 + 72, 41, i * 12 + 84);
169 }
170 else
172 Rectangle(hdc, 5, i * 12 + 76, 38, i * 12 + 78 + i);
173 }
174 DeleteObject(SelectObject(hdc, oldPen));
175 break;
176 }
177 case TOOL_FILL:
178 case TOOL_COLOR:
179 case TOOL_ZOOM:
180 case TOOL_PEN:
181 break;
182 }
183 EndPaint(&ps);
184 return 0;
185}
int GetAirBrushWidth() const
Definition: toolsmodel.cpp:113
int GetLineWidth() const
Definition: toolsmodel.cpp:43
int GetShapeStyle() const
Definition: toolsmodel.cpp:54
int GetBrushStyle() const
Definition: toolsmodel.cpp:65
BOOL IsBackgroundTransparent() const
Definition: toolsmodel.cpp:135
int GetRubberRadius() const
Definition: toolsmodel.cpp:124
void Airbrush(HDC hdc, LONG x, LONG y, COLORREF color, LONG r)
Definition: drawing.cpp:149
RECT rect2
Definition: edittest.c:51
pKey DeleteObject()
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
HICON hTranspIcon
Definition: main.cpp:40
HICON hNontranspIcon
Definition: main.cpp:39
HDC hdc
Definition: main.c:9
static HDC
Definition: imagelist.c:92
#define PS_NULL
Definition: wingdi.h:591
HGDIOBJ WINAPI SelectObject(_In_ HDC, _In_ HGDIOBJ)
Definition: dc.c:1539
#define DI_NORMAL
Definition: wingdi.h:72
BOOL WINAPI Rectangle(_In_ HDC, _In_ int, _In_ int, _In_ int, _In_ int)
HPEN WINAPI CreatePen(_In_ int, _In_ int, _In_ COLORREF)
DWORD WINAPI GetSysColor(_In_ int)
#define BDR_SUNKENOUTER
Definition: winuser.h:443
#define COLOR_WINDOWTEXT
Definition: winuser.h:915
#define COLOR_HIGHLIGHT
Definition: winuser.h:920
HBRUSH WINAPI GetSysColorBrush(_In_ int)
#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 *)
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:1997
#define COLOR_APPWORKSPACE
Definition: winuser.h:919
#define COLOR_HIGHLIGHTTEXT
Definition: winuser.h:921
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 
)

Definition at line 256 of file toolsettings.cpp.

257{
258 Invalidate();
259 return 0;
260}

◆ OnToolsModelToolChanged()

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

Definition at line 249 of file toolsettings.cpp.

250{
251 Invalidate();
253 return 0;
254}
BOOL ShowWindow(int nCmdShow)
Definition: atlwin.h:1327
WPARAM wParam
Definition: combotst.c:138
#define SW_HIDE
Definition: winuser.h:762
#define SW_SHOW
Definition: winuser.h:769

◆ OnToolsModelZoomChanged()

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

Definition at line 262 of file toolsettings.cpp.

263{
264 int tbPos = 0;
265 int tempZoom = toolsModel.GetZoom();
266
267 while (tempZoom > MIN_ZOOM)
268 {
269 tbPos++;
270 tempZoom = tempZoom >> 1;
271 }
273 return 0;
274}
#define MIN_ZOOM
Definition: common.h:14
int GetZoom() const
Definition: toolsmodel.cpp:148

Referenced by OnVScroll().

◆ OnVScroll()

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

Definition at line 25 of file toolsettings.cpp.

26{
27 if (!zoomTo(125 << trackbarZoom.SendMessage(TBM_GETPOS, 0, 0), 0, 0))
28 {
29 OnToolsModelZoomChanged(nMsg, wParam, lParam, bHandled);
30 }
31 return 0;
32}
BOOL zoomTo(int newZoom, int mouseX, int mouseY)
Definition: winproc.cpp:19
LRESULT OnToolsModelZoomChanged(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
#define TBM_GETPOS
Definition: commctrl.h:2031

Member Data Documentation

◆ trackbarZoom

CWindow CToolSettingsWindow::trackbarZoom

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