ReactOS  0.4.15-dev-3733-g974a0f0
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};
19  trackbarZoom.Create(TRACKBAR_CLASS, m_hWnd, trackbarZoomPos, NULL, WS_CHILD | TBS_VERT | TBS_AUTOTICKS);
22  return 0;
23 }
#define TRUE
Definition: types.h:120
#define TRACKBAR_CLASS
Definition: commctrl.h:2013
#define MAKELPARAM(l, h)
Definition: winuser.h:3988
#define TBM_SETRANGE
Definition: commctrl.h:2037
#define TBM_SETPOS
Definition: commctrl.h:2036
UINT_PTR WPARAM
Definition: windef.h:207
#define WS_CHILD
Definition: pedump.c:617
LONG_PTR LPARAM
Definition: windef.h:208
#define TBS_AUTOTICKS
Definition: commctrl.h:2015
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:383
#define TBS_VERT
Definition: commctrl.h:2016
#define NULL
Definition: types.h:112
LRESULT SendMessage(UINT message, WPARAM wParam=0, LPARAM lParam=0)
Definition: atlwin.h:1082

◆ OnLButtonDown()

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

Definition at line 188 of file toolsettings.cpp.

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

◆ OnPaint()

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

Definition at line 34 of file toolsettings.cpp.

35 {
36  RECT rect1 = { 0, 0, 42, 66 };
37  RECT rect2 = { 0, 70, 42, 136 };
38 
40 
41  HDC hdc = GetDC();
44  switch (toolsModel.GetActiveTool())
45  {
46  case TOOL_FREESEL:
47  case TOOL_RECTSEL:
48  case TOOL_TEXT:
49  {
50  HPEN oldPen = (HPEN) SelectObject(hdc, CreatePen(PS_NULL, 0, 0));
53  DeleteObject(SelectObject(hdc, oldPen));
54  DrawIconEx(hdc, 1, 2, hNontranspIcon, 40, 30, 0, NULL, DI_NORMAL);
55  DrawIconEx(hdc, 1, 33, hTranspIcon, 40, 30, 0, NULL, DI_NORMAL);
56  break;
57  }
58  case TOOL_RUBBER:
59  {
60  int i;
61  HPEN oldPen = (HPEN) SelectObject(hdc, CreatePen(PS_NULL, 0, 0));
62  for(i = 0; i < 4; i++)
63  {
64  if (toolsModel.GetRubberRadius() == i + 2)
65  {
67  Rectangle(hdc, 14, i * 15 + 2, 29, i * 15 + 17);
69  }
70  else
72  Rectangle(hdc, 19 - i, i * 14 + 7, 24 + i, i * 16 + 12);
73  }
74  DeleteObject(SelectObject(hdc, oldPen));
75  break;
76  }
77  case TOOL_BRUSH:
78  {
79  int i;
80  HPEN oldPen = (HPEN) SelectObject(hdc, CreatePen(PS_NULL, 0, 0));
82  Rectangle(hdc, toolsModel.GetBrushStyle() % 3 * 13 + 2, toolsModel.GetBrushStyle() / 3 * 15 + 2, toolsModel.GetBrushStyle() % 3 * 13 + 15,
83  toolsModel.GetBrushStyle() / 3 * 15 + 17);
84  DeleteObject(SelectObject(hdc, oldPen));
85  for(i = 0; i < 12; i++)
86  Brush(hdc, i % 3 * 13 + 7, i / 3 * 15 + 8, i % 3 * 13 + 7, i / 3 * 15 + 8,
88  break;
89  }
90  case TOOL_AIRBRUSH:
91  {
92  HPEN oldPen = (HPEN) SelectObject(hdc, CreatePen(PS_NULL, 0, 0));
94  switch (toolsModel.GetAirBrushWidth())
95  {
96  case 5:
97  Rectangle(hdc, 2, 2, 21, 31);
98  break;
99  case 8:
100  Rectangle(hdc, 20, 2, 41, 31);
101  break;
102  case 3:
103  Rectangle(hdc, 2, 30, 16, 61);
104  break;
105  case 12:
106  Rectangle(hdc, 15, 30, 41, 61);
107  break;
108  }
109  Airbrush(hdc, 10, 15,
111  Airbrush(hdc, 30, 15,
113  Airbrush(hdc, 8, 45,
115  Airbrush(hdc, 27, 45,
117  DeleteObject(SelectObject(hdc, oldPen));
118  break;
119  }
120  case TOOL_LINE:
121  case TOOL_BEZIER:
122  {
123  int i;
124  HPEN oldPen = (HPEN) SelectObject(hdc, CreatePen(PS_NULL, 0, 0));
125  for(i = 0; i < 5; i++)
126  {
127  if (toolsModel.GetLineWidth() == i + 1)
128  {
130  Rectangle(hdc, 2, i * 12 + 2, 41, i * 12 + 14);
132  }
133  else
135  Rectangle(hdc, 5, i * 12 + 6, 38, i * 12 + 8 + i);
136  }
137  DeleteObject(SelectObject(hdc, oldPen));
138  break;
139  }
140  case TOOL_RECT:
141  case TOOL_SHAPE:
142  case TOOL_ELLIPSE:
143  case TOOL_RRECT:
144  {
145  int i;
146  HPEN oldPen = (HPEN) SelectObject(hdc, CreatePen(PS_NULL, 0, 0));
147  for(i = 0; i < 3; i++)
148  {
149  if (toolsModel.GetShapeStyle() == i)
150  {
152  Rectangle(hdc, 2, i * 20 + 2, 41, i * 20 + 22);
153  }
154  }
155  Rect(hdc, 5, 6, 37, 16,
158  Rect(hdc, 5, 26, 37, 36,
162  1, 1);
163  for(i = 0; i < 5; i++)
164  {
165  if (toolsModel.GetLineWidth() == i + 1)
166  {
168  Rectangle(hdc, 2, i * 12 + 72, 41, i * 12 + 84);
170  }
171  else
173  Rectangle(hdc, 5, i * 12 + 76, 38, i * 12 + 78 + i);
174  }
175  DeleteObject(SelectObject(hdc, oldPen));
176  break;
177  }
178  case TOOL_FILL:
179  case TOOL_COLOR:
180  case TOOL_ZOOM:
181  case TOOL_PEN:
182  break;
183  }
184  ReleaseDC(hdc);
185  return 0;
186 }
RECT rect2
Definition: edittest.c:51
#define BF_MIDDLE
Definition: winuser.h:468
ToolsModel toolsModel
Definition: main.cpp:18
HPEN WINAPI CreatePen(_In_ int, _In_ int, _In_ COLORREF)
#define COLOR_HIGHLIGHT
Definition: winuser.h:920
BOOL WINAPI Rectangle(_In_ HDC, _In_ int, _In_ int, _In_ int, _In_ int)
HDC WINAPI GetDC(_In_opt_ HWND)
static HDC
Definition: imagelist.c:92
HGDIOBJ WINAPI SelectObject(_In_ HDC, _In_ HGDIOBJ)
Definition: dc.c:1539
BOOL WINAPI DeleteObject(_In_ HGDIOBJ)
#define COLOR_APPWORKSPACE
Definition: winuser.h:919
int GetBrushStyle() const
Definition: toolsmodel.cpp:65
DWORD WINAPI GetSysColor(_In_ int)
WPARAM wParam
Definition: combotst.c:138
int GetRubberRadius() const
Definition: toolsmodel.cpp:127
HICON hNontranspIcon
Definition: main.cpp:39
#define BF_RECT
Definition: winuser.h:462
BOOL WINAPI DrawEdge(_In_ HDC, _Inout_ LPRECT, _In_ UINT, _In_ UINT)
int WINAPI ReleaseDC(_In_opt_ HWND, _In_ HDC)
void Brush(HDC hdc, LONG x1, LONG y1, LONG x2, LONG y2, COLORREF color, LONG style)
Definition: drawing.cpp:160
#define COLOR_HIGHLIGHTTEXT
Definition: winuser.h:921
#define DefWindowProc
Definition: ros2win.h:31
int GetLineWidth() const
Definition: toolsmodel.cpp:43
int GetShapeStyle() const
Definition: toolsmodel.cpp:54
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_WINDOWTEXT
Definition: winuser.h:915
#define WM_PAINT
Definition: winuser.h:1607
TOOLTYPE GetActiveTool() const
Definition: toolsmodel.cpp:76
HDC hdc
Definition: main.c:9
#define DI_NORMAL
Definition: wingdi.h:72
#define BDR_SUNKENOUTER
Definition: winuser.h:443
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
int GetAirBrushWidth() const
Definition: toolsmodel.cpp:116
#define NULL
Definition: types.h:112
#define PS_NULL
Definition: wingdi.h:591
HICON hTranspIcon
Definition: main.cpp:40
void Airbrush(HDC hdc, LONG x, LONG y, COLORREF color, LONG r)
Definition: drawing.cpp:149
HBRUSH WINAPI GetSysColorBrush(_In_ int)
LPARAM lParam
Definition: combotst.c:139
struct Rect Rect
BOOL IsBackgroundTransparent() const
Definition: toolsmodel.cpp:138

◆ OnToolsModelSettingsChanged()

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

Definition at line 257 of file toolsettings.cpp.

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

◆ OnToolsModelToolChanged()

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

Definition at line 250 of file toolsettings.cpp.

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

◆ OnToolsModelZoomChanged()

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

Definition at line 263 of file toolsettings.cpp.

264 {
265  int tbPos = 0;
266  int tempZoom = toolsModel.GetZoom();
267 
268  while (tempZoom > MIN_ZOOM)
269  {
270  tbPos++;
271  tempZoom = tempZoom >> 1;
272  }
274  return 0;
275 }
ToolsModel toolsModel
Definition: main.cpp:18
#define TRUE
Definition: types.h:120
#define TBM_SETPOS
Definition: commctrl.h:2036
UINT_PTR WPARAM
Definition: windef.h:207
LONG_PTR LPARAM
Definition: windef.h:208
#define MIN_ZOOM
Definition: common.h:14
int GetZoom() const
Definition: toolsmodel.cpp:149
LRESULT SendMessage(UINT message, WPARAM wParam=0, LPARAM lParam=0)
Definition: atlwin.h:1082

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 }
LRESULT OnToolsModelZoomChanged(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
WPARAM wParam
Definition: combotst.c:138
#define TBM_GETPOS
Definition: commctrl.h:2031
BOOL zoomTo(int newZoom, int mouseX, int mouseY)
Definition: winproc.cpp:19
LRESULT SendMessage(UINT message, WPARAM wParam=0, LPARAM lParam=0)
Definition: atlwin.h:1082
LPARAM lParam
Definition: combotst.c:139

Member Data Documentation

◆ trackbarZoom

CWindow CToolSettingsWindow::trackbarZoom

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