[MSPAINT] Introduce Ctrl+Plus / Ctrl+Minus (#5717)

- Add Ctrl+Plus and Ctrl+Minus accelerators.
- Add IDM_CTRL_PLUS and IDM_CTRL_MINUS
  commands.
- Stretch the selection area on IDM_CTRL_PLUS
  and IDM_CTRL_MINUS actions.
CORE-19094
This commit is contained in:
Katayama Hirofumi MZ 2023-09-23 09:26:11 +09:00 committed by GitHub
parent bbb33a6ed5
commit ed9973f876
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
38 changed files with 193 additions and 14 deletions

View file

@ -750,8 +750,8 @@ LRESULT CCanvasWindow::OnPaint(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bH
VOID CCanvasWindow::cancelDrawing()
{
selectionModel.ClearColor();
selectionModel.ClearMask();
selectionModel.ClearColorImage();
selectionModel.ClearMaskImage();
m_hitSelection = HIT_NONE;
m_drawing = FALSE;
toolsModel.OnCancelDraw();

View file

@ -140,6 +140,10 @@ BEGIN
"^I", IDM_IMAGEINVERTCOLORS
"^E", IDM_IMAGEATTRIBUTES
"N", IDM_IMAGEDELETEIMAGE, CONTROL, SHIFT, VIRTKEY
VK_ADD, IDM_CTRL_PLUS, CONTROL, VIRTKEY
VK_SUBTRACT, IDM_CTRL_MINUS, CONTROL, VIRTKEY
VK_OEM_PLUS, IDM_CTRL_PLUS, CONTROL, VIRTKEY
VK_OEM_MINUS, IDM_CTRL_MINUS, CONTROL, VIRTKEY
END
IDD_MIRRORROTATE DIALOGEX 100, 100, 180, 100

View file

@ -140,6 +140,10 @@ BEGIN
"^I", IDM_IMAGEINVERTCOLORS
"^E", IDM_IMAGEATTRIBUTES
"N", IDM_IMAGEDELETEIMAGE, CONTROL, SHIFT, VIRTKEY
VK_ADD, IDM_CTRL_PLUS, CONTROL, VIRTKEY
VK_SUBTRACT, IDM_CTRL_MINUS, CONTROL, VIRTKEY
VK_OEM_PLUS, IDM_CTRL_PLUS, CONTROL, VIRTKEY
VK_OEM_MINUS, IDM_CTRL_MINUS, CONTROL, VIRTKEY
END
IDD_MIRRORROTATE DIALOGEX 100, 100, 180, 100

View file

@ -139,6 +139,10 @@ BEGIN
"^U", IDM_IMAGEINVERTCOLORS
"^E", IDM_IMAGEATTRIBUTES
"N", IDM_IMAGEDELETEIMAGE, CONTROL, SHIFT, VIRTKEY
VK_ADD, IDM_CTRL_PLUS, CONTROL, VIRTKEY
VK_SUBTRACT, IDM_CTRL_MINUS, CONTROL, VIRTKEY
VK_OEM_PLUS, IDM_CTRL_PLUS, CONTROL, VIRTKEY
VK_OEM_MINUS, IDM_CTRL_MINUS, CONTROL, VIRTKEY
END
IDD_MIRRORROTATE DIALOGEX 100, 100, 180, 100

View file

@ -139,6 +139,10 @@ BEGIN
"^I", IDM_IMAGEINVERTCOLORS
"^E", IDM_IMAGEATTRIBUTES
"N", IDM_IMAGEDELETEIMAGE, CONTROL, SHIFT, VIRTKEY
VK_ADD, IDM_CTRL_PLUS, CONTROL, VIRTKEY
VK_SUBTRACT, IDM_CTRL_MINUS, CONTROL, VIRTKEY
VK_OEM_PLUS, IDM_CTRL_PLUS, CONTROL, VIRTKEY
VK_OEM_MINUS, IDM_CTRL_MINUS, CONTROL, VIRTKEY
END
IDD_MIRRORROTATE DIALOGEX 100, 100, 180, 100

View file

@ -140,6 +140,10 @@ BEGIN
"^I", IDM_IMAGEINVERTCOLORS
"^E", IDM_IMAGEATTRIBUTES
"N", IDM_IMAGEDELETEIMAGE, CONTROL, SHIFT, VIRTKEY
VK_ADD, IDM_CTRL_PLUS, CONTROL, VIRTKEY
VK_SUBTRACT, IDM_CTRL_MINUS, CONTROL, VIRTKEY
VK_OEM_PLUS, IDM_CTRL_PLUS, CONTROL, VIRTKEY
VK_OEM_MINUS, IDM_CTRL_MINUS, CONTROL, VIRTKEY
END
IDD_MIRRORROTATE DIALOGEX 100, 100, 180, 100

View file

@ -142,6 +142,10 @@ BEGIN
"^I", IDM_IMAGEINVERTCOLORS
"^E", IDM_IMAGEATTRIBUTES
"N", IDM_IMAGEDELETEIMAGE, CONTROL, SHIFT, VIRTKEY
VK_ADD, IDM_CTRL_PLUS, CONTROL, VIRTKEY
VK_SUBTRACT, IDM_CTRL_MINUS, CONTROL, VIRTKEY
VK_OEM_PLUS, IDM_CTRL_PLUS, CONTROL, VIRTKEY
VK_OEM_MINUS, IDM_CTRL_MINUS, CONTROL, VIRTKEY
END
IDD_MIRRORROTATE DIALOGEX 100, 100, 180, 100

View file

@ -139,6 +139,10 @@ BEGIN
"^I", IDM_IMAGEINVERTCOLORS
"^E", IDM_IMAGEATTRIBUTES
"N", IDM_IMAGEDELETEIMAGE, CONTROL, SHIFT, VIRTKEY
VK_ADD, IDM_CTRL_PLUS, CONTROL, VIRTKEY
VK_SUBTRACT, IDM_CTRL_MINUS, CONTROL, VIRTKEY
VK_OEM_PLUS, IDM_CTRL_PLUS, CONTROL, VIRTKEY
VK_OEM_MINUS, IDM_CTRL_MINUS, CONTROL, VIRTKEY
END
IDD_MIRRORROTATE DIALOGEX 100, 100, 180, 100

View file

@ -140,6 +140,10 @@ BEGIN
"^I", IDM_IMAGEINVERTCOLORS
"^E", IDM_IMAGEATTRIBUTES
"N", IDM_IMAGEDELETEIMAGE, CONTROL, SHIFT, VIRTKEY
VK_ADD, IDM_CTRL_PLUS, CONTROL, VIRTKEY
VK_SUBTRACT, IDM_CTRL_MINUS, CONTROL, VIRTKEY
VK_OEM_PLUS, IDM_CTRL_PLUS, CONTROL, VIRTKEY
VK_OEM_MINUS, IDM_CTRL_MINUS, CONTROL, VIRTKEY
END
IDD_MIRRORROTATE DIALOGEX 100, 100, 180, 100

View file

@ -140,6 +140,10 @@ BEGIN
"^I", IDM_IMAGEINVERTCOLORS
"^E", IDM_IMAGEATTRIBUTES
"N", IDM_IMAGEDELETEIMAGE, CONTROL, SHIFT, VIRTKEY
VK_ADD, IDM_CTRL_PLUS, CONTROL, VIRTKEY
VK_SUBTRACT, IDM_CTRL_MINUS, CONTROL, VIRTKEY
VK_OEM_PLUS, IDM_CTRL_PLUS, CONTROL, VIRTKEY
VK_OEM_MINUS, IDM_CTRL_MINUS, CONTROL, VIRTKEY
END
IDD_MIRRORROTATE DIALOGEX 100, 100, 180, 100

View file

@ -139,6 +139,10 @@ BEGIN
"^I", IDM_IMAGEINVERTCOLORS
"^E", IDM_IMAGEATTRIBUTES
"N", IDM_IMAGEDELETEIMAGE, CONTROL, SHIFT, VIRTKEY
VK_ADD, IDM_CTRL_PLUS, CONTROL, VIRTKEY
VK_SUBTRACT, IDM_CTRL_MINUS, CONTROL, VIRTKEY
VK_OEM_PLUS, IDM_CTRL_PLUS, CONTROL, VIRTKEY
VK_OEM_MINUS, IDM_CTRL_MINUS, CONTROL, VIRTKEY
END
IDD_MIRRORROTATE DIALOGEX 100, 100, 180, 100

View file

@ -140,6 +140,10 @@ BEGIN
"^I", IDM_IMAGEINVERTCOLORS
"^E", IDM_IMAGEATTRIBUTES
"N", IDM_IMAGEDELETEIMAGE, CONTROL, SHIFT, VIRTKEY
VK_ADD, IDM_CTRL_PLUS, CONTROL, VIRTKEY
VK_SUBTRACT, IDM_CTRL_MINUS, CONTROL, VIRTKEY
VK_OEM_PLUS, IDM_CTRL_PLUS, CONTROL, VIRTKEY
VK_OEM_MINUS, IDM_CTRL_MINUS, CONTROL, VIRTKEY
END
IDD_MIRRORROTATE DIALOGEX 100, 100, 180, 100

View file

@ -139,6 +139,10 @@ BEGIN
"^I", IDM_IMAGEINVERTCOLORS
"^E", IDM_IMAGEATTRIBUTES
"N", IDM_IMAGEDELETEIMAGE, CONTROL, SHIFT, VIRTKEY
VK_ADD, IDM_CTRL_PLUS, CONTROL, VIRTKEY
VK_SUBTRACT, IDM_CTRL_MINUS, CONTROL, VIRTKEY
VK_OEM_PLUS, IDM_CTRL_PLUS, CONTROL, VIRTKEY
VK_OEM_MINUS, IDM_CTRL_MINUS, CONTROL, VIRTKEY
END
IDD_MIRRORROTATE DIALOGEX 100, 100, 180, 100

View file

@ -140,6 +140,10 @@ BEGIN
"^I", IDM_IMAGEINVERTCOLORS
"^E", IDM_IMAGEATTRIBUTES
"N", IDM_IMAGEDELETEIMAGE, CONTROL, SHIFT, VIRTKEY
VK_ADD, IDM_CTRL_PLUS, CONTROL, VIRTKEY
VK_SUBTRACT, IDM_CTRL_MINUS, CONTROL, VIRTKEY
VK_OEM_PLUS, IDM_CTRL_PLUS, CONTROL, VIRTKEY
VK_OEM_MINUS, IDM_CTRL_MINUS, CONTROL, VIRTKEY
END
IDD_MIRRORROTATE DIALOGEX 100, 100, 180, 100

View file

@ -141,6 +141,10 @@ BEGIN
"^I", IDM_IMAGEINVERTCOLORS
"^E", IDM_IMAGEATTRIBUTES
"N", IDM_IMAGEDELETEIMAGE, CONTROL, SHIFT, VIRTKEY
VK_ADD, IDM_CTRL_PLUS, CONTROL, VIRTKEY
VK_SUBTRACT, IDM_CTRL_MINUS, CONTROL, VIRTKEY
VK_OEM_PLUS, IDM_CTRL_PLUS, CONTROL, VIRTKEY
VK_OEM_MINUS, IDM_CTRL_MINUS, CONTROL, VIRTKEY
END
IDD_MIRRORROTATE DIALOGEX 100, 100, 180, 100

View file

@ -139,6 +139,10 @@ BEGIN
"^I", IDM_IMAGEINVERTCOLORS
"^E", IDM_IMAGEATTRIBUTES
"N", IDM_IMAGEDELETEIMAGE, CONTROL, SHIFT, VIRTKEY
VK_ADD, IDM_CTRL_PLUS, CONTROL, VIRTKEY
VK_SUBTRACT, IDM_CTRL_MINUS, CONTROL, VIRTKEY
VK_OEM_PLUS, IDM_CTRL_PLUS, CONTROL, VIRTKEY
VK_OEM_MINUS, IDM_CTRL_MINUS, CONTROL, VIRTKEY
END
IDD_MIRRORROTATE DIALOGEX 100, 100, 180, 100

View file

@ -139,6 +139,10 @@ BEGIN
"^I", IDM_IMAGEINVERTCOLORS
"^E", IDM_IMAGEATTRIBUTES
"N", IDM_IMAGEDELETEIMAGE, CONTROL, SHIFT, VIRTKEY
VK_ADD, IDM_CTRL_PLUS, CONTROL, VIRTKEY
VK_SUBTRACT, IDM_CTRL_MINUS, CONTROL, VIRTKEY
VK_OEM_PLUS, IDM_CTRL_PLUS, CONTROL, VIRTKEY
VK_OEM_MINUS, IDM_CTRL_MINUS, CONTROL, VIRTKEY
END
IDD_MIRRORROTATE DIALOGEX 100, 100, 180, 100

View file

@ -142,6 +142,10 @@ BEGIN
"^I", IDM_IMAGEINVERTCOLORS
"^E", IDM_IMAGEATTRIBUTES
"N", IDM_IMAGEDELETEIMAGE, CONTROL, SHIFT, VIRTKEY
VK_ADD, IDM_CTRL_PLUS, CONTROL, VIRTKEY
VK_SUBTRACT, IDM_CTRL_MINUS, CONTROL, VIRTKEY
VK_OEM_PLUS, IDM_CTRL_PLUS, CONTROL, VIRTKEY
VK_OEM_MINUS, IDM_CTRL_MINUS, CONTROL, VIRTKEY
END
IDD_MIRRORROTATE DIALOGEX 100, 100, 180, 100

View file

@ -140,6 +140,10 @@ BEGIN
"^I", IDM_IMAGEINVERTCOLORS
"^E", IDM_IMAGEATTRIBUTES
"N", IDM_IMAGEDELETEIMAGE, CONTROL, SHIFT, VIRTKEY
VK_ADD, IDM_CTRL_PLUS, CONTROL, VIRTKEY
VK_SUBTRACT, IDM_CTRL_MINUS, CONTROL, VIRTKEY
VK_OEM_PLUS, IDM_CTRL_PLUS, CONTROL, VIRTKEY
VK_OEM_MINUS, IDM_CTRL_MINUS, CONTROL, VIRTKEY
END
IDD_MIRRORROTATE DIALOGEX 100, 100, 180, 100

View file

@ -140,6 +140,10 @@ BEGIN
"^I", IDM_IMAGEINVERTCOLORS
"^E", IDM_IMAGEATTRIBUTES
"N", IDM_IMAGEDELETEIMAGE, CONTROL, SHIFT, VIRTKEY
VK_ADD, IDM_CTRL_PLUS, CONTROL, VIRTKEY
VK_SUBTRACT, IDM_CTRL_MINUS, CONTROL, VIRTKEY
VK_OEM_PLUS, IDM_CTRL_PLUS, CONTROL, VIRTKEY
VK_OEM_MINUS, IDM_CTRL_MINUS, CONTROL, VIRTKEY
END
IDD_MIRRORROTATE DIALOGEX 100, 100, 180, 100

View file

@ -141,6 +141,10 @@ BEGIN
"^I", IDM_IMAGEINVERTCOLORS
"^E", IDM_IMAGEATTRIBUTES
"N", IDM_IMAGEDELETEIMAGE, CONTROL, SHIFT, VIRTKEY
VK_ADD, IDM_CTRL_PLUS, CONTROL, VIRTKEY
VK_SUBTRACT, IDM_CTRL_MINUS, CONTROL, VIRTKEY
VK_OEM_PLUS, IDM_CTRL_PLUS, CONTROL, VIRTKEY
VK_OEM_MINUS, IDM_CTRL_MINUS, CONTROL, VIRTKEY
END
IDD_MIRRORROTATE DIALOGEX 100, 100, 180, 100

View file

@ -143,6 +143,10 @@ BEGIN
"^I", IDM_IMAGEINVERTCOLORS
"^E", IDM_IMAGEATTRIBUTES
"N", IDM_IMAGEDELETEIMAGE, CONTROL, SHIFT, VIRTKEY
VK_ADD, IDM_CTRL_PLUS, CONTROL, VIRTKEY
VK_SUBTRACT, IDM_CTRL_MINUS, CONTROL, VIRTKEY
VK_OEM_PLUS, IDM_CTRL_PLUS, CONTROL, VIRTKEY
VK_OEM_MINUS, IDM_CTRL_MINUS, CONTROL, VIRTKEY
END
IDD_MIRRORROTATE DIALOGEX 100, 100, 180, 100

View file

@ -139,6 +139,10 @@ BEGIN
"^I", IDM_IMAGEINVERTCOLORS
"^E", IDM_IMAGEATTRIBUTES
"N", IDM_IMAGEDELETEIMAGE, CONTROL, SHIFT, VIRTKEY
VK_ADD, IDM_CTRL_PLUS, CONTROL, VIRTKEY
VK_SUBTRACT, IDM_CTRL_MINUS, CONTROL, VIRTKEY
VK_OEM_PLUS, IDM_CTRL_PLUS, CONTROL, VIRTKEY
VK_OEM_MINUS, IDM_CTRL_MINUS, CONTROL, VIRTKEY
END
IDD_MIRRORROTATE DIALOGEX 100, 100, 180, 100

View file

@ -139,6 +139,10 @@ BEGIN
"^I", IDM_IMAGEINVERTCOLORS
"^E", IDM_IMAGEATTRIBUTES
"N", IDM_IMAGEDELETEIMAGE, CONTROL, SHIFT, VIRTKEY
VK_ADD, IDM_CTRL_PLUS, CONTROL, VIRTKEY
VK_SUBTRACT, IDM_CTRL_MINUS, CONTROL, VIRTKEY
VK_OEM_PLUS, IDM_CTRL_PLUS, CONTROL, VIRTKEY
VK_OEM_MINUS, IDM_CTRL_MINUS, CONTROL, VIRTKEY
END
IDD_MIRRORROTATE DIALOGEX 100, 100, 180, 100

View file

@ -140,6 +140,10 @@ BEGIN
"^I", IDM_IMAGEINVERTCOLORS
"^E", IDM_IMAGEATTRIBUTES
"N", IDM_IMAGEDELETEIMAGE, CONTROL, SHIFT, VIRTKEY
VK_ADD, IDM_CTRL_PLUS, CONTROL, VIRTKEY
VK_SUBTRACT, IDM_CTRL_MINUS, CONTROL, VIRTKEY
VK_OEM_PLUS, IDM_CTRL_PLUS, CONTROL, VIRTKEY
VK_OEM_MINUS, IDM_CTRL_MINUS, CONTROL, VIRTKEY
END
IDD_MIRRORROTATE DIALOGEX 100, 100, 180, 100

View file

@ -140,6 +140,10 @@ BEGIN
"^I", IDM_IMAGEINVERTCOLORS
"^E", IDM_IMAGEATTRIBUTES
"N", IDM_IMAGEDELETEIMAGE, CONTROL, SHIFT, VIRTKEY
VK_ADD, IDM_CTRL_PLUS, CONTROL, VIRTKEY
VK_SUBTRACT, IDM_CTRL_MINUS, CONTROL, VIRTKEY
VK_OEM_PLUS, IDM_CTRL_PLUS, CONTROL, VIRTKEY
VK_OEM_MINUS, IDM_CTRL_MINUS, CONTROL, VIRTKEY
END
IDD_MIRRORROTATE DIALOGEX 100, 100, 180, 100

View file

@ -141,6 +141,10 @@ BEGIN
"^I", IDM_IMAGEINVERTCOLORS
"^E", IDM_IMAGEATTRIBUTES
"N", IDM_IMAGEDELETEIMAGE, CONTROL, SHIFT, VIRTKEY
VK_ADD, IDM_CTRL_PLUS, CONTROL, VIRTKEY
VK_SUBTRACT, IDM_CTRL_MINUS, CONTROL, VIRTKEY
VK_OEM_PLUS, IDM_CTRL_PLUS, CONTROL, VIRTKEY
VK_OEM_MINUS, IDM_CTRL_MINUS, CONTROL, VIRTKEY
END
IDD_MIRRORROTATE DIALOGEX 100, 100, 180, 100

View file

@ -139,6 +139,10 @@ BEGIN
"^I", IDM_IMAGEINVERTCOLORS
"^E", IDM_IMAGEATTRIBUTES
"N", IDM_IMAGEDELETEIMAGE, CONTROL, SHIFT, VIRTKEY
VK_ADD, IDM_CTRL_PLUS, CONTROL, VIRTKEY
VK_SUBTRACT, IDM_CTRL_MINUS, CONTROL, VIRTKEY
VK_OEM_PLUS, IDM_CTRL_PLUS, CONTROL, VIRTKEY
VK_OEM_MINUS, IDM_CTRL_MINUS, CONTROL, VIRTKEY
END
IDD_MIRRORROTATE DIALOGEX 100, 100, 180, 100

View file

@ -142,6 +142,10 @@ BEGIN
"^I", IDM_IMAGEINVERTCOLORS
"^E", IDM_IMAGEATTRIBUTES
"N", IDM_IMAGEDELETEIMAGE, CONTROL, SHIFT, VIRTKEY
VK_ADD, IDM_CTRL_PLUS, CONTROL, VIRTKEY
VK_SUBTRACT, IDM_CTRL_MINUS, CONTROL, VIRTKEY
VK_OEM_PLUS, IDM_CTRL_PLUS, CONTROL, VIRTKEY
VK_OEM_MINUS, IDM_CTRL_MINUS, CONTROL, VIRTKEY
END
IDD_MIRRORROTATE DIALOGEX 100, 100, 180, 100

View file

@ -140,6 +140,10 @@ BEGIN
"^I", IDM_IMAGEINVERTCOLORS
"^E", IDM_IMAGEATTRIBUTES
"N", IDM_IMAGEDELETEIMAGE, CONTROL, SHIFT, VIRTKEY
VK_ADD, IDM_CTRL_PLUS, CONTROL, VIRTKEY
VK_SUBTRACT, IDM_CTRL_MINUS, CONTROL, VIRTKEY
VK_OEM_PLUS, IDM_CTRL_PLUS, CONTROL, VIRTKEY
VK_OEM_MINUS, IDM_CTRL_MINUS, CONTROL, VIRTKEY
END
IDD_MIRRORROTATE DIALOGEX 100, 100, 180, 100

View file

@ -140,6 +140,10 @@ BEGIN
"^I", IDM_IMAGEINVERTCOLORS
"^E", IDM_IMAGEATTRIBUTES
"N", IDM_IMAGEDELETEIMAGE, CONTROL, SHIFT, VIRTKEY
VK_ADD, IDM_CTRL_PLUS, CONTROL, VIRTKEY
VK_SUBTRACT, IDM_CTRL_MINUS, CONTROL, VIRTKEY
VK_OEM_PLUS, IDM_CTRL_PLUS, CONTROL, VIRTKEY
VK_OEM_MINUS, IDM_CTRL_MINUS, CONTROL, VIRTKEY
END
IDD_MIRRORROTATE DIALOGEX 100, 100, 180, 100

View file

@ -199,6 +199,11 @@ struct FreeSelTool : ToolBase
selectionModel.HideSelection();
ToolBase::OnCancelDraw();
}
void OnSpecialTweak(BOOL bMinus) override
{
selectionModel.StretchSelection(bMinus);
}
};
// TOOL_RECTSEL
@ -280,6 +285,11 @@ struct RectSelTool : ToolBase
selectionModel.HideSelection();
ToolBase::OnCancelDraw();
}
void OnSpecialTweak(BOOL bMinus) override
{
selectionModel.StretchSelection(bMinus);
}
};
struct TwoPointDrawTool : ToolBase

