ReactOS  0.4.15-dev-3739-gff9301e
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 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 71 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:84
int m_rubberRadius
Definition: toolsmodel.h:80
#define ZeroMemory
Definition: winbase.h:1664
TOOLTYPE m_oldActiveTool
Definition: toolsmodel.h:78
int m_zoom
Definition: toolsmodel.h:82
BOOL m_transpBg
Definition: toolsmodel.h:81
#define FALSE
Definition: types.h:117
int m_airBrushWidth
Definition: toolsmodel.h:79
TOOLTYPE m_activeTool
Definition: toolsmodel.h:77
ToolBase * m_tools[TOOL_MAX+1]
Definition: toolsmodel.h:83
int m_brushStyle
Definition: toolsmodel.h:76
ToolBase * GetOrCreateTool(TOOLTYPE nTool)
Definition: toolsmodel.cpp:35
int m_lineWidth
Definition: toolsmodel.h:74
int m_shapeStyle
Definition: toolsmodel.h:75

◆ ~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:83
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 116 of file toolsmodel.cpp.

117 {
118  return m_airBrushWidth;
119 }
int m_airBrushWidth
Definition: toolsmodel.h:79

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:76

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:78

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:83
static ToolBase * createToolObject(TOOLTYPE type)
Definition: mouse.cpp:679

Referenced by SetActiveTool(), and ToolsModel().

◆ GetRubberRadius()

int ToolsModel::GetRubberRadius ( ) const

Definition at line 127 of file toolsmodel.cpp.

128 {
129  return m_rubberRadius;
130 }
int m_rubberRadius
Definition: toolsmodel.h:80

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:75

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

◆ GetZoom()

◆ IsBackgroundTransparent()

◆ NotifyToolChanged()

void ToolsModel::NotifyToolChanged ( )

Definition at line 160 of file toolsmodel.cpp.

161 {
164  if (toolSettingsWindow.IsWindow())
166  if (fontsDialog.IsWindow())
168  if (textEditWindow.IsWindow())
170 }
CToolBox toolBoxContainer
Definition: main.cpp:66
BOOL IsWindow() const
Definition: atlwin.h:913
TOOLTYPE m_activeTool
Definition: toolsmodel.h:77
CFontsDialog fontsDialog
Definition: dialogs.cpp:22
#define WM_TOOLSMODELTOOLCHANGED
Definition: precomp.h:36
LRESULT SendMessage(UINT message, WPARAM wParam=0, LPARAM lParam=0)
Definition: atlwin.h:1082
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 172 of file toolsmodel.cpp.

173 {
176  if (textEditWindow.IsWindow())
178 }
#define WM_TOOLSMODELSETTINGSCHANGED
Definition: precomp.h:37
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 180 of file toolsmodel.cpp.

181 {
183  if (textEditWindow.IsWindow())
185  if (selectionWindow.IsWindow())
187 }
#define WM_TOOLSMODELZOOMCHANGED
Definition: precomp.h:38
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 189 of file toolsmodel.cpp.

190 {
193  m_pToolObject->OnButtonDown(bLeftButton, x, y, bDoubleClick);
195 }
ToolBase * m_pToolObject
Definition: toolsmodel.h:84
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:93
void updateStartAndLast(LONG x, LONG y)
Definition: mouse.cpp:64
void beginEvent()
Definition: mouse.cpp:86
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548

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

◆ OnButtonUp()

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

Definition at line 205 of file toolsmodel.cpp.

206 {
208  m_pToolObject->OnButtonUp(bLeftButton, x, y);
209  updateLast(x, y);
211 }
ToolBase * m_pToolObject
Definition: toolsmodel.h:84
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
void endEvent()
Definition: mouse.cpp:93
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:86
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548

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

◆ OnCancelDraw()

void ToolsModel::OnCancelDraw ( )

Definition at line 213 of file toolsmodel.cpp.

214 {
218 }
ToolBase * m_pToolObject
Definition: toolsmodel.h:84
virtual void OnCancelDraw()
Definition: mouse.cpp:81
void endEvent()
Definition: mouse.cpp:93
void beginEvent()
Definition: mouse.cpp:86

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

◆ OnMouseMove()

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

Definition at line 197 of file toolsmodel.cpp.

198 {
200  m_pToolObject->OnMouseMove(bLeftButton, x, y);
201  updateLast(x, y);
203 }
ToolBase * m_pToolObject
Definition: toolsmodel.h:84
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
void endEvent()
Definition: mouse.cpp:93
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:86
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 225 of file toolsmodel.cpp.

226 {
228  OnButtonDown(TRUE, 0, 0, FALSE);
231 }
#define TRUE
Definition: types.h:120
void OnButtonDown(BOOL bLeftButton, LONG x, LONG y, BOOL bDoubleClick)
Definition: toolsmodel.cpp:189
void OnMouseMove(BOOL bLeftButton, LONG x, LONG y)
Definition: toolsmodel.cpp:197
#define FALSE
Definition: types.h:117
int GetWidth() const
Definition: history.cpp:199
void OnButtonUp(BOOL bLeftButton, LONG x, LONG y)
Definition: toolsmodel.cpp:205
ImageModel imageModel
Definition: main.cpp:32
int GetHeight() const
Definition: history.cpp:204
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  switch (m_activeTool)
89  {
90  case TOOL_FREESEL:
91  case TOOL_RECTSEL:
92  case TOOL_RUBBER:
93  case TOOL_COLOR:
94  case TOOL_ZOOM:
95  break;
96 
97  case TOOL_TEXT:
98  if (nActiveTool != TOOL_TEXT)
99  {
100  // Finish the text
101  OnButtonDown(TRUE, -1, -1, TRUE);
102  OnButtonUp(TRUE, -1, -1);
103  }
104  break;
105 
106  default:
108  break;
109  }
110 
111  m_activeTool = nActiveTool;
114 }
ToolBase * m_pToolObject
Definition: toolsmodel.h:84
#define TRUE
Definition: types.h:120
TOOLTYPE m_oldActiveTool
Definition: toolsmodel.h:78
void OnButtonDown(BOOL bLeftButton, LONG x, LONG y, BOOL bDoubleClick)
Definition: toolsmodel.cpp:189
TOOLTYPE m_activeTool
Definition: toolsmodel.h:77
void OnButtonUp(BOOL bLeftButton, LONG x, LONG y)
Definition: toolsmodel.cpp:205
void NotifyToolChanged()
Definition: toolsmodel.cpp:160
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 121 of file toolsmodel.cpp.

122 {
123  m_airBrushWidth = nAirBrushWidth;
125 }
int m_airBrushWidth
Definition: toolsmodel.h:79
void NotifyToolSettingsChanged()
Definition: toolsmodel.cpp:172

Referenced by CToolSettingsWindow::OnLButtonDown().

◆ SetBackgroundTransparent()

void ToolsModel::SetBackgroundTransparent ( BOOL  bTransparent)

Definition at line 143 of file toolsmodel.cpp.

144 {
145  m_transpBg = bTransparent;
147 }
BOOL m_transpBg
Definition: toolsmodel.h:81
void NotifyToolSettingsChanged()
Definition: toolsmodel.cpp:172

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:76
void NotifyToolSettingsChanged()
Definition: toolsmodel.cpp:172

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:172
int m_lineWidth
Definition: toolsmodel.h:74

Referenced by CToolSettingsWindow::OnLButtonDown().

◆ SetRubberRadius()

void ToolsModel::SetRubberRadius ( int  nRubberRadius)

Definition at line 132 of file toolsmodel.cpp.

133 {
134  m_rubberRadius = nRubberRadius;
136 }
int m_rubberRadius
Definition: toolsmodel.h:80
void NotifyToolSettingsChanged()
Definition: toolsmodel.cpp:172

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:172
int m_shapeStyle
Definition: toolsmodel.h:75

Referenced by CToolSettingsWindow::OnLButtonDown().

◆ SetZoom()

void ToolsModel::SetZoom ( int  nZoom)

Definition at line 154 of file toolsmodel.cpp.

155 {
156  m_zoom = nZoom;
158 }
int m_zoom
Definition: toolsmodel.h:82
void NotifyZoomChanged()
Definition: toolsmodel.cpp:180

Referenced by zoomTo().

Member Data Documentation

◆ m_activeTool

TOOLTYPE ToolsModel::m_activeTool
private

Definition at line 77 of file toolsmodel.h.

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

◆ m_airBrushWidth

int ToolsModel::m_airBrushWidth
private

Definition at line 79 of file toolsmodel.h.

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

◆ m_brushStyle

int ToolsModel::m_brushStyle
private

Definition at line 76 of file toolsmodel.h.

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

◆ m_lineWidth

int ToolsModel::m_lineWidth
private

Definition at line 74 of file toolsmodel.h.

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

◆ m_oldActiveTool

TOOLTYPE ToolsModel::m_oldActiveTool
private

Definition at line 78 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 80 of file toolsmodel.h.

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

◆ m_shapeStyle

int ToolsModel::m_shapeStyle
private

Definition at line 75 of file toolsmodel.h.

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

◆ m_tools

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

Definition at line 83 of file toolsmodel.h.

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

◆ m_transpBg

BOOL ToolsModel::m_transpBg
private

Definition at line 81 of file toolsmodel.h.

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

◆ m_zoom

int ToolsModel::m_zoom
private

Definition at line 82 of file toolsmodel.h.

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


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