ReactOS  0.4.15-dev-5446-g3f3714b
ToolsModel Class Reference

#include <toolsmodel.h>

Collaboration diagram for ToolsModel:

Public Member Functions

 ToolsModel ()
 
 ~ToolsModel ()
 
int GetLineWidth () const
 
void SetLineWidth (int nLineWidth)
 
int GetShapeStyle () const
 
void SetShapeStyle (int nShapeStyle)
 
int GetBrushStyle () const
 
void SetBrushStyle (int nBrushStyle)
 
TOOLTYPE GetActiveTool () const
 
TOOLTYPE GetOldActiveTool () const
 
void SetActiveTool (TOOLTYPE nActiveTool)
 
int GetAirBrushWidth () const
 
void SetAirBrushWidth (int nAirBrushWidth)
 
int GetRubberRadius () const
 
void SetRubberRadius (int nRubberRadius)
 
BOOL IsBackgroundTransparent () const
 
void SetBackgroundTransparent (BOOL bTransparent)
 
int GetZoom () const
 
void SetZoom (int nZoom)
 
void OnButtonDown (BOOL bLeftButton, LONG x, LONG y, BOOL bDoubleClick)
 
void OnMouseMove (BOOL bLeftButton, LONG x, LONG y)
 
void OnButtonUp (BOOL bLeftButton, LONG x, LONG y)
 
void OnCancelDraw ()
 
void OnFinishDraw ()
 
void resetTool ()
 
void selectAll ()
 
void NotifyToolChanged ()
 
void NotifyToolSettingsChanged ()
 
void NotifyZoomChanged ()
 

Private Member Functions

ToolBaseGetOrCreateTool (TOOLTYPE nTool)
 

Private Attributes

int m_lineWidth
 
int m_shapeStyle
 
int m_brushStyle
 
TOOLTYPE m_activeTool
 
TOOLTYPE m_oldActiveTool
 
int m_airBrushWidth
 
int m_rubberRadius
 
BOOL m_transpBg
 
int m_zoom
 
ToolBasem_tools [TOOL_MAX+1]
 
ToolBasem_pToolObject
 

Detailed Description

Definition at line 72 of file toolsmodel.h.

Constructor & Destructor Documentation

◆ ToolsModel()

ToolsModel::ToolsModel ( )

Definition at line 15 of file toolsmodel.cpp.

16 {
17  m_lineWidth = 1;
18  m_shapeStyle = 0;
19  m_brushStyle = 0;
21  m_airBrushWidth = 5;
22  m_rubberRadius = 4;
23  m_transpBg = FALSE;
24  m_zoom = 1000;
25  ZeroMemory(&m_tools, sizeof(m_tools));
27 }
ToolBase * m_pToolObject
Definition: toolsmodel.h:85
int m_rubberRadius
Definition: toolsmodel.h:81
#define ZeroMemory
Definition: winbase.h:1670
TOOLTYPE m_oldActiveTool
Definition: toolsmodel.h:79
int m_zoom
Definition: toolsmodel.h:83
BOOL m_transpBg
Definition: toolsmodel.h:82
#define FALSE
Definition: types.h:117
int m_airBrushWidth
Definition: toolsmodel.h:80
TOOLTYPE m_activeTool
Definition: toolsmodel.h:78
ToolBase * m_tools[TOOL_MAX+1]
Definition: toolsmodel.h:84
int m_brushStyle
Definition: toolsmodel.h:77
ToolBase * GetOrCreateTool(TOOLTYPE nTool)
Definition: toolsmodel.cpp:35
int m_lineWidth
Definition: toolsmodel.h:75
int m_shapeStyle
Definition: toolsmodel.h:76

◆ ~ToolsModel()

ToolsModel::~ToolsModel ( )

Definition at line 29 of file toolsmodel.cpp.

30 {
31  for (size_t i = 0; i < TOOL_MAX + 1; ++i)
32  delete m_tools[i];
33 }
ToolBase * m_tools[TOOL_MAX+1]
Definition: toolsmodel.h:84
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

Member Function Documentation

◆ GetActiveTool()

◆ GetAirBrushWidth()

int ToolsModel::GetAirBrushWidth ( ) const

Definition at line 113 of file toolsmodel.cpp.

114 {
115  return m_airBrushWidth;
116 }
int m_airBrushWidth
Definition: toolsmodel.h:80

Referenced by AirBrushTool::draw(), and CToolSettingsWindow::OnPaint().

◆ GetBrushStyle()

int ToolsModel::GetBrushStyle ( ) const

Definition at line 65 of file toolsmodel.cpp.

66 {
67  return m_brushStyle;
68 }
int m_brushStyle
Definition: toolsmodel.h:77

Referenced by BrushTool::draw(), and CToolSettingsWindow::OnPaint().

◆ GetLineWidth()

int ToolsModel::GetLineWidth ( ) const

◆ GetOldActiveTool()

TOOLTYPE ToolsModel::GetOldActiveTool ( ) const

Definition at line 81 of file toolsmodel.cpp.

82 {
83  return m_oldActiveTool;
84 }
TOOLTYPE m_oldActiveTool
Definition: toolsmodel.h:79

Referenced by ColorTool::OnButtonUp().

◆ GetOrCreateTool()

ToolBase * ToolsModel::GetOrCreateTool ( TOOLTYPE  nTool)
private

Definition at line 35 of file toolsmodel.cpp.

36 {
37  if (!m_tools[nTool])
38  m_tools[nTool] = ToolBase::createToolObject(nTool);
39 
40  return m_tools[nTool];
41 }
ToolBase * m_tools[TOOL_MAX+1]
Definition: toolsmodel.h:84
static ToolBase * createToolObject(TOOLTYPE type)
Definition: mouse.cpp:764

Referenced by SetActiveTool(), and ToolsModel().

◆ GetRubberRadius()

int ToolsModel::GetRubberRadius ( ) const

Definition at line 124 of file toolsmodel.cpp.

125 {
126  return m_rubberRadius;
127 }
int m_rubberRadius
Definition: toolsmodel.h:81

Referenced by RubberTool::draw(), and CToolSettingsWindow::OnPaint().

◆ GetShapeStyle()

int ToolsModel::GetShapeStyle ( ) const

Definition at line 54 of file toolsmodel.cpp.

55 {
56  return m_shapeStyle;
57 }
int m_shapeStyle
Definition: toolsmodel.h:76

Referenced by RectTool::draw(), ShapeTool::draw(), EllipseTool::draw(), RRectTool::draw(), and CToolSettingsWindow::OnPaint().

◆ GetZoom()

◆ IsBackgroundTransparent()

◆ NotifyToolChanged()

void ToolsModel::NotifyToolChanged ( )

Definition at line 159 of file toolsmodel.cpp.

160 {
163  if (toolSettingsWindow.IsWindow())
165  if (fontsDialog.IsWindow())
167  if (textEditWindow.IsWindow())
169 }
CToolBox toolBoxContainer
Definition: main.cpp:66
BOOL IsWindow() const
Definition: atlwin.h:941
TOOLTYPE m_activeTool
Definition: toolsmodel.h:78
CFontsDialog fontsDialog
Definition: dialogs.cpp:22
#define WM_TOOLSMODELTOOLCHANGED
Definition: precomp.h:32
LRESULT SendMessage(UINT message, WPARAM wParam=0, LPARAM lParam=0)
Definition: atlwin.h:1110
CTextEditWindow textEditWindow
Definition: main.cpp:81
CToolSettingsWindow toolSettingsWindow
Definition: main.cpp:67

Referenced by CFontsDialog::OnCommand(), CFontsDialog::OnFontName(), CFontsDialog::OnFontSize(), and SetActiveTool().

◆ NotifyToolSettingsChanged()

void ToolsModel::NotifyToolSettingsChanged ( )

Definition at line 171 of file toolsmodel.cpp.

172 {
173  if (toolSettingsWindow.IsWindow())
175  if (selectionWindow.IsWindow())
177  if (textEditWindow.IsWindow())
179 }
#define WM_TOOLSMODELSETTINGSCHANGED
Definition: precomp.h:33
CTextEditWindow textEditWindow
Definition: main.cpp:81
CToolSettingsWindow toolSettingsWindow
Definition: main.cpp:67
CSelectionWindow selectionWindow
Definition: main.cpp:71

