mirror of
https://github.com/reactos/reactos.git
synced 2025-08-04 23:15:39 +00:00
[MSPAINT] Add selectionModel.drawFrameOnCanvas and use it
Refactoring. CORE-19094
This commit is contained in:
parent
c2bb5aa01d
commit
4a52a4b04c
4 changed files with 16 additions and 19 deletions
|
@ -103,18 +103,6 @@ void ToolBase::endEvent()
|
||||||
m_hdc = NULL;
|
m_hdc = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ToolBase::OnDrawSelectionOnCanvas(HDC hdc)
|
|
||||||
{
|
|
||||||
if (!selectionModel.m_bShow)
|
|
||||||
return;
|
|
||||||
|
|
||||||
RECT rcSelection = selectionModel.m_rc;
|
|
||||||
canvasWindow.ImageToCanvas(rcSelection);
|
|
||||||
|
|
||||||
::InflateRect(&rcSelection, GRIP_SIZE, GRIP_SIZE);
|
|
||||||
drawSizeBoxes(hdc, &rcSelection, TRUE);
|
|
||||||
}
|
|
||||||
|
|
||||||
void ToolBase::pushToPtStack(LONG x, LONG y)
|
void ToolBase::pushToPtStack(LONG x, LONG y)
|
||||||
{
|
{
|
||||||
if (s_pointSP >= s_maxPointSP)
|
if (s_pointSP >= s_maxPointSP)
|
||||||
|
@ -157,7 +145,7 @@ struct FreeSelTool : ToolBase
|
||||||
|
|
||||||
void OnDrawOverlayOnCanvas(HDC hdc) override
|
void OnDrawOverlayOnCanvas(HDC hdc) override
|
||||||
{
|
{
|
||||||
OnDrawSelectionOnCanvas(hdc);
|
selectionModel.drawFrameOnCanvas(hdc);
|
||||||
}
|
}
|
||||||
|
|
||||||
void OnButtonDown(BOOL bLeftButton, LONG x, LONG y, BOOL bDoubleClick) override
|
void OnButtonDown(BOOL bLeftButton, LONG x, LONG y, BOOL bDoubleClick) override
|
||||||
|
@ -249,7 +237,7 @@ struct RectSelTool : ToolBase
|
||||||
|
|
||||||
void OnDrawOverlayOnCanvas(HDC hdc) override
|
void OnDrawOverlayOnCanvas(HDC hdc) override
|
||||||
{
|
{
|
||||||
OnDrawSelectionOnCanvas(hdc);
|
selectionModel.drawFrameOnCanvas(hdc);
|
||||||
}
|
}
|
||||||
|
|
||||||
void OnButtonDown(BOOL bLeftButton, LONG x, LONG y, BOOL bDoubleClick) override
|
void OnButtonDown(BOOL bLeftButton, LONG x, LONG y, BOOL bDoubleClick) override
|
||||||
|
|
|
@ -523,8 +523,7 @@ void SelectionModel::NotifyContentChanged()
|
||||||
|
|
||||||
void SelectionModel::SwapWidthAndHeight()
|
void SelectionModel::SwapWidthAndHeight()
|
||||||
{
|
{
|
||||||
INT cx = m_rc.Width();
|
INT cx = m_rc.Width(), cy = m_rc.Height();
|
||||||
INT cy = m_rc.Height();
|
|
||||||
m_rc.right = m_rc.left + cy;
|
m_rc.right = m_rc.left + cy;
|
||||||
m_rc.bottom = m_rc.top + cx;
|
m_rc.bottom = m_rc.top + cx;
|
||||||
}
|
}
|
||||||
|
@ -540,6 +539,18 @@ HITTEST SelectionModel::hitTest(POINT ptCanvas)
|
||||||
return getSizeBoxHitTest(ptCanvas, &rcSelection);
|
return getSizeBoxHitTest(ptCanvas, &rcSelection);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SelectionModel::drawFrameOnCanvas(HDC hCanvasDC)
|
||||||
|
{
|
||||||
|
if (!m_bShow)
|
||||||
|
return;
|
||||||
|
|
||||||
|
RECT rcSelection = m_rc;
|
||||||
|
canvasWindow.ImageToCanvas(rcSelection);
|
||||||
|
|
||||||
|
::InflateRect(&rcSelection, GRIP_SIZE, GRIP_SIZE);
|
||||||
|
drawSizeBoxes(hCanvasDC, &rcSelection, TRUE);
|
||||||
|
}
|
||||||
|
|
||||||
void SelectionModel::StretchSelection(BOOL bShrink)
|
void SelectionModel::StretchSelection(BOOL bShrink)
|
||||||
{
|
{
|
||||||
if (!m_bShow)
|
if (!m_bShow)
|
||||||
|
|
|
@ -40,6 +40,7 @@ public:
|
||||||
void HideSelection();
|
void HideSelection();
|
||||||
void DeleteSelection();
|
void DeleteSelection();
|
||||||
HITTEST hitTest(POINT ptCanvas);
|
HITTEST hitTest(POINT ptCanvas);
|
||||||
|
void drawFrameOnCanvas(HDC hCanvasDC);
|
||||||
|
|
||||||
HBITMAP GetSelectionContents();
|
HBITMAP GetSelectionContents();
|
||||||
void DrawFramePoly(HDC hDCImage);
|
void DrawFramePoly(HDC hDCImage);
|
||||||
|
|
|
@ -65,9 +65,6 @@ struct ToolBase
|
||||||
void pushToPtStack(LONG x, LONG y);
|
void pushToPtStack(LONG x, LONG y);
|
||||||
|
|
||||||
static ToolBase* createToolObject(TOOLTYPE type);
|
static ToolBase* createToolObject(TOOLTYPE type);
|
||||||
|
|
||||||
protected:
|
|
||||||
void OnDrawSelectionOnCanvas(HDC hdc);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class ToolsModel
|
class ToolsModel
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue