MicroImages::GRTOOL Class Reference

GRTOOL - Base class for graphic tools. More...

#include <mi32/grtool.h>

Inheritance diagram for MicroImages::GRTOOL:

Inheritance graph
[legend]
List of all members.

Public Types

enum  ADJUSTFLAGS { ADJUST_Default = 0x00, ADJUST_Absolute = 0x01, ADJUST_ScreenCoords = 0x02, ADJUST_Notify = 0x80 }
enum  CTRLOPT {
  CTRLOPT_Default = 0x00, CTRLOPT_Manual = 0x01, CTRLOPT_GPS = 0x02, CTRLOPT_SnapGrid = 0x04,
  CTRLOPT_NoManualProj = 0x08
}
enum  MARKER {
  MARKER_X = 0, MARKER_Plus = 1, MARKER_ArrowIn = 2, MARKER_ArrowOut = 3,
  MARKER_None = 4, MARKER_Circle = 5, MARKER_Flat = 6, MARKER_Square = 7
}
enum  MOVESEQ { MOVESEQ_Begin = 1, MOVESEQ_Continue = 2, MOVESEQ_End = 3, MOVESEQ_Cancel = 4 }
enum  MOVETYPE {
  MOVETYPE_None = 0, MOVETYPE_Shift = 1, MOVETYPE_Resize = 2, MOVETYPE_Rotate = 3,
  MOVETYPE_Shear = 4, MOVETYPE_Edit = 5, MOVETYPE_Create = 6, MOVETYPE_Clear = 7
}
enum  PENCOLOR { PENCOLOR_Primary, PENCOLOR_Inactive, PENCOLOR_Highlight, PENCOLOR_COUNT }

Public Member Functions

void Activate ()
void ClearPosition ()
virtual MGUI::CTRLCreateControlForm (MGUI::LAYOUT_PANE_BASE &ParentPane, CTRLOPT ctrlopt)
virtual MGUI::CTRLCreateManualForm (MGUI::LAYOUT_PANE_BASE &ParentPane, CTRLOPT ctrlopt)
void Deactivate ()
virtual int GenerateRegion (REGION2D &region) const
const DPOINT2DGetArrowKeyDeltas () const
CTRLOPT GetControlOptions () const
const TRANS2D_AFFINEGetTransToWindow () const
GRTOOLVIEWGetView () const
const DRECT2DGetViewExtents () const
bool HasControls () const
bool HasManualControls () const
bool HasPosition () const
bool IsActive () const
bool IsResizable () const
bool IsRotatable () const
bool IsSuspended () const
void Move (double dx, double dy, ADJUSTFLAGS flags)
void Resize (double dx, double dy, ADJUSTFLAGS flags)
void Resume ()
void SetArrowKeyDeltas (double dx, double dy)
void SetCanStartNew (bool canstartnew)
void SetControlOptions (CTRLOPT ctrlopt)
void SetResizable (bool resizable)
void SetRotatable (bool rotatable)
void SetTransToWindow (const TRANS2D_AFFINE &trans)
const SNAPGRIDPARMSSnapGridGet () const
bool SnapGridIsActive () const
void SnapGridSet (SNAPGRIDPARMS &parms)
void SnapGridSetActive (bool active)
void Suspend ()
virtual ~GRTOOL ()=0

Static Public Member Functions

DWORD GetPenColor (PENCOLOR pencolor)
void SetPenColor (PENCOLOR pencolor, DWORD ColorRef)

Protected Types

enum  CONTROLNEED { CONTROLNEED_None, CONTROLNEED_Optional, CONTROLNEED_Required }
enum  PENSTYLE { PENSTYLE_Solid, PENSTYLE_Dash, PENSTYLE_COUNT }

Protected Member Functions

virtual void AdjustBegin (MOVETYPE movetype, bool redraw=true)
virtual void AdjustEnd (bool releasecapture=true, bool cancel=false)
void ApplyMoveDeltas (DPOINT2D &point, double dx, double dy, ADJUSTFLAGS flags) const
void ApplySnap (DPOINT2D &point) const
bool CanStartNew () const
int CheckBounds (const DRECT2D &, DRECT2D *) const
virtual void DoDraw (CDC *)=0
virtual void DoMove (double, double, ADJUSTFLAGS)
virtual void DoResize (double, double, ADJUSTFLAGS)
void DrawMarker (CDC *pDC, const POINT &centerpoint, const POINT &dirpoint, MARKER marker, UINT16 size) const
bool GetArrowDeltas (int, double *, double *)
CDC * GetDC ()
MOVETYPE GetMoveType () const
 GRTOOL (GRTOOLVIEW *view, CONTROLNEED ControlNeed, bool HasManualControls)
