selector.h

Go to the documentation of this file.
00001 // $Id: selector.h 1282 2006-06-09 09:46:49Z alex $
00002 /* @@tag:xara-cn@@ DO NOT MODIFY THIS LINE
00003 ================================XARAHEADERSTART===========================
00004  
00005                Xara LX, a vector drawing and manipulation program.
00006                     Copyright (C) 1993-2006 Xara Group Ltd.
00007        Copyright on certain contributions may be held in joint with their
00008               respective authors. See AUTHORS file for details.
00009 
00010 LICENSE TO USE AND MODIFY SOFTWARE
00011 ----------------------------------
00012 
00013 This file is part of Xara LX.
00014 
00015 Xara LX is free software; you can redistribute it and/or modify it
00016 under the terms of the GNU General Public License version 2 as published
00017 by the Free Software Foundation.
00018 
00019 Xara LX and its component source files are distributed in the hope
00020 that it will be useful, but WITHOUT ANY WARRANTY; without even the
00021 implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
00022 See the GNU General Public License for more details.
00023 
00024 You should have received a copy of the GNU General Public License along
00025 with Xara LX (see the file GPL in the root directory of the
00026 distribution); if not, write to the Free Software Foundation, Inc., 51
00027 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
00028 
00029 
00030 ADDITIONAL RIGHTS
00031 -----------------
00032 
00033 Conditional upon your continuing compliance with the GNU General Public
00034 License described above, Xara Group Ltd grants to you certain additional
00035 rights. 
00036 
00037 The additional rights are to use, modify, and distribute the software
00038 together with the wxWidgets library, the wxXtra library, and the "CDraw"
00039 library and any other such library that any version of Xara LX relased
00040 by Xara Group Ltd requires in order to compile and execute, including
00041 the static linking of that library to XaraLX. In the case of the
00042 "CDraw" library, you may satisfy obligation under the GNU General Public
00043 License to provide source code by providing a binary copy of the library
00044 concerned and a copy of the license accompanying it.
00045 
00046 Nothing in this section restricts any of the rights you have under
00047 the GNU General Public License.
00048 
00049 
00050 SCOPE OF LICENSE
00051 ----------------
00052 
00053 This license applies to this program (XaraLX) and its constituent source
00054 files only, and does not necessarily apply to other Xara products which may
00055 in part share the same code base, and are subject to their own licensing
00056 terms.
00057 
00058 This license does not apply to files in the wxXtra directory, which
00059 are built into a separate library, and are subject to the wxWindows
00060 license contained within that directory in the file "WXXTRA-LICENSE".
00061 
00062 This license does not apply to the binary libraries (if any) within
00063 the "libs" directory, which are subject to a separate license contained
00064 within that directory in the file "LIBS-LICENSE".
00065 
00066 
00067 ARRANGEMENTS FOR CONTRIBUTION OF MODIFICATIONS
00068 ----------------------------------------------
00069 
00070 Subject to the terms of the GNU Public License (see above), you are
00071 free to do whatever you like with your modifications. However, you may
00072 (at your option) wish contribute them to Xara's source tree. You can
00073 find details of how to do this at:
00074   http://www.xaraxtreme.org/developers/
00075 
00076 Prior to contributing your modifications, you will need to complete our
00077 contributor agreement. This can be found at:
00078   http://www.xaraxtreme.org/developers/contribute/
00079 
00080 Please note that Xara will not accept modifications which modify any of
00081 the text between the start and end of this header (marked
00082 XARAHEADERSTART and XARAHEADEREND).
00083 
00084 
00085 MARKS
00086 -----
00087 
00088 Xara, Xara LX, Xara X, Xara X/Xtreme, Xara Xtreme, the Xtreme and Xara
00089 designs are registered or unregistered trademarks, design-marks, and/or
00090 service marks of Xara Group Ltd. All rights in these marks are reserved.
00091 
00092 
00093       Xara Group Ltd, Gaddesden Place, Hemel Hempstead, HP2 6EX, UK.
00094                         http://www.xara.com/
00095 
00096 =================================XARAHEADEREND============================
00097  */
00098 // The selector tool and associated operations.
00099 
00100 #ifndef INC_SELECTOR
00101 #define INC_SELECTOR
00102 
00103 #include "dragtool.h"
00104 #include "transop.h"
00105 //#include "doccoord.h" - in camtypes.h [AUTOMATICALLY REMOVED]
00106 #include "blobs.h"
00107 //#include "binds.h" - in camtypes.h [AUTOMATICALLY REMOVED]
00108 
00109 #define OPTOKEN_SELECTOR_DRAGBOX        _T("SelectorDragBox")
00110 #define OPTOKEN_SELECTOR_DRAGCENTRE     _T("SelectorDragCentre")
00111 
00112 class OpState;          // #include "opdesc.h"
00113 class Cursor;           // #include "csrstack.h"
00114 class Spread;
00115 class SelectorInfoBarOp;
00116 class SelChangingMsg;
00117 class DocViewMsg;
00118 class KeyPress;
00119 
00120 
00121 /********************************************************************************************
00122 >   class OpSelectorDragBox : public Operation
00123 
00124     Author:     Rik_Heywood (Xara Group Ltd) <camelotdev@xara.com>
00125     Created:    1/7/93
00126     Purpose:    This operation is started when the user does a drag over the document, that
00127                 started in empty space. A drag box will be drawn out over the document as the
00128                 user moves the mouse about and when the drag ends, all the objects wholly
00129                 inside the box will be selected.
00130 ********************************************************************************************/
00131 
00132 class OpSelectorDragBox : public Operation
00133 {
00134 public:
00135 
00136     // Construction/Destruction
00137     OpSelectorDragBox();
00138 
00139     // The all important Do functions
00140     void StartDragBox( Spread* pSpread, DocCoord Anchor, ClickModifiers);
00141     virtual BOOL SnappingDrag() { return FALSE; }
00142     
00143     // Virtual functions needed for the dragging operations to work
00144     virtual void DragPointerMove(DocCoord, ClickModifiers, Spread*, BOOL bSolidDrag);
00145     virtual void DragFinished(DocCoord, ClickModifiers, Spread*, BOOL, BOOL bSolidDrag);
00146 
00147     // Some Render functions to will draw the EORed path
00148     void RenderDragBlobs(DocRect, Spread*, BOOL bSolidDrag);
00149         
00150     // These functions required for the OpDescriptor class
00151     static BOOL Declare();
00152     static OpState GetState(String_256* Description, OpDescriptor*);
00153 
00154 private:
00155     
00156     CC_DECLARE_DYNCREATE(OpSelectorDragBox);
00157 
00158     // Member vars of the operation
00159     Spread*  StartSpread;           // The spread where the drag started
00160     DocCoord StartPoint;            // The point where the drag started
00161     DocCoord LastMousePosition;     // The last position the mouse was in
00162 };
00163 
00164 
00165 
00166 /********************************************************************************************
00167 >   class OpDragRotateCentre : public Operation
00168 
00169     Author:     Justin_Flude (Xara Group Ltd) <camelotdev@xara.com>
00170     Created:    several deadlines previous, I can assure you
00171     Purpose:    Allows you to drag the selector tool's centre of rotattion around
00172     SeeAlso:    -
00173 ********************************************************************************************/
00174 
00175 class OpDragRotateCentre : public Operation
00176 {
00177 public:
00178 
00179     // Construction/Destruction
00180     OpDragRotateCentre();
00181 
00182     // This is called by the tool when a drag has been started.
00183     void StartDragCentreBlob(Spread*, const DocCoord&, ClickModifiers);
00184     
00185     // Virtual functions needed for the dragging operations to work
00186     virtual void DragPointerMove(DocCoord, ClickModifiers, Spread*, BOOL bSolidDrag);
00187     virtual void DragFinished(DocCoord, ClickModifiers, Spread*, BOOL, BOOL bSolidDrag);
00188     virtual BOOL DragKeyPress(KeyPress* pKey, BOOL bSolidDrag);
00189 
00190     // Some Render functions to will draw the EORed path
00191     void RenderDragBlobs(DocRect, Spread*, BOOL bSolidDrag);
00192         
00193     // These functions required for the OpDescriptor class
00194     static BOOL Declare();
00195     static OpState GetState(String_256* Description, OpDescriptor*);
00196 
00197     // This generates a little rectangle enclosing the rotation centre blob.
00198     static DocRect CalcBlobClipRect(const DocCoord& dcPos);
00199 
00200 private:
00201 
00202     CC_DECLARE_DYNCREATE(OpDragRotateCentre);
00203 
00204     // Helper functions.
00205     void GetNearestBlob(const DocCoord& dcPos, DocCoord* pPos, INT32* pBlob) const;
00206 
00207     // Data members.
00208     Spread*       m_pStartSpread;
00209     DocCoord      m_dcFirstPos;
00210     DocCoord      m_dcLastPos;
00211     DocCoord      m_dcLastMousePos;
00212 };
00213 
00214 
00215 
00216 /********************************************************************************************
00217 >   class SelectorTool : public DragTool
00218 
00219     Author:     Rik_Heywood (Xara Group Ltd) <camelotdev@xara.com>
00220     Created:    20/7/93
00221     Purpose:    The Selector tool is used to change the selection, edit objects and
00222                 transform them.
00223 ********************************************************************************************/
00224 
00225 /********************************************************************************************
00226 
00227 >   class CCAPI SelectorTool : public DragTool
00228 
00229     Author:     Karim_MacDonald (Xara Group Ltd) <camelotdev@xara.com>
00230     Created:    14/10/1999
00231     Purpose:    The Selector tool now derives from the DragTool, so that TransOperation
00232                 may refer to a general DragTool when an object drag is in progress.
00233                 At a later date, drag functionality may be pulled up into DragTool,
00234                 to allow future tools to implement dragging of objects more easily.
00235 
00236 ********************************************************************************************/
00237 class CCAPI SelectorTool : public DragTool
00238 {
00239 
00241 // Tool interface
00242 
00243 public:
00244 
00245     // Creation & destruction.
00246     SelectorTool();
00247     virtual ~SelectorTool();
00248     BOOL Init();
00249 
00250     // Attributes.
00251     void Describe(void* InfoPtr);
00252     UINT32 GetID() { return TOOLID_SELECTOR; };
00253     
00254     // Event handlers etc.
00255     virtual void SelectChange(BOOL);
00256     virtual void OnClick(DocCoord, ClickType, ClickModifiers, Spread*);
00257     virtual void OnMouseMove(DocCoord, Spread*, ClickModifiers);
00258     virtual BOOL OnKeyPress(KeyPress* pKey);
00259     virtual BOOL OnIdle();
00260     virtual void RenderToolBlobs(Spread* pSpread, DocRect* pClipRect);
00261 
00262     // Function that allows the transform to tell the tool how things are going
00263     void DragMove(TransformBoundingData* pBoundingData);
00264     
00265     // This is called to notify the tool when a drag has finished so it can tidy up
00266     // appropriately.
00267     virtual BOOL DragFinished(DragEndType det);
00268 
00269     // This function can can called by Operations to turn idle processing on or off.
00270     // They need to do this to prevent the tool overwriting status bar text etc.
00271     static void AllowIdleWork(BOOL fIsAllowed);
00272     
00273     static BOOL IsSelectorCaching(){ return fSelectorIsCaching;};
00274 
00275     // This function returns TRUE if the given floating-point value exceeds the range
00276     // that FIXED16 numbers can represent.
00277     static BOOL BeyondFixedRange(double fpFixedVal);
00278 
00279     virtual BOOL AreToolBlobsRenderedOnSelection() {return TRUE;}
00280 
00281     // CGS:  support functions for profile dialogs - see NOTES where variable are defined
00282 
00283     static BOOL GetNormalClick_CheckProfileDialog () { return (bNormalClickCheckProfileDialog); }
00284     static void SetNormalClick_CheckProfileDialog (BOOL newVal) { bNormalClickCheckProfileDialog = newVal; }
00285 
00286 private:
00287 
00288     BOOL fAllowIdleProcessing;          // if TRUE then perform OnIdle stuff
00289     BOOL fMouseHasMoved;                // sort of ditto
00290     static BOOL fSelectorIsCaching;     // set during a cache - avoids bar redraws
00291 
00292     // More attributes.
00293     static TCHAR* FamilyName;           // The Tools Family Name
00294     static TCHAR* ToolName;             // The Tool Name
00295     static TCHAR* Purpose;              // What the tool is for
00296     static TCHAR* Author;               // Who wrote it
00297 
00298     static INT32 CursorStackID;         // My cursor (stack position) handle
00299 //  static INT32 pCursor;               // Pointer to my current cursor
00300 
00301     // own up in memory dumps
00302     CC_DECLARE_MEMDUMP(SelectorTool);
00303 
00304 
00306 // View & selection message handling.
00307 
00308 public:
00309 
00310     // Called when the view or selection changes.
00311     void SelectionHasChanged(BOOL DontUpdate =0);
00312     void AttributeHasChanged();
00313     void ViewChanged(const DocViewMsg& msg);
00314     BOOL UpdateSelectionInfo();
00315 
00316     // Attributes.
00317     Spread* GetSelectionSpread() const;
00318     const DocRect& GetSelectionBounds(BOOL WithNoAttrs = FALSE) const;
00319     const BOOL GetAreaDetails(BOOL WithNoAttrs, XLONG* pxlArea, XLONG* pxlPerim) const;
00320 
00321 private:
00322 
00323     // Information about the selected object(s).
00324     Spread*     SelectionSpread;
00325     SelRange*   SelectRange;
00326     DocRect     SelectionRect;
00327     DocRect     SelectionRectNoAttr;
00328 
00329     XLONG       xlSelectionArea;
00330     XLONG       xlSelectionPerim;
00331 
00332     // When true we will ignore selection changed messages.
00333     BOOL        fIgnoreSelChange;
00334 
00335 
00337 // Click & drag handling.
00338 
00339 public:
00340     static NodeRenderableInk* FindPreProcessClickNode(Spread* pSpread,
00341                                                       DocCoord ClickPos,
00342                                                       BOOL Interruptible = FALSE);
00343 
00344 protected:
00345 
00346     // Top-level mouse handlers.
00347     virtual BOOL PreProcessClick();
00348     virtual BOOL ProcessObjectClick();
00349     virtual void PostProcessClick();
00350 
00351     // Click event handlers.
00352     virtual void HandleSingleClick();
00353     virtual void HandleDoubleClick();
00354     virtual void HandleDragClick();
00355     virtual void HandleButtonUp();
00356 
00357     // Key handler.
00358     virtual void HandleTabKey(BOOL fIsShifted);
00359 
00360     // The IterateFlags structure provides a little control over tab-iteration of nodes.
00361     // It currently contains flags to indicate whether to ignore locked or invisible layers.
00362     struct IterateFlags
00363     {
00364         IterateFlags(   BOOL IgInvisibleLayers  = FALSE,
00365                         BOOL IgLockedLayers     = FALSE )
00366         {
00367             IgnoreInvisibleLayers   = IgInvisibleLayers;
00368             IgnoreLockedLayers      = IgLockedLayers;
00369         }
00370 
00371         BOOL IgnoreInvisibleLayers  :1;
00372         BOOL IgnoreLockedLayers     :1;
00373     };
00374 
00375     // we need to maintain a record of the layer we started on, so we don't infinitely loop
00376     // around the same layers again and again.
00377     Layer* m_pIterStartLayer;
00378 
00379     // These functions are for tabbing through the selection.
00380 
00381     Node* IteratePreProcess(Node* pCurrent);
00382     NodeRenderableInk* IterateNextInk(Node* pCurrent, IterateFlags iterFlags);
00383     NodeRenderableInk* IteratePrevInk(Node* pCurrent, IterateFlags iterFlags);
00384     NodeRenderableInk* IteratePostProcessNext(  Node* pCurrent, Node* pParent,
00385                                                 IterateFlags iterFlags );
00386     NodeRenderableInk* IteratePostProcessPrev(  Node* pCurrent, Node* pParent,
00387                                                 IterateFlags iterFlags );
00388 
00389 private:
00390 
00391     // Returns TRUE if the current click is on the rotation centre blob.
00392     BOOL IsRotateCentreClicked(DocCoord ClickStart) const;
00393 
00394     // Returns TRUE if the user is holding down the translation op shortcut keys.
00395     BOOL IsTranslateShortcut(ClickModifiers cmods) const;
00396     
00397     // Returns TRUE if the current mouse click has been "modified", eg. Adjust, Constrain etc.
00398     BOOL IsClickModified(ClickModifiers cmods) const;
00399 
00400     // This detects whether the current click means "select-under", allowing for the
00401     // SelectUnderLikeArtWorks preference.
00402     BOOL IsSelectUnderClick(ClickModifiers cmods) const;
00403 
00404     // Returns TRUE if the current set of click modifiers indicates "select-inside".
00405     BOOL IsSelectMemberClick(ClickModifiers cmods) const;
00406 
00407     // Returns TRUE if the current set of click modifiers indicates "select-leaf".
00408     BOOL IsSelectLeafClick(ClickModifiers cmods) const;
00409 
00410     // These provide some shorthand to the FindSimple/FindCompound hit-testing functions in
00411     // NodeRenderableInk.  They are "hard-wired" to use the current click position.
00412     NodeRenderableInk* FindFrom(NodeRenderableInk* pSimpleNode) const;
00413 
00414     // Like the above, but for FindInnerCompound and unrelated to the click position.
00415     NodeRenderableInk* EnsureInkNext(Range* range, Node* pNode) const;
00416     NodeRenderableInk* EnsureInkPrev(Range* range, Node* pNode) const;
00417 
00418     // Declaration of click action code...
00419     enum    ClickActionCode {
00420                             CLICKACTION_NONE,
00421                             CLICKACTION_BOUNDTOPLEFT,
00422                             CLICKACTION_BOUNDTOP,
00423                             CLICKACTION_BOUNDTOPRIGHT,
00424                             CLICKACTION_BOUNDLEFT,
00425                             CLICKACTION_BOUNDRIGHT,
00426                             CLICKACTION_BOUNDBOTTOMLEFT,
00427                             CLICKACTION_BOUNDBOTTOM,
00428                             CLICKACTION_BOUNDBOTTOMRIGHT,
00429                             CLICKACTION_BOUNDTRANSFORMORIGIN,
00430                             CLICKACTION_SELNONE,
00431                             CLICKACTION_SELNODE,
00432                             CLICKACTION_SELUNDER,
00433                             CLICKACTION_SELUNDERCYCLE,
00434                             CLICKACTION_SELUNDERFAIL,
00435                             CLICKACTION_SELUNDERFAIL2,
00436                             CLICKACTION_SELINSIDE,
00437                             CLICKACTION_SELINSIDECYCLE,
00438                             CLICKACTION_SELINSIDEFAIL,
00439                             CLICKACTION_SELINSIDEFAIL2,
00440                             CLICKACTION_SELLEAF
00441                         };
00442                         
00443     // Determine what action needs to be taken in response to a click
00444     ClickActionCode DetermineClickAction(NodeRenderableInk** ppActionNode,
00445                                          NodeRenderableInk* pLastClickNode,
00446                                          NodeRenderableInk* pClickSimpleNode,
00447                                          NodeRenderableInk* pClickCompoundNode,
00448                                          Spread* pStartSpread,
00449                                          DocCoord ClickStart,
00450                                          ClickModifiers ClickMods);
00451     ClickActionCode CycleClickAction(NodeRenderableInk** ppActionNode,
00452                                      NodeRenderableInk* pClickCompoundNode,
00453                                      ClickActionCode foundAction,
00454                                      ClickActionCode cycleAction);
00455     BOOL ValidateLastClickUnder(NodeRenderableInk* pLastClickNode, Spread* pStartSpread, DocCoord ClickStart);
00456     BOOL ValidateLastClickInside(NodeRenderableInk* pLastClickNode, NodeRenderableInk* pClickSimpleNode);
00457 
00458     // Data members.
00459     DocCoord            ClickStart;
00460     Spread*             StartSpread;
00461     ClickModifiers      ClickMods;
00462     ClickType           TypeOfClick;
00463     INT32               nClickedBoundsBlob;
00464     BOOL                fPossibleToggleClick;
00465     BOOL                fIsBlobDrag;
00466 
00467     // These are used for the "select-under" feature, which must maintain data across clicks.
00468 /*  NodeRenderableInk*  pClickedNode;
00469     NodeRenderableInk*  pSimpleClickedNode;
00470     NodeRenderableInk*  pLastClickedNode;
00471     NodeRenderableInk*  pLastUnderNode;
00472     NodeRenderableInk*  pLastSimpleNode;
00473     NodeRenderableInk*  pLastInsideNode;
00474 */
00475     NodeRenderableInk*  pClickSimpleNode;
00476     NodeRenderableInk*  pClickCompoundNode;
00477     NodeRenderableInk*  pLastClickNode;
00478     NodeRenderableInk*  pPreProcClickNode;
00479 
00481 // Transformations (and the other drags).
00482 
00483 public:
00484 
00485     // This is called when a drag has moved the rotation centre.
00486     void RotationCentreDragged(const DocCoord& dcNewPos);
00487 
00488     // This tells the selector tool to restore the rotation centre to the middle of the
00489     // selection bounds at the next opportunity.
00490     void InvalidateRotationCentre();
00491 
00492 private:
00493 
00494     // This gets default settings for the transform params from the info-bar.
00495     void GetUserParams();
00496 
00497     // These initialise a mouse-drag transform.
00498     void DoScale();
00499     void DoSquash();
00500     void DoShear();
00501     void DoTranslate();
00502     void DoRotate();
00503 
00504     // These are non-transform drags.
00505     void DoDragBox();
00506     void DoDragRotateCentre();
00507 
00508     // These start a mouse-drag transform & an immediate (info-bar) transform, respectively.
00509     BOOL StartXformDrag(TransOperation* pXformDragOp, DragType dragtype);
00510     BOOL StartXformImmediate(const TCHAR* chOpToken, void* pvParam2);
00511 
00512     // Parameters for a transformation.
00513     TransformData   tdParams;
00514     DocCoord        dcRotateCentre;
00515     BOOL            fRotateCentreIsValid;
00516 
00517     // A structure that contains the position, size etc of the selection
00518     // (ie whats in the info bar)
00519     TransformBoundingData BoundingData;
00520 
00521 
00523 // Info-bar data & functions.
00524 
00525 public:
00526     
00527     // Called by the info-bar when the user changes certain buttons.
00528     void SelectionBlobChange(BlobStyle ChangingBlobs);
00529     void BoundsButtonChange();
00530     void RotateButtonChange(BOOL fNewState);
00531     void FlipButtonChange(BOOL fIsVertical);
00532     void SetRotateCentre(INT32 nBlob);
00533 
00534     // These run keyboard transformations, ie. those started by typing in an edit-field.
00535     void DoTranslateImmediate(MILLIPOINT nXpos, MILLIPOINT nYpos);
00536     void DoScaleImmediate(MILLIPOINT nWinc, MILLIPOINT nHinc);
00537 //  void DoScaleImmediate(MILLIPOINT nWinc, MILLIPOINT nHinc, BOOL);
00538     void DoScalePercentImmediate(double nWpercent, double nHpercent);
00539     void DoRotateImmediate(ANGLE nAngle);
00540     void DoShearImmediate(ANGLE nAngle);
00541 
00542     // A public interface onto the DoTranslate() method, so that somebody other than the
00543     // selector tool can tell the selector tool to drag objects around.
00544     void PublicDoTranslate();
00545 
00546     // This function switches the settings of the info-bar back to known defaults, eg.
00547     // rotate blobs OFF, don't leave copies etc.
00548     void ResetDefaults();
00549 
00550     // This sets the status bar text to the given string.
00551     static void SetStatusText(UINT32 nStringID);
00552     static void SetStatusText(String_256* pStr);
00553     static void UnCacheInfoBar(BOOL = FALSE);
00554 
00555     // Interogate the current tool for status line text
00556     virtual BOOL GetStatusLineText(String_256* ptext, Spread* pSpread,
00557                                    DocCoord DocPos, ClickModifiers cmods);
00558 
00559     void FigureUserFeedback(Spread* pSpread,
00560                             DocCoord dcMousePos,
00561                             ClickModifiers cmods,
00562                             BOOL DoSlowTests,
00563                             String_256* pStr,
00564                             Cursor** ppPointerShape);
00565     BOOL Append(String_256* pStr, UINT32 StringID);
00566     BOOL Append(String_256* pStr, String_256 String);
00567     BOOL Append(String_256* pStr, ClickModifiers cmods,
00568                                   UINT32 SelectID,
00569                                   UINT32 AddID,
00570                                   UINT32 RemoveID,
00571                                   NodeRenderableInk* pActionNode = NULL);
00572     BOOL Append(String_256* pStr, ClickModifiers cmods,
00573                                   String_256 SelectTemplate,
00574                                   String_256 AddTemplate,
00575                                   String_256 RemoveTemplate,
00576                                   NodeRenderableInk* pActionNode = NULL);
00577 
00578 private:
00579 
00580     // This reads preferences from the .INI file, returning TRUE if they are all there etc.
00581     static BOOL ReadPrefs();
00582 
00583     // Points to this tool's info-bar
00584     static SelectorInfoBarOp* pInfoBarOp;
00585 
00586     // This is our friend . . .
00587     friend class SelectorInfoBarOp;
00588 
00589 
00590 
00592 // Blob management.
00593 
00594 public:
00595 
00596     // This defines constants to indicate what kind of tool blobs the selector can
00597     // display.
00598     enum BlobType
00599     {
00600         NO_BLOBS,               // use the fShowToolBlobs flag instead of this!
00601         BOUNDS_BLOBS,
00602         ROTATE_BLOBS
00603     };
00604 
00605     // Called by the info-bar when it needs to know the settings of the blob buttons.
00606     BlobStyle GetBlobStyle() const;
00607     BlobType  GetCurrentToolBlobType() const;
00608 
00609     // This inflates the given rectangle by the "blob border", ie. the amount that bounds blobs
00610     // are offset by when drawing them around a selected object.  This function is also useful
00611     // in the zoom tool.
00612     static INT32 GetBlobBorderSize(void);
00613     static void InflateByBlobBorder(DocRect* pdrRect);
00614 
00615     static void AllowGuidelineScan (BOOL newVal = TRUE) { bGlineSAllowed = newVal; }
00616 
00617 private:
00618 
00619     // These draw the appropriate blobs in the right places.
00620     void RenderBoundBlobs(Spread*, DocRect*, const DocRect&);
00621     void RenderRotateBlobs(Spread*, DocRect*, const DocRect&);
00622     void RenderRotateCentre(RenderRegion*, const DocCoord&);
00623 
00624     // These calculate the position of blobs around the selection.
00625     DocRect  InflatedSelRect() const;
00626     DocCoord GetBoundsBlobPos(INT32 nBlob) const;
00627     DocCoord GetSelPosNearBlob(INT32 nBlob) const;
00628 
00629     // These convert a mouse coordinate into the appropriate blob number, if any.
00630     INT32 BoundsBlobHitTest(const DocCoord& dcMousePos) const;
00631     static BOOL IsNearBlob(const DocCoord& dcBlobOrigin, const DocCoord& dcTestPoint);
00632 
00633     // This handles changing the cursor when it moves over a blob.
00634     void ChangeCursorAndText(INT32 nBlobID, String_256* pStr, Cursor** pPointerShape);
00635 
00636     // These handle changing the cursor according to which modifier keys are up or down.
00637     void SetKeyDownCursor(ClickModifiers cmods);
00638     void ResetCursorNow();
00639 
00640     // Func that gets the tool to render it's blobs when the selection changes, but only if the current
00641     // tool is not the selector tool.
00642     void RenderOtherToolBlobs();
00643 
00644     // Data members.
00645     static BlobManager* pBlobManager;
00646     BlobStyle           bsBlobStyle;
00647     BlobType            eCurrentBlobs;
00648     BOOL                fShowToolBlobs;
00649 
00650     INT32                   nLastSelectedBlob;
00651     BOOL                fValidSelectedBlob;
00652     BOOL                m_bComputeAreaDetails;
00653 
00654     // Cursor stuff.
00655 //  unsigned            fKeyStates;                 // used as a bit-field
00656 //  BOOL                fCursorOverBlob;
00657 //  BOOL                fCursorOverGradFillBlob;
00658 //  BOOL                fKeyDownCursor;
00659 
00660     Cursor*             pNormalCursor;
00661     Cursor*             pAdjustCursor;
00662     Cursor*             pUnderCursor;
00663     Cursor*             pInsideCursor;
00664     Cursor*             pUnderAdjustCursor;
00665     Cursor*             pInsideAdjustCursor;
00666     Cursor*             pLeafCursor;
00667     Cursor*             pLeafAdjustCursor;
00668 
00669     Cursor*             pALLCursor;
00670     Cursor*             pNWSECursor;
00671     Cursor*             pNESWCursor;
00672     Cursor*             pNSCursor;
00673     Cursor*             pWECursor;
00674     Cursor*             pGradFillCursor;
00675     Cursor*             pDragRotateCursor;
00676     Cursor*             pHorzGuideCursor;
00677     Cursor*             pVertGuideCursor;
00678 //  Cursor*             pLastKeyDownCursor;
00679 
00680     // Various preferences.
00681     static INT32            nBlobBorder;
00682     static unsigned     fBlobPref;
00683     static BOOL         fAllowCorelToggleClick;
00684     static BOOL         fSelectUnderLikeArtWorks;
00685 
00686     // CGS:  wo there!  when selecting another object, everything is deselected - and then just that node
00687     // selected.  This is a problem, since if we proceed regardless, the profile dialog closes (when it
00688     // possibly shouldn't have).  As such, we now check for this occurring ....
00689     // NOTE:  it has to be done within the selector tool cause the problem occurs internally!
00690     static BOOL         bNormalClickCheckProfileDialog;     // you need to check the profile dialog again buddy!
00691 
00692     // CGS:  wo there!  now that I've implemented selection capability for all tools, it is undesirable to allow
00693     // them to move guidlines about!
00694 
00695     static BOOL         bGlineSAllowed;
00696 
00697 protected:
00698     // Preferences used by our friend InfoBarOp class
00699     static BOOL         fSlaveLineWidthToButton;
00700     static BOOL         fConsiderLineWidths;
00701     static BOOL         fUseScalingFix;
00702     static BOOL         bPageDoubleClickOpenFile;
00703 
00704     // These classes have special access.
00705     friend class OpDragRotateCentre;
00706 };
00707 
00708 #endif  // INC_SELECTOR

Generated on Sat Nov 10 03:47:55 2007 for Camelot by  doxygen 1.4.4