Referenced by SetAirBrushWidth(), SetBackgroundTransparent(), SetBrushStyle(), SetLineWidth(), SetRubberRadius(), and SetShapeStyle().

◆ NotifyZoomChanged()

void ToolsModel::NotifyZoomChanged ( )

Definition at line 181 of file toolsmodel.cpp.

182 {
183  if (toolSettingsWindow.IsWindow())
185  if (textEditWindow.IsWindow())
187  if (selectionWindow.IsWindow())
189 }
#define WM_TOOLSMODELZOOMCHANGED
Definition: precomp.h:34
CTextEditWindow textEditWindow
Definition: main.cpp:81
CToolSettingsWindow toolSettingsWindow
Definition: main.cpp:67
CSelectionWindow selectionWindow
Definition: main.cpp:71

Referenced by SetZoom().

◆ OnButtonDown()

void ToolsModel::OnButtonDown ( BOOL  bLeftButton,
LONG  x,
LONG  y,
BOOL  bDoubleClick 
)

Definition at line 191 of file toolsmodel.cpp.

192 {
195  m_pToolObject->OnButtonDown(bLeftButton, x, y, bDoubleClick);
197 }
ToolBase * m_pToolObject
Definition: toolsmodel.h:85
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
virtual void OnButtonDown(BOOL bLeftButton, LONG x, LONG y, BOOL bDoubleClick)
Definition: toolsmodel.h:50
void endEvent()
Definition: mouse.cpp:102
void updateStartAndLast(LONG x, LONG y)
Definition: mouse.cpp:64
void beginEvent()
Definition: mouse.cpp:95
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548

Referenced by TextTool::OnFinishDraw(), CImgAreaWindow::OnLButtonDblClk(), CImgAreaWindow::OnLButtonDown(), CImgAreaWindow::OnRButtonDblClk(), CImgAreaWindow::OnRButtonDown(), and selectAll().

◆ OnButtonUp()

void ToolsModel::OnButtonUp ( BOOL  bLeftButton,
LONG  x,
LONG  y 
)

Definition at line 207 of file toolsmodel.cpp.

208 {
210  m_pToolObject->OnButtonUp(bLeftButton, x, y);
211  updateLast(x, y);
213 }
ToolBase * m_pToolObject
Definition: toolsmodel.h:85
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
void endEvent()
Definition: mouse.cpp:102
void updateLast(LONG x, LONG y)
Definition: mouse.cpp:70
virtual void OnButtonUp(BOOL bLeftButton, LONG x, LONG y)
Definition: toolsmodel.h:58
void beginEvent()
Definition: mouse.cpp:95
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548

Referenced by TextTool::OnFinishDraw(), CImgAreaWindow::OnLButtonUp(), CImgAreaWindow::OnRButtonUp(), and selectAll().

◆ OnCancelDraw()

void ToolsModel::OnCancelDraw ( )

Definition at line 215 of file toolsmodel.cpp.

216 {
217  ATLTRACE("ToolsModel::OnCancelDraw()\n");
221 }
ToolBase * m_pToolObject
Definition: toolsmodel.h:85
#define ATLTRACE(format,...)
Definition: atltrace.h:276
virtual void OnCancelDraw()
Definition: mouse.cpp:85
void endEvent()
Definition: mouse.cpp:102
void beginEvent()
Definition: mouse.cpp:95

Referenced by CImgAreaWindow::cancelDrawing(), CTextEditWindow::OnKeyDown(), and CScrollboxWindow::OnLButtonDown().

◆ OnFinishDraw()

void ToolsModel::OnFinishDraw ( )

Definition at line 223 of file toolsmodel.cpp.

224 {
225  ATLTRACE("ToolsModel::OnFinishDraw()\n");
229 }
ToolBase * m_pToolObject
Definition: toolsmodel.h:85
#define ATLTRACE(format,...)
Definition: atltrace.h:276
void endEvent()
Definition: mouse.cpp:102
virtual void OnFinishDraw()
Definition: mouse.cpp:90
void beginEvent()
Definition: mouse.cpp:95

Referenced by CImgAreaWindow::finishDrawing(), and SetActiveTool().

◆ OnMouseMove()

void ToolsModel::OnMouseMove ( BOOL  bLeftButton,
LONG  x,
LONG  y 
)

Definition at line 199 of file toolsmodel.cpp.

200 {
202  m_pToolObject->OnMouseMove(bLeftButton, x, y);
203  updateLast(x, y);
205 }
ToolBase * m_pToolObject
Definition: toolsmodel.h:85
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
void endEvent()
Definition: mouse.cpp:102
void updateLast(LONG x, LONG y)
Definition: mouse.cpp:70
virtual void OnMouseMove(BOOL bLeftButton, LONG x, LONG y)
Definition: toolsmodel.h:54
void beginEvent()
Definition: mouse.cpp:95
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548

Referenced by CImgAreaWindow::OnMouseMove(), and selectAll().

◆ resetTool()

void ToolsModel::resetTool ( )

◆ selectAll()

void ToolsModel::selectAll ( )

Definition at line 236 of file toolsmodel.cpp.

237 {
239  OnButtonDown(TRUE, 0, 0, FALSE);
242 }
#define TRUE
Definition: types.h:120
void OnButtonDown(BOOL bLeftButton, LONG x, LONG y, BOOL bDoubleClick)
Definition: toolsmodel.cpp:191
void OnMouseMove(BOOL bLeftButton, LONG x, LONG y)
Definition: toolsmodel.cpp:199
#define FALSE
Definition: types.h:117
int GetWidth() const
Definition: history.cpp:215
void OnButtonUp(BOOL bLeftButton, LONG x, LONG y)
Definition: toolsmodel.cpp:207
ImageModel imageModel
Definition: main.cpp:32
int GetHeight() const
Definition: history.cpp:220
void SetActiveTool(TOOLTYPE nActiveTool)
Definition: toolsmodel.cpp:86

Referenced by CMainWindow::OnCommand().

◆ SetActiveTool()

void ToolsModel::SetActiveTool ( TOOLTYPE  nActiveTool)

Definition at line 86 of file toolsmodel.cpp.

87 {
88  OnFinishDraw();
89 
90  if (m_activeTool == nActiveTool)
91  return;
92 
93  switch (m_activeTool)
94  {
95  case TOOL_FREESEL:
96  case TOOL_RECTSEL:
97  case TOOL_RUBBER:
98  case TOOL_COLOR:
99  case TOOL_ZOOM:
100  case TOOL_TEXT:
101  break;
102 
103  default:
105  break;
106  }
107 
108  m_activeTool = nActiveTool;
111 }
ToolBase * m_pToolObject
Definition: toolsmodel.h:85
TOOLTYPE m_oldActiveTool
Definition: toolsmodel.h:79
void OnFinishDraw()
Definition: toolsmodel.cpp:223
TOOLTYPE m_activeTool
Definition: toolsmodel.h:78
void NotifyToolChanged()
Definition: toolsmodel.cpp:159
ToolBase * GetOrCreateTool(TOOLTYPE nTool)
Definition: toolsmodel.cpp:35

Referenced by ColorTool::OnButtonUp(), CToolBox::OnCommand(), and selectAll().

◆ SetAirBrushWidth()

void ToolsModel::SetAirBrushWidth ( int  nAirBrushWidth)

Definition at line 118 of file toolsmodel.cpp.

119 {
120  m_airBrushWidth = nAirBrushWidth;
122 }
int m_airBrushWidth
Definition: toolsmodel.h:80
void NotifyToolSettingsChanged()
Definition: toolsmodel.cpp:171

Referenced by CToolSettingsWindow::OnLButtonDown().

◆ SetBackgroundTransparent()

void ToolsModel::SetBackgroundTransparent ( BOOL  bTransparent)

Definition at line 140 of file toolsmodel.cpp.

141 {
142  m_transpBg = bTransparent;
144  if (selectionWindow.IsWindow())
146 }
BOOL m_transpBg
Definition: toolsmodel.h:82
void NotifyToolSettingsChanged()
Definition: toolsmodel.cpp:171
void ForceRefreshSelectionContents()
Definition: selection.cpp:24
CSelectionWindow selectionWindow
Definition: main.cpp:71

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

◆ SetBrushStyle()

void ToolsModel::SetBrushStyle ( int  nBrushStyle)

Definition at line 70 of file toolsmodel.cpp.