View file

@ -102,6 +102,9 @@
#define IDM_UNDERLINE 282
#define IDM_VERTICAL 283
#define IDM_CTRL_PLUS 290
#define IDM_CTRL_MINUS 291
/* the following 16 numbers need to be in order, increasing by 1 */
#define ID_FREESEL 600
#define ID_RECTSEL 601

View file

@ -28,8 +28,8 @@ SelectionModel::SelectionModel()
SelectionModel::~SelectionModel()
{
ClearColor();
ClearMask();
ClearColorImage();
ClearMaskImage();
ResetPtStack();
}
@ -85,7 +85,7 @@ void SelectionModel::BuildMaskFromPtStack()
m_rc = m_rcOld = rc;
ClearMask();
ClearMaskImage();
ShiftPtStack(-m_rcOld.left, -m_rcOld.top);
@ -154,7 +154,7 @@ void SelectionModel::DrawSelection(HDC hDCImage, COLORREF crBg, BOOL bBgTranspar
void SelectionModel::GetSelectionContents(HDC hDCImage)
{
ClearColor();
ClearColorImage();
HDC hMemDC = ::CreateCompatibleDC(NULL);
m_hbmColor = CreateColorDIB(m_rc.Width(), m_rc.Height(), RGB(255, 255, 255));
@ -174,12 +174,17 @@ BOOL SelectionModel::TakeOff()
if (!IsLanded() || ::IsRectEmpty(&m_rc))
return FALSE;
// The background color is needed for transparency of selection
m_rgbBack = paletteModel.GetBgColor();
// Get the contents of the selection area
GetSelectionContents(imageModel.GetDC());
// RectSel doesn't need the mask image
if (toolsModel.GetActiveTool() == TOOL_RECTSEL)
ClearMask();
ClearMaskImage();
// Save the selection area
m_rcOld = m_rc;
imageModel.NotifyImageChanged();
@ -225,7 +230,7 @@ void SelectionModel::InsertFromHBITMAP(HBITMAP hbmColor, INT x, INT y, HBITMAP h
}
else
{
ClearMask();
ClearMaskImage();
}
NotifyContentChanged();
@ -458,7 +463,7 @@ void SelectionModel::Dragging(HITTEST hit, POINT pt)
m_ptHit = pt;
}
void SelectionModel::ClearMask()
void SelectionModel::ClearMaskImage()
{
if (m_hbmMask)
{
@ -467,7 +472,7 @@ void SelectionModel::ClearMask()
}
}
void SelectionModel::ClearColor()
void SelectionModel::ClearColorImage()
{
if (m_hbmColor)
{
@ -479,8 +484,8 @@ void SelectionModel::ClearColor()
void SelectionModel::HideSelection()
{
m_bShow = m_bContentChanged = FALSE;
ClearColor();
ClearMask();
ClearColorImage();
ClearMaskImage();
::SetRectEmpty(&m_rc);
::SetRectEmpty(&m_rcOld);
imageModel.NotifyImageChanged();
@ -540,3 +545,26 @@ void SelectionModel::UnlockBitmap(HBITMAP hbmLocked)
{
m_hbmColor = hbmLocked;
}
void SelectionModel::StretchSelection(BOOL bShrink)
{
if (!m_bShow)
return;
TakeOff();
INT cx = m_rc.Width(), cy = m_rc.Height();
if (bShrink)
m_rc.InflateRect(-cx / 4, -cy / 4);
else
m_rc.InflateRect(+cx / 2, +cy / 2);
// The selection area must exist there
if (m_rc.Width() <= 0)
m_rc.right = m_rc.left + 1;
if (m_rc.Height() <= 0)
m_rc.bottom = m_rc.top + 1;
imageModel.NotifyImageChanged();
}

View file

@ -58,10 +58,12 @@ public:
void InvertSelection();
void Dragging(HITTEST hit, POINT pt);
void ClearMask();
void ClearColor();
void ClearMaskImage();
void ClearColorImage();
void NotifyContentChanged();
void StretchSelection(BOOL bShrink);
private:
SelectionModel(const SelectionModel&);
SelectionModel& operator=(const SelectionModel&);

View file

@ -248,3 +248,8 @@ void ToolsModel::selectAll()
OnMouseMove(TRUE, imageModel.GetWidth(), imageModel.GetHeight());
OnButtonUp(TRUE, imageModel.GetWidth(), imageModel.GetHeight());
}
void ToolsModel::SpecialTweak(BOOL bMinus)
{
m_pToolObject->OnSpecialTweak(bMinus);
}

View file

@ -51,6 +51,8 @@ struct ToolBase
virtual void OnDrawOverlayOnImage(HDC hdc) { }
virtual void OnDrawOverlayOnCanvas(HDC hdc) { }
virtual void OnSpecialTweak(BOOL bMinus) { }
void beginEvent();
void endEvent();
void reset();
@ -115,6 +117,8 @@ public:
void NotifyToolChanged();
void NotifyToolSettingsChanged();
void NotifyZoomChanged();
void SpecialTweak(BOOL bMinus);
};
extern ToolsModel toolsModel;

View file

@ -1069,6 +1069,13 @@ LRESULT CMainWindow::OnCommand(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bH
fullscreenWindow.DoCreate();
fullscreenWindow.ShowWindow(SW_SHOWMAXIMIZED);
break;
case IDM_CTRL_PLUS:
toolsModel.SpecialTweak(FALSE);
break;
case IDM_CTRL_MINUS:
toolsModel.SpecialTweak(TRUE);
break;
}
return 0;
}