bool IsMouseCaptured () const
virtual void OnActivate ()
virtual void OnCancel ()
virtual void OnCaptureChanged (CWnd *pWnd)
virtual void OnClear ()
virtual void OnDeactivate ()
virtual bool OnKey (UINT nChar, UINT nRepCnt, UINT nFlags)
virtual void OnLButtonDown (UINT nFlags, const CPoint &mpoint)=0
virtual void OnLButtonUp (UINT nFlags, const CPoint &mpoint)
virtual void OnMouseMove (UINT nFlags, const CPoint &mpoint)=0
virtual void OnMove (MOVESEQ moveseq, MOVETYPE movetype)
virtual void OnRButtonDown (UINT nFlags, const CPoint &mpoint)
virtual void OnRButtonUp (UINT nFlags, const CPoint &mpoint)
virtual void OnResume ()
virtual void OnSetTransToWindow ()
virtual void OnSize ()
void ReleaseDC (CDC *pDC)
void RestoreBackground (const LRECT2D &rect, bool AddLineWidth=true) const
void RestoreBackground () const
void SetHasPosition (bool HasPosition=true)
POINT TransToolToWindow (const DPOINT3D &point) const
POINT TransToolToWindow (const DPOINT2D &point) const
DPOINT2D TransWindowToTool (const POINT &point) const

Static Protected Member Functions

CPen * GetPen (PENCOLOR PenColor=PENCOLOR_Primary, PENSTYLE PenStyle=PENSTYLE_Solid)

Detailed Description

GRTOOL - Base class for graphic tools.

Definition at line 89 of file grtool.h.


Member Enumeration Documentation

enum MicroImages::GRTOOL::ADJUSTFLAGS
 

Adjustment flags for Move() and Resize() methods.

Enumeration values:
ADJUST_Default  Values are relative tool coordinates.
ADJUST_Absolute  Adjustment values are absolute.
ADJUST_ScreenCoords  Adjustment values are in screen pixels.
ADJUST_Notify  Send notification message.

Definition at line 93 of file grtool.h.

enum MicroImages::GRTOOL::CONTROLNEED [protected]
 

Enumeration values:
CONTROLNEED_None 
CONTROLNEED_Optional 
CONTROLNEED_Required 

Definition at line 323 of file grtool.h.

enum MicroImages::GRTOOL::CTRLOPT
 

Enumeration values:
CTRLOPT_Default 
CTRLOPT_Manual  Include "manual" controls if available.
CTRLOPT_GPS  Include "gps" controls if supported.
CTRLOPT_SnapGrid  Include "snap to grid" toggle if supported.
CTRLOPT_NoManualProj  Don't allow manual projection / distance controls.

Definition at line 100 of file grtool.h.

enum MicroImages::GRTOOL::MARKER
 

Marker types, not all types are supported by all tools.

Enumeration values:
MARKER_X 
MARKER_Plus 
MARKER_ArrowIn  Arrow pointing in for line endpoint.
MARKER_ArrowOut  Arrow pointing out for line endpoint.
MARKER_None 
MARKER_Circle 
MARKER_Flat  Flat line endpoint.
MARKER_Square 

Definition at line 127 of file grtool.h.

enum MicroImages::GRTOOL::MOVESEQ
 

Enumeration values:
MOVESEQ_Begin 
MOVESEQ_Continue 
MOVESEQ_End 
MOVESEQ_Cancel 

Definition at line 108 of file grtool.h.

enum MicroImages::GRTOOL::MOVETYPE
 

Enumeration values:
MOVETYPE_None 
MOVETYPE_Shift 
MOVETYPE_Resize 
MOVETYPE_Rotate 
MOVETYPE_Shear 
MOVETYPE_Edit 
MOVETYPE_Create 
MOVETYPE_Clear 

Definition at line 115 of file grtool.h.

enum MicroImages::GRTOOL::PENCOLOR
 

Enumeration values:
PENCOLOR_Primary  Primary tool drawing color.
PENCOLOR_Inactive  Color for inactive elements (eg in POLYLINE tool).
PENCOLOR_Highlight  Color for highlighting.
PENCOLOR_COUNT  Number of pens, always last.

Definition at line 138 of file grtool.h.

enum MicroImages::GRTOOL::PENSTYLE [protected]
 

Enumeration values:
PENSTYLE_Solid 
PENSTYLE_Dash 
PENSTYLE_COUNT 

Definition at line 329 of file grtool.h.


Constructor & Destructor Documentation

virtual MicroImages::GRTOOL::~GRTOOL  )  [pure virtual]
 

Destructor.

MicroImages::GRTOOL::GRTOOL GRTOOLVIEW view,
CONTROLNEED  ControlNeed,
bool  HasManualControls
[explicit, protected]
 

Constructor.

Parameters:
ControlNeed  Need for control dialog or form
HasManualControls  Optional manual controls available


Member Function Documentation

void MicroImages::GRTOOL::Activate  ) 
 

Activate the tool.

If another tool is currently active in the view it will be automatically deactivated.

virtual void MicroImages::GRTOOL::AdjustBegin MOVETYPE  movetype,
bool  redraw = true
[protected, virtual]
 

Utility methods for use by tool implementation.

virtual void MicroImages::GRTOOL::AdjustEnd bool  releasecapture = true,
bool  cancel = false
[protected, virtual]
 

void MicroImages::GRTOOL::ApplyMoveDeltas DPOINT2D point,
double  dx,
double  dy,
ADJUSTFLAGS  flags
const [protected]
 

void MicroImages::GRTOOL::ApplySnap DPOINT2D point  )  const [protected]
 

Snap point to current snap grid, if no snapping enabled point unchanged.

Parameters:
point  Point to adjust

bool MicroImages::GRTOOL::CanStartNew  )  const [inline, protected]
 

Definition at line 436 of file grtool.h.

int MicroImages::GRTOOL::CheckBounds const DRECT2D ,
DRECT2D
const [protected]
 

Check rectangle against tool limits.

void MicroImages::GRTOOL::ClearPosition  ) 
 

Clear current tool position, erasing all graphics.

virtual MGUI::CTRL* MicroImages::GRTOOL::CreateControlForm MGUI::LAYOUT_PANE_BASE ParentPane,
CTRLOPT  ctrlopt
[virtual]
 

Create "form" with tool-specific controls.

Parameters:
ParentPane  Parent pane
ctrlopt  Control options

Reimplemented in MicroImages::GRTOOL_MULTIPOINT, and MicroImages::GRTOOL_POLYLINE.

virtual MGUI::CTRL* MicroImages::GRTOOL::CreateManualForm MGUI::LAYOUT_PANE_BASE ParentPane,
CTRLOPT  ctrlopt
[virtual]
 

Create "form" with tool-specific manual-entry controls.

Parameters:
ParentPane  Parent pane
ctrlopt  Control options

void MicroImages::GRTOOL::Deactivate  ) 
 

Deactivate this tool.

virtual void MicroImages::GRTOOL::DoDraw CDC *   )  [protected, pure virtual]
 

Implemented in MicroImages::GRTOOL_SELECTPOINT, MicroImages::GRTOOL_POINT, MicroImages::GRTOOL_MULTIPOINT, MicroImages::GRTOOL_CROSSHAIR, MicroImages::GRTOOL_SEGMENT, MicroImages::GRTOOL_CIRCLE, MicroImages::GRTOOL_ELLIPSE, MicroImages::GRTOOL_ARC, MicroImages::GRTOOL_RECTANGLE, MicroImages::GRTOOL_REGPOLYGON, MicroImages::GRTOOL_POLYLINE, MicroImages::GRTOOL_REGION, and MicroImages::GRTOOL_TEXT.

virtual void MicroImages::GRTOOL::DoMove double  ,
double  ,
ADJUSTFLAGS 
[protected, virtual]
 

Reimplemented in MicroImages::GRTOOL_SELECTPOINT, MicroImages::GRTOOL_POINT, MicroImages::GRTOOL_MULTIPOINT, MicroImages::GRTOOL_CROSSHAIR, MicroImages::GRTOOL_SEGMENT, MicroImages::GRTOOL_CIRCLE, MicroImages::GRTOOL_ELLIPSE, MicroImages::GRTOOL_ARC, MicroImages::GRTOOL_RECTANGLE, and MicroImages::GRTOOL_REGPOLYGON.

virtual void MicroImages::GRTOOL::DoResize double  ,
double  ,
ADJUSTFLAGS 
[protected, virtual]
 

void MicroImages::GRTOOL::DrawMarker CDC *  pDC,
const POINT &  centerpoint,
const POINT &  dirpoint,
MARKER  marker,
UINT16  size
const [protected]
 

Draw a marker (MARKER...) in the position and size specified.

virtual int MicroImages::GRTOOL::GenerateRegion REGION2D region  )  const [virtual]
 

Generate region from tool.

Returns:
TRUE if region generated, FALSE if not, < 0 if error.

Reimplemented in MicroImages::GRTOOL_CIRCLE, MicroImages::GRTOOL_ELLIPSE, MicroImages::GRTOOL_ARC, MicroImages::GRTOOL_RECTANGLE, MicroImages::GRTOOL_REGPOLYGON, and MicroImages::GRTOOL_POLYLINE.

bool MicroImages::GRTOOL::GetArrowDeltas int  ,
double *  ,
double * 
[protected]
 

const DPOINT2D& MicroImages::GRTOOL::GetArrowKeyDeltas  )  const [inline]
 

Get movement values associated with arrow keys.

Returns:
Values in "tool" coordinates.

Definition at line 202 of file grtool.h.

CTRLOPT MicroImages::GRTOOL::GetControlOptions  )  const [inline]
 

Get current control options settings.

Definition at line 206 of file grtool.h.

CDC* MicroImages::GRTOOL::GetDC  )  [protected]
 

MOVETYPE MicroImages::GRTOOL::GetMoveType  )  const [inline, protected]
 

Definition at line 451 of file grtool.h.

CPen* MicroImages::GRTOOL::GetPen PENCOLOR  PenColor = PENCOLOR_Primary,
PENSTYLE  PenStyle = PENSTYLE_Solid
[static, protected]
 

Get pen for drawing tool.

Returns:
Pointer to CPen so can use directly in CDC::SelectObject().

DWORD MicroImages::GRTOOL::GetPenColor PENCOLOR  pencolor  )  [static]
 

Get global tool pen color reference.

Returns:
Color reference.

const TRANS2D_AFFINE& MicroImages::GRTOOL::GetTransToWindow  )  const [inline]
 

Get transformation between "tool" and "window" coordinates.

Definition at line 210 of file grtool.h.

GRTOOLVIEW* MicroImages::GRTOOL::GetView  )  const [inline]
 

Get "view" associated with tool.

Definition at line 214 of file grtool.h.

const DRECT2D& MicroImages::GRTOOL::GetViewExtents  )  const [inline]
 

Get extents of view.

bool MicroImages::GRTOOL::HasControls  )  const [inline]
 

Determine if tool controls available.

Definition at line 222 of file grtool.h.

bool MicroImages::GRTOOL::HasManualControls  )  const [inline]
 

Determine if has manual data entry controls.

Definition at line 226 of file grtool.h.

bool MicroImages::GRTOOL::HasPosition  )  const [inline]
 

Check if tool has a valid position set.

Definition at line 246 of file grtool.h.

bool MicroImages::GRTOOL::IsActive  )  const [inline]
 

Check if tool is currently "active".

Definition at line 230 of file grtool.h.

bool MicroImages::GRTOOL::IsMouseCaptured  )  const [inline, protected]
 

bool MicroImages::GRTOOL::IsResizable  )  const [inline]
 

Determine if tool is "resizable".

Definition at line 234 of file grtool.h.

bool MicroImages::GRTOOL::IsRotatable  )  const [inline]
 

Determine if tool is "rotatable".

Definition at line 238 of file grtool.h.

bool MicroImages::GRTOOL::IsSuspended  )  const [inline]
 

Check if tool is "suspended".

Definition at line 242 of file grtool.h.

void MicroImages::GRTOOL::Move double  dx,
double  dy,
ADJUSTFLAGS  flags
 

