SliceTool Class Reference

SliceTool is actually a misnomer. This tool is used for creating rollover buttons and bars for web pages. More...

#include <slicetool.h>

Inheritance diagram for SliceTool:

DragTool Tool_v1 List of all members.

Public Member Functions

 SliceTool ()
 Default Constructor. Other initialisation is done in SliceTool::Init which is called by the Tool Manager.
virtual ~SliceTool ()
 Destructor (Virtual). Does nothing.
virtual BOOL Init ()
 Used to check if the Tool was properly constructed.
virtual void Describe (void *InfoPtr)
 Allows the tool manager to extract information about the tool.
virtual UINT32 GetID ()
void ViewChanged (const DocViewMsg &msg)
 The SliceTool's view-changed message handler. This method is called directly from the message handler of SliceInfoBarOp, which lives further down in this file. Its sole purpose is to let us redraw our blobs correctly.
virtual void RenderToolBlobs (Spread *pSpread, DocRect *pClipRect)
 Render the SliceTool's tool blob. This consists of a bounding rect identical to that used when dragging the selection (dotted, red line), around whatever is currently selected.
virtual BOOL AreToolBlobsRenderedOnSelection ()
virtual void SelectChange (BOOL isSelected)
 Starts up and closes down the Slice tool.
virtual void OnClick (DocCoord, ClickType, ClickModifiers, Spread *)
 To handle a Mouse Click event for the Slice Tool.
virtual BOOL OnKeyPress (KeyPress *pKey)
 key-press event handler. Catch CTRL/ALT/SHIFT modifiers and change the status-line/cursor appropriately.
virtual void OnMouseMove (DocCoord PointerPos, Spread *pSpread, ClickModifiers ClickMods)
 To handle a Mouse Move event for the Slice Tool.
virtual BOOL GetStatusLineText (String_256 *ptext, Spread *pSpread, DocCoord DocPos, ClickModifiers ClickMods)
 Figure out what the status text for the SliceTool is at the given position on the given spread with the given click modifiers.
virtual void SelectionHasChanged ()
 A public function, for other people to call whenever they need to let the Slice tool know that the selection has changed.

Static Public Member Functions

static SliceInfoBarOpGetSliceInfoBarOp ()
static BOOL IsCurrentTool ()

Protected Types

enum  ClickActionCode {
  CLICKACTION_NONE, CLICKACTION_SELNONE, CLICKACTION_SELNODE, CLICKACTION_SELUNDER,
  CLICKACTION_SELUNDERCYCLE, CLICKACTION_SELUNDERFAIL, CLICKACTION_SELUNDERFAIL2, CLICKACTION_SELINSIDE,
  CLICKACTION_SELINSIDECYCLE, CLICKACTION_SELINSIDEFAIL, CLICKACTION_SELINSIDEFAIL2, CLICKACTION_SELLEAF
}
enum  SetSelectionState { NoSetsSelected, HalfSetsSelected, FullSetsSelected }

Protected Member Functions

virtual BOOL UpdateSelectionInfo ()
 Updates the slice tool's record of the spread and bounding rectangle of the current selection.
virtual BOOL PreProcessClick ()
 Allows a click to be handled before going through the main click-handling code. This function checks for a clicked Node, and allows it to respond to the click.
virtual BOOL ProcessObjectClick ()
 In the selector tool, this function OnClick()'s each object in the tool's range if the Selector tool is using Object blobs. We don't, so we won't.
virtual void PostProcessClick ()
 Provided a click wasn't eaten by a pre- or mid- processor, we deal with it here. This passes the event on to specific handler routines, depending on its type (TypeOfClick):.
virtual NodeRenderableInkFindPreProcessClickNode (Spread *pSpread, DocCoord ClickPos, BOOL Interruptible=FALSE)
virtual void HandleSingleClick ()
 Single mouse-click event handler.
virtual void HandleDoubleClick ()
 Double mouse-click event handler. Currently, passes the event to HandleSingleClick().
virtual void HandleDragClick ()
 Mouse-drag event handler.
virtual void HandleButtonUp ()
 Mouse button-up event handler.
virtual void HandleTabKey (BOOL bIsShifted)
 Tab keypress event handler.
virtual void SetKeyDownCursor (ClickModifiers cmMods)
 Decodes the bit-field fKeyStates, indicating which combination of modifier keys are down, and sets the cursor appropriately.
