mirror of
https://github.com/reactos/reactos.git
synced 2024-12-28 01:55:19 +00:00
[MSPAINT] Rename some identifiers (#5362)
- s/CANVAS_HITTEST/HITTEST/ - s/m_whereHit/m_hitCanvasSizeBox/ - s/m_rcNew/m_rcResizing/ - Add comments to CCanvasWindow. CORE-18867
This commit is contained in:
parent
5bb0a2c484
commit
cb98e91b55
7 changed files with 48 additions and 47 deletions
|
@ -14,11 +14,11 @@ CCanvasWindow canvasWindow;
|
|||
CCanvasWindow::CCanvasWindow()
|
||||
: m_drawing(FALSE)
|
||||
, m_hitSelection(HIT_NONE)
|
||||
, m_whereHit(HIT_NONE)
|
||||
, m_hitCanvasSizeBox(HIT_NONE)
|
||||
, m_ptOrig { -1, -1 }
|
||||
{
|
||||
m_ahbmCached[0] = m_ahbmCached[1] = NULL;
|
||||
::SetRectEmpty(&m_rcNew);
|
||||
::SetRectEmpty(&m_rcResizing);
|
||||
}
|
||||
|
||||
CCanvasWindow::~CCanvasWindow()
|
||||
|
@ -93,7 +93,7 @@ VOID CCanvasWindow::GetImageRect(RECT& rc)
|
|||
::SetRect(&rc, 0, 0, imageModel.GetWidth(), imageModel.GetHeight());
|
||||
}
|
||||
|
||||
CANVAS_HITTEST CCanvasWindow::CanvasHitTest(POINT pt)
|
||||
HITTEST CCanvasWindow::CanvasHitTest(POINT pt)
|
||||
{
|
||||
if (selectionModel.m_bShow || ::IsWindowVisible(textEditWindow))
|
||||
return HIT_INNER;
|
||||
|
@ -166,8 +166,8 @@ VOID CCanvasWindow::DoDraw(HDC hDC, RECT& rcClient, RECT& rcPaint)
|
|||
toolsModel.OnDrawOverlayOnCanvas(hdcMem0);
|
||||
|
||||
// Draw new frame on hdcMem0 if any
|
||||
if (m_whereHit != HIT_NONE && !::IsRectEmpty(&m_rcNew))
|
||||
DrawXorRect(hdcMem0, &m_rcNew);
|
||||
if (m_hitCanvasSizeBox != HIT_NONE && !::IsRectEmpty(&m_rcResizing))
|
||||
DrawXorRect(hdcMem0, &m_rcResizing);
|
||||
|
||||
// Transfer the bits (hDC <-- hdcMem0)
|
||||
::BitBlt(hDC,
|
||||
|
@ -265,7 +265,7 @@ LRESULT CCanvasWindow::OnLRButtonDown(BOOL bLeftButton, UINT nMsg, WPARAM wParam
|
|||
{
|
||||
POINT pt = { GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam) };
|
||||
|
||||
CANVAS_HITTEST hitSelection = SelectionHitTest(pt);
|
||||
HITTEST hitSelection = SelectionHitTest(pt);
|
||||
if (hitSelection != HIT_NONE)
|
||||
{
|
||||
if (bLeftButton)
|
||||
|
@ -281,7 +281,7 @@ LRESULT CCanvasWindow::OnLRButtonDown(BOOL bLeftButton, UINT nMsg, WPARAM wParam
|
|||
return 0;
|
||||
}
|
||||
|
||||
CANVAS_HITTEST hit = CanvasHitTest(pt);
|
||||
HITTEST hit = CanvasHitTest(pt);
|
||||
if (hit == HIT_NONE || hit == HIT_BORDER)
|
||||
{
|
||||
switch (toolsModel.GetActiveTool())
|
||||
|
@ -320,7 +320,7 @@ LRESULT CCanvasWindow::OnLRButtonDown(BOOL bLeftButton, UINT nMsg, WPARAM wParam
|
|||
|
||||
if (bLeftButton)
|
||||
{
|
||||
m_whereHit = hit;
|
||||
m_hitCanvasSizeBox = hit;
|
||||
UnZoomed(pt);
|
||||
m_ptOrig = pt;
|
||||
SetCapture();
|
||||
|
@ -474,14 +474,14 @@ LRESULT CCanvasWindow::OnMouseMove(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL
|
|||
return 0;
|
||||
}
|
||||
|
||||
if (m_whereHit == HIT_NONE || ::GetCapture() != m_hWnd)
|
||||
if (m_hitCanvasSizeBox == HIT_NONE || ::GetCapture() != m_hWnd)
|
||||
return 0;
|
||||
|
||||
// Dragging now... Calculate the new size
|
||||
INT cxImage = imageModel.GetWidth(), cyImage = imageModel.GetHeight();
|
||||
INT cxDelta = pt.x - m_ptOrig.x;
|
||||
INT cyDelta = pt.y - m_ptOrig.y;
|
||||
switch (m_whereHit)
|
||||
switch (m_hitCanvasSizeBox)
|
||||
{
|
||||
case HIT_UPPER_LEFT:
|
||||
cxImage -= cxDelta;
|
||||
|
@ -526,29 +526,30 @@ LRESULT CCanvasWindow::OnMouseMove(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL
|
|||
strSize.Format(_T("%d x %d"), cxImage, cyImage);
|
||||
::SendMessage(g_hStatusBar, SB_SETTEXT, 2, (LPARAM) (LPCTSTR) strSize);
|
||||
|
||||
CRect rc = { 0, 0, cxImage, cyImage };
|
||||
switch (m_whereHit)
|
||||
// Dragging now... Fix the position...
|
||||
CRect rcResizing = { 0, 0, cxImage, cyImage };
|
||||
switch (m_hitCanvasSizeBox)
|
||||
{
|
||||
case HIT_UPPER_LEFT:
|
||||
::OffsetRect(&rc, cxDelta, cyDelta);
|
||||
::OffsetRect(&rcResizing, cxDelta, cyDelta);
|
||||
break;
|
||||
case HIT_UPPER_CENTER:
|
||||
::OffsetRect(&rc, 0, cyDelta);
|
||||
::OffsetRect(&rcResizing, 0, cyDelta);
|
||||
break;
|
||||
case HIT_UPPER_RIGHT:
|
||||
::OffsetRect(&rc, 0, cyDelta);
|
||||
::OffsetRect(&rcResizing, 0, cyDelta);
|
||||
break;
|
||||
case HIT_MIDDLE_LEFT:
|
||||
::OffsetRect(&rc, cxDelta, 0);
|
||||
::OffsetRect(&rcResizing, cxDelta, 0);
|
||||
break;
|
||||
case HIT_LOWER_LEFT:
|
||||
::OffsetRect(&rc, cxDelta, 0);
|
||||
::OffsetRect(&rcResizing, cxDelta, 0);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
ImageToCanvas(rc);
|
||||
m_rcNew = rc;
|
||||
ImageToCanvas(rcResizing);
|
||||
m_rcResizing = rcResizing;
|
||||
Invalidate(TRUE);
|
||||
|
||||
return 0;
|
||||
|
@ -575,14 +576,14 @@ LRESULT CCanvasWindow::OnLRButtonUp(BOOL bLeftButton, UINT nMsg, WPARAM wParam,
|
|||
return 0;
|
||||
}
|
||||
|
||||
if (m_whereHit == HIT_NONE || !bLeftButton)
|
||||
if (m_hitCanvasSizeBox == HIT_NONE || !bLeftButton)
|
||||
return 0;
|
||||
|
||||
// Resize the image
|
||||
INT cxImage = imageModel.GetWidth(), cyImage = imageModel.GetHeight();
|
||||
INT cxDelta = pt.x - m_ptOrig.x;
|
||||
INT cyDelta = pt.y - m_ptOrig.y;
|
||||
switch (m_whereHit)
|
||||
switch (m_hitCanvasSizeBox)
|
||||
{
|
||||
case HIT_UPPER_LEFT:
|
||||
imageModel.Crop(cxImage - cxDelta, cyImage - cyDelta, cxDelta, cyDelta);
|
||||
|
@ -611,11 +612,11 @@ LRESULT CCanvasWindow::OnLRButtonUp(BOOL bLeftButton, UINT nMsg, WPARAM wParam,
|
|||
default:
|
||||
break;
|
||||
}
|
||||
::SetRectEmpty(&m_rcNew);
|
||||
::SetRectEmpty(&m_rcResizing);
|
||||
|
||||
g_imageSaved = FALSE;
|
||||
|
||||
m_whereHit = HIT_NONE;
|
||||
m_hitCanvasSizeBox = HIT_NONE;
|
||||
toolsModel.resetTool(); // resets the point-buffer of the polygon and bezier functions
|
||||
Update(NULL);
|
||||
Invalidate(TRUE);
|
||||
|
@ -647,7 +648,7 @@ LRESULT CCanvasWindow::OnSetCursor(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL
|
|||
return 0;
|
||||
}
|
||||
|
||||
CANVAS_HITTEST hitSelection = SelectionHitTest(pt);
|
||||
HITTEST hitSelection = SelectionHitTest(pt);
|
||||
if (hitSelection != HIT_NONE)
|
||||
{
|
||||
if (!setCursorOnSizeBox(hitSelection))
|
||||
|
@ -696,8 +697,8 @@ LRESULT CCanvasWindow::OnKeyDown(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL&
|
|||
{
|
||||
// Cancel dragging
|
||||
::ReleaseCapture();
|
||||
m_whereHit = HIT_NONE;
|
||||
::SetRectEmpty(&m_rcNew);
|
||||
m_hitCanvasSizeBox = HIT_NONE;
|
||||
::SetRectEmpty(&m_rcResizing);
|
||||
Invalidate(TRUE);
|
||||
}
|
||||
|
||||
|
@ -707,8 +708,8 @@ LRESULT CCanvasWindow::OnKeyDown(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL&
|
|||
LRESULT CCanvasWindow::OnCancelMode(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
|
||||
{
|
||||
// Cancel dragging
|
||||
m_whereHit = HIT_NONE;
|
||||
::SetRectEmpty(&m_rcNew);
|
||||
m_hitCanvasSizeBox = HIT_NONE;
|
||||
::SetRectEmpty(&m_rcResizing);
|
||||
Invalidate(TRUE);
|
||||
return 0;
|
||||
}
|
||||
|
@ -758,7 +759,7 @@ VOID CCanvasWindow::finishDrawing()
|
|||
Invalidate(FALSE);
|
||||
}
|
||||
|
||||
CANVAS_HITTEST CCanvasWindow::SelectionHitTest(POINT ptImage)
|
||||
HITTEST CCanvasWindow::SelectionHitTest(POINT ptImage)
|
||||
{
|
||||
if (!selectionModel.m_bShow)
|
||||
return HIT_NONE;
|
||||
|
@ -771,7 +772,7 @@ CANVAS_HITTEST CCanvasWindow::SelectionHitTest(POINT ptImage)
|
|||
return getSizeBoxHitTest(ptImage, &rcSelection);
|
||||
}
|
||||
|
||||
VOID CCanvasWindow::StartSelectionDrag(CANVAS_HITTEST hit, POINT ptImage)
|
||||
VOID CCanvasWindow::StartSelectionDrag(HITTEST hit, POINT ptImage)
|
||||
{
|
||||
m_hitSelection = hit;
|
||||
selectionModel.m_ptHit = ptImage;
|
||||
|
|
|
@ -52,20 +52,20 @@ public:
|
|||
VOID MoveSelection(INT xDelta, INT yDelta);
|
||||
|
||||
protected:
|
||||
CANVAS_HITTEST m_hitSelection;
|
||||
CANVAS_HITTEST m_whereHit;
|
||||
HITTEST m_hitSelection;
|
||||
HITTEST m_hitCanvasSizeBox;
|
||||
POINT m_ptOrig; // The origin of drag start
|
||||
HBITMAP m_ahbmCached[2]; // The cached buffer bitmaps
|
||||
CRect m_rcNew;
|
||||
CRect m_rcResizing; // Resizing rectagle
|
||||
|
||||
CANVAS_HITTEST CanvasHitTest(POINT pt);
|
||||
HITTEST CanvasHitTest(POINT pt);
|
||||
RECT GetBaseRect();
|
||||
VOID DoDraw(HDC hDC, RECT& rcClient, RECT& rcPaint);
|
||||
VOID OnHVScroll(WPARAM wParam, INT fnBar);
|
||||
VOID drawZoomFrame(INT mouseX, INT mouseY);
|
||||
|
||||
CANVAS_HITTEST SelectionHitTest(POINT ptImage);
|
||||
VOID StartSelectionDrag(CANVAS_HITTEST hit, POINT ptImage);
|
||||
HITTEST SelectionHitTest(POINT ptImage);
|
||||
VOID StartSelectionDrag(HITTEST hit, POINT ptImage);
|
||||
VOID SelectionDragging(POINT ptImage);
|
||||
VOID EndSelectionDrag(POINT ptImage);
|
||||
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
/* this simplifies enabling or graying menu items */
|
||||
#define ENABLED_IF(a) ((a) ? (MF_ENABLED | MF_BYCOMMAND) : (MF_GRAYED | MF_BYCOMMAND))
|
||||
|
||||
enum CANVAS_HITTEST // hit
|
||||
enum HITTEST // hit
|
||||
{
|
||||
HIT_NONE = 0, // Nothing hit or outside
|
||||
HIT_UPPER_LEFT,
|
||||
|
|
|
@ -416,7 +416,7 @@ void SelectionModel::SetRectFromPoints(const POINT& ptFrom, const POINT& ptTo)
|
|||
m_rc.bottom = max(ptFrom.y, ptTo.y);
|
||||
}
|
||||
|
||||
void SelectionModel::Dragging(CANVAS_HITTEST hit, POINT pt)
|
||||
void SelectionModel::Dragging(HITTEST hit, POINT pt)
|
||||
{
|
||||
switch (hit)
|
||||
{
|
||||
|
|
|
@ -55,7 +55,7 @@ public:
|
|||
void StretchSkew(int nStretchPercentX, int nStretchPercentY, int nSkewDegX, int nSkewDegY);
|
||||
void InvertSelection();
|
||||
|
||||
void Dragging(CANVAS_HITTEST hit, POINT pt);
|
||||
void Dragging(HITTEST hit, POINT pt);
|
||||
void ClearMask();
|
||||
void ClearColor();
|
||||
void NotifyContentChanged();
|
||||
|
|
|
@ -17,7 +17,7 @@ static LPCWSTR s_cursor_shapes[] =
|
|||
|
||||
/* FUNCTIONS ********************************************************/
|
||||
|
||||
BOOL setCursorOnSizeBox(CANVAS_HITTEST hit)
|
||||
BOOL setCursorOnSizeBox(HITTEST hit)
|
||||
{
|
||||
if (HIT_UPPER_LEFT <= hit && hit <= HIT_LOWER_RIGHT)
|
||||
{
|
||||
|
@ -27,7 +27,7 @@ BOOL setCursorOnSizeBox(CANVAS_HITTEST hit)
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
BOOL getSizeBoxRect(LPRECT prc, CANVAS_HITTEST hit, LPCRECT prcBase)
|
||||
BOOL getSizeBoxRect(LPRECT prc, HITTEST hit, LPCRECT prcBase)
|
||||
{
|
||||
switch (hit)
|
||||
{
|
||||
|
@ -77,7 +77,7 @@ BOOL getSizeBoxRect(LPRECT prc, CANVAS_HITTEST hit, LPCRECT prcBase)
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
CANVAS_HITTEST getSizeBoxHitTest(POINT pt, LPCRECT prcBase)
|
||||
HITTEST getSizeBoxHitTest(POINT pt, LPCRECT prcBase)
|
||||
{
|
||||
RECT rc;
|
||||
|
||||
|
@ -91,7 +91,7 @@ CANVAS_HITTEST getSizeBoxHitTest(POINT pt, LPCRECT prcBase)
|
|||
|
||||
for (INT i = HIT_UPPER_LEFT; i <= HIT_LOWER_RIGHT; ++i)
|
||||
{
|
||||
CANVAS_HITTEST hit = (CANVAS_HITTEST)i;
|
||||
HITTEST hit = (HITTEST)i;
|
||||
getSizeBoxRect(&rc, hit, prcBase);
|
||||
if (::PtInRect(&rc, pt))
|
||||
return hit;
|
||||
|
@ -123,7 +123,7 @@ VOID drawSizeBoxes(HDC hdc, LPCRECT prcBase, BOOL bDrawFrame, LPCRECT prcPaint)
|
|||
|
||||
for (INT i = HIT_UPPER_LEFT; i <= HIT_LOWER_RIGHT; ++i)
|
||||
{
|
||||
getSizeBoxRect(&rc, (CANVAS_HITTEST)i, prcBase);
|
||||
getSizeBoxRect(&rc, (HITTEST)i, prcBase);
|
||||
if (!prcPaint || ::IntersectRect(&rcIntersect, &rc, prcPaint))
|
||||
::FillRect(hdc, &rc, (HBRUSH)(COLOR_HIGHLIGHT + 1));
|
||||
}
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
BOOL setCursorOnSizeBox(CANVAS_HITTEST hit);
|
||||
BOOL getSizeBoxRect(LPRECT prc, CANVAS_HITTEST hit, LPCRECT prcBase);
|
||||
CANVAS_HITTEST getSizeBoxHitTest(POINT pt, LPCRECT prcBase);
|
||||
BOOL setCursorOnSizeBox(HITTEST hit);
|
||||
BOOL getSizeBoxRect(LPRECT prc, HITTEST hit, LPCRECT prcBase);
|
||||
HITTEST getSizeBoxHitTest(POINT pt, LPCRECT prcBase);
|
||||
VOID drawSizeBoxes(HDC hdc, LPCRECT prcBase, BOOL bDrawFrame = FALSE, LPCRECT prcPaint = NULL);
|
||||
|
|
Loading…
Reference in a new issue