Move the tool by the specified amount.

virtual void MicroImages::GRTOOL::OnActivate  )  [protected, virtual]
 

Called when tool is "activated".

Derived class must call superclass method BEFORE performing own processing.

Reimplemented in MicroImages::GRTOOL_LIMITED.

virtual void MicroImages::GRTOOL::OnCancel  )  [protected, virtual]
 

Called when user performs "Cancel" action with tool.

Derived class must call superclass method BEFORE performing own processing.

virtual void MicroImages::GRTOOL::OnCaptureChanged CWnd *  pWnd  )  [protected, virtual]
 

virtual void MicroImages::GRTOOL::OnClear  )  [protected, virtual]
 

Called when tool is "cleared" by user action, usually on control dialog.

Derived class must call superclass method BEFORE performing own processing.

Reimplemented in MicroImages::GRTOOL_MULTIPOINT, and MicroImages::GRTOOL_POLYLINE.

virtual void MicroImages::GRTOOL::OnDeactivate  )  [protected, virtual]
 

Called when tool is deactivated.

Derived class must call superclass method BEFORE performing own processing.

virtual bool MicroImages::GRTOOL::OnKey UINT  nChar,
UINT  nRepCnt,
UINT  nFlags
[protected, virtual]
 

Called when key pressed/released.

Returns:
'true' if key handled, 'false' if not.

Reimplemented in MicroImages::GRTOOL_MULTIPOINT, MicroImages::GRTOOL_REGPOLYGON, and MicroImages::GRTOOL_POLYLINE.

virtual void MicroImages::GRTOOL::OnLButtonDown UINT  nFlags,
const CPoint &  mpoint
[protected, pure virtual]
 

Implemented in MicroImages::GRTOOL_SELECTPOINT, MicroImages::GRTOOL_POINT, MicroImages::GRTOOL_MULTIPOINT, MicroImages::GRTOOL_CROSSHAIR, MicroImages::GRTOOL_SEGMENT, MicroImages::GRTOOL_CIRCLE, MicroImages::GRTOOL_ELLIPSE, MicroImages::GRTOOL_ARC, MicroImages::GRTOOL_RECTANGLE, MicroImages::GRTOOL_REGPOLYGON, MicroImages::GRTOOL_POLYLINE, MicroImages::GRTOOL_REGION, and MicroImages::GRTOOL_TEXT.

virtual void MicroImages::GRTOOL::OnLButtonUp UINT  nFlags,
const CPoint &  mpoint
[protected, virtual]
 

Reimplemented in MicroImages::GRTOOL_MULTIPOINT, and MicroImages::GRTOOL_POLYLINE.

virtual void MicroImages::GRTOOL::OnMouseMove UINT  nFlags,
const CPoint &  mpoint
[protected, pure virtual]
 

Implemented in MicroImages::GRTOOL_SELECTPOINT, MicroImages::GRTOOL_POINT, MicroImages::GRTOOL_MULTIPOINT, MicroImages::GRTOOL_CROSSHAIR, MicroImages::GRTOOL_SEGMENT, MicroImages::GRTOOL_CIRCLE, MicroImages::GRTOOL_ELLIPSE, MicroImages::GRTOOL_ARC, MicroImages::GRTOOL_RECTANGLE, MicroImages::GRTOOL_REGPOLYGON, MicroImages::GRTOOL_POLYLINE, MicroImages::GRTOOL_REGION, and MicroImages::GRTOOL_TEXT.

virtual void MicroImages::GRTOOL::OnMove MOVESEQ  moveseq,
MOVETYPE  movetype
[protected, virtual]
 

Called when user alters tool position, shape, size, etc.

Derived class must call superclass method BEFORE performing own processing.

Parameters:
moveseq  Movement sequence
movetype  Movement type

virtual void MicroImages::GRTOOL::OnRButtonDown UINT  nFlags,
const CPoint &  mpoint
[protected, virtual]
 

Called when right mouse button pressed.

Usually overridden to show a popup menu. Default implementation does nothing.

virtual void MicroImages::GRTOOL::OnRButtonUp UINT  nFlags,
const CPoint &  mpoint
[protected, virtual]
 

Called when right mouse button released.

Usually overridden to perform an 'apply' action. Default implementation does nothing.

