Skip to content

Commit

Permalink
[MSPAINT] Larger/smaller Rubber/AirBrush on Ctrl+Plus/Minus (reactos#…
Browse files Browse the repository at this point in the history
…5740)

- Enable changing rubber/airbrush thickness by Ctrl+Plus / Ctrl+Minus
  key combination in TOOL_AIRBRUSH and TOOL_RUBBER.
CORE-19094
  • Loading branch information
katahiromz authored Sep 28, 2023
1 parent 8a4787b commit 945ee4b
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 0 deletions.
10 changes: 10 additions & 0 deletions base/applications/mspaint/mouse.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -505,6 +505,11 @@ struct RubberTool : SmoothDrawTool
else
Replace(m_hdc, g_ptEnd.x, g_ptEnd.y, x, y, m_fg, m_bg, toolsModel.GetRubberRadius());
}

void OnSpecialTweak(BOOL bMinus) override
{
toolsModel.MakeRubberThickerOrThinner(bMinus);
}
};

// TOOL_FILL
Expand Down Expand Up @@ -631,6 +636,11 @@ struct AirBrushTool : SmoothDrawTool
COLORREF rgb = bLeftButton ? m_fg : m_bg;
Airbrush(m_hdc, x, y, rgb, toolsModel.GetAirBrushWidth());
}

void OnSpecialTweak(BOOL bMinus) override
{
toolsModel.MakeAirBrushThickerOrThinner(bMinus);
}
};

// TOOL_TEXT
Expand Down
12 changes: 12 additions & 0 deletions base/applications/mspaint/toolsmodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,18 @@ void ToolsModel::MakeBrushThickerOrThinner(BOOL bThinner)
SetBrushWidth(bThinner ? max(1, thickness - 1) : (thickness + 1));
}

void ToolsModel::MakeAirBrushThickerOrThinner(BOOL bThinner)
{
INT thickness = GetAirBrushWidth();
SetAirBrushWidth(bThinner ? max(1, thickness - 1) : (thickness + 1));
}

void ToolsModel::MakeRubberThickerOrThinner(BOOL bThinner)
{
INT thickness = GetRubberRadius();
SetRubberRadius(bThinner ? max(1, thickness - 1) : (thickness + 1));
}

int ToolsModel::GetShapeStyle() const
{
return m_shapeStyle;
Expand Down
2 changes: 2 additions & 0 deletions base/applications/mspaint/toolsmodel.h
Original file line number Diff line number Diff line change
Expand Up @@ -120,9 +120,11 @@ class ToolsModel

int GetAirBrushWidth() const;
void SetAirBrushWidth(int nAirBrushWidth);
void MakeAirBrushThickerOrThinner(BOOL bThinner);

int GetRubberRadius() const;
void SetRubberRadius(int nRubberRadius);
void MakeRubberThickerOrThinner(BOOL bThinner);

BOOL IsBackgroundTransparent() const;
void SetBackgroundTransparent(BOOL bTransparent);
Expand Down

0 comments on commit 945ee4b

Please sign in to comment.