mirror of
https://github.com/reactos/reactos.git
synced 2025-06-20 07:36:05 +00:00
[MSPAINT] Larger/smaller pen nib on Ctrl+Plus/Minus (#5738)
- Introduce the concept of pen width (not line width) to the tools model. - Enable changing pen/line width by Ctrl+Plus/Minus key combination in TOOL_PEN, TOOL_LINE, TOOL_BEZIER, TOOL_RECT, TOOL_SHAPE, TOO_ELLIPSE, and TOOL_RRECT tools. CORE-19094
This commit is contained in:
parent
cbc63d876c
commit
f2a012240f
6 changed files with 89 additions and 27 deletions
|
@ -13,7 +13,7 @@ ToolsModel toolsModel;
|
|||
|
||||
ToolsModel::ToolsModel()
|
||||
{
|
||||
m_lineWidth = 1;
|
||||
m_lineWidth = m_penWidth = 1;
|
||||
m_shapeStyle = 0;
|
||||
m_brushStyle = 0;
|
||||
m_oldActiveTool = m_activeTool = TOOL_PEN;
|
||||
|
@ -53,6 +53,31 @@ void ToolsModel::SetLineWidth(int nLineWidth)
|
|||
{
|
||||
m_lineWidth = nLineWidth;
|
||||
NotifyToolSettingsChanged();
|
||||
imageModel.NotifyImageChanged();
|
||||
}
|
||||
|
||||
INT ToolsModel::GetPenWidth() const
|
||||
{
|
||||
return m_penWidth;
|
||||
}
|
||||
|
||||
void ToolsModel::SetPenWidth(INT nPenWidth)
|
||||
{
|
||||
m_penWidth = nPenWidth;
|
||||
NotifyToolSettingsChanged();
|
||||
imageModel.NotifyImageChanged();
|
||||
}
|
||||
|
||||
void ToolsModel::MakeLineThickerOrThinner(BOOL bThinner)
|
||||
{
|
||||
INT thickness = GetLineWidth();
|
||||
SetLineWidth(bThinner ? max(1, thickness - 1) : (thickness + 1));
|
||||
}
|
||||
|
||||
void ToolsModel::MakePenThickerOrThinner(BOOL bThinner)
|
||||
{
|
||||
INT thickness = GetPenWidth();
|
||||
SetPenWidth(bThinner ? max(1, thickness - 1) : (thickness + 1));
|
||||
}
|
||||
|
||||
int ToolsModel::GetShapeStyle() const
|
||||
|
@ -91,23 +116,38 @@ void ToolsModel::SetActiveTool(TOOLTYPE nActiveTool)
|
|||
{
|
||||
OnFinishDraw();
|
||||
|
||||
selectionModel.Landing();
|
||||
|
||||
m_activeTool = nActiveTool;
|
||||
|
||||
switch (m_activeTool)
|
||||
{
|
||||
case TOOL_FREESEL:
|
||||
case TOOL_RECTSEL:
|
||||
case TOOL_RUBBER:
|
||||
case TOOL_COLOR:
|
||||
case TOOL_ZOOM:
|
||||
case TOOL_TEXT:
|
||||
// The active tool is not an actually drawing tool
|
||||
break;
|
||||
|
||||
default:
|
||||
m_oldActiveTool = m_activeTool;
|
||||
case TOOL_LINE:
|
||||
case TOOL_BEZIER:
|
||||
case TOOL_RECT:
|
||||
case TOOL_SHAPE:
|
||||
case TOOL_ELLIPSE:
|
||||
case TOOL_FILL:
|
||||
case TOOL_AIRBRUSH:
|
||||
case TOOL_RRECT:
|
||||
case TOOL_RUBBER:
|
||||
case TOOL_BRUSH:
|
||||
case TOOL_PEN:
|
||||
// The active tool is an actually drawing tool. Save it for TOOL_COLOR to restore
|
||||
m_oldActiveTool = nActiveTool;
|
||||
break;
|
||||
}
|
||||
|
||||
m_activeTool = nActiveTool;
|
||||
m_pToolObject = GetOrCreateTool(m_activeTool);
|
||||
|
||||
NotifyToolChanged();
|
||||
}
|
||||
|
||||
|
@ -189,9 +229,9 @@ void ToolsModel::NotifyZoomChanged()
|
|||
void ToolsModel::OnButtonDown(BOOL bLeftButton, LONG x, LONG y, BOOL bDoubleClick)
|
||||
{
|
||||
m_pToolObject->beginEvent();
|
||||
m_pToolObject->OnButtonDown(bLeftButton, x, y, bDoubleClick);
|
||||
g_ptStart.x = g_ptEnd.x = x;
|
||||
g_ptStart.y = g_ptEnd.y = y;
|
||||
m_pToolObject->OnButtonDown(bLeftButton, x, y, bDoubleClick);
|
||||
m_pToolObject->endEvent();
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue