[MSPAINT] Larger/smaller brush nib on Ctrl+Plus/Minus (#5739)

- Introduce the concept of "brush width" to the
  tools model.
- Enable changing the brush width by Ctrl+Plus/Minus
  key combination in TOOL_BRUSH.
- Re-define brush styles.
CORE-19094
This commit is contained in:
Katayama Hirofumi MZ 2023-09-28 21:30:34 +09:00 committed by GitHub
parent c84b5007d0
commit 8a4787b384
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 132 additions and 76 deletions

View file

@ -14,8 +14,9 @@ ToolsModel toolsModel;
ToolsModel::ToolsModel()
{
m_lineWidth = m_penWidth = 1;
m_brushWidth = 4;
m_shapeStyle = 0;
m_brushStyle = 0;
m_brushStyle = BrushStyleRound;
m_oldActiveTool = m_activeTool = TOOL_PEN;
m_airBrushWidth = 5;
m_rubberRadius = 4;
@ -68,6 +69,18 @@ void ToolsModel::SetPenWidth(INT nPenWidth)
imageModel.NotifyImageChanged();
}
INT ToolsModel::GetBrushWidth() const
{
return m_brushWidth;
}
void ToolsModel::SetBrushWidth(INT nBrushWidth)
{
m_brushWidth = nBrushWidth;
NotifyToolSettingsChanged();
imageModel.NotifyImageChanged();
}
void ToolsModel::MakeLineThickerOrThinner(BOOL bThinner)
{
INT thickness = GetLineWidth();
@ -80,6 +93,12 @@ void ToolsModel::MakePenThickerOrThinner(BOOL bThinner)
SetPenWidth(bThinner ? max(1, thickness - 1) : (thickness + 1));
}
void ToolsModel::MakeBrushThickerOrThinner(BOOL bThinner)
{
INT thickness = GetBrushWidth();
SetBrushWidth(bThinner ? max(1, thickness - 1) : (thickness + 1));
}
int ToolsModel::GetShapeStyle() const
{
return m_shapeStyle;
@ -91,12 +110,12 @@ void ToolsModel::SetShapeStyle(int nShapeStyle)
NotifyToolSettingsChanged();
}
int ToolsModel::GetBrushStyle() const
BrushStyle ToolsModel::GetBrushStyle() const
{
return m_brushStyle;
}
void ToolsModel::SetBrushStyle(int nBrushStyle)
void ToolsModel::SetBrushStyle(BrushStyle nBrushStyle)
{
m_brushStyle = nBrushStyle;
NotifyToolSettingsChanged();