2015-07-09 09:48:01 +00:00
|
|
|
/*
|
|
|
|
* PROJECT: PAINT for ReactOS
|
|
|
|
* LICENSE: LGPL
|
2015-09-09 13:13:35 +00:00
|
|
|
* FILE: base/applications/mspaint/selectionmodel.h
|
2015-07-09 09:48:01 +00:00
|
|
|
* PURPOSE: Keep track of selection parameters, notify listeners
|
|
|
|
* PROGRAMMERS: Benedikt Freisen
|
2019-12-25 06:46:29 +00:00
|
|
|
* Katayama Hirofumi MZ
|
2015-07-09 09:48:01 +00:00
|
|
|
*/
|
|
|
|
|
2017-12-09 12:36:45 +00:00
|
|
|
#pragma once
|
|
|
|
|
2015-07-09 09:48:01 +00:00
|
|
|
/* DEFINES **********************************************************/
|
|
|
|
|
|
|
|
#define ACTION_MOVE 0
|
|
|
|
#define ACTION_RESIZE_TOP_LEFT 1
|
|
|
|
#define ACTION_RESIZE_TOP 2
|
|
|
|
#define ACTION_RESIZE_TOP_RIGHT 3
|
|
|
|
#define ACTION_RESIZE_LEFT 4
|
|
|
|
#define ACTION_RESIZE_RIGHT 5
|
|
|
|
#define ACTION_RESIZE_BOTTOM_LEFT 6
|
|
|
|
#define ACTION_RESIZE_BOTTOM 7
|
|
|
|
#define ACTION_RESIZE_BOTTOM_RIGHT 8
|
|
|
|
|
|
|
|
/* CLASSES **********************************************************/
|
|
|
|
|
|
|
|
class SelectionModel
|
|
|
|
{
|
|
|
|
private:
|
|
|
|
HDC m_hDC;
|
|
|
|
RECT m_rcSrc;
|
|
|
|
RECT m_rcDest;
|
|
|
|
HBITMAP m_hBm;
|
|
|
|
HBITMAP m_hMask;
|
|
|
|
POINT *m_ptStack;
|
|
|
|
int m_iPtSP;
|
|
|
|
|
|
|
|
// void NotifySelectionChanging();
|
|
|
|
// void NotifySelectionChanged();
|
2015-07-09 18:48:42 +00:00
|
|
|
void NotifyRefreshNeeded();
|
2015-07-09 09:48:01 +00:00
|
|
|
|
|
|
|
public:
|
|
|
|
SelectionModel();
|
2019-12-25 06:46:29 +00:00
|
|
|
~SelectionModel();
|
2015-07-09 09:48:01 +00:00
|
|
|
void ResetPtStack();
|
|
|
|
void PushToPtStack(LONG x, LONG y);
|
|
|
|
void CalculateBoundingBoxAndContents(HDC hDCImage);
|
|
|
|
void CalculateContents(HDC hDCImage);
|
|
|
|
void DrawBackgroundPoly(HDC hDCImage, COLORREF crBg);
|
|
|
|
void DrawBackgroundRect(HDC hDCImage, COLORREF crBg);
|
|
|
|
void DrawSelection(HDC hDCImage, COLORREF crBg = 0, BOOL bBgTransparent = FALSE);
|
|
|
|
void DrawSelectionStretched(HDC hDCImage);
|
|
|
|
void ScaleContentsToFit();
|
|
|
|
void InsertFromHBITMAP(HBITMAP hBm);
|
|
|
|
void FlipHorizontally();
|
|
|
|
void FlipVertically();
|
|
|
|
void RotateNTimes90Degrees(int iN);
|
|
|
|
HBITMAP GetBitmap();
|
|
|
|
int PtStackSize();
|
|
|
|
void DrawFramePoly(HDC hDCImage);
|
2019-12-24 04:08:35 +00:00
|
|
|
void SetSrcAndDestRectFromPoints(const POINT& ptFrom, const POINT& ptTo);
|
2015-07-09 09:48:01 +00:00
|
|
|
void SetSrcRectSizeToZero();
|
|
|
|
BOOL IsSrcRectSizeNonzero();
|
|
|
|
void ModifyDestRect(POINT& ptDelta, int iAction);
|
|
|
|
LONG GetDestRectWidth();
|
|
|
|
LONG GetDestRectHeight();
|
|
|
|
LONG GetDestRectLeft();
|
|
|
|
LONG GetDestRectTop();
|
|
|
|
void DrawTextToolText(HDC hDCImage, COLORREF crFg, COLORREF crBg, BOOL bBgTransparent = FALSE);
|
2019-12-25 06:46:29 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
SelectionModel(const SelectionModel&);
|
|
|
|
SelectionModel& operator=(const SelectionModel&);
|
2015-07-09 09:48:01 +00:00
|
|
|
};
|