71 {
72  m_brushStyle = nBrushStyle;
74 }
int m_brushStyle
Definition: toolsmodel.h:77
void NotifyToolSettingsChanged()
Definition: toolsmodel.cpp:171

Referenced by CToolSettingsWindow::OnLButtonDown().

◆ SetLineWidth()

void ToolsModel::SetLineWidth ( int  nLineWidth)

Definition at line 48 of file toolsmodel.cpp.

49 {
50  m_lineWidth = nLineWidth;
52 }
void NotifyToolSettingsChanged()
Definition: toolsmodel.cpp:171
int m_lineWidth
Definition: toolsmodel.h:75

Referenced by CToolSettingsWindow::OnLButtonDown().

◆ SetRubberRadius()

void ToolsModel::SetRubberRadius ( int  nRubberRadius)

Definition at line 129 of file toolsmodel.cpp.

130 {
131  m_rubberRadius = nRubberRadius;
133 }
int m_rubberRadius
Definition: toolsmodel.h:81
void NotifyToolSettingsChanged()
Definition: toolsmodel.cpp:171

Referenced by CToolSettingsWindow::OnLButtonDown().

◆ SetShapeStyle()

void ToolsModel::SetShapeStyle ( int  nShapeStyle)

Definition at line 59 of file toolsmodel.cpp.

60 {
61  m_shapeStyle = nShapeStyle;
63 }
void NotifyToolSettingsChanged()
Definition: toolsmodel.cpp:171
int m_shapeStyle
Definition: toolsmodel.h:76

Referenced by CToolSettingsWindow::OnLButtonDown().

◆ SetZoom()

void ToolsModel::SetZoom ( int  nZoom)

Definition at line 153 of file toolsmodel.cpp.

154 {
155  m_zoom = nZoom;
157 }
int m_zoom
Definition: toolsmodel.h:83
void NotifyZoomChanged()
Definition: toolsmodel.cpp:181

Referenced by zoomTo().

Member Data Documentation

◆ m_activeTool

TOOLTYPE ToolsModel::m_activeTool
private

Definition at line 78 of file toolsmodel.h.

Referenced by GetActiveTool(), NotifyToolChanged(), SetActiveTool(), and ToolsModel().

◆ m_airBrushWidth

int ToolsModel::m_airBrushWidth
private

Definition at line 80 of file toolsmodel.h.

Referenced by GetAirBrushWidth(), SetAirBrushWidth(), and ToolsModel().

◆ m_brushStyle

int ToolsModel::m_brushStyle
private

Definition at line 77 of file toolsmodel.h.

Referenced by GetBrushStyle(), SetBrushStyle(), and ToolsModel().

◆ m_lineWidth

int ToolsModel::m_lineWidth
private

Definition at line 75 of file toolsmodel.h.

Referenced by GetLineWidth(), SetLineWidth(), and ToolsModel().

◆ m_oldActiveTool

TOOLTYPE ToolsModel::m_oldActiveTool
private

Definition at line 79 of file toolsmodel.h.

Referenced by GetOldActiveTool(), SetActiveTool(), and ToolsModel().

◆ m_pToolObject

ToolBase* ToolsModel::m_pToolObject
private

◆ m_rubberRadius

int ToolsModel::m_rubberRadius
private

Definition at line 81 of file toolsmodel.h.

Referenced by GetRubberRadius(), SetRubberRadius(), and ToolsModel().

◆ m_shapeStyle

int ToolsModel::m_shapeStyle
private

Definition at line 76 of file toolsmodel.h.

Referenced by GetShapeStyle(), SetShapeStyle(), and ToolsModel().

◆ m_tools

ToolBase* ToolsModel::m_tools[TOOL_MAX+1]
private

Definition at line 84 of file toolsmodel.h.

Referenced by GetOrCreateTool(), ToolsModel(), and ~ToolsModel().

◆ m_transpBg

BOOL ToolsModel::m_transpBg
private

Definition at line 82 of file toolsmodel.h.

Referenced by IsBackgroundTransparent(), SetBackgroundTransparent(), and ToolsModel().

◆ m_zoom

int ToolsModel::m_zoom
private

Definition at line 83 of file toolsmodel.h.

Referenced by GetZoom(), SetZoom(), and ToolsModel().


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