DragTool Class Reference

The Drag tool is a base class for the Selector and Slice tools. It acts to give these tools a common heritage, so that TransOperation, which handles dragging of objects, can maintain a pointer to them and inform them of various events during a drag. At some point in the future (ie maybe never, but we can hope...) it may be useful to pull common drag functionality up from these two tools, into a base implementation in this class. More...

#include <dragtool.h>

Inheritance diagram for DragTool:

Tool_v1 BlendTool ContourTool FreeHandTool GradFillTool LiveEffectsTool MouldTool QuickShapeBase SelectorTool SliceTool TranspTool List of all members.

Public Member Functions

virtual void DragMove (TransformBoundingData *pBoundingData)
 Placeholder for base-class implementations. Does nothing here.
virtual void OnClick (DocCoord PointerPos, ClickType cType, ClickModifiers cMods, Spread *pSpread)
 Call this function (for derived classes) when you don't want to process the message yourself (or you don't want to handle it). This function locates the selector tool - and allows it to handle the message.

Static Public Member Functions

static BOOL BeyondFixedRange (double fpFixedVal)
 Checks for under/overflow in fixed-point calculations.

Private Member Functions

 CC_DECLARE_MEMDUMP (DragTool)

Static Private Attributes

static TCHARFamilyName = _T("Drag Tools")
static TCHARToolName = _T("Drag Tool")
static TCHARPurpose = _T("The parent tool of Selector and Slice tools")
static TCHARAuthor = _T("Karim MacDonald")

Detailed Description

The Drag tool is a base class for the Selector and Slice tools. It acts to give these tools a common heritage, so that TransOperation, which handles dragging of objects, can maintain a pointer to them and inform them of various events during a drag. At some point in the future (ie maybe never, but we can hope...) it may be useful to pull common drag functionality up from these two tools, into a base implementation in this class.

Author:
Karim_MacDonald (Xara Group Ltd) <camelotdev@xara.com>
Date:
13/10/1999
Currently, all the function definitions in this class are purely to allow TransOperation's pSelTool data member to be changed from a SelectorTool* to a DragTool*. Default implementation in this class is simply to do nothing.

CGS:

The DragTool is also the base class for all tools which require selection ability. A single interface is provided for this pupose: OnClick (). OnClick () actually serves as a wrapper for our selection tool - thereby allowing all derived tools to harness the power of our selection tool.

Definition at line 131 of file dragtool.h.


Member Function Documentation

BOOL DragTool::BeyondFixedRange double  fpFixedVal  )  [static]
 

Checks for under/overflow in fixed-point calculations.

Author:
Karim_MacDonald (Xara Group Ltd) <camelotdev@xara.com> from JustinF's SelectorTool::BeyondFixedRange code.
Date:
14/10/1999
Parameters:
fpFixedVal the double that is to be converted to fixed-point [INPUTS]
Returns:
TRUE if the number is beyond the range that fixed-piont numbers can represent, FALSE if its OK to convert.
This function hails from SelectorTool::BeyondFixedRange. The reason it is here is that it needs to be called from a pointer to a DragTool, without going through everyone elses code and re-casting their pointer to SelectorTool*. Because it is a small function, it is implemented here, as well as in SelectorTool.

Reimplemented in SelectorTool.

Definition at line 156 of file dragtool.cpp.

00157 {
00158     const double fpMinFixPt = 1.0 / (INT32(SHRT_MAX) + 1);      // 1/32768
00159     const double fpMaxFixPt = SHRT_MAX;                         // 32767
00160     double fp = fabs(fpFixedVal);
00161     return fp < fpMinFixPt || fp > fpMaxFixPt;
00162 }

DragTool::CC_DECLARE_MEMDUMP DragTool   )  [private]
 

void DragTool::DragMove TransformBoundingData pBoundingData  )  [virtual]
 

Placeholder for base-class implementations. Does nothing here.

Author:
Karim_MacDonald (Xara Group Ltd) <camelotdev@xara.com>
Date:
14/10/1999

Reimplemented in SelectorTool.

Definition at line 130 of file dragtool.cpp.

00131 {
00132     // empty.
00133 }

void DragTool::OnClick DocCoord  PointerPos,
ClickType  cType,
ClickModifiers  cMods,
Spread pSpread
[virtual]
 

Call this function (for derived classes) when you don't want to process the message yourself (or you don't want to handle it). This function locates the selector tool - and allows it to handle the message.

Author:
Chris_Snook (Xara Group Ltd) <camelotdev@xara.com>
Date:
17/7/2000
Parameters:
standard things [INPUTS]
Returns:
-

Reimplemented from Tool_v1.

Reimplemented in BlendTool, ContourTool, GradFillTool, TranspTool, FreeHandTool, LiveEffectsTool, MouldTool, QuickShapeBase, SelectorTool, and SliceTool.

Definition at line 178 of file dragtool.cpp.

00179 {
00180     if ((cType == CLICKTYPE_SINGLE) || (cType == CLICKTYPE_UP))
00181     {   
00182         ToolListItem* pSelectorItem = Tool::Find(TOOLID_SELECTOR);
00183         ERROR3IF(pSelectorItem == NULL, "ARGH! No Selector when we got a click!");
00184         ERROR3IF(pSelectorItem->m_pTool == NULL, "ARGH! No Selector when we got a click!");
00185         Tool* pSelector = pSelectorItem->m_pTool;
00186 
00187         if (pSelector)
00188         {   
00189             SelectorTool::AllowGuidelineScan (FALSE);
00190             pSelector->OnClick(PointerPos, cType, cMods, pSpread);
00191             SelectorTool::AllowGuidelineScan (TRUE);
00192         }
00193     }
00194 }


Member Data Documentation

TCHAR * DragTool::Author = _T("Karim MacDonald") [static, private]
 

Reimplemented in BlendTool, ContourTool, EllipseTool, GradFillTool, TranspTool, FreeHandTool, LiveEffectsTool, MouldTool, RectangleTool, QuickShapeTool, SelectorTool, and SliceTool.

Definition at line 156 of file dragtool.h.

TCHAR * DragTool::FamilyName = _T("Drag Tools") [static, private]
 

Reimplemented in BlendTool, ContourTool, EllipseTool, GradFillTool, TranspTool, FreeHandTool, LiveEffectsTool, MouldTool, RectangleTool, QuickShapeTool, SelectorTool, and SliceTool.

Definition at line 153 of file dragtool.h.

TCHAR * DragTool::Purpose = _T("The parent tool of Selector and Slice tools") [static, private]
 

Reimplemented in BlendTool, ContourTool, EllipseTool, GradFillTool, TranspTool, FreeHandTool, LiveEffectsTool, MouldTool, RectangleTool, QuickShapeTool, SelectorTool, and SliceTool.

Definition at line 155 of file dragtool.h.

TCHAR * DragTool::ToolName = _T("Drag Tool") [static, private]
 

Reimplemented in BlendTool, ContourTool, EllipseTool, GradFillTool, TranspTool, FreeHandTool, LiveEffectsTool, MouldTool, RectangleTool, QuickShapeTool, SelectorTool, and SliceTool.

Definition at line 154 of file dragtool.h.


The documentation for this class was generated from the following files:
Generated on Sat Nov 10 03:53:53 2007 for Camelot by  doxygen 1.4.4