virtual void FigureUserFeedback (Spread *pSpread, DocCoord dcPos, ClickModifiers cmods, BOOL DoSlowTests, String_256 *pStr, Cursor **ppPointerShape)
BOOL Append (String_256 *pStr, UINT32 StringID)
 

BOOL Append (String_256 *pStr, String_256 String)
 

BOOL Append (String_256 *pStr, ClickModifiers cmods, UINT32 SelectID, UINT32 AddID, UINT32 RemoveID, NodeRenderableInk *pActionNode=NULL)
 

BOOL Append (String_256 *pStr, ClickModifiers cmods, String_256 SelectTemplate, String_256 AddTemplate, String_256 RemoveTemplate, NodeRenderableInk *pActionNode=NULL)
 

BOOL IsTranslateShortcut (ClickModifiers cmods) const
 Detects whether the current mouse click modifiers denote the translate drag operation shortcut.
BOOL IsClickModified (ClickModifiers cmods) const
 Tests whether any of the modifiers, eg. Constrain, Adjust etc, apply to the current mouse click (as received by the OnClick function).
BOOL IsSelectUnderClick (ClickModifiers cmods) const
 Decides whether the current click is modified to be an "under" click or not.
BOOL IsSelectMemberClick (ClickModifiers cmods) const
 Reports whether the current mouse click meant the user wanted to "select- inside" or not.
BOOL IsSelectLeafClick (ClickModifiers cmods) const
 Reports whether the current mouse click meant the user wanted to "select- leaf" or not.
void DoTranslate ()
 Runs a translation tranformation drag on the selection.
void DoDragBox ()
 Runs a selector-tool drag-box operation.
void MakeSelectionValidForDrag ()
 Runs through the selected nodes, making sure they are all happy with being dragged. Checks are:- 1. Sub-Selected text characters are deselected, and their parent story (and all other nodes sharing its name) are selected instead.
NodeRenderableInkFindFrom (NodeRenderableInk *pSimpleNode) const
 Front-end short-hand for NodeRenderableInk::FindCompoundFromSimple.
ClickActionCode DetermineClickAction (NodeRenderableInk **ppActionNode, NodeRenderableInk *pLastClickNode, NodeRenderableInk *pClickSimpleNode, NodeRenderableInk *pClickCompoundNode, Spread *pStartSpread, DocCoord ClickStart, ClickModifiers ClickMods)
 Determine what action needs to be taken in response to a click.
ClickActionCode CycleClickAction (NodeRenderableInk **ppActionNode, NodeRenderableInk *pClickCompoundNode, ClickActionCode foundAction, ClickActionCode cycleAction)
 Determine what action needs to be taken in response to a click.
BOOL ValidateLastClickUnder (NodeRenderableInk *pLastClickNode, Spread *pStartSpread, DocCoord ClickStart)
 Validate that the last click node is still under the pointer Note! This routine can be slow depending on how deep it has to look in the tree for the last selected object.
BOOL ValidateLastClickInside (NodeRenderableInk *pLastClickNode, NodeRenderableInk *pClickSimpleNode)
 Validate that the simple node is inside the last clicked node.
virtual BOOL DragFinished (DragEndType det)
 Called by TransOperation when a drag is finished. Allows the SliceTool to reset its cursors and update its current selection information.

Static Protected Member Functions

static void SetStatusText (UINT32 nStringID)
 Sets the status bar text to the given string. Alternative to loading the string yourself and calling the other SetStatusText function.
static void SetStatusText (String_256 *pStr)
 Sets the status bar text to the given string.

Protected Attributes

CursorpcNormalSliceCursor
CursorpcAdjustCursor
CursorpcUnderCursor
CursorpcInsideCursor
CursorpcUnderAdjustCursor
CursorpcInsideAdjustCursor
CursorpcLeafCursor
CursorpcLeafAdjustCursor
CursorpcALLCursor
CursorpcHorzGuideCursor
CursorpcVertGuideCursor
DocCoord ClickStart
SpreadStartSpread
ClickModifiers ClickMods
ClickType TypeOfClick
SpreadSelectionSpread
SelRangeSelectRange
DocRect SelectionRect
BOOL m_bSliceToolSetSel
DocRect m_drBlobRect
NodeRenderableInkpClickSimpleNode
NodeRenderableInkpClickCompoundNode
NodeRenderableInkpLastClickNode
NodeRenderableInkpPreProcClickNode
enum SetSelectionState m_SetSelectionState
TransformBoundingData BoundingData

Private Member Functions

 CC_DECLARE_MEMDUMP (SliceTool)
void DisplayStatusBarHelp (DocCoord DocPos, Spread *pSpread, ClickModifiers ClickMods)
 Displays status help string for the given position in the status bar.
void GetCurrentStatusText (String_256 *ptext, Spread *pSpread, DocCoord DocPos, ClickModifiers ClickMods)
 Selects a suitable string for the status line based on the current location (as input via the parameters).
BOOL CreateCursors ()
 Creates all the Slice tool cursors.
void DestroyCursors ()
 Destroys all the Slice tool cursors.

Private Attributes

CursorpcCurrentCursor
INT32 CurrentCursorID
BOOL m_fIgnoreSelChange

Static Private Attributes

static BOOL CurrentTool = FALSE
static SliceInfoBarOppSliceInfoBarOp = NULL
static char * FamilyName = "Slice Tools"
static char * ToolName = "Slice Tool"
static char * Purpose = "Slice manipulation"
static char * Author = "Simon K"

Friends

class OpSliceDragBox
class OpSliceTranslate

Detailed Description

SliceTool is actually a misnomer. This tool is used for creating rollover buttons and bars for web pages.

Author:
Karim_MacDonald (Xara Group Ltd) <camelotdev@xara.com> / Simon Knight
Date:
September 1999

Definition at line 132 of file slicetool.h.


Member Enumeration Documentation

enum SliceTool::ClickActionCode [protected]
 

Enumerator:
CLICKACTION_NONE 
CLICKACTION_SELNONE 
CLICKACTION_SELNODE 
CLICKACTION_SELUNDER 
CLICKACTION_SELUNDERCYCLE 
CLICKACTION_SELUNDERFAIL 
CLICKACTION_SELUNDERFAIL2 
CLICKACTION_SELINSIDE 
CLICKACTION_SELINSIDECYCLE 
CLICKACTION_SELINSIDEFAIL 
CLICKACTION_SELINSIDEFAIL2 
CLICKACTION_SELLEAF 

Definition at line 291 of file slicetool.h.

enum SliceTool::SetSelectionState [protected]
 

Enumerator:
NoSetsSelected 
HalfSetsSelected 
FullSetsSelected 

Definition at line 307 of file slicetool.h.

00308     {
00309         NoSetsSelected,
00310         HalfSetsSelected,
00311         FullSetsSelected
00312     };


Constructor & Destructor Documentation

SliceTool::SliceTool  ) 
 

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

Author:
Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
Date:
3/10/94
See also:
SliceTool::Init

Definition at line 202 of file slicetool.cpp.

00203 {
00204     // initialise all our member pointers to NULL.
00205 
00206     pcNormalSliceCursor     = NULL;
00207     pcAdjustCursor          = NULL;
00208     pcUnderCursor           = NULL;
00209     pcInsideCursor          = NULL;
00210     pcUnderAdjustCursor     = NULL;
00211     pcInsideAdjustCursor    = NULL;
00212     pcLeafCursor            = NULL;
00213     pcLeafAdjustCursor      = NULL;
00214 
00215     pcCurrentCursor     = NULL;
00216     pcALLCursor         = NULL;
00217     pcHorzGuideCursor   = NULL;
00218     pcVertGuideCursor   = NULL;
00219 
00220     StartSpread     = NULL;
00221     SelectionSpread = NULL;
00222     SelectRange     = NULL;
00223 
00224     pClickSimpleNode    = NULL;
00225     pClickCompoundNode  = NULL;
00226     pLastClickNode      = NULL;
00227     pPreProcClickNode   = NULL;
00228 }

SliceTool::~SliceTool  )  [virtual]
 

Destructor (Virtual). Does nothing.

Author:
Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
Date:
3/10/94

Definition at line 240 of file slicetool.cpp.

00241 {
00242 }


Member Function Documentation

BOOL SliceTool::Append String_256 pStr,
ClickModifiers  cmods,
String_256  SelectTemplate,
String_256  AddTemplate,
String_256  RemoveTemplate,
NodeRenderableInk pActionNode = NULL
[protected]
 

Author:
Phil_Martin (Xara Group Ltd) <camelotdev@xara.com>
Date:
01/06/95
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
-

Errors: -

Definition at line 2404 of file slicetool.cpp.

02410 {
02411     ERROR2IF(SelectTemplate.IsEmpty(), FALSE, "Asked to Append an empty message");
02412 
02413     // Append a message to the string, preceding it with a separator if there was something
02414     // already in the string...
02415     if (!pStr->IsEmpty())
02416         *pStr += String_256(_R(IDS_SLICE_SEPARATOR));
02417 
02418     String_256 Message;
02419     String_256* pTemplate;
02420     Message.Empty();
02421 
02422     if (!cmods.Adjust || pActionNode==NULL)
02423         pTemplate = &SelectTemplate;
02424     else
02425     {
02426         if (!pActionNode->IsSelected())
02427             pTemplate = &AddTemplate;
02428         else
02429             pTemplate = &RemoveTemplate;
02430     }
02431 
02432     if (pTemplate->IsEmpty())
02433         pTemplate = &SelectTemplate;
02434 
02435     if (pActionNode==NULL)
02436         *pStr += *pTemplate;
02437     else
02438     {
02439         Message._MakeMsg( (TCHAR*) *pTemplate, &pActionNode->Describe(FALSE) );
02440         *pStr += Message;
02441     }
02442 
02443     return TRUE;
02444 }

BOOL SliceTool::Append String_256 pStr,
ClickModifiers  cmods,
UINT32  SelectID,
UINT32  AddID,
UINT32  RemoveID,
NodeRenderableInk pActionNode = NULL
[protected]
 

Author:
Phil_Martin (Xara Group Ltd) <camelotdev@xara.com>
Date:
31/5/95
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
-

Errors: -

Definition at line 2286 of file slicetool.cpp.

02291 {
02292     ERROR2IF(SelectID==0, FALSE, "Asked to append a string resource with a null ID");
02293 
02294     // Append a message to the string, preceding it with a separator if there was something
02295     // already in the string...
02296     if (!pStr->IsEmpty())
02297         *pStr += String_256(_R(IDS_SLICE_SEPARATOR));
02298 
02299     String_256 Message;
02300     UINT32 TemplateID = 0;
02301     Message.Empty();
02302 
02303     if (!cmods.Adjust || pActionNode==NULL)
02304         TemplateID = SelectID;
02305     else
02306     {
02307         if (!pActionNode->IsSelected())
02308             TemplateID = AddID;
02309         else
02310             TemplateID = RemoveID;
02311     }
02312 
02313     if (TemplateID==0)
02314         TemplateID = SelectID;
02315 
02316     if (pActionNode==NULL)
02317         *pStr += String_256(TemplateID);
02318     else
02319     {
02320         Message._MakeMsg( (TCHAR*) String_256(TemplateID), &pActionNode->Describe(FALSE) );
02321         *pStr += Message;
02322     }
02323 
02324     return TRUE;
02325 }

BOOL SliceTool::Append String_256 pStr,
String_256  String
[protected]
 

Author:
Phil_Martin (Xara Group Ltd) <camelotdev@xara.com>
Date:
31/5/95
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
-

Errors: -

Definition at line 2372 of file slicetool.cpp.

02373 {
02374     // Append a message to the string, preceding it with a separator if there was something
02375     // already in the string...
02376     if (!pStr->IsEmpty())
02377         *pStr += String_256(_R(IDS_SLICE_SEPARATOR));
02378     *pStr += String;
02379 
02380     return TRUE;
02381 }

BOOL SliceTool::Append String_256 pStr,
UINT32  StringID
[protected]
 

Author:
Phil_Martin (Xara Group Ltd) <camelotdev@xara.com>
Date:
31/5/95
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
-

Errors: -

Definition at line 2344 of file slicetool.cpp.

02345 {
02346     // Append a message to the string, preceding it with a separator if there was something
02347     // already in the string...
02348     if (!pStr->IsEmpty())
02349         *pStr += String_256(_R(IDS_SLICE_SEPARATOR));
02350     *pStr += String_256(StringID);
02351 
02352     return TRUE;
02353 }

virtual BOOL SliceTool::AreToolBlobsRenderedOnSelection  )  [inline, virtual]
 

Reimplemented from Tool_v1.

Definition at line 156 of file slicetool.h.

00156 { return TRUE; }

SliceTool::CC_DECLARE_MEMDUMP SliceTool   )  [private]
 

BOOL SliceTool::CreateCursors  )  [private]
 

Creates all the Slice tool cursors.

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

Definition at line 542 of file slicetool.cpp.

00543 {
00544     // This tool has just been selected.  Create its cursors.
00545     pcNormalSliceCursor = new Cursor(this, _R(IDC_POINTER_SLICE));
00546     pcAdjustCursor      = new Cursor(this, _R(IDC_POINTER_SLICE_ADJUST));
00547     pcUnderCursor       = new Cursor(this, _R(IDC_POINTER_SLICE_UNDER));
00548     pcInsideCursor      = new Cursor(this, _R(IDC_POINTER_SLICE_INSIDE));
00549     pcUnderAdjustCursor = new Cursor(this, _R(IDC_POINTER_SLICE_UNDERADJUST));
00550     pcInsideAdjustCursor= new Cursor(this, _R(IDC_POINTER_SLICE_INSIDEADJUST));
00551     pcALLCursor         = new Cursor(this, _R(IDCSR_SEL_GRADPOINT));
00552     pcLeafCursor        = new Cursor(this, _R(IDC_POINTER_SLICE_LEAF));
00553     pcLeafAdjustCursor  = new Cursor(this, _R(IDC_POINTER_SLICE_LEAFADJUST));
00554     pcHorzGuideCursor   = new Cursor(this, _R(IDCSR_SEL_HGUIDE));
00555     pcVertGuideCursor   = new Cursor(this, _R(IDCSR_SEL_VGUIDE));
00556 
00557     // now check them...
00558     BOOL    ok = (pcNormalSliceCursor != NULL && pcNormalSliceCursor->IsValid());
00559     if (ok) ok = (pcAdjustCursor != NULL && pcAdjustCursor->IsValid());
00560     if (ok) ok = (pcUnderCursor != NULL && pcUnderCursor->IsValid());
00561     if (ok) ok = (pcInsideCursor != NULL && pcInsideCursor->IsValid());
00562     if (ok) ok = (pcUnderAdjustCursor != NULL && pcUnderAdjustCursor->IsValid());
00563     if (ok) ok = (pcInsideAdjustCursor != NULL && pcInsideAdjustCursor->IsValid());
00564     if (ok) ok = (pcALLCursor != NULL && pcALLCursor->IsValid());
00565     if (ok) ok = (pcLeafCursor != NULL && pcLeafCursor->IsValid());
00566     if (ok) ok = (pcLeafAdjustCursor != NULL && pcLeafAdjustCursor->IsValid());
00567     if (ok) ok = (pcHorzGuideCursor != NULL && pcHorzGuideCursor->IsValid());
00568     if (ok) ok = (pcVertGuideCursor != NULL && pcVertGuideCursor->IsValid());
00569     if (!ok)
00570         DestroyCursors();
00571 
00572     return ok;
00573 }

SliceTool::ClickActionCode SliceTool::CycleClickAction NodeRenderableInk **  ppActionNode,
NodeRenderableInk pClickCompoundNode,
ClickActionCode  foundAction,
ClickActionCode  cycleAction
[protected]
 

Determine what action needs to be taken in response to a click.

Author:
Karim_MacDonald (Xara Group Ltd) <camelotdev@xara.com>, from Phil's SelectorTool code
Date:
11/10/1999
Parameters:
- [INPUTS]
pNodeToSelect Pointer to pointer to node to select or NULL [OUTPUTS]
Returns:
ActionCode describing what the click should do

Errors: -

See also:
SliceTool::DetermineClickAction

Definition at line 2055 of file slicetool.cpp.

02059 {
02060     // If we have found a node then return the specified action code...
02061     if (*ppActionNode)
02062     {
02063         return foundAction;
02064     }
02065     // Else no suitable node so see whether the click occurred over a compound node
02066     else
02067     {
02068         // If click occurred over a compound node then we can return that
02069         // along with the alternative action code...
02070         if (pClickCompoundNode)
02071         {
02072             *ppActionNode = pClickCompoundNode;
02073             return cycleAction;
02074         }
02075         else
02076         // Else if there wasn't even a compound node we must return the information that
02077         // the click occurred over white space...
02078         {
02079             *ppActionNode = NULL;
02080             return CLICKACTION_SELNONE;
02081         }
02082     }
02083 }

void SliceTool::Describe void *  InfoPtr  )  [virtual]
 

Allows the tool manager to extract information about the tool.

Author:
Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
Date:
3/10/94
Parameters:
InfoPtr - A pointer to a tool info block. It is passed cast to void* as [INPUTS] the version of the tool is unknown at this point. Later versions of the Tool class may have more items in this block, that this tool will not use
InfoPtr - The structure pointed to by InfoPtr will have had all the info [OUTPUTS] that this version of the Tool knows about

Reimplemented from Tool_v1.

Definition at line 318 of file slicetool.cpp.

00319 {
00320     // Cast structure into the latest one we understand.
00321     ToolInfo_v1 *Info = (ToolInfo_v1 *) InfoPtr;
00322 
00323     Info->InfoVersion = 1;
00324     
00325     Info->InterfaceVersion = GetToolInterfaceVersion();  // You should always have this line.
00326         
00327     // These are all arbitrary at present.
00328     Info->Version = 1;
00329     Info->ID      = GetID();
00330     Info->TextID  = _R(IDS_SLICE_TOOL);
00331 
00332     Info->Family  = FamilyName;
00333     Info->Name    = ToolName;
00334     Info->Purpose = Purpose;
00335     Info->Author  = Author;
00336 
00337     Info->BubbleID = _R(IDBBL_SLICE_TOOLBOX);
00338 }

void SliceTool::DestroyCursors  )  [private]
 

Destroys all the Slice tool cursors.

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

Definition at line 589 of file slicetool.cpp.

00590 {
00591     if (pcNormalSliceCursor != NULL) delete pcNormalSliceCursor;
00592     if (pcAdjustCursor != NULL) delete pcAdjustCursor;
00593     if (pcUnderCursor != NULL) delete pcUnderCursor;
00594     if (pcInsideCursor != NULL) delete pcInsideCursor;
00595     if (pcUnderAdjustCursor != NULL) delete pcUnderAdjustCursor;
00596     if (pcInsideAdjustCursor != NULL) delete pcInsideAdjustCursor;
00597     if (pcALLCursor != NULL) delete pcALLCursor;
00598     if (pcLeafCursor != NULL) delete pcLeafCursor;
00599     if (pcLeafAdjustCursor != NULL) delete pcLeafAdjustCursor;
00600     if (pcHorzGuideCursor != NULL) delete pcHorzGuideCursor;
00601     if (pcVertGuideCursor != NULL) delete pcVertGuideCursor;
00602 }

SliceTool::ClickActionCode SliceTool::DetermineClickAction NodeRenderableInk **  ppActionNode,
NodeRenderableInk pLastClickNode,
NodeRenderableInk pClickSimpleNode,
NodeRenderableInk pClickCompoundNode,
Spread pStartSpread,
DocCoord  ClickStart,
ClickModifiers  ClickMods
[protected]
 

Determine what action needs to be taken in response to a click.

Author:
Karim_MacDonald (Xara Group Ltd) <camelotdev@xara.com>, from Phil's SelectorTool code
Date:
11/10/1999
Parameters:
- [INPUTS]
pNodeToSelect Pointer to pointer to node to select or NULL [OUTPUTS]
Returns:
ActionCode describing what the click should do

Errors: -

See also:
SliceTool::HandleButtonUp

Definition at line 1870 of file slicetool.cpp.

01877 {
01878     *ppActionNode = NULL;
01879 
01880     //--------------------------------------
01881     // Test "leaf" modifier...
01882     if (IsSelectLeafClick(ClickMods))
01883     {
01884         // Go directly to leaf nodes!
01885         if (pClickSimpleNode != pClickCompoundNode)
01886         {
01887             *ppActionNode = pClickSimpleNode;
01888             
01889             // <<<<< Inclusion by Mike 11/01/96
01890             // this stuff is to check whether any parent is responding to
01891             // AllowSelectInside() and returning FALSE. Selections will not go down
01892             // into these objects if so.
01893 
01894             Node* pParentNode = pClickSimpleNode->FindParent();
01895             while (pParentNode)
01896             {
01897                 if (pParentNode->IsKindOf(CC_RUNTIME_CLASS(Layer)))
01898                     break;
01899                 if (pParentNode->IsKindOf(CC_RUNTIME_CLASS(NodeRenderableInk)))
01900                 {
01901                     if ( (!pParentNode->AllowSelectInside()) && 
01902                          ((NodeRenderableInk*)pParentNode)->CanSelectAsCompoundParent()
01903                        )
01904                     {
01905                         *ppActionNode = (NodeRenderableInk*)(pParentNode);
01906                     }
01907                 }
01908                 if (pParentNode==pClickCompoundNode)
01909                     break;
01910                 pParentNode = pParentNode->FindParent();
01911             }
01912 
01913             // <<<<< End of inclusion
01914         }
01915 
01916         // If we still haven't found what we're looking for
01917         // Cycle round to the top again...
01918         return CycleClickAction(ppActionNode,pClickCompoundNode,CLICKACTION_SELLEAF,CLICKACTION_SELNODE);
01919     }
01920 
01921     //--------------------------------------
01922     // Test "under" modifier...
01923     if (IsSelectUnderClick(ClickMods))
01924     {
01925         // Try to perform a select under
01926         // First check that the context node is still under the pointer
01927         // If not then all we can do is a normal click operation...
01928         if (!ValidateLastClickUnder(pLastClickNode,pStartSpread,ClickStart))
01929             return CycleClickAction(ppActionNode,pClickCompoundNode,CLICKACTION_SELUNDERFAIL2,CLICKACTION_SELUNDERFAIL2);
01930 
01931         // Find the leaf node at the click position, but only search nodes
01932         // before the last clicked node.
01933         *ppActionNode = NodeRenderableInk::FindSimpleAtPoint(pStartSpread,ClickStart,pLastClickNode);
01934         // Then find a compound node containing the leaf, preferably a sibling
01935         // of the last clicked node.
01936         *ppActionNode = NodeRenderableInk::FindCompoundFromSimple(*ppActionNode,pLastClickNode);
01937 
01938         // If the "under" node turns out to be the node we started from
01939         // return a failure code but go ahead and re-select it...
01940         // (If we failed to find anything under the last node, and the last node is the top node)
01941         if (*ppActionNode==NULL && pLastClickNode == pClickCompoundNode)
01942             return CycleClickAction(ppActionNode,pClickCompoundNode,CLICKACTION_SELUNDERFAIL,CLICKACTION_SELUNDERFAIL);
01943 
01944         // If we still haven't found what we're looking for
01945         // Cycle round to the top again...
01946         return CycleClickAction(ppActionNode,pClickCompoundNode,CLICKACTION_SELUNDER,CLICKACTION_SELUNDERCYCLE);
01947     }
01948 
01949     //--------------------------------------
01950     // Test "member" modifier...
01951     if (IsSelectMemberClick(ClickMods))
01952     {
01953         // See if the clicked simple node is a descendent of the last clicked node
01954         if (!ValidateLastClickInside(pLastClickNode,pClickSimpleNode))
01955             return CycleClickAction(ppActionNode,pClickCompoundNode,CLICKACTION_SELINSIDEFAIL2,CLICKACTION_SELINSIDEFAIL2);
01956 
01957         // If the node we're going to look inside is not compound and it's the top node
01958         // return a failure code but go ahead and re-select it...
01959         if (pLastClickNode && !pLastClickNode->IsCompound() && pLastClickNode == pClickCompoundNode)
01960             return CycleClickAction(ppActionNode,pClickCompoundNode,CLICKACTION_SELINSIDEFAIL,CLICKACTION_SELINSIDEFAIL);
01961 
01962         // Try to perform a select inside
01963         *ppActionNode = NodeRenderableInk::FindInnerCompound(pClickSimpleNode,pLastClickNode);
01964 
01965         // If we still haven't found what we're looking for
01966         // Cycle round to the top again...
01967         return CycleClickAction(ppActionNode,pClickCompoundNode,CLICKACTION_SELINSIDE,CLICKACTION_SELINSIDECYCLE);
01968     }
01969 
01970     //--------------------------------------
01971     // OK, so no modifiers are currently down
01972     // Just try to do a normal click action...
01973     return CycleClickAction(ppActionNode,pClickCompoundNode,CLICKACTION_NONE,CLICKACTION_SELNODE);
01974 }

void SliceTool::DisplayStatusBarHelp DocCoord  DocPos,
Spread pSpread,
ClickModifiers  ClickMods
[private]
 

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

Author:
Peter_Arnold (Xara Group Ltd) <camelotdev@xara.com>
Date:
12/12/94
Parameters:
DocPos - the document coordinate of the point to display help on [INPUTS] pSpread - pointer to the spread containing DocPos ClickMods - the current click modifiers
- [OUTPUTS]
Returns:
-
See also:
SliceTool::GetCurrentStatusText

Definition at line 1485 of file slicetool.cpp.

01486 {
01487     String_256 StatusMsg("");
01488 
01489     // Get a string from the underlying help function and display it.
01490     GetCurrentStatusText(&StatusMsg, pSpread, DocPos, ClickMods);
01491     GetApplication()->UpdateStatusBarText(&StatusMsg);                           
01492 }

void SliceTool::DoDragBox  )  [protected]
 

Runs a selector-tool drag-box operation.

Author:
Karim_MacDonald (Xara Group Ltd) <camelotdev@xara.com>
Date:
11/10/1999
Parameters:
[INPUTS] 
[OUTPUTS] 
Returns:

Errors: See also:

Definition at line 1454 of file slicetool.cpp.

01455 {
01456     OpSliceDragBox* pOpDragBox = new OpSliceDragBox();
01457     if (pOpDragBox == NULL)
01458     {
01459         InformError(_R(IDS_OUT_OF_MEMORY), _R(IDS_OK));
01460     }
01461     else
01462     {
01463         pOpDragBox->StartDragBox(StartSpread, ClickStart, ClickMods);
01464     }
01465 }

void SliceTool::DoTranslate  )  [protected]
 

Runs a translation tranformation drag on the selection.

Author:
Karim_MacDonald (Xara Group Ltd) <camelotdev@xara.com>
Date:
11/10/1999
Parameters:
[INPUTS] 
[OUTPUTS] 
Returns:

Errors: See also:

Definition at line 1393 of file slicetool.cpp.

01394 {
01395     // set appropriate transform parameters...
01396     TransformData tdParams;
01397     tdParams.CentreOfTrans  = ClickStart;
01398     tdParams.LeaveCopy      = FALSE;
01399     tdParams.LockAspect     = TRUE;
01400     tdParams.pRange         = NULL;
01401     tdParams.ScaleLines     = FALSE;
01402     tdParams.StartBlob      = 0;
01403     tdParams.TransFills     = TRUE;
01404 
01405     // set drag pointer shape.
01406     if (CurrentCursorID != CURSORID_UNSET)
01407         CursorStack::GSetTop(pcALLCursor, CurrentCursorID);
01408 
01409     // attempt to create a translate op.
01410     OpSliceTranslate* pSliceTransOp = new OpSliceTranslate();
01411     if (pSliceTransOp == NULL)
01412     {
01413         InformError(_R(IDS_OUT_OF_MEMORY), _R(IDS_OK));
01414         return;
01415     }
01416 
01417     // Get the current DocView (there must be one or we wouldn't be here).
01418     DocView* pDocView = DocView::GetCurrent();
01419     ERROR3IF(pDocView == NULL, "SliceTool::DoTranslate- Null current DocView");
01420 
01421     DocCoord dcOffset(0, 0);        // Default to offsets of 0
01422 
01423     // Fill a Transform Bounding Data structure up here
01424     BoundingData.x        = SelectionRect.lo.x;
01425     BoundingData.y        = SelectionRect.lo.y;
01426     BoundingData.Width    = SelectionRect.Width();
01427     BoundingData.Height   = SelectionRect.Height();
01428     BoundingData.XScale   = (FIXED16) 1;
01429     BoundingData.YScale   = (FIXED16) 1;
01430     BoundingData.Rotation = (ANGLE) 0;
01431     BoundingData.Shear    = (ANGLE) 0;
01432 
01433     // Run the transformation drag operation and return success code.
01434     pSliceTransOp->DragStarted(&tdParams, this, &BoundingData, ClickStart,
01435                               StartSpread, ClickMods, dcOffset, NULL, DRAGTYPE_AUTOSCROLL);
01436 }

BOOL SliceTool::DragFinished DragEndType  det  )  [protected, virtual]
 

Called by TransOperation when a drag is finished. Allows the SliceTool to reset its cursors and update its current selection information.

Author:
Karim_MacDonald (Xara Group Ltd) <camelotdev@xara.com>, from JustinF's SelectorTool::DragFinished
Date:
14/10/1999
Parameters:
det a code indicating how the drag was ended, [INPUTS] eg. did the user hit ESCAPE and cancel it?
[OUTPUTS] 
Returns:
TRUE if the drag operation should be allowed to complete, FALSE to signal that the drag should be cancelled.

Errors:

See also:

Reimplemented from Tool_v1.

Definition at line 2614 of file slicetool.cpp.

02615 {
02616     // update the current cursor.
02617     SetKeyDownCursor(ClickModifiers::GetClickModifiers());
02618 
02619     // we always leave cancelling the drag to a capricious user.
02620     return TRUE;
02621 }

void SliceTool::FigureUserFeedback Spread pSpread,
DocCoord  dcPos,