virtual void MicroImages::GRTOOL::OnResume  )  [protected, virtual]
 

Called when tool is "resumed" after being suspended.

Derived class must call superclass method BEFORE performing own processing.

virtual void MicroImages::GRTOOL::OnSetTransToWindow  )  [protected, virtual]
 

Called when tool to window transformation is set.

Derived class must call superclass method BEFORE performing own processing.

Reimplemented in MicroImages::GRTOOL_LIMITED.

virtual void MicroImages::GRTOOL::OnSize  )  [protected, virtual]
 

Reimplemented in MicroImages::GRTOOL_LIMITED.

void MicroImages::GRTOOL::ReleaseDC CDC *  pDC  )  [inline, protected]
 

void MicroImages::GRTOOL::Resize double  dx,
double  dy,
ADJUSTFLAGS  flags
 

Resize the tool.

void MicroImages::GRTOOL::RestoreBackground const LRECT2D rect,
bool  AddLineWidth = true
const [protected]
 

Restore background for specified rectangle.

Parameters:
AddLineWidth  Expand rectangle by 'LineWidth+1'

void MicroImages::GRTOOL::RestoreBackground  )  const [protected]
 

Restore background for entire tool view window.

void MicroImages::GRTOOL::Resume  ) 
 

Resume the tool after performing drawing operation on the view.

void MicroImages::GRTOOL::SetArrowKeyDeltas double  dx,
double  dy
 

Set movement amounts associated with arrow keys.

void MicroImages::GRTOOL::SetCanStartNew bool  canstartnew  )  [inline]
 

Set whether user can start drawing a "new" tool.

Definition at line 274 of file grtool.h.

void MicroImages::GRTOOL::SetControlOptions CTRLOPT  ctrlopt  )  [inline]
 

Set controls to appear on dialog when shown.

If used, this must be called before tool is first activated.

Parameters:
ctrlopt  Control settings

Definition at line 280 of file grtool.h.

void MicroImages::GRTOOL::SetHasPosition bool  HasPosition = true  )  [inline, protected]
 

Definition at line 468 of file grtool.h.

void MicroImages::GRTOOL::SetPenColor PENCOLOR  pencolor,
DWORD  ColorRef
[static]
 

Set global tool pen color.

Parameters:
ColorRef  Color reference

void MicroImages::GRTOOL::SetResizable bool  resizable  )  [inline]
 

Set whether tool is resizable.

Definition at line 285 of file grtool.h.

void MicroImages::GRTOOL::SetRotatable bool  rotatable  )  [inline]
 

Set whether tool is rotatable.

Definition at line 290 of file grtool.h.

void MicroImages::GRTOOL::SetTransToWindow const TRANS2D_AFFINE trans  ) 
 

Set transformation between "tool" and "window" coordinates.

const SNAPGRIDPARMS& MicroImages::GRTOOL::SnapGridGet  )  const [inline]
 

Get snap grid settings.

Definition at line 304 of file grtool.h.

bool MicroImages::GRTOOL::SnapGridIsActive  )  const [inline]
 

Determine if snap grid is currently in use.

Definition at line 300 of file grtool.h.

void MicroImages::GRTOOL::SnapGridSet SNAPGRIDPARMS parms  ) 
 

Set snap grid parameters.

void MicroImages::GRTOOL::SnapGridSetActive bool  active  )  [inline]
 

Set whether to use snap grid or not.

Definition at line 313 of file grtool.h.

void MicroImages::GRTOOL::Suspend  ) 
 

Suspend tool prior to performing a drawing operation on the view.

POINT MicroImages::GRTOOL::TransToolToWindow const DPOINT3D point  )  const [protected]
 

Transform DPOINT3D from "tool" to "window" coordinates.

POINT MicroImages::GRTOOL::TransToolToWindow const DPOINT2D point  )  const [protected]
 

Transform DPOINT2D from "tool" to "window" coordinates.

DPOINT2D MicroImages::GRTOOL::TransWindowToTool const POINT &  point  )  const [inline, protected]
 

Transform point in "window" to "tool" coordinates.

Definition at line 483 of file grtool.h.


The documentation for this class was generated from the following file:
Generated on Tue Dec 14 13:21:03 2004 for TNTsdk by  doxygen 1.3.8-20040913