ReactOS  0.4.15-dev-4857-g47842d7
CSelectionWindow Class Reference

#include <selection.h>

Inheritance diagram for CSelectionWindow:
Collaboration diagram for CSelectionWindow:

Public Member Functions

 CSelectionWindow ()
 
BOOL IsMoved () const
 
void IsMoved (BOOL bMoved)
 
void ForceRefreshSelectionContents ()
 
LRESULT OnPaint (UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
 
LRESULT OnEraseBkgnd (UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
 
LRESULT OnCreate (UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
 
LRESULT OnSysColorChange (UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
 
LRESULT OnSetCursor (UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
 
LRESULT OnLButtonDown (UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
 
LRESULT OnMouseMove (UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
 
LRESULT OnMouseWheel (UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
 
LRESULT OnLButtonUp (UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
 
LRESULT OnPaletteModelColorChanged (UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
 
LRESULT OnToolsModelSettingsChanged (UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
 
LRESULT OnToolsModelZoomChanged (UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
 
LRESULT OnSelectionModelRefreshNeeded (UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
 
LRESULT OnCaptureChanged (UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
 
LRESULT OnKeyDown (UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
 
LRESULT OnMove (UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
 

Private Member Functions

int IdentifyCorner (int iXPos, int iYPos, int iWidth, int iHeight)
 

Private Attributes

BOOL m_bMoved
 
BOOL m_bMoving
 
int m_iAction
 
POINT m_ptPos
 
POINT m_ptFrac
 
POINT m_ptDelta
 
COLORREF m_rgbBack
 

Static Private Attributes

static const LPCTSTR m_lpszCursorLUT [9]
 

Detailed Description

Definition at line 12 of file selection.h.

Constructor & Destructor Documentation

◆ CSelectionWindow()

CSelectionWindow::CSelectionWindow ( )
inline

Definition at line 15 of file selection.h.

15  : m_bMoved(FALSE)
16  {
17  }
#define FALSE
Definition: types.h:117

Member Function Documentation

◆ ForceRefreshSelectionContents()

void CSelectionWindow::ForceRefreshSelectionContents ( )

Definition at line 24 of file selection.cpp.

25 {
27  {
31  }
32 }
ToolsModel toolsModel
Definition: main.cpp:18
COLORREF m_rgbBack
Definition: selection.h:70
SelectionModel selectionModel
Definition: main.cpp:20
COLORREF GetBgColor() const
HDC GetDC()
Definition: history.cpp:239
ImageModel imageModel
Definition: main.cpp:32
PaletteModel paletteModel
Definition: main.cpp:28
void DrawSelection(HDC hDCImage, COLORREF crBg=0, BOOL bBgTransparent=FALSE)
void DrawSelectionBackground(COLORREF rgbBG)
Definition: history.cpp:285
BOOL WINAPI IsWindowVisible(_In_ HWND)
void ResetToPrevious(void)
Definition: history.cpp:100
CSelectionWindow selectionWindow
Definition: main.cpp:71
BOOL IsBackgroundTransparent() const
Definition: toolsmodel.cpp:135

Referenced by CMainWindow::InsertSelectionFromHBITMAP(), FreeSelTool::OnFinishDraw(), RectSelTool::OnFinishDraw(), OnSelectionModelRefreshNeeded(), SelectionModel::RotateNTimes90Degrees(), ToolsModel::SetBackgroundTransparent(), and SelectionModel::StretchSkew().

◆ IdentifyCorner()

int CSelectionWindow::IdentifyCorner ( int  iXPos,
int  iYPos,
int  iWidth,
int  iHeight 
)
private

Definition at line 34 of file selection.cpp.

35 {
36  POINT pt = { iXPos, iYPos };
38  if (hwndChild == sizeboxLeftTop)
40  if (hwndChild == sizeboxCenterTop)
41  return ACTION_RESIZE_TOP;
42  if (hwndChild == sizeboxRightTop)
44  if (hwndChild == sizeboxRightCenter)
45  return ACTION_RESIZE_RIGHT;
46  if (hwndChild == sizeboxLeftCenter)
47  return ACTION_RESIZE_LEFT;
48  if (hwndChild == sizeboxCenterBottom)
49  return ACTION_RESIZE_BOTTOM;
50  if (hwndChild == sizeboxRightBottom)
52  if (hwndChild == sizeboxLeftBottom)
54  return 0;
55 }
#define ACTION_RESIZE_TOP_LEFT
#define pt(x, y)
Definition: drawing.c:79
CSizeboxWindow sizeboxRightCenter
Definition: main.cpp:77
#define ACTION_RESIZE_RIGHT
#define ACTION_RESIZE_BOTTOM_LEFT
CSizeboxWindow sizeboxCenterTop
Definition: main.cpp:74
CSizeboxWindow sizeboxRightTop
Definition: main.cpp:75
CSizeboxWindow sizeboxCenterBottom
Definition: main.cpp:79
#define CWP_SKIPINVISIBLE
Definition: winuser.h:208
#define CWP_SKIPDISABLED
Definition: winuser.h:209
CSizeboxWindow sizeboxRightBottom
Definition: main.cpp:80
#define ACTION_RESIZE_TOP_RIGHT
#define ACTION_RESIZE_TOP
HWND WINAPI ChildWindowFromPointEx(_In_ HWND, _In_ POINT, _In_ UINT)
#define ACTION_RESIZE_LEFT
CSizeboxWindow sizeboxLeftCenter
Definition: main.cpp:76
CSizeboxWindow sizeboxLeftBottom
Definition: main.cpp:78
CSizeboxWindow sizeboxLeftTop
Definition: main.cpp:73
#define ACTION_RESIZE_BOTTOM
#define ACTION_RESIZE_BOTTOM_RIGHT

Referenced by OnMouseMove().

◆ IsMoved() [1/2]

◆ IsMoved() [2/2]

void CSelectionWindow::IsMoved ( BOOL  bMoved)
inline

Definition at line 20 of file selection.h.

20 { m_bMoved = bMoved; }

◆ OnCaptureChanged()

LRESULT CSelectionWindow::OnCaptureChanged ( UINT  nMsg,
WPARAM  wParam,
LPARAM  lParam,
BOOL bHandled 
)

Definition at line 191 of file selection.cpp.

192 {
193  if (m_bMoving)
194  {
195  m_bMoving = FALSE;
196  if (m_iAction == ACTION_MOVE)
197  {
200  else
201  placeSelWin();
202  }
203  else
204  {
206  }
208  }
209  return 0;
210 }
ToolsModel toolsModel
Definition: main.cpp:18
void placeSelWin(void)
Definition: mouse.cpp:20
#define SW_HIDE
Definition: winuser.h:762
BOOL WINAPI ShowWindow(_In_ HWND, _In_ int)
CImgAreaWindow imageArea
Definition: main.cpp:72
#define FALSE
Definition: types.h:117
#define ACTION_MOVE
TOOLTYPE GetActiveTool() const
Definition: toolsmodel.cpp:76
void cancelDrawing()
Definition: imgarea.cpp:238

◆ OnCreate()

LRESULT CSelectionWindow::OnCreate ( UINT  nMsg,
WPARAM  wParam,
LPARAM  lParam,
BOOL bHandled 
)

Definition at line 78 of file selection.cpp.

79 {
80  m_bMoving = FALSE;
82  /* update the system selection color */
83  Invalidate();
84  return 0;
85 }
#define FALSE
Definition: types.h:117
#define ACTION_MOVE

◆ OnEraseBkgnd()

LRESULT CSelectionWindow::OnEraseBkgnd ( UINT  nMsg,
WPARAM  wParam,
LPARAM  lParam,
BOOL bHandled 
)

Definition at line 72 of file selection.cpp.

73 {
74  // do nothing => transparent background
75  return TRUE;
76 }
#define TRUE
Definition: types.h:120

◆ OnKeyDown()

LRESULT CSelectionWindow::OnKeyDown ( UINT  nMsg,
WPARAM  wParam,
LPARAM  lParam,
BOOL bHandled 
)

Definition at line 212 of file selection.cpp.

213 {
214  if (wParam == VK_ESCAPE)
215  {
216  if (GetCapture() == m_hWnd)
217  {
218  ReleaseCapture();
219  }
220  }
221  return 0;
222 }
#define VK_ESCAPE
Definition: winuser.h:2194
WPARAM wParam
Definition: combotst.c:138
HWND WINAPI GetCapture(void)
Definition: message.c:2881
BOOL WINAPI ReleaseCapture(void)
Definition: message.c:2890

◆ OnLButtonDown()

LRESULT CSelectionWindow::OnLButtonDown ( UINT  nMsg,
WPARAM  wParam,
LPARAM  lParam,
BOOL bHandled 
)

Definition at line 100 of file selection.cpp.

101 {
104  m_ptDelta.x = 0;
105  m_ptDelta.y = 0;
106  SetCapture();
107  if (m_iAction != ACTION_MOVE)
109  m_bMoving = TRUE;
110  scrlClientWindow.InvalidateRect(NULL, TRUE);
111  scrlClientWindow.SendMessage(WM_PAINT, 0, 0);
115  return 0;
116 }
long y
Definition: polytest.cpp:48
long x
Definition: polytest.cpp:48
#define TRUE
Definition: types.h:120
COLORREF m_rgbBack
Definition: selection.h:70
#define GET_X_LPARAM(lp)
Definition: windowsx.h:274
COLORREF GetBgColor() const
BOOL InvalidateRect(LPCRECT lpRect, BOOL bErase=TRUE)
Definition: atlwin.h:868
CImgAreaWindow imageArea
Definition: main.cpp:72
#define FALSE
Definition: types.h:117
CScrollboxWindow scrlClientWindow
Definition: main.cpp:70
#define ACTION_MOVE
#define WM_PAINT
Definition: winuser.h:1607
#define LoadCursor
Definition: winuser.h:5792
HWND WINAPI SetCapture(_In_ HWND hWnd)
PaletteModel paletteModel
Definition: main.cpp:28
HCURSOR WINAPI SetCursor(_In_opt_ HCURSOR)
#define NULL
Definition: types.h:112
#define GET_Y_LPARAM(lp)
Definition: windowsx.h:275
static const LPCTSTR m_lpszCursorLUT[9]
Definition: selection.h:63
LRESULT SendMessage(UINT message, WPARAM wParam=0, LPARAM lParam=0)
Definition: atlwin.h:1082
LPARAM lParam
Definition: combotst.c:139

◆ OnLButtonUp()

LRESULT CSelectionWindow::OnLButtonUp ( UINT  nMsg,
WPARAM  wParam,
LPARAM  lParam,
BOOL bHandled 
)

Definition at line 173 of file selection.cpp.

174 {
175  if (m_bMoving)
176  {
177  m_bMoving = FALSE;
178  ReleaseCapture();
180  {
181  imageModel.Undo();
185  }
186  placeSelWin();
187  }
188  return 0;
189 }
ToolsModel toolsModel
Definition: main.cpp:18
void CopyPrevious(void)
Definition: history.cpp:47
void placeSelWin(void)
Definition: mouse.cpp:20
COLORREF m_rgbBack
Definition: selection.h:70
SelectionModel selectionModel
Definition: main.cpp:20
#define FALSE
Definition: types.h:117
#define ACTION_MOVE
TOOLTYPE GetActiveTool() const
Definition: toolsmodel.cpp:76
ImageModel imageModel
Definition: main.cpp:32
void DrawSelectionBackground(COLORREF rgbBG)
Definition: history.cpp:285
BOOL WINAPI ReleaseCapture(void)
Definition: message.c:2890
void Undo(BOOL bClearRedo=FALSE)
Definition: history.cpp:60

◆ OnMouseMove()

LRESULT CSelectionWindow::OnMouseMove ( UINT  nMsg,
WPARAM  wParam,
LPARAM  lParam,
BOOL bHandled 
)

Definition at line 118 of file selection.cpp.

119 {
120  if (m_bMoving)
121  {
128  if (toolsModel.GetZoom() < 1000)
129  {
130  m_ptFrac.x = 0;
131  m_ptFrac.y = 0;
132  }
133  else
134  {
137  }
139 
140  CString strSize;
142  SendMessage(hStatusBar, SB_SETTEXT, 2, (LPARAM) (LPCTSTR) strSize);
143 
144  if (m_iAction != ACTION_MOVE)
146  else
152  }
153  else
154  {
161  if (m_iAction != ACTION_MOVE)
163  }
164  return 0;
165 }
void DrawSelectionStretched(HDC hDCImage)
static int Zoomed(int xy)
Definition: common.h:37
ToolsModel toolsModel
Definition: main.cpp:18
const CHAR * LPCTSTR
Definition: xmlstorage.h:193
GLubyte GLubyte GLubyte GLubyte w
Definition: glext.h:6102
long y
Definition: polytest.cpp:48
long x
Definition: polytest.cpp:48
COLORREF m_rgbBack
Definition: selection.h:70
#define GET_X_LPARAM(lp)
Definition: windowsx.h:274
void __cdecl Format(UINT nFormatID,...)
Definition: cstringt.h:753
SelectionModel selectionModel
Definition: main.cpp:20
LONG GetDestRectWidth() const
COLORREF GetBgColor() const
GLfloat GLfloat GLfloat GLfloat h
Definition: glext.h:7723
BOOL InvalidateRect(LPCRECT lpRect, BOOL bErase=TRUE)
Definition: atlwin.h:868
CImgAreaWindow imageArea
Definition: main.cpp:72
#define FALSE
Definition: types.h:117
HDC GetDC()
Definition: history.cpp:239
LONG_PTR LPARAM
Definition: windef.h:208
void ModifyDestRect(POINT &ptDelta, int iAction)
#define _T(x)
Definition: vfdio.h:22
#define ACTION_MOVE
HWND hStatusBar
Definition: main.cpp:35
int GetZoom() const
Definition: toolsmodel.cpp:148
#define WM_PAINT
Definition: winuser.h:1607
#define GRIP_SIZE
Definition: common.h:13
#define SB_SETTEXT
Definition: commctrl.h:1949
ImageModel imageModel
Definition: main.cpp:32
#define LoadCursor
Definition: winuser.h:5792
LONG GetDestRectHeight() const
PaletteModel paletteModel
Definition: main.cpp:28
HCURSOR WINAPI SetCursor(_In_opt_ HCURSOR)
#define NULL
Definition: types.h:112
void DrawSelection(HDC hDCImage, COLORREF crBg=0, BOOL bBgTransparent=FALSE)
#define GET_Y_LPARAM(lp)
Definition: windowsx.h:275
static const LPCTSTR m_lpszCursorLUT[9]
Definition: selection.h:63
int IdentifyCorner(int iXPos, int iYPos, int iWidth, int iHeight)
Definition: selection.cpp:34
void DrawSelectionBackground(COLORREF rgbBG)
Definition: history.cpp:285
#define SendMessage
Definition: winuser.h:5823
LRESULT SendMessage(UINT message, WPARAM wParam=0, LPARAM lParam=0)
Definition: atlwin.h:1082
void ResetToPrevious(void)
Definition: history.cpp:100
LPARAM lParam
Definition: combotst.c:139
BOOL IsBackgroundTransparent() const
Definition: toolsmodel.cpp:135
static int UnZoomed(int xy)
Definition: common.h:42

◆ OnMouseWheel()

LRESULT CSelectionWindow::OnMouseWheel ( UINT  nMsg,
WPARAM  wParam,
LPARAM  lParam,
BOOL bHandled 
)

Definition at line 240 of file selection.cpp.

241 {
243 }
WPARAM wParam
Definition: combotst.c:138
HWND WINAPI GetParent(_In_ HWND)
#define SendMessage
Definition: winuser.h:5823
LPARAM lParam
Definition: combotst.c:139

◆ OnMove()

LRESULT CSelectionWindow::OnMove ( UINT  nMsg,
WPARAM  wParam,
LPARAM  lParam,
BOOL bHandled 
)

Definition at line 167 of file selection.cpp.

168 {
169  m_bMoved = TRUE;
170  return 0;
171 }
#define TRUE
Definition: types.h:120

◆ OnPaint()

LRESULT CSelectionWindow::OnPaint ( UINT  nMsg,
WPARAM  wParam,
LPARAM  lParam,
BOOL bHandled 
)

Definition at line 57 of file selection.cpp.

58 {
59  PAINTSTRUCT ps;
60  HDC hDC = BeginPaint(&ps);
61  if (!m_bMoving)
62  {
63  SelectionFrame(hDC, 1, 1,
67  }
68  EndPaint(&ps);
69  return 0;
70 }
static int Zoomed(int xy)
Definition: common.h:37
#define COLOR_HIGHLIGHT
Definition: winuser.h:920
static HDC
Definition: imagelist.c:92
SelectionModel selectionModel
Definition: main.cpp:20
LONG GetDestRectWidth() const
BOOL WINAPI EndPaint(_In_ HWND, _In_ const PAINTSTRUCT *)
DWORD WINAPI GetSysColor(_In_ int)
HDC WINAPI BeginPaint(_In_ HWND, _Out_ LPPAINTSTRUCT)
void SelectionFrame(HDC hdc, LONG x1, LONG y1, LONG x2, LONG y2, COLORREF system_selection_color)
Definition: drawing.cpp:249
#define GRIP_SIZE
Definition: common.h:13
LONG GetDestRectHeight() const
static HDC hDC
Definition: 3dtext.c:33

◆ OnPaletteModelColorChanged()

LRESULT CSelectionWindow::OnPaletteModelColorChanged ( UINT  nMsg,
WPARAM  wParam,
LPARAM  lParam,
BOOL bHandled 
)

Definition at line 224 of file selection.cpp.

225 {
226  return 0;
227 }

◆ OnSelectionModelRefreshNeeded()

LRESULT CSelectionWindow::OnSelectionModelRefreshNeeded ( UINT  nMsg,
WPARAM  wParam,
LPARAM  lParam,
BOOL bHandled 
)

Definition at line 234 of file selection.cpp.

235 {
237  return 0;
238 }
void ForceRefreshSelectionContents()
Definition: selection.cpp:24

◆ OnSetCursor()

LRESULT CSelectionWindow::OnSetCursor ( UINT  nMsg,
WPARAM  wParam,
LPARAM  lParam,
BOOL bHandled 
)

Definition at line 94 of file selection.cpp.

95 {
97  return 0;
98 }
#define LoadCursor
Definition: winuser.h:5792
HCURSOR WINAPI SetCursor(_In_opt_ HCURSOR)
#define IDC_SIZEALL
Definition: winuser.h:691
#define NULL
Definition: types.h:112

◆ OnSysColorChange()

LRESULT CSelectionWindow::OnSysColorChange ( UINT  nMsg,
WPARAM  wParam,
LPARAM  lParam,
BOOL bHandled 
)

Definition at line 87 of file selection.cpp.

88 {
89  /* update the system selection color */
90  Invalidate();
91  return 0;
92 }

◆ OnToolsModelSettingsChanged()

LRESULT CSelectionWindow::OnToolsModelSettingsChanged ( UINT  nMsg,
WPARAM  wParam,
LPARAM  lParam,
BOOL bHandled 
)

Definition at line 229 of file selection.cpp.

230 {
231  return 0;
232 }

◆ OnToolsModelZoomChanged()

LRESULT CSelectionWindow::OnToolsModelZoomChanged ( UINT  nMsg,
WPARAM  wParam,
LPARAM  lParam,
BOOL bHandled 
)

Definition at line 245 of file selection.cpp.

246 {
247  placeSelWin();
248  return 0;
249 }
void placeSelWin(void)
Definition: mouse.cpp:20

Member Data Documentation

◆ m_bMoved

BOOL CSelectionWindow::m_bMoved
private

Definition at line 64 of file selection.h.

Referenced by IsMoved(), and OnMove().

◆ m_bMoving

BOOL CSelectionWindow::m_bMoving
private

Definition at line 65 of file selection.h.

Referenced by OnCaptureChanged(), OnCreate(), OnLButtonDown(), OnLButtonUp(), OnMouseMove(), and OnPaint().

◆ m_iAction

int CSelectionWindow::m_iAction
private

Definition at line 66 of file selection.h.

Referenced by OnCaptureChanged(), OnCreate(), OnLButtonDown(), OnLButtonUp(), and OnMouseMove().

◆ m_lpszCursorLUT

const LPCTSTR CSelectionWindow::m_lpszCursorLUT
staticprivate

◆ m_ptDelta

POINT CSelectionWindow::m_ptDelta
private

Definition at line 69 of file selection.h.

Referenced by OnLButtonDown(), and OnMouseMove().

◆ m_ptFrac

POINT CSelectionWindow::m_ptFrac
private

Definition at line 68 of file selection.h.

Referenced by OnMouseMove().

◆ m_ptPos

POINT CSelectionWindow::m_ptPos
private

Definition at line 67 of file selection.h.

Referenced by OnLButtonDown(), and OnMouseMove().

◆ m_rgbBack

COLORREF CSelectionWindow::m_rgbBack
private

Definition at line 70 of file selection.h.

Referenced by ForceRefreshSelectionContents(), OnLButtonDown(), OnLButtonUp(), and OnMouseMove().


The documentation for this class was generated from the following files: