QuickShapeBase Class Reference

The base class for the Quick shape tool family. Not actually a tool itself but the QuickShape, Ellipse and Rectangle tool are derived from it. More...

#include <regshape.h>

Inheritance diagram for QuickShapeBase:

DragTool Tool_v1 EllipseTool QuickShapeTool RectangleTool List of all members.

Public Types

enum  EditModeIDS {
  EDITF_CENTRE, EDITF_MAJOR, EDITF_STELLATION, EDITF_CURVE,
  EDITF_SIZE, EDITF_ROT
}

Public Member Functions

 QuickShapeBase ()
 Default Constructor. Other initialisation is done in QuickShapeBase::Init which is called by the Tool Manager.
 ~QuickShapeBase ()
 Destructor (Virtual). Does nothing.
BOOL Init ()
 Used to finish construction and to check if the Tool was properly constructed.
void SelectChange (BOOL isSelected)
 Starts up and closes down the RegShape tool.
void OnClick (DocCoord, ClickType, ClickModifiers, Spread *)
 To handle a Mouse Click event for the RegShape Tool.
void OnMouseMove (DocCoord PointerPos, Spread *pSpread, ClickModifiers ClickMods)
 To handle a Mouse Move event for the RegShape Tool.
BOOL GetStatusLineText (String_256 *ptext, Spread *pSpread, DocCoord DocPos, ClickModifiers ClickMods)
 Returns the current status line help string.
QuickShapeBaseInfoBarOpGetInfoBar ()
virtual INT32 GetNumSides ()=0
virtual INT32 GetCreationMode ()=0
virtual BOOL GetPolygon ()=0
virtual BOOL GetStellation ()=0
virtual BOOL GetCurved ()=0
virtual void SetNumSides (INT32 NewValue)=0
virtual void SetCreationMode (INT32 NewValue)=0
virtual void SetPolygon (BOOL NewValue)=0
virtual void SetStellation (BOOL NewValue)=0
virtual void SetCurved (BOOL NewValue)=0
virtual BOOL ForcePolygonToGrey ()=0
virtual BOOL ForceEllipseToGrey ()=0
virtual BOOL ForceStellationToGrey ()=0
virtual BOOL ForceCurvatureToGrey ()=0
virtual BOOL ForceNumSidesToGrey ()=0
virtual BOOL IsInterestingShape (NodeRegularShape *pShape)=0
virtual INT32 GetShapesToAffect ()=0
virtual BOOL DoesPolygonExist ()=0
virtual BOOL DoesEllipseExist ()=0
virtual BOOL DoesStellationExist ()=0
virtual BOOL DoesCurvatureExist ()=0
virtual BOOL DoesReformSidesExist ()=0
virtual BOOL DoesNumSidesExist ()=0
virtual INT32 GetCursorID ()=0
virtual INT32 GetShapeID ()=0
virtual INT32 GetShapesID ()=0
virtual BOOL CanReformEdges ()
virtual BOOL IsEllipse ()
virtual BOOL IsRectangle ()

Public Attributes

EditModeIDS EditFieldMode
EditModeIDS EditFieldOptions [MAX_EDIT_FIELD_LENGTH]

Protected Member Functions

void DisplayStatusBarHelp (DocCoord DocPos, Spread *pSpread, ClickModifiers ClickMods)
 Displays status help string for the given position in the status bar.
void GetCurrentStatusLineText (String_256 *ptext, Spread *pSpread, DocCoord DocPos, ClickModifiers ClickMods)
 QuickShapeBase::GetStatusLineText.
ShapeClickEffect DetermineClickEffect (DocCoord PointerPos, Spread *pSpread, NodeRegularShape **ReturnShape=NULL)
 Used when the cursor moves and when single clicking. This routine determines what effect a click will have by looking at the object under the pointer. The last position and result is cached so we can avoid excessive document scans.
void ExpandShapeString (StringBase *pString, INT32 StringID, BOOL Singular)
 Insert the name of the QuickShape the tool is currently creating into position in the string.
BOOL CreateCursors ()
 Creates all the RegShape tool cursors.
void DestroyCursors ()
 Destroys all the RegShape tool cursors.

Protected Attributes

QuickShapeBaseInfoBarOppQuickShapeBaseInfoBarOp
CursorpcNormalCursor
CursorpcBlobCursor
CursorpcEdgeCursor
CursorpcCurrentCursor
INT32 CurrentCursorID
DocCoord OldDeterminePos
SpreadOldDetermineSpread
NodeRegularShapeOldDetermineShape
ShapeClickEffect OldDetermineResult

Private Member Functions

 CC_DECLARE_MEMDUMP (QuickShapeBase)

Detailed Description

The base class for the Quick shape tool family. Not actually a tool itself but the QuickShape, Ellipse and Rectangle tool are derived from it.

Author:
Peter_Arnold (Xara Group Ltd) <camelotdev@xara.com>
Date:
15/11/94

Definition at line 130 of file regshape.h.


Member Enumeration Documentation

enum QuickShapeBase::EditModeIDS
 

Enumerator:
EDITF_CENTRE 
EDITF_MAJOR 
EDITF_STELLATION 
EDITF_CURVE 
EDITF_SIZE 
EDITF_ROT 

Definition at line 150 of file regshape.h.


Constructor & Destructor Documentation

QuickShapeBase::QuickShapeBase  ) 
 

Default Constructor. Other initialisation is done in QuickShapeBase::Init which is called by the Tool Manager.

Author:
Peter_Arnold (Xara Group Ltd) <camelotdev@xara.com>
Date:
15/11/94
See also:
QuickShapeBase::Init

Definition at line 164 of file regshape.cpp.

QuickShapeBase::~QuickShapeBase  ) 
 

Destructor (Virtual). Does nothing.

Author:
Peter_Arnold (Xara Group Ltd) <camelotdev@xara.com>
Date:
15/11/94

Definition at line 184 of file regshape.cpp.

00185 {
00186     // Set the infobar,s pointer to us to NULL as we are expiring
00187     pQuickShapeBaseInfoBarOp->pQuickShapeBase = NULL;
00188 }


Member Function Documentation

virtual BOOL QuickShapeBase::CanReformEdges  )  [inline, virtual]
 

Reimplemented in QuickShapeTool.

Definition at line 182 of file regshape.h.

00182 {return FALSE;};

QuickShapeBase::CC_DECLARE_MEMDUMP QuickShapeBase   )  [private]
 

BOOL QuickShapeBase::CreateCursors  )  [protected]
 

Creates all the RegShape tool cursors.

Author:
Peter_Arnold (Xara Group Ltd) <camelotdev@xara.com>
Date:
15/11/94
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
TRUE if all the RegShape tool cursors have been successfully created
See also:
-

Definition at line 332 of file regshape.cpp.

00333 {
00334     // This tool has just been selected.  Create the cursors.
00335     pcNormalCursor = new Cursor(this, GetCursorID());
00336     pcBlobCursor = new Cursor(this, _R(IDC_MOVEBEZIERCURSOR));
00337     pcEdgeCursor = new Cursor(this, _R(IDC_RESHAPECURSOR));
00338 
00339     if ( pcNormalCursor==NULL || !pcNormalCursor->IsValid() ||
00340          pcEdgeCursor==NULL || !pcEdgeCursor->IsValid() ||
00341          pcBlobCursor==NULL || !pcBlobCursor->IsValid() )
00342     {
00343         DestroyCursors();
00344         return FALSE;
00345     }
00346     else
00347         return TRUE;
00348 }

void QuickShapeBase::DestroyCursors  )  [protected]
 

Destroys all the RegShape tool cursors.

Author:
Peter_Arnold (Xara Group Ltd) <camelotdev@xara.com>
Date:
15/11/94
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
-
See also:
-

Definition at line 366 of file regshape.cpp.

00367 {
00368     if (pcNormalCursor != NULL) delete pcNormalCursor;
00369     if (pcEdgeCursor != NULL) delete pcEdgeCursor;
00370     if (pcBlobCursor != NULL) delete pcBlobCursor;
00371 
00372     pcNormalCursor = NULL;
00373     pcBlobCursor = NULL;
00374     pcEdgeCursor = NULL;
00375 }

ShapeClickEffect QuickShapeBase::DetermineClickEffect DocCoord  PointerPos,
Spread pSpread,
NodeRegularShape **  ReturnShape = NULL
[protected]
 

Used when the cursor moves and when single clicking. This routine determines what effect a click will have by looking at the object under the pointer. The last position and result is cached so we can avoid excessive document scans.

Author:
Peter_Arnold (Xara Group Ltd) <camelotdev@xara.com>
Date:
12/12/94
Parameters:
PointerPos is the mouse position [INPUTS] pSpread is a pointer to the spread containing the mouse position
ReturnShape returns a pointer to the shape the mouse would click on (NULL is [OUTPUTS] returned if there is no excited shape)
Returns:
The effect of clicking.

Errors: ERROR2 if there is no current DocView

See also:
ShapeClickEffect

Definition at line 723 of file regshape.cpp.

00724 {
00725 //  // See if we can supply the result from the cache.
00726 //  if ((OldDeterminePos == PointerPos) && (OldDetermineSpread == pSpread) && IsInterestingShape(OldDetermineShape))
00727 //  {
00728 //      *ReturnShape = OldDetermineShape;
00729 //      return OldDetermineResult;
00730 //  }
00731 
00732     OldDeterminePos = PointerPos;
00733     OldDetermineSpread = pSpread;
00734     ShapeClickEffect WhatToDo = SHAPECLICK_NONE;
00735 
00736     // Scan through the selected shapes, and see if any of them want the click
00737     DocRect BlobRect;
00738     DocView* pDocView = DocView::GetCurrent();
00739     ERROR2IF( pDocView==NULL, WhatToDo, "QuickShapeBase::DetermineClickEffect: Can't find current DocView");
00740 
00741     // Find the selected range of objects
00742     SelRange* Selected = GetApplication()->FindSelection();
00743     Node* pNode = Selected->FindFirst();
00744 
00745     while (pNode != NULL)
00746     {
00747         if (IS_A(pNode, NodeRegularShape) && IsInterestingShape((NodeRegularShape*)pNode))
00748         {
00749             NodeRegularShape* CurrentHit = (NodeRegularShape*) pNode;
00750             INT32 ClickPointNumber;
00751             WhatToDo = CurrentHit->DetermineClickEffect(&PointerPos, pSpread, &ClickPointNumber);
00752 
00753             // Ignore edge reforming if the tool shouldn't do it
00754             if ( ( (WhatToDo == SHAPECLICK_EDGE1) || (WhatToDo == SHAPECLICK_EDGE2) ) && !CanReformEdges())
00755                 WhatToDo = SHAPECLICK_NONE; 
00756 
00757             if (WhatToDo != SHAPECLICK_NONE)
00758             {
00759                 if (ReturnShape != NULL)
00760                     *ReturnShape = CurrentHit;
00761                 OldDetermineShape = CurrentHit;
00762                 return (OldDetermineResult = WhatToDo);
00763             }
00764         }
00765 
00766         // Now find the next selected node
00767         pNode = Selected->FindNext(pNode);
00768     }
00769 
00770     // Didn't find anything
00771     if (ReturnShape != NULL)
00772         *ReturnShape = NULL;
00773     OldDetermineShape = NULL;
00774     return (OldDetermineResult = SHAPECLICK_NONE);
00775 }

void QuickShapeBase::DisplayStatusBarHelp DocCoord  DocPos,
Spread pSpread,
ClickModifiers  ClickMods
[protected]
 

Displays status help string for the given position in the status bar.

Author:
Peter_Arnold (Xara Group Ltd) <camelotdev@xara.com>
Date:
15/11/94
Parameters:
Point,Spread and click modifiers [INPUTS]
- [OUTPUTS]
Returns:
-
See also:
QuickShapeBase::GetCurrentStatusLineText

Definition at line 553 of file regshape.cpp.

00554 {
00555     String_256 StatusMsg("");
00556 
00557     GetCurrentStatusLineText(&StatusMsg, pSpread, DocPos, ClickMods);
00558     GetApplication()->UpdateStatusBarText(&StatusMsg);                           
00559 }

virtual BOOL QuickShapeBase::DoesCurvatureExist  )  [pure virtual]
 

Implemented in EllipseTool, RectangleTool, and QuickShapeTool.

virtual BOOL QuickShapeBase::DoesEllipseExist  )  [pure virtual]
 

Implemented in EllipseTool, RectangleTool, and QuickShapeTool.

virtual BOOL QuickShapeBase::DoesNumSidesExist  )  [pure virtual]
 

Implemented in EllipseTool, RectangleTool, and QuickShapeTool.

virtual BOOL QuickShapeBase::DoesPolygonExist  )  [pure virtual]
 

Implemented in EllipseTool, RectangleTool, and QuickShapeTool.

virtual BOOL QuickShapeBase::DoesReformSidesExist  )  [pure virtual]
 

Implemented in EllipseTool, RectangleTool, and QuickShapeTool.

virtual BOOL QuickShapeBase::DoesStellationExist  )  [pure virtual]
 

Implemented in EllipseTool, RectangleTool, and QuickShapeTool.

void QuickShapeBase::ExpandShapeString StringBase pString,
INT32  StringID,
BOOL  Singular
[protected]
 

Insert the name of the QuickShape the tool is currently creating into position in the string.

Author:
Peter_Arnold (Xara Group Ltd) <camelotdev@xara.com>
Date:
29/03/95
Parameters:
pString - points to the string to store the expanded result in [INPUTS] Singular - TRUE/FALSE for singular/plural StringID - the resource ID of the string to expand
pString will be expanded to hold the name of the QuickShape being edited [OUTPUTS]
Returns:
-

Errors: -

See also:
-

Definition at line 691 of file regshape.cpp.

00692 {
00693     String_32 Name;
00694     if (Singular)
00695         Name.Load(GetShapeID());
00696     else
00697         Name.Load(GetShapesID());
00698 
00699     pString->MakeMsg(StringID, (TCHAR*)Name);
00700 }

virtual BOOL QuickShapeBase::ForceCurvatureToGrey  )  [pure virtual]
 

Implemented in EllipseTool, RectangleTool, and QuickShapeTool.

virtual BOOL QuickShapeBase::ForceEllipseToGrey  )  [pure virtual]
 

Implemented in EllipseTool, RectangleTool, and QuickShapeTool.

virtual BOOL QuickShapeBase::ForceNumSidesToGrey  )  [pure virtual]
 

Implemented in EllipseTool, RectangleTool, and QuickShapeTool.

virtual BOOL QuickShapeBase::ForcePolygonToGrey  )  [pure virtual]
 

Implemented in EllipseTool, RectangleTool, and QuickShapeTool.

virtual BOOL QuickShapeBase::ForceStellationToGrey  )  [pure virtual]
 

Implemented in EllipseTool, RectangleTool, and QuickShapeTool.

virtual INT32 QuickShapeBase::GetCreationMode  )  [pure virtual]
 

Implemented in EllipseTool, RectangleTool, and QuickShapeTool.

void QuickShapeBase::GetCurrentStatusLineText String_256 ptext,
Spread pSpread,
DocCoord  DocPos,
ClickModifiers  ClickMods
[protected]
 

QuickShapeBase::GetStatusLineText.

Author:
Peter_Arnold (Xara Group Ltd) <camelotdev@xara.com>
Date:
12/12/94
Parameters:
pSpread points to a spread [INPUTS] DocPos points to a point in a document ClickMods are the current click modifiers
Updates the string in ptext [OUTPUTS]
Returns:
-

Definition at line 600 of file regshape.cpp.

00601 {
00602     NodeRegularShape* pShape;
00603     switch (DetermineClickEffect(DocPos, pSpread, &pShape))
00604     {
00605         case SHAPECLICK_NONE:
00606             ExpandShapeString(ptext, _R(IDS_REGSHAPETOOL_CREATENEW), TRUE);
00607             break;
00608         case SHAPECLICK_RECTANGLE:
00609         case SHAPECLICK_PRIMARY:
00610         {
00611             String_32 shape;
00612             if (pShape->IsPrimaryCurvature() || pShape->IsStellationCurvature())
00613                 shape.Load(_R(IDS_REGSHAPETOOL_RCURVE));
00614             else            
00615                 shape.Load(_R(IDS_REGSHAPETOOL_ACURVE));
00616             ptext->MakeMsg(_R(IDS_REGSHAPETOOL_DRAGPVERTEX), (TCHAR*)shape);
00617             break;
00618         }
00619         case SHAPECLICK_ELLIPSE:
00620         {
00621             ptext->Load(_R(IDS_REGSHAPETOOL_DRAGELLIPSE));
00622             break;
00623         }
00624         case SHAPECLICK_STELLATION:
00625         {
00626             String_32 shape;
00627             if (pShape->IsPrimaryCurvature() || pShape->IsStellationCurvature())
00628                 shape.Load(_R(IDS_REGSHAPETOOL_RCURVE));
00629             else            
00630                 shape.Load(_R(IDS_REGSHAPETOOL_ACURVE));
00631             ptext->MakeMsg(_R(IDS_REGSHAPETOOL_DRAGSVERTEX), (TCHAR*)shape);
00632             break;
00633         }
00634         case SHAPECLICK_PRIMARYCURVE:
00635         case SHAPECLICK_STELLATIONCURVE:
00636             ptext->Load(_R(IDS_REGSHAPETOOL_DRAGCURVE));
00637             break;
00638         case SHAPECLICK_CENTRE:
00639         {
00640             String_32 shape;
00641             if (pShape->IsCircular())
00642                 shape.Load(_R(IDS_REGSHAPETOOL_SPOLYGON));
00643             else            
00644                 shape.Load(_R(IDS_REGSHAPETOOL_SELLIPSE));
00645             ptext->MakeMsg(_R(IDS_REGSHAPETOOL_DRAGCENTRE), (TCHAR*)shape);
00646             break;
00647         }
00648         case SHAPECLICK_EDGE1:
00649         case SHAPECLICK_EDGE2:
00650         {
00651             String_32 extra;
00652             INT32 ID;
00653 
00654             if (pShape->IsCircular())
00655                 ID = _R(IDS_REGSHAPETOOL_DRAGEDGE1);
00656             else            
00657                 ID = _R(IDS_REGSHAPETOOL_DRAGEDGE2);
00658 
00659             if (pShape->IsStellated())
00660                 extra.Load(_R(IDS_REGSHAPETOOL_RSTELL));
00661             else            
00662                 extra.Load(_R(IDS_REGSHAPETOOL_SSTELL));
00663 
00664             ptext->MakeMsg(ID, (TCHAR*)extra);
00665             break;
00666         }
00667         default:
00668             break;
00669     }
00670 }

virtual INT32 QuickShapeBase::GetCursorID  )  [pure virtual]
 

Implemented in EllipseTool, RectangleTool, and QuickShapeTool.

virtual BOOL QuickShapeBase::GetCurved  )  [pure virtual]
 

Implemented in EllipseTool, RectangleTool, and QuickShapeTool.

QuickShapeBaseInfoBarOp* QuickShapeBase::GetInfoBar  )  [inline]
 

Definition at line 148 of file regshape.h.

00148 { return pQuickShapeBaseInfoBarOp; }

virtual INT32 QuickShapeBase::GetNumSides  )  [pure virtual]
 

Implemented in EllipseTool, RectangleTool, and QuickShapeTool.

virtual BOOL QuickShapeBase::GetPolygon  )  [pure virtual]
 

Implemented in EllipseTool, RectangleTool, and QuickShapeTool.

virtual INT32 QuickShapeBase::GetShapeID  )  [pure virtual]
 

Implemented in EllipseTool, RectangleTool, and QuickShapeTool.

virtual INT32 QuickShapeBase::GetShapesID  )  [pure virtual]
 

Implemented in EllipseTool, RectangleTool, and QuickShapeTool.

virtual INT32 QuickShapeBase::GetShapesToAffect  )  [pure virtual]
 

Implemented in EllipseTool, RectangleTool, and QuickShapeTool.

BOOL QuickShapeBase::GetStatusLineText String_256 ptext,
Spread pSpread,
DocCoord  DocPos,
ClickModifiers  ClickMods
[virtual]
 

Returns the current status line help string.

Author:
Peter_Arnold (Xara Group Ltd) <camelotdev@xara.com>
Date:
12/12/94
Parameters:
pSpread points to a spread [INPUTS] DocPos points to a point in a document ClickMods are the current click modifiers
Updates the string in ptext [OUTPUTS]
Returns:
TRUE
See also:
QuickShapeBase::GetCurrentStatusLineText

Reimplemented from Tool_v1.

Definition at line 578 of file regshape.cpp.

00579 {
00580     GetCurrentStatusLineText(ptext, pSpread, DocPos, ClickMods);
00581     return TRUE;
00582 }

virtual BOOL QuickShapeBase::GetStellation  )  [pure virtual]
 

Implemented in EllipseTool, RectangleTool, and QuickShapeTool.

BOOL QuickShapeBase::Init void   )  [virtual]
 

Used to finish construction and to check if the Tool was properly constructed.

Author:
Peter_Arnold (Xara Group Ltd) <camelotdev@xara.com>
Date:
15/11/94
Returns:
FALSE if it does not want to be created, TRUE otherwise

Errors: ERROR2's if the resource file or the bar could not be found/opened/read

See also:
QuickShapeBase::QuickShapeBase

Reimplemented from Tool_v1.

Reimplemented in EllipseTool, RectangleTool, and QuickShapeTool.

Definition at line 205 of file regshape.cpp.

00206 {
00207     // Declare all your ops here and only succeed if all declarations succeed
00208 
00209     BOOL ok = OpNewRegShape::Declare();
00210 
00211     // This section reads in the infobar definition and creates an instance of
00212     // QuickShapeBaseInfoBarOp.  Also pQuickShapeBaseInfoBarOp, the ptr to the tool's infobar, is set up
00213     // after the infobar is successfully read and created.
00214     if (ok)
00215     {
00216         pQuickShapeBaseInfoBarOp = new QuickShapeBaseInfoBarOp(this, _R(IDD_REGSHAPETOOLBAR));
00217         ok=(pQuickShapeBaseInfoBarOp!=NULL);
00218 PORTNOTE("dialog", "Removed Bar reading")
00219 #if 0
00220         CCResTextFile           file;               // Resource File
00221         QuickShapeBaseInfoBarOpCreate BarCreate;            // Object that creates QuickShapeBaseInfoBarOp objects
00222 
00223                 ok = file.open(_R(IDM_REGSHAPE_BAR), _R(IDT_INFO_BAR_RES)); // Open resource
00224         if (ok) ok = DialogBarOp::ReadBarsFromFile(file,BarCreate); // Read and create info bar
00225         if (ok) file.close();                                       // Close resource
00226 
00227         ERROR2IF(!ok,FALSE,"Unable to load RegShBar.ini from resource"); 
00228 
00229         // Info bar now exists.  Now get a pointer to it
00230         String_32 str(_R(IDS_REGSHAPE_INFOBARNAME));
00231         DialogBarOp* pDialogBarOp = DialogBarOp::FindDialogBarOp(str);
00232         
00233         ERROR2IF(pDialogBarOp==NULL, FALSE, "infobar not found\n");
00234 
00235         ok = pDialogBarOp->IsKindOf(CC_RUNTIME_CLASS(QuickShapeBaseInfoBarOp));
00236         if (ok)
00237         {
00238             pQuickShapeBaseInfoBarOp = (QuickShapeBaseInfoBarOp*)pDialogBarOp;
00239             pQuickShapeBaseInfoBarOp->pQuickShapeBase = this;
00240         }
00241 #endif
00242         ERROR2IF(!ok,FALSE,"Error finding the RegShape tool info bar");
00243 
00244     }
00245 
00246     return (ok);
00247 }

virtual BOOL QuickShapeBase::IsEllipse  )  [inline, virtual]
 

Reimplemented in EllipseTool.

Definition at line 184 of file regshape.h.

00184 {return FALSE;};

virtual BOOL QuickShapeBase::IsInterestingShape NodeRegularShape pShape  )  [pure virtual]
 

Implemented in EllipseTool, RectangleTool, and QuickShapeTool.

virtual BOOL QuickShapeBase::IsRectangle  )  [inline, virtual]
 

Reimplemented in RectangleTool.

Definition at line 185 of file regshape.h.

00185 {return FALSE;};

void QuickShapeBase::OnClick DocCoord  PointerPos,
ClickType  Click,
ClickModifiers  ClickMods,
Spread pSpread
[virtual]
 

To handle a Mouse Click event for the RegShape Tool.

Author:
Peter_Arnold (Xara Group Ltd) <camelotdev@xara.com>
Date:
15/11/94
Parameters:
PointerPos - The DocCoord of the point where the mouse button was clicked [INPUTS] Click - Describes the type of click that was detected. ClickMods - Indicates which buttons caused the click and which modifers were pressed at the same time pSpread - The spread in which the click happened
Returns:
-
See also:
Tool::MouseClick; ClickType; ClickModifiers

Reimplemented from DragTool.

Definition at line 396 of file regshape.cpp.

00398 {
00399     if (ClickMods.Menu) return;                         // Don't do anything if the user clicked the Menu button
00400 
00401     NodeRegularShape* HitShape = NULL;
00402     ShapeClickEffect TestEffect = DetermineClickEffect(PointerPos, pSpread, &HitShape);
00403 
00404     // Get the infobar into the right mode so immediate drags are shown
00405     EditModeIDS NewMode;
00406     switch (TestEffect)
00407     {
00408         case SHAPECLICK_CENTRE:
00409             NewMode = EDITF_CENTRE;
00410             break;
00411         case SHAPECLICK_PRIMARY:
00412             NewMode = EDITF_MAJOR;
00413             break;
00414         case SHAPECLICK_ELLIPSE:
00415         case SHAPECLICK_RECTANGLE:
00416             NewMode = EDITF_SIZE;
00417             break;
00418         case SHAPECLICK_STELLATION:
00419             NewMode = EDITF_STELLATION;
00420             break;
00421         case SHAPECLICK_PRIMARYCURVE:
00422         case SHAPECLICK_STELLATIONCURVE:
00423             NewMode = EDITF_CURVE;
00424             break;
00425         default:
00426             NewMode = EditFieldMode;
00427     }
00428     if (NewMode != EditFieldMode)
00429     {
00430         EditFieldMode = NewMode;
00431         GetInfoBar()->BuildEditMenu(TRUE);
00432     }
00433 
00434     // If we have found a shape then pass the click onto the shape for it to deal with
00435     if (HitShape != NULL)
00436     {
00437         if (DoesPolygonExist())
00438             HitShape->OnToolClick(PointerPos, Click, ClickMods, pSpread);
00439         else
00440             HitShape->OnClick(PointerPos, Click, ClickMods, pSpread);
00441     }
00442     else
00443     {
00444         // call the base class ....
00445         
00446         DragTool::OnClick (PointerPos, Click, ClickMods, pSpread);
00447     }
00448 
00449     // Alternativly, Deal with creating new shapes
00450     if ( (HitShape == NULL) && (Click == CLICKTYPE_DRAG) )
00451     {
00452         // Just what we wanted - Someone is dragging the mouse about
00453         // We need to make an operation to perform the drag with
00454         OpNewRegShape* pOpNewRegShape = new OpNewRegShape;
00455         if (pOpNewRegShape == NULL)
00456         {
00457             // Inform the person doing the clicking that life is not looking so good
00458             InformError();
00459         }
00460         else
00461         {
00462             // Put the edit field into size mode
00463             EditModeIDS NewMode = EDITF_MAJOR;
00464             if (IsEllipse() || IsRectangle())
00465                 NewMode = EDITF_SIZE;
00466             if (NewMode != EditFieldMode)
00467             {
00468                 EditFieldMode = NewMode;
00469                 GetInfoBar()->BuildEditMenu(TRUE);
00470             }
00471 
00472             // Start the drag operation and pass in the Anchor
00473             INT32 NumberOfSides = GetNumSides();
00474             OpNewRegShape::CreateMode CreateMode = (OpNewRegShape::CreateMode)GetCreationMode();
00475             BOOL PolyGone = !GetPolygon();
00476             BOOL Stellation = GetStellation();
00477             BOOL Curvature = GetCurved();
00478             // Possibly use the current infobar settings
00479             if (AttributeManager::LastAttrAppliedBecomesCurrent && !IsEllipse())
00480             {
00481                 if (!IsRectangle())
00482                 {
00483                     NumberOfSides = pQuickShapeBaseInfoBarOp->GetNumSides(FALSE);
00484                     if (NumberOfSides < 3)
00485                         NumberOfSides = GetNumSides();
00486                     PolyGone = !pQuickShapeBaseInfoBarOp->IsPolygonCreate();
00487                     Stellation = pQuickShapeBaseInfoBarOp->IsStellationCreate();
00488                 }
00489                 Curvature = pQuickShapeBaseInfoBarOp->IsCurvedCreate();
00490             }
00491 
00492             pOpNewRegShape->DoDrag( pSpread, PointerPos, NumberOfSides, CreateMode, PolyGone, Stellation, Curvature); 
00493             DialogBarOp::SetSystemStateChanged();
00494         }
00495     }
00496 }

void QuickShapeBase::OnMouseMove DocCoord  PointerPos,
Spread pSpread,
ClickModifiers  ClickMods
[virtual]
 

To handle a Mouse Move event for the RegShape Tool.

Author:
Peter_Arnold (Xara Group Ltd) <camelotdev@xara.com>
Date:
15/11/94
Parameters:
PointerPos - The DocCoord of the point where the mouse has moved to [INPUTS] pSpread - The spread in which the move occurred ClickMods - The state of the various modifiers at the time of the mouse move
Returns:
TRUE if it handled the Click, FALSE otherwise
See also:
Tool::MouseClick; ClickType; ClickModifiers

Reimplemented from Tool_v1.

Definition at line 514 of file regshape.cpp.

00515 {
00516     // If we're over a blob then show the move blob cursor
00517     NodeRegularShape* HitShape;
00518     ShapeClickEffect TestEffect = DetermineClickEffect(PointerPos, pSpread, &HitShape);
00519 
00520     Cursor* DisplayCur = pcNormalCursor;
00521     if (TestEffect != SHAPECLICK_NONE)
00522         DisplayCur = pcBlobCursor;
00523 
00524     if ( ((TestEffect == SHAPECLICK_EDGE1) || (TestEffect == SHAPECLICK_EDGE2)) && !HitShape->IsCircular())
00525         DisplayCur = pcEdgeCursor;
00526 
00527     if ( (DisplayCur != pcCurrentCursor) && (DisplayCur != NULL) )
00528     {
00529         pcCurrentCursor = DisplayCur;
00530         CursorStack::GSetTop(pcCurrentCursor, CurrentCursorID);
00531     }
00532 
00533     // Display status line help text for the current position
00534     DisplayStatusBarHelp(PointerPos, pSpread, ClickMods);
00535 }

void QuickShapeBase::SelectChange BOOL  isSelected  )  [virtual]
 

Starts up and closes down the RegShape tool.

Author:
Peter_Arnold (Xara Group Ltd) <camelotdev@xara.com>
Date:
15/11/94
Parameters:
isSelected - TRUE = tool has been selected [INPUTS]
  • FALSE = tool has been deselected
- [OUTPUTS]
Returns:
-
See also:
-

Reimplemented from Tool_v1.

Definition at line 266 of file regshape.cpp.

00267 {
00268     if (isSelected)
00269     {
00270         if (!CreateCursors()) return;
00271         CurrentCursorID = CursorStack::GPush(pcNormalCursor, FALSE);        // Push cursor but don't display now
00272         pcCurrentCursor = pcNormalCursor;
00273 
00274         // Create and display the tool's info bar
00275         pQuickShapeBaseInfoBarOp->Create();
00276         pQuickShapeBaseInfoBarOp->SetCreationMode(GetCreationMode());
00277         pQuickShapeBaseInfoBarOp->SetHelp();
00278         
00279         // Say which blobs to display
00280         BlobManager* BlobMgr = GetApplication()->GetBlobManager();
00281         if (BlobMgr != NULL)
00282         {
00283             // Decide which blobs we will display
00284             BlobStyle MyBlobs;
00285             MyBlobs.Object = TRUE;
00286 
00287             // Tell the blob manager
00288             BlobMgr->ToolInterest(MyBlobs);
00289         }
00290     }
00291     else
00292     {
00293         // Deselection - destroy the tool's cursors, if they exist.
00294         if (pcCurrentCursor != NULL)
00295         {
00296             CursorStack::GPop(CurrentCursorID);
00297             CurrentCursorID = 0;
00298             pcCurrentCursor = NULL;
00299         }
00300         DestroyCursors();
00301 
00302         // Remove the info bar from view by deleting the actual underlying window
00303         pQuickShapeBaseInfoBarOp->Delete();
00304     }
00305 
00306         // ensure any tool object blobs are removed.
00307         BlobManager* BlobMgr = GetApplication()->GetBlobManager();
00308         if (BlobMgr != NULL)
00309         {
00310             BlobStyle bsRemoves;
00311             bsRemoves.ToolObject = TRUE;
00312             BlobMgr->RemoveInterest(bsRemoves);
00313         }
00314 }

virtual void QuickShapeBase::SetCreationMode INT32  NewValue  )  [pure virtual]
 

Implemented in EllipseTool, RectangleTool, and QuickShapeTool.

virtual void QuickShapeBase::SetCurved BOOL  NewValue  )  [pure virtual]
 

Implemented in EllipseTool, RectangleTool, and QuickShapeTool.

virtual void QuickShapeBase::SetNumSides INT32  NewValue  )  [pure virtual]
 

Implemented in EllipseTool, RectangleTool, and QuickShapeTool.

virtual void QuickShapeBase::SetPolygon BOOL  NewValue  )  [pure virtual]
 

Implemented in EllipseTool, RectangleTool, and QuickShapeTool.

virtual void QuickShapeBase::SetStellation BOOL  NewValue  )  [pure virtual]
 

Implemented in EllipseTool, RectangleTool, and QuickShapeTool.


Member Data Documentation

INT32 QuickShapeBase::CurrentCursorID [protected]
 

Definition at line 202 of file regshape.h.

EditModeIDS QuickShapeBase::EditFieldMode
 

Definition at line 151 of file regshape.h.

EditModeIDS QuickShapeBase::EditFieldOptions[MAX_EDIT_FIELD_LENGTH]
 

Definition at line 152 of file regshape.h.

DocCoord QuickShapeBase::OldDeterminePos [protected]
 

Definition at line 205 of file regshape.h.

ShapeClickEffect QuickShapeBase::OldDetermineResult [protected]
 

Definition at line 208 of file regshape.h.

NodeRegularShape* QuickShapeBase::OldDetermineShape [protected]
 

Definition at line 207 of file regshape.h.

Spread* QuickShapeBase::OldDetermineSpread [protected]
 

Definition at line 206 of file regshape.h.

Cursor* QuickShapeBase::pcBlobCursor [protected]
 

Definition at line 199 of file regshape.h.

Cursor* QuickShapeBase::pcCurrentCursor [protected]
 

Definition at line 201 of file regshape.h.

Cursor* QuickShapeBase::pcEdgeCursor [protected]
 

Definition at line 200 of file regshape.h.

Cursor* QuickShapeBase::pcNormalCursor [protected]
 

Definition at line 198 of file regshape.h.

QuickShapeBaseInfoBarOp* QuickShapeBase::pQuickShapeBaseInfoBarOp [protected]
 

Definition at line 193 of file regshape.h.


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