mirror of
https://github.com/reactos/reactos.git
synced 2025-07-04 13:51:22 +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
|
@ -20,8 +20,13 @@ CPaintToolBar::ToolBarWndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam
|
|||
{
|
||||
// We have to detect clicking on toolbar even if no change of pressed button
|
||||
POINT pt = { GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam) };
|
||||
INT id = (INT)SendMessage(hwnd, TB_HITTEST, 0, (LPARAM)&pt);
|
||||
::PostMessage(::GetParent(hwnd), WM_TOOLBARHIT, id, 0);
|
||||
INT index = (INT)::SendMessage(hwnd, TB_HITTEST, 0, (LPARAM)&pt);
|
||||
if (index >= 0)
|
||||
{
|
||||
TBBUTTON button;
|
||||
if (::SendMessage(hwnd, TB_GETBUTTON, index, (LPARAM)&button))
|
||||
::PostMessage(::GetParent(hwnd), WM_COMMAND, button.idCommand, 0);
|
||||
}
|
||||
}
|
||||
return ::CallWindowProc(oldWndProc, hwnd, uMsg, wParam, lParam);
|
||||
}
|
||||
|
@ -112,6 +117,7 @@ static const COMMAND_TO_TOOL CommandToToolMapping[] =
|
|||
{ ID_ELLIPSE, TOOL_ELLIPSE },
|
||||
{ ID_RRECT, TOOL_RRECT },
|
||||
};
|
||||
static_assert(_countof(CommandToToolMapping) == TOOL_MAX, "Logical error");
|
||||
|
||||
LRESULT CToolBox::OnCommand(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
|
||||
{
|
||||
|
@ -183,10 +189,3 @@ LRESULT CToolBox::OnLButtonUp(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHa
|
|||
::ReleaseCapture();
|
||||
return 0;
|
||||
}
|
||||
|
||||
LRESULT CToolBox::OnToolBarHit(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
|
||||
{
|
||||
// See also: CPaintToolBar::ToolBarWndProc
|
||||
selectionModel.Landing();
|
||||
return 0;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue