ReactOS 0.4.16-dev-329-g9223134
SelectionBaseTool Struct Reference
Inheritance diagram for SelectionBaseTool:
Collaboration diagram for SelectionBaseTool:

Public Member Functions

BOOL isRectSelect () const
 
void OnDrawOverlayOnImage (HDC hdc) override
 
void OnDrawOverlayOnCanvas (HDC hdc) override
 
void OnButtonDown (BOOL bLeftButton, LONG x, LONG y, BOOL bDoubleClick) override
 
BOOL OnMouseMove (BOOL bLeftButton, LONG &x, LONG &y) override
 
BOOL OnButtonUp (BOOL bLeftButton, LONG &x, LONG &y) override
 
void OnEndDraw (BOOL bCancel) override
 
void OnSpecialTweak (BOOL bMinus) override
 
- Public Member Functions inherited from ToolBase
 ToolBase ()
 
virtual ~ToolBase ()
 
virtual void OnButtonDown (BOOL bLeftButton, LONG x, LONG y, BOOL bDoubleClick)
 
virtual BOOL OnMouseMove (BOOL bLeftButton, LONG &x, LONG &y)
 
virtual BOOL OnButtonUp (BOOL bLeftButton, LONG &x, LONG &y)
 
virtual void OnDrawOverlayOnImage (HDC hdc)
 
virtual void OnDrawOverlayOnCanvas (HDC hdc)
 
virtual void OnSpecialTweak (BOOL bMinus)
 
virtual void OnEndDraw (BOOL bCancel)
 
void beginEvent ()
 
void endEvent ()
 
void reset ()
 

Public Attributes

BOOL m_bLeftButton = FALSE
 
BOOL m_bCtrlKey = FALSE
 
BOOL m_bShiftKey = FALSE
 
BOOL m_bDrawing = FALSE
 
BOOL m_bNoDrawBack = FALSE
 
HITTEST m_hitSelection = HIT_NONE
 
- Public Attributes inherited from ToolBase
HDC m_hdc
 
COLORREF m_fg
 
COLORREF m_bg
 

Additional Inherited Members

- Static Public Member Functions inherited from ToolBase
static ToolBasecreateToolObject (TOOLTYPE type)
 

Detailed Description

Definition at line 373 of file mouse.cpp.

Member Function Documentation

◆ isRectSelect()

BOOL SelectionBaseTool::isRectSelect ( ) const
inline

Definition at line 382 of file mouse.cpp.

383 {
385 }
ToolsModel toolsModel
Definition: toolsmodel.cpp:10
TOOLTYPE GetActiveTool() const
Definition: toolsmodel.cpp:134
@ TOOL_RECTSEL
Definition: toolsmodel.h:13

Referenced by OnButtonDown(), OnButtonUp(), and OnMouseMove().

◆ OnButtonDown()

void SelectionBaseTool::OnButtonDown ( BOOL  bLeftButton,
LONG  x,
LONG  y,
BOOL  bDoubleClick 
)
inlineoverridevirtual

Reimplemented from ToolBase.

Definition at line 404 of file mouse.cpp.

405 {
406 m_bLeftButton = bLeftButton;
411
412 POINT pt = { x, y };
413 if (!m_bLeftButton) // Show context menu on Right-click
414 {
416 canvasWindow.ClientToScreen(&pt);
418 return;
419 }
420
421 POINT ptCanvas = pt;
422 canvasWindow.ImageToCanvas(ptCanvas);
423 HITTEST hit = selectionModel.hitTest(ptCanvas);
424 if (hit != HIT_NONE) // Dragging of selection started?
425 {
426 if (m_bCtrlKey || m_bShiftKey)
427 {
430 }
431 m_hitSelection = hit;
436 return;
437 }
438
441
443 if (isRectSelect())
444 {
446 }
447 else
448 {
449 s_cPoints = 0;
450 pushToPoints(pt.x, pt.y);
451 }
452
454 }
CMainWindow mainWindow
Definition: main.cpp:25
static void pushToPoints(LONG x, LONG y)
Definition: mouse.cpp:143
static POINT g_ptStart
Definition: mouse.cpp:17
static SIZE_T s_cPoints
Definition: mouse.cpp:12
SelectionModel selectionModel
HITTEST
Definition: precomp.h:55
@ HIT_NONE
Definition: precomp.h:56
CCanvasWindow canvasWindow
Definition: canvas.cpp:10
VOID ImageToCanvas(POINT &pt)
Definition: canvas.cpp:40
VOID TrackPopupMenu(POINT ptScreen, INT iSubMenu)
Definition: main.cpp:1316
void PushImageForUndo()
Definition: history.cpp:127
void NotifyImageChanged()
Definition: history.cpp:23
HDC GetDC()
Definition: history.cpp:271
void Clamp(POINT &pt) const
Definition: history.cpp:314
HITTEST hitTest(POINT ptCanvas)
void SetRectFromPoints(const POINT &ptFrom, const POINT &ptTo)
void OnDrawOverlayOnImage(HDC hdc)
Definition: mouse.cpp:1186
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define pt(x, y)
Definition: drawing.c:79
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
ImageModel imageModel
Definition: history.cpp:11
HITTEST m_hitSelection
Definition: mouse.cpp:380
BOOL isRectSelect() const
Definition: mouse.cpp:382
BOOL m_bLeftButton
Definition: mouse.cpp:375
BOOL m_bNoDrawBack
Definition: mouse.cpp:379
#define VK_CONTROL
Definition: winuser.h:2206
#define VK_SHIFT
Definition: winuser.h:2205
SHORT WINAPI GetKeyState(_In_ int)

◆ OnButtonUp()

BOOL SelectionBaseTool::OnButtonUp ( BOOL  bLeftButton,
LONG x,
LONG y 
)
inlineoverridevirtual

Reimplemented from ToolBase.

Definition at line 487 of file mouse.cpp.

488 {
489 POINT pt = { x, y };
491
492 if (!m_bLeftButton)
493 return TRUE;
494
495 if (m_hitSelection != HIT_NONE) // Dragging of selection ended?
496 {
497 if (m_bShiftKey)
499
503 return TRUE;
504 }
505
506 if (isRectSelect() && ::GetKeyState(VK_SHIFT) < 0)
508
510
511 if (isRectSelect())
512 {
515 }
516 else
517 {
518 if (s_cPoints > 2)
519 {
522 }
523 else
524 {
525 s_cPoints = 0;
527 }
528 }
529
532 return TRUE;
533 }
void BuildMaskFromPoints()
Definition: mouse.cpp:84
void regularize(LONG x0, LONG y0, LONG &x1, LONG &y1)
Definition: mouse.cpp:22
BOOL IsRectEmpty() const noexcept
Definition: atltypes.h:351
void Dragging(HITTEST hit, POINT pt)
long y
Definition: polytest.cpp:48
long x
Definition: polytest.cpp:48

◆ OnDrawOverlayOnCanvas()

void SelectionBaseTool::OnDrawOverlayOnCanvas ( HDC  hdc)
inlineoverridevirtual

Reimplemented from ToolBase.

Definition at line 398 of file mouse.cpp.

399 {
402 }
void drawFrameOnCanvas(HDC hCanvasDC)
HDC hdc
Definition: main.c:9

◆ OnDrawOverlayOnImage()

void SelectionBaseTool::OnDrawOverlayOnImage ( HDC  hdc)
inlineoverridevirtual

Reimplemented from ToolBase.

Reimplemented in FreeSelTool, and RectSelTool.

Definition at line 387 of file mouse.cpp.

388 {
390 return;
391
392 if (!m_bNoDrawBack)
394
396 }
COLORREF GetBgColor() const
void DrawBackground(HDC hDCImage, COLORREF crBg)
void DrawSelection(HDC hDCImage, COLORREF crBg, BOOL bBgTransparent, const CRect &rc, HBITMAP hbm)
COLORREF m_rgbBack
BOOL IsLanded() const
BOOL IsBackgroundTransparent() const
Definition: toolsmodel.cpp:249
PaletteModel paletteModel

Referenced by FreeSelTool::OnDrawOverlayOnImage(), and RectSelTool::OnDrawOverlayOnImage().

◆ OnEndDraw()

void SelectionBaseTool::OnEndDraw ( BOOL  bCancel)
inlineoverridevirtual

Reimplemented from ToolBase.

Definition at line 535 of file mouse.cpp.

536 {
537 if (bCancel)
539 else
541
544 ToolBase::OnEndDraw(bCancel);
545 }
virtual void OnEndDraw(BOOL bCancel)
Definition: mouse.cpp:125

◆ OnMouseMove()

BOOL SelectionBaseTool::OnMouseMove ( BOOL  bLeftButton,
LONG x,
LONG y 
)
inlineoverridevirtual

Reimplemented from ToolBase.

Definition at line 456 of file mouse.cpp.

457 {
458 POINT pt = { x, y };
459
460 if (!m_bLeftButton)
461 return TRUE;
462
463 if (m_hitSelection != HIT_NONE) // Now dragging selection?
464 {
465 if (m_bShiftKey)
467
470 return TRUE;
471 }
472
473 if (isRectSelect() && ::GetKeyState(VK_SHIFT) < 0)
475
477
478 if (isRectSelect())
480 else
481 pushToPoints(pt.x, pt.y);
482
484 return TRUE;
485 }

◆ OnSpecialTweak()

void SelectionBaseTool::OnSpecialTweak ( BOOL  bMinus)
inlineoverridevirtual

Reimplemented from ToolBase.

Definition at line 547 of file mouse.cpp.

548 {
550 }
void StretchSelection(BOOL bShrink)

Member Data Documentation

◆ m_bCtrlKey

BOOL SelectionBaseTool::m_bCtrlKey = FALSE

Definition at line 376 of file mouse.cpp.

Referenced by OnButtonDown().

◆ m_bDrawing

◆ m_bLeftButton

BOOL SelectionBaseTool::m_bLeftButton = FALSE

Definition at line 375 of file mouse.cpp.

Referenced by OnButtonDown(), OnButtonUp(), and OnMouseMove().

◆ m_bNoDrawBack

BOOL SelectionBaseTool::m_bNoDrawBack = FALSE

Definition at line 379 of file mouse.cpp.

Referenced by OnButtonDown(), OnButtonUp(), and OnDrawOverlayOnImage().

◆ m_bShiftKey

BOOL SelectionBaseTool::m_bShiftKey = FALSE

Definition at line 377 of file mouse.cpp.

Referenced by OnButtonDown(), OnButtonUp(), and OnMouseMove().

◆ m_hitSelection

HITTEST SelectionBaseTool::m_hitSelection = HIT_NONE

Definition at line 380 of file mouse.cpp.

Referenced by OnButtonDown(), OnButtonUp(), OnEndDraw(), and OnMouseMove().


The documentation for this struct was generated from the following file: