ReactOS 0.4.15-dev-5865-g640e228
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;
24 m_zoom = 1000;
25 ZeroMemory(&m_tools, sizeof(m_tools));
27}
TOOLTYPE m_oldActiveTool
Definition: toolsmodel.h:79
int m_airBrushWidth
Definition: toolsmodel.h:80
int m_brushStyle
Definition: toolsmodel.h:77
int m_rubberRadius
Definition: toolsmodel.h:81
int m_lineWidth
Definition: toolsmodel.h:75
BOOL m_transpBg
Definition: toolsmodel.h:82
int m_shapeStyle
Definition: toolsmodel.h:76
ToolBase * m_tools[TOOL_MAX+1]
Definition: toolsmodel.h:84
int m_zoom
Definition: toolsmodel.h:83
TOOLTYPE m_activeTool
Definition: toolsmodel.h:78
ToolBase * m_pToolObject
Definition: toolsmodel.h:85
ToolBase * GetOrCreateTool(TOOLTYPE nTool)
Definition: toolsmodel.cpp:35
#define FALSE
Definition: types.h:117
@ TOOL_PEN
Definition: toolsmodel.h:19
#define ZeroMemory
Definition: winbase.h:1670

◆ ~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}
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
@ TOOL_MAX
Definition: toolsmodel.h:29

Member Function Documentation

◆ GetActiveTool()

◆ GetAirBrushWidth()

int ToolsModel::GetAirBrushWidth ( ) const

Definition at line 113 of file toolsmodel.cpp.

114{
115 return m_airBrushWidth;
116}

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

◆ GetBrushStyle()

int ToolsModel::GetBrushStyle ( ) const

Definition at line 65 of file toolsmodel.cpp.

66{
67 return m_brushStyle;
68}

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

◆ GetLineWidth()

◆ GetOldActiveTool()

TOOLTYPE ToolsModel::GetOldActiveTool ( ) const

Definition at line 81 of file toolsmodel.cpp.

82{
83 return m_oldActiveTool;
84}

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

Referenced by SetActiveTool(), and ToolsModel().

◆ GetRubberRadius()

int ToolsModel::GetRubberRadius ( ) const

Definition at line 124 of file toolsmodel.cpp.

125{
126 return m_rubberRadius;
127}

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

◆ GetShapeStyle()

int ToolsModel::GetShapeStyle ( ) const

◆ GetZoom()

◆ IsBackgroundTransparent()

◆ NotifyToolChanged()

void ToolsModel::NotifyToolChanged ( )

Definition at line 159 of file toolsmodel.cpp.

160{
161 if (toolBoxContainer.IsWindow())
163 if (toolSettingsWindow.IsWindow())
165 if (fontsDialog.IsWindow())
167 if (textEditWindow.IsWindow())
169}
CFontsDialog fontsDialog
Definition: dialogs.cpp:22
#define WM_TOOLSMODELTOOLCHANGED
Definition: precomp.h:37
CToolBox toolBoxContainer
Definition: main.cpp:50
CTextEditWindow textEditWindow
Definition: main.cpp:56
CToolSettingsWindow toolSettingsWindow
Definition: main.cpp:51

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:38
CSelectionWindow selectionWindow
Definition: main.cpp:54

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

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}
void updateStartAndLast(LONG x, LONG y)
Definition: mouse.cpp:68
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
void endEvent()
Definition: mouse.cpp:106
virtual void OnButtonDown(BOOL bLeftButton, LONG x, LONG y, BOOL bDoubleClick)
Definition: toolsmodel.h:50
void beginEvent()
Definition: mouse.cpp:99

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}
void updateLast(LONG x, LONG y)
Definition: mouse.cpp:74
virtual void OnButtonUp(BOOL bLeftButton, LONG x, LONG y)
Definition: toolsmodel.h:58

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}
#define ATLTRACE(format,...)
Definition: atltrace.h:276
virtual void OnCancelDraw()
Definition: mouse.cpp:89

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

◆ OnFinishDraw()

void ToolsModel::OnFinishDraw ( )

Definition at line 223 of file toolsmodel.cpp.

224{
225 ATLTRACE("ToolsModel::OnFinishDraw()\n");
229}
virtual void OnFinishDraw()
Definition: mouse.cpp:94

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}
virtual void OnMouseMove(BOOL bLeftButton, LONG x, LONG y)
Definition: toolsmodel.h:54

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

◆ resetTool()

◆ selectAll()

void ToolsModel::selectAll ( )

Definition at line 236 of file toolsmodel.cpp.

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

Referenced by CMainWindow::OnCommand().

◆ SetActiveTool()

void ToolsModel::SetActiveTool ( TOOLTYPE  nActiveTool)

Definition at line 86 of file toolsmodel.cpp.

87{
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}
void OnFinishDraw()
Definition: toolsmodel.cpp:223
void NotifyToolChanged()
Definition: toolsmodel.cpp:159
@ TOOL_COLOR
Definition: toolsmodel.h:17
@ TOOL_RUBBER
Definition: toolsmodel.h:15
@ TOOL_TEXT
Definition: toolsmodel.h:22
@ TOOL_FREESEL
Definition: toolsmodel.h:13
@ TOOL_ZOOM
Definition: toolsmodel.h:18

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}
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}
void ForceRefreshSelectionContents()
Definition: selection.cpp:24

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}

Referenced by CToolSettingsWindow::OnLButtonDown().

◆ SetLineWidth()

void ToolsModel::SetLineWidth ( int  nLineWidth)

Definition at line 48 of file toolsmodel.cpp.

49{
50 m_lineWidth = nLineWidth;
52}

Referenced by CToolSettingsWindow::OnLButtonDown().

◆ SetRubberRadius()

void ToolsModel::SetRubberRadius ( int  nRubberRadius)

Definition at line 129 of file toolsmodel.cpp.

130{
131 m_rubberRadius = nRubberRadius;
133}

Referenced by CToolSettingsWindow::OnLButtonDown().

◆ SetShapeStyle()

void ToolsModel::SetShapeStyle ( int  nShapeStyle)

Definition at line 59 of file toolsmodel.cpp.

60{
61 m_shapeStyle = nShapeStyle;
63}

Referenced by CToolSettingsWindow::OnLButtonDown().

◆ SetZoom()

void ToolsModel::SetZoom ( int  nZoom)

Definition at line 153 of file toolsmodel.cpp.

154{
155 m_zoom = nZoom;
157}
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: