mirror of
https://github.com/reactos/reactos.git
synced 2025-02-20 15:35:04 +00:00
[MSPAINT] Add selectionModel.hitTest and use it
Refactoring. CORE-19094
This commit is contained in:
parent
df54fb01fd
commit
c2bb5aa01d
4 changed files with 14 additions and 16 deletions
|
@ -317,7 +317,7 @@ LRESULT CCanvasWindow::OnButtonDown(UINT nMsg, WPARAM wParam, LPARAM lParam, BOO
|
|||
return 0;
|
||||
}
|
||||
|
||||
HITTEST hitSelection = SelectionHitTest(pt);
|
||||
HITTEST hitSelection = selectionModel.hitTest(pt);
|
||||
if (hitSelection != HIT_NONE)
|
||||
{
|
||||
selectionModel.m_nSelectionBrush = 0; // Selection Brush is OFF
|
||||
|
@ -634,7 +634,7 @@ LRESULT CCanvasWindow::OnSetCursor(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL
|
|||
return 0;
|
||||
}
|
||||
|
||||
HITTEST hitSelection = SelectionHitTest(pt);
|
||||
HITTEST hitSelection = selectionModel.hitTest(pt);
|
||||
if (hitSelection != HIT_NONE)
|
||||
{
|
||||
if (!setCursorOnSizeBox(hitSelection))
|
||||
|
@ -746,19 +746,6 @@ VOID CCanvasWindow::finishDrawing()
|
|||
Invalidate(FALSE);
|
||||
}
|
||||
|
||||
HITTEST CCanvasWindow::SelectionHitTest(POINT ptImage)
|
||||
{
|
||||
if (!selectionModel.m_bShow)
|
||||
return HIT_NONE;
|
||||
|
||||
RECT rcSelection = selectionModel.m_rc;
|
||||
Zoomed(rcSelection);
|
||||
::OffsetRect(&rcSelection, GRIP_SIZE - GetScrollPos(SB_HORZ), GRIP_SIZE - GetScrollPos(SB_VERT));
|
||||
::InflateRect(&rcSelection, GRIP_SIZE, GRIP_SIZE);
|
||||
|
||||
return getSizeBoxHitTest(ptImage, &rcSelection);
|
||||
}
|
||||
|
||||
VOID CCanvasWindow::StartSelectionDrag(HITTEST hit, POINT ptImage)
|
||||
{
|
||||
m_hitSelection = hit;
|
||||
|
|
|
@ -68,7 +68,6 @@ protected:
|
|||
VOID DoDraw(HDC hDC, RECT& rcClient, RECT& rcPaint);
|
||||
VOID OnHVScroll(WPARAM wParam, INT fnBar);
|
||||
|
||||
HITTEST SelectionHitTest(POINT ptImage);
|
||||
VOID StartSelectionDrag(HITTEST hit, POINT ptImage);
|
||||
VOID SelectionDragging(POINT ptImage);
|
||||
VOID EndSelectionDrag(POINT ptImage);
|
||||
|
|
|
@ -529,6 +529,17 @@ void SelectionModel::SwapWidthAndHeight()
|
|||
m_rc.bottom = m_rc.top + cx;
|
||||
}
|
||||
|
||||
HITTEST SelectionModel::hitTest(POINT ptCanvas)
|
||||
{
|
||||
if (!m_bShow)
|
||||
return HIT_NONE;
|
||||
|
||||
RECT rcSelection = m_rc;
|
||||
canvasWindow.ImageToCanvas(rcSelection);
|
||||
::InflateRect(&rcSelection, GRIP_SIZE, GRIP_SIZE);
|
||||
return getSizeBoxHitTest(ptCanvas, &rcSelection);
|
||||
}
|
||||
|
||||
void SelectionModel::StretchSelection(BOOL bShrink)
|
||||
{
|
||||
if (!m_bShow)
|
||||
|
|
|
@ -39,6 +39,7 @@ public:
|
|||
BOOL IsLanded() const;
|
||||
void HideSelection();
|
||||
void DeleteSelection();
|
||||
HITTEST hitTest(POINT ptCanvas);
|
||||
|
||||
HBITMAP GetSelectionContents();
|
||||
void DrawFramePoly(HDC hDCImage);
|
||||
|
|
Loading…
Reference in a new issue