#include <selector.h>
Inheritance diagram for SelectorTool:
Public Types | |
enum | BlobType { NO_BLOBS, BOUNDS_BLOBS, ROTATE_BLOBS } |
Public Member Functions | |
SelectorTool () | |
Dummy Constructor - sets member pointers to NULL and initialises the record of which blobs are displayed (initially only "tiny" blobs). | |
virtual | ~SelectorTool () |
Destructor (Virtual). Does nothing. | |
BOOL | Init () |
Used to check if the Tool was properly constructed. | |
void | Describe (void *InfoPtr) |
Allows the tool manager to extract information about the tool. | |
UINT32 | GetID () |
virtual void | SelectChange (BOOL) |
Called whenever this tool is selected or deselected. | |
virtual void | OnClick (DocCoord, ClickType, ClickModifiers, Spread *) |
Dispatches mouse events to the proper handler. The tool is given a chance to handle an event first, which allows it to override the usual behaviour if necessary. If it doesn't handle the event the selected object(s) are given a chance. Finally, any events still not handled are given to the selector tool to deal with. | |
virtual void | OnMouseMove (DocCoord, Spread *, ClickModifiers) |
Called by the tool system for the current tool when the mouse is moved outside of a drag. Checks if the mouse is over one of the tool's blobs, changing the cursor appropriately if it is. | |
virtual BOOL | OnKeyPress (KeyPress *pKey) |
Called when a key is pressed of released. If the key is a "click modifier" such as the ALT or CTRL key then the cursor is changed to indicate whatever the tool can do with that modifier. | |
virtual BOOL | OnIdle () |
Called on idle events. Performs hit-detection on the current mouse position and updates the status-bar text accordingly. | |
virtual void | RenderToolBlobs (Spread *pSpread, DocRect *pClipRect) |
Draws the blobs specific to the selector tool. This can include the Bounds blobs that surround the current selection, or the Rotate/Shear blobs that also surround the selection. | |
void | DragMove (TransformBoundingData *pBoundingData) |
This function is called by the transform operations every time the mouse moves, so that the selector tool can keep the fields in its info bar up to date. | |
virtual BOOL | DragFinished (DragEndType det) |
Called by the tool base-class when a drag is finished. In the selector tool this resets the cursor and always returns success. It also makes sure that the info-bar text reflects the selection, even if the drag was cancelled with the ESCAPE key. | |
virtual BOOL | AreToolBlobsRenderedOnSelection () |
void | SelectionHasChanged (BOOL DontUpdate=0) |
Called when the selection changes, allowing the selector tool to do things like update its tools blobs etc. | |
void | AttributeHasChanged () |
Responds to an attribute-changing message by forcing the selection range to update its bounds, then forces a recalc and redraw of the tool's bounds blobs. | |
void | ViewChanged (const DocViewMsg &msg) |
When views and documents are changing the selector tool needs to get its selection data correct for the old and new views so that its tool blobs can be removed. This function allows the info bar to get the tool to re-calculate this information and draw the blobs accordingly. The blobs are only drawn once here as this functions real purpose it to get rid of the blobs from the old view and the draw them in on the new view. As a result the info bar calls this function twice after setting up the appropriate docview info. | |
BOOL | UpdateSelectionInfo () |
Updates the selector tool's record of the spread and bounding rectangle of the current selection. | |
Spread * | GetSelectionSpread () const |
Returns a pointer to the spread containing the currently selected object(s). Used internally by the info-bar. | |
const DocRect & | GetSelectionBounds (BOOL WithNoAttrs=FALSE) const |
Returns a reference to the bounds of the selected object(s). This will be empty if there is no current selection. Used internally by the info-bar. | |
const BOOL | GetAreaDetails (BOOL WithNoAttrs, XLONG *pxlArea, XLONG *pxlPerim) const |
Returns a reference to the bounds of the selected object(s). This will be empty if there is no current selection. Used internally by the info-bar. | |
void | RotationCentreDragged (const DocCoord &dcNewPos) |
Updates the centre of rotation, marking it as now 'valid'. This is called by the drag operation on successful completion. | |
void | InvalidateRotationCentre () |
Tells the selector tool that it should position the centre of rotation in the middle of the selection's bounds, the next time there is a selection. | |
void | SelectionBlobChange (BlobStyle ChangingBlobs) |
Called when the types of blob that are being displayed is to be changed (ie, someone pressed one of the buttons on the info bar). This function tells the blob manager what it wants to know and will display or remove the Tool blobs as appropriate. You should only have one of the blobs types set to TRUE at a time. ie, only change one type of blob at once. | |
void | BoundsButtonChange () |
Called by the info-bar when the user has clicked on the 'Show Bounds/Rotate Blobs' button. Handles keeping a record of the setting, changing the blobs on-screen etc. | |
void | RotateButtonChange (BOOL fNewState) |
Called by the info-bar when the user clicks on the "Rotate Blobs" button, that switches between rotate blobs and bounds blobs. Handles updating on-screen blobs etc. | |
void | FlipButtonChange (BOOL fIsVertical) |
Called by the info-bar when the user clicks one of the "flip" buttons. Gets default transformation parameters and starts an "immediate" transformation operation. | |
void | SetRotateCentre (INT32 nBlob) |
Responds to a click on the "telephone keypad" by moving the centre of rotation to the given position, as described by a blob number. The blob itself will be redrawn if necessary. | |
void | DoTranslateImmediate (MILLIPOINT nXpos, MILLIPOINT nYpos) |
Runs a translation of the selected object(s) initiated from the info-bar. | |
void | DoScaleImmediate (MILLIPOINT nWinc, MILLIPOINT nHinc) |
Scales the selected object(s) as initiated from the info-bar. | |
void | DoScalePercentImmediate (double nWpercent, double nHpercent) |
As the previous DoScaleImmediate() ( Scales the selected object(s) as initiated by the info-bar ), except omitting calculation of the relative change in scale, and filling the transform's parameter block with the width & height instead, and sending a different optoken. Scales the selection as initiated from the info-bar. | |
void | DoRotateImmediate (ANGLE nAngle) |
Rotates the selection as initiated from the info-bar. | |
void | DoShearImmediate (ANGLE nAngle) |
Shears the selection, as initiated from the info-bar. | |
void | PublicDoTranslate () |
void | ResetDefaults () |
Called after a click or drag event if the tool's options should be set back to certain defaults. For example, if the selection is changed to a new object then rotate blobs should be switched back to bounds blobs and the "Leave Copy" button should be OFF. | |
virtual BOOL | GetStatusLineText (String_256 *ptext, Spread *pSpread, DocCoord DocPos, ClickModifiers cmods) |
Figure out what the status text for the Selector tool is at the given position on the given spread with the given click modifiers. | |
void | FigureUserFeedback (Spread *pSpread, DocCoord dcMousePos, ClickModifiers cmods, BOOL DoSlowTests, String_256 *pStr, Cursor **ppPointerShape) |
This routine computes the status line help and the pointer shape for any given mouse position in the Selector tool. It does NOT set either of these values but returns them both to the caller. It's up to the caller to decide whether to use these values or not. The tests done to figure out which pointer shapes, status help (and maybe other stuff one day) is quite complex so it's most efficient to compute them all at once and then let the caller decide which ones to actually use. The precedence of pointer shapes, status messages and other user feedback is determined by the order of the checks within this function (not by flags any more!). | |
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) |
BlobStyle | GetBlobStyle () const |
To find out what blobs the selector tool is displaying. | |
BlobType | GetCurrentToolBlobType () const |
Returns the type of tool blobs currently being displayed, either None, Bounds, or Rotate blobs. Used internally by the info-bar. | |
Static Public Member Functions | |
static void | AllowIdleWork (BOOL fIsAllowed) |
Turns idle processing on or off. During idle events the selector tool updates the status bar, so if a drag operation, for instance, wants to place its own text in the status bar while it is running it should call this function at its start and at its end. | |
static BOOL | IsSelectorCaching () |
static BOOL | BeyondFixedRange (double fpFixedVal) |
Checks for under/overflow in fixed-point calculations. | |
static BOOL | GetNormalClick_CheckProfileDialog () |
static void | SetNormalClick_CheckProfileDialog (BOOL newVal) |
static NodeRenderableInk * | FindPreProcessClickNode (Spread *pSpread, DocCoord ClickPos, BOOL Interruptible=FALSE) |
This scans the nodes in the spread to see if any of them are interested in the click before it is processed in the normal way. | |
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. | |
static void | UnCacheInfoBar (BOOL=FALSE) |
deletes the cached infobar and sets it's ID to NULL -this is normally called when the selector is not the current tool - it can be forced however(on close down etc..) | |
static INT32 | GetBlobBorderSize (void) |
Determines the width of the "border" between a selected object and the bounds blobs around it. NB. there must be a selected DocView for this function to work (it relies on the selected view's scale factor). | |
static void | InflateByBlobBorder (DocRect *pdrRect) |
Useful public function that adjusts a bounding rectangle by the "border" between a selected object and the bounds blobs around it. NB. there must be a selected DocView for this function to work (it relies on the selected view's scale factor). | |
static void | AllowGuidelineScan (BOOL newVal=TRUE) |
Protected Member Functions | |
virtual BOOL | PreProcessClick () |
This allows a click to be handled before going through the standard selector tool click handling code. | |
virtual BOOL | ProcessObjectClick () |
Iterates over the selector objects, calling the OnClick method of each NodeRenderableInk and AttrFillGeometry. | |
virtual void | PostProcessClick () |
Last-chance handler for a mouse event. Calls HandleSingleClick for a CLICKTYPE_SINGLE and HandleDragClick for a CLICKTYPE_DRAG etc. | |
virtual void | HandleSingleClick () |
Called when the selector tool must process a button-down mouse event. | |
virtual void | HandleDoubleClick () |
Called when the selector tool must process a mouse double-click. Currently does nothing. | |
virtual void | HandleDragClick () |
Called when the selector tool must process a mouse drag. | |
virtual void | HandleButtonUp () |
Called when the selector tool must process a mouse button-up event. Note that such events are NOT sent if an Operation etc has run a drag in response to a CLICKTYPE_DRAG. | |
virtual void | HandleTabKey (BOOL fIsShifted) |
Called when the selector tool receives a TAB keystroke. Moves the selection to the next object in render-order. | |
Node * | IteratePreProcess (Node *pCurrent) |
Iteration pre-processing. If we're asked to iterate over the selection, and we happen to be on a node, eg a text-character, which is unsuitable for iterating from, then we need to move to a more suitable node. | |
NodeRenderableInk * | IterateNextInk (Node *pCurrent, IterateFlags iterFlags) |
Iterate over the document. See notes up above for more info. Notes: * Could be made into a non-virtual function in Node or NodeRenderableInk. Recursively calls IteratePostProcessNext(). | |
NodeRenderableInk * | IteratePrevInk (Node *pCurrent, IterateFlags iterFlags) |
Iterate over the document. See notes up above for more info. Notes: * Could be made into a non-virtual function in Node or NodeRenderableInk. Recursively calls IteratePostProcessPrev(). | |
NodeRenderableInk * | IteratePostProcessNext (Node *pCurrent, Node *pParent, IterateFlags iterFlags) |
IterateNextInk() is brainless - it picks the next sibling of a node. This function makes an informed decision, based on that chosen node, to get the selection-tabbing order correct. See notes above for more info. | |
NodeRenderableInk * | IteratePostProcessPrev (Node *pCurrent, Node *pParent, IterateFlags iterFlags) |
IteratePrevInk() is brainless - it picks the previous sibling of a node. This function makes an informed decision, based on that chosen node, to get the selection-tabbing order correct. See notes above for more info. | |
Protected Attributes | |
Layer * | m_pIterStartLayer |
Static Protected Attributes | |
static BOOL | fSlaveLineWidthToButton = TRUE |
Controls whether attributes (line widths mainly) are considered when calculating bounding rectangles for objects. This is used when displaying and editing width/height information in the infobar. | |
static BOOL | fConsiderLineWidths = FALSE |
Controls whether attributes (line widths mainly) are considered when calculating bounding rectangles for objects. This is used when displaying and editing width/height information in the infobar. | |
static BOOL | fUseScalingFix = FALSE |
Controls whether my scaling fix is used. | |
static BOOL | bPageDoubleClickOpenFile = FALSE |
Controls whether double-clicking on the page will show the Open dialog. | |
Private Types | |
enum | ClickActionCode { CLICKACTION_NONE, CLICKACTION_BOUNDTOPLEFT, CLICKACTION_BOUNDTOP, CLICKACTION_BOUNDTOPRIGHT, CLICKACTION_BOUNDLEFT, CLICKACTION_BOUNDRIGHT, CLICKACTION_BOUNDBOTTOMLEFT, CLICKACTION_BOUNDBOTTOM, CLICKACTION_BOUNDBOTTOMRIGHT, CLICKACTION_BOUNDTRANSFORMORIGIN, CLICKACTION_SELNONE, CLICKACTION_SELNODE, CLICKACTION_SELUNDER, CLICKACTION_SELUNDERCYCLE, CLICKACTION_SELUNDERFAIL, CLICKACTION_SELUNDERFAIL2, CLICKACTION_SELINSIDE, CLICKACTION_SELINSIDECYCLE, CLICKACTION_SELINSIDEFAIL, CLICKACTION_SELINSIDEFAIL2, CLICKACTION_SELLEAF } |
Private Member Functions | |
CC_DECLARE_MEMDUMP (SelectorTool) | |
BOOL | IsRotateCentreClicked (DocCoord ClickStart) const |
Decides whether the user has clicked the rotation centre blob, correctly handling the case where rotate blobs aren't visible. | |
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. | |
NodeRenderableInk * | FindFrom (NodeRenderableInk *pSimpleNode) const |
Front-end short-hand for NodeRenderableInk::FindCompoundFromSimple. | |
NodeRenderableInk * | EnsureInkNext (Range *range, Node *pNode) const |
Ensure that the node passed is an ink node and if not find the next object in the range that IS. | |
NodeRenderableInk * | EnsureInkPrev (Range *range, Node *pNode) const |
Ensure that the node passed is an ink node and if not find the prev object in the range that IS. | |
ClickActionCode | DetermineClickAction (NodeRenderableInk **ppActionNode, NodeRenderableInk *pLastClickNode, NodeRenderableInk *pClickSimpleNode, NodeRenderableInk *pClickCompoundNode, Spread *pStartSpread, DocCoord ClickStart, ClickModifiers ClickMods) |
Determine what action needs to be taken inresponse to a click. | |
ClickActionCode | CycleClickAction (NodeRenderableInk **ppActionNode, NodeRenderableInk *pClickCompoundNode, ClickActionCode foundAction, ClickActionCode cycleAction) |
Determine what action needs to be taken inresponse 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. | |
void | GetUserParams () |
Sets up the transformation data structure with default values read from the tool's info-bar, as set by the user. Individual transformations can override these settings later. | |
void | DoScale () |
Runs a scale transformation drag of the selection. | |
void | DoSquash () |
Runs a squash transformation drag on the selection. | |
void | DoShear () |
Runs a shear transformation drag on the selection. | |
void | DoTranslate () |
Runs a translation transformation drag on the selection. | |
void | DoRotate () |
Runs a rotation transformation drag on the selection. | |
void | DoDragBox () |
Runs a selector tool drag-box operation. | |
void | DoDragRotateCentre () |
Runs a drag operation for moving the centre of rotation blob around. | |
BOOL | StartXformDrag (TransOperation *pXformDragOp, DragType dragtype) |
Fills in any remaining fields of the transformation data structure(s) and calls the Tranform virtual function that initiates a mouse drag. | |
BOOL | StartXformImmediate (const TCHAR *chOpToken, void *pvParam2) |
Runs a tranformation Operation in response to the user changing settings on the tool's info-bar. This works through the traditional 'Invoke' method. | |
void | RenderBoundBlobs (Spread *, DocRect *, const DocRect &) |
This function is called from the RenderToolBlobs function. If the Bounds Blobs should be displayed (ie the user has switch them on) then this function is used to draw them. The blobs appear as a small rect at each corner of the selection rectangle as well as one at the midpoint of each of the sides of the rectangle. This function should not be called directly, but only through RenderToolBlobs(). | |
void | RenderRotateBlobs (Spread *, DocRect *, const DocRect &) |
Draws the blobs that appear when the Rotate/Shear mode of the selector tool is entered. These blobs appear in the same places as the Bounds Blobs, around the edge of the given rectangle. The only difference is their appearance. The blobs at the corner of the selection appear as small curved arrows to indicate rotation and the ones on the side of the selection appear as straight arrows to indicate shearing. | |
void | RenderRotateCentre (RenderRegion *, const DocCoord &) |
Draws the rotation centre blob at the given position. This is a separate function so that the drag code can call it as well. | |
DocRect | InflatedSelRect () const |
Calculates the position of the blobs around a selected object. | |
DocCoord | GetBoundsBlobPos (INT32 nBlob) const |
Calculates the position of a given blob within the document. | |
DocCoord | GetSelPosNearBlob (INT32 nBlob) const |
This returns the nearest point to the given blob on the selected object(s) bounding rectangle. | |
INT32 | BoundsBlobHitTest (const DocCoord &dcMousePos) const |
Checks if the given coordinate is over or very near a blob. | |
void | ChangeCursorAndText (INT32 nBlobID, String_256 *pStr, Cursor **pPointerShape) |
Changes the cursor shape according to thew nBlobID parameter. Each blob has its own cursor shape. | |
void | SetKeyDownCursor (ClickModifiers cmods) |
Decodes the bit-field fKeyStates, indicating which combination of modifier keys are down, and sets the cursor appropriately. | |
void | ResetCursorNow () |
Called when a mouse button-up event or end-of-drag event occurs. It resets the cursor according to which modifier keys are up or down, without a key event having to take place. | |
void | RenderOtherToolBlobs () |
Called when the selector tool changes the selection, and yet may not be the *current* tool. This can happen nowadays with the right mouse button popping up the menu and changing the selection whilst in any tool. | |
Static Private Member Functions | |
static BOOL | ReadPrefs () |
Reads settings concerning the selector tool from the .INI file. | |
static BOOL | IsNearBlob (const DocCoord &dcBlobOrigin, const DocCoord &dcTestPoint) |
Private helper function for SelectorTool::BlobHitTest. | |
Private Attributes | |
BOOL | fAllowIdleProcessing |
BOOL | fMouseHasMoved |
Spread * | SelectionSpread |
SelRange * | SelectRange |
DocRect | SelectionRect |
DocRect | SelectionRectNoAttr |
XLONG | xlSelectionArea |
XLONG | xlSelectionPerim |
BOOL | fIgnoreSelChange |
DocCoord | ClickStart |
Spread * | StartSpread |
ClickModifiers | ClickMods |
ClickType | TypeOfClick |
INT32 | nClickedBoundsBlob |
BOOL | fPossibleToggleClick |
BOOL | fIsBlobDrag |
NodeRenderableInk * | pClickSimpleNode |
NodeRenderableInk * | pClickCompoundNode |
NodeRenderableInk * | pLastClickNode |
NodeRenderableInk * | pPreProcClickNode |
TransformData | tdParams |
DocCoord | dcRotateCentre |
BOOL | fRotateCentreIsValid |
TransformBoundingData | BoundingData |
BlobStyle | bsBlobStyle |
BlobType | eCurrentBlobs |
BOOL | fShowToolBlobs |
INT32 | nLastSelectedBlob |
BOOL | fValidSelectedBlob |
BOOL | m_bComputeAreaDetails |
Cursor * | pNormalCursor |
Cursor * | pAdjustCursor |
Cursor * | pUnderCursor |
Cursor * | pInsideCursor |
Cursor * | pUnderAdjustCursor |
Cursor * | pInsideAdjustCursor |
Cursor * | pLeafCursor |
Cursor * | pLeafAdjustCursor |
Cursor * | pALLCursor |
Cursor * | pNWSECursor |
Cursor * | pNESWCursor |
Cursor * | pNSCursor |
Cursor * | pWECursor |
Cursor * | pGradFillCursor |
Cursor * | pDragRotateCursor |
Cursor * | pHorzGuideCursor |
Cursor * | pVertGuideCursor |
Static Private Attributes | |
static BOOL | fSelectorIsCaching = FALSE |
static TCHAR * | FamilyName = _T("Selection Tools") |
static TCHAR * | ToolName = _T("Selector Tool") |
static TCHAR * | Purpose = _T("Selecting objects and editing the selection") |
static TCHAR * | Author = _T("Justin Flude & Phil Martin") |
static INT32 | CursorStackID = 5000 |
static SelectorInfoBarOp * | pInfoBarOp = NULL |
static BlobManager * | pBlobManager = NULL |
static INT32 | nBlobBorder = 4 |
Determines how wide a border, in millimetres, to inflate the bounding rectangle of the selected object, when drawing blobs around it. The default is 4 mm. | |
static unsigned | fBlobPref = 1 |
Determines which blobs should be initially displayed. This should really be done by the blob manager! | |
static BOOL | fAllowCorelToggleClick = TRUE |
If TRUE (the default) allows a single click on a selected object to toggle between bounds blobs & rotate blobs, for compatibility with Corel Draw. This toggling option not allowed when Object blobs are shown, it would be a pain. | |
static BOOL | fSelectUnderLikeArtWorks = FALSE |
If TRUE then the select-under feature, Alt-Click, works exactly like ArtWorks, so that an Alt-Click on an unselected object selects that object rather than the object underneath. If FALSE then Alt-Click always selects an object underneath the clicked object, irrespective of whether the clicked object was selected or not. The default is FALSE, as this is consistent with the way that select-inside works. | |
static BOOL | bNormalClickCheckProfileDialog = FALSE |
static BOOL | bGlineSAllowed = TRUE |
Friends | |
class | SelectorInfoBarOp |
class | OpDragRotateCentre |
Classes | |
struct | IterateFlags |
Definition at line 237 of file selector.h.
|
Definition at line 598 of file selector.h. 00599 { 00600 NO_BLOBS, // use the fShowToolBlobs flag instead of this! 00601 BOUNDS_BLOBS, 00602 ROTATE_BLOBS 00603 };
|
|
Definition at line 419 of file selector.h. 00419 { 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 };
|
|
Dummy Constructor - sets member pointers to NULL and initialises the record of which blobs are displayed (initially only "tiny" blobs).
Definition at line 385 of file selector.cpp. 00386 : //pInfoBarOp(NULL), 00387 fRotateCentreIsValid(FALSE), 00388 eCurrentBlobs(BOUNDS_BLOBS), 00389 fShowToolBlobs(TRUE), 00390 fValidSelectedBlob(FALSE) 00391 { 00392 // initialise all our member pointers to NULL. 00393 00394 SelectionSpread = NULL; 00395 SelectRange = NULL; 00396 StartSpread = NULL; 00397 00398 pClickSimpleNode = NULL; 00399 pClickCompoundNode = NULL; 00400 pLastClickNode = NULL; 00401 pPreProcClickNode = NULL; 00402 00403 pNormalCursor = NULL; 00404 pAdjustCursor = NULL; 00405 pUnderCursor = NULL; 00406 pInsideCursor = NULL; 00407 pUnderAdjustCursor = NULL; 00408 pInsideAdjustCursor = NULL; 00409 pLeafCursor = NULL; 00410 pLeafAdjustCursor = NULL; 00411 00412 pALLCursor = NULL; 00413 pNWSECursor = NULL; 00414 pNESWCursor = NULL; 00415 pNSCursor = NULL; 00416 pWECursor = NULL; 00417 pGradFillCursor = NULL; 00418 pDragRotateCursor = NULL; 00419 pHorzGuideCursor = NULL; 00420 pVertGuideCursor = NULL; 00421 00422 bGlineSAllowed = TRUE; 00423 m_bComputeAreaDetails = FALSE; 00424 00425 // Pre-load the resource we're going to use 00426 (CamArtProvider::Get())->FindBitmap( _R(IDBMP_HANDLE_6) ); 00427 (CamArtProvider::Get())->FindBitmap( _R(IDBMP_HANDLE_3) ); 00428 (CamArtProvider::Get())->FindBitmap( _R(IDBMP_HANDLE_1) ); 00429 (CamArtProvider::Get())->FindBitmap( _R(IDBMP_HANDLE_8) ); 00430 (CamArtProvider::Get())->FindBitmap( _R(IDBMP_HANDLE_45) ); 00431 (CamArtProvider::Get())->FindBitmap( _R(IDBMP_HANDLE_45) ); 00432 (CamArtProvider::Get())->FindBitmap( _R(IDBMP_HANDLE_27) ); 00433 (CamArtProvider::Get())->FindBitmap( _R(IDBMP_HANDLE_27) ); 00434 (CamArtProvider::Get())->FindBitmap( _R(IDBMP_HANDLE_CENTRE) ); 00435 }
|
|
Destructor (Virtual). Does nothing.
Definition at line 449 of file selector.cpp.
|
|
Definition at line 615 of file selector.h. 00615 { bGlineSAllowed = newVal; }
|
|
Turns idle processing on or off. During idle events the selector tool updates the status bar, so if a drag operation, for instance, wants to place its own text in the status bar while it is running it should call this function at its start and at its end.
Definition at line 1095 of file selector.cpp. 01096 { 01097 // Make sure the selector is the current tool. 01098 ERROR3IF(Tool::GetCurrent() == NULL || Tool::GetCurrent()->GetID() != TOOLID_SELECTOR, 01099 "Selector isn't current tool in SelectorTool::AllowIdleWork"); 01100 01101 if (Tool::GetCurrent() != NULL && Tool::GetCurrent()->GetID() == TOOLID_SELECTOR) 01102 { 01103 // Set the flag. 01104 #ifndef SELECTION_AREA_FEATURE 01105 ((SelectorTool*) Tool::GetCurrent())->fAllowIdleProcessing = fIsAllowed; 01106 #else 01107 ((SelectorTool*) Tool::GetCurrent())->fAllowIdleProcessing = fIsAllowed; 01108 // ((SelectorTool*) Tool::GetCurrent())->fAllowIdleProcessing = (fIsAllowed || m_bComputeAreaDetails); 01109 #endif 01110 } 01111 // >>>> 01112 //((SelectorTool*) Tool::GetCurrent())->fAllowIdleProcessing = FALSE; 01113 }
|
|
Definition at line 1664 of file selector.cpp. 01670 { 01671 ERROR2IF(SelectTemplate.IsEmpty(),FALSE,"Asked to Append an empty message"); 01672 01673 // Append a message to the string, preceding it with a separator if there was something 01674 // already in the string... 01675 if (!pStr->IsEmpty()) 01676 *pStr += String_256(_R(IDS_SEL_SEPARATOR)); 01677 01678 String_256 Message; 01679 String_256* pTemplate; 01680 Message.Empty(); 01681 01682 if (!cmods.Adjust || pActionNode==NULL) 01683 pTemplate = &SelectTemplate; 01684 else 01685 { 01686 if (!pActionNode->IsSelected()) 01687 pTemplate = &AddTemplate; 01688 else 01689 pTemplate = &RemoveTemplate; 01690 } 01691 01692 if (pTemplate->IsEmpty()) 01693 pTemplate = &SelectTemplate; 01694 01695 if (pActionNode==NULL) 01696 *pStr += *pTemplate; 01697 else 01698 { 01699 String_256 NodeDesc = pActionNode->Describe(FALSE); 01700 Message._MakeMsg( (TCHAR*) *pTemplate, &NodeDesc ); 01701 *pStr += Message; 01702 } 01703 01704 return TRUE; 01705 }
|
|
Definition at line 1544 of file selector.cpp. 01549 { 01550 ERROR2IF(SelectID==0,FALSE,"Asked to append a string resource with a null ID"); 01551 01552 // Append a message to the string, preceding it with a separator if there was something 01553 // already in the string... 01554 if (!pStr->IsEmpty()) 01555 *pStr += String_256(_R(IDS_SEL_SEPARATOR)); 01556 01557 String_256 Message; 01558 UINT32 TemplateID = 0; 01559 Message.Empty(); 01560 01561 if (!cmods.Adjust || pActionNode==NULL) 01562 TemplateID = SelectID; 01563 else 01564 { 01565 if (!pActionNode->IsSelected()) 01566 TemplateID = AddID; 01567 else 01568 TemplateID = RemoveID; 01569 } 01570 01571 if (TemplateID==0) 01572 TemplateID = SelectID; 01573 01574 if (pActionNode==NULL) 01575 *pStr += String_256(TemplateID); 01576 else 01577 { 01578 String_256 sTemplateID(TemplateID); 01579 String_256 NodeDesc = pActionNode->Describe(FALSE); 01580 Message._MakeMsg( (TCHAR*) sTemplateID, &NodeDesc); 01581 *pStr += Message; 01582 } 01583 01584 return TRUE; 01585 }
|
|
Definition at line 1632 of file selector.cpp. 01633 { 01634 // Append a message to the string, preceding it with a separator if there was something 01635 // already in the string... 01636 if (!pStr->IsEmpty()) 01637 *pStr += String_256(_R(IDS_SEL_SEPARATOR)); 01638 *pStr += String; 01639 01640 return TRUE; 01641 }
|
|
Definition at line 1604 of file selector.cpp. 01605 { 01606 // Append a message to the string, preceding it with a separator if there was something 01607 // already in the string... 01608 if (!pStr->IsEmpty()) 01609 *pStr += String_256(_R(IDS_SEL_SEPARATOR)); 01610 *pStr += String_256(StringID); 01611 01612 return TRUE; 01613 }
|
|
Reimplemented from Tool_v1. Definition at line 279 of file selector.h. 00279 {return TRUE;}
|
|
Responds to an attribute-changing message by forcing the selection range to update its bounds, then forces a recalc and redraw of the tool's bounds blobs.
Definition at line 4926 of file selector.cpp. 04927 { 04928 // If there's no SelRange then we're a bit stuck. 04929 if (SelectRange == NULL) return; 04930 04931 // Make sure the SelRange has updated bounds. 04932 SelectRange->UpdateBounds(); 04933 04934 // Force a recalc and redraw of the bounds blobs. 04935 SelectionHasChanged(); 04936 }
|
|
Checks for under/overflow in fixed-point calculations.
Reimplemented from DragTool. Definition at line 5724 of file selector.cpp. 05725 { 05726 const double fpMinFixPt = 1.0 / (INT32(SHRT_MAX) + 1); // 1/32768 05727 const double fpMaxFixPt = SHRT_MAX; // 32767 05728 double fp = fabs(fpFixedVal); 05729 return fp < fpMinFixPt || fp > fpMaxFixPt; 05730 }
|
|
Checks if the given coordinate is over or very near a blob.
Definition at line 5302 of file selector.cpp. 05303 { 05304 // If there isn't a selected object or no blobs at all we can't have clicked on a blob. 05305 if (SelectionRect.IsEmpty() || !fShowToolBlobs) return 0; 05306 05307 // Calculate the rectangle describing where the blobs are on the screen, and the 05308 // mid-points of its horizontal and vertical sides. 05309 DocRect drBlobRect = InflatedSelRect(); 05310 INT32 nMidX = (drBlobRect.lo.x + drBlobRect.hi.x) / 2; 05311 INT32 nMidY = (drBlobRect.lo.y + drBlobRect.hi.y) / 2; 05312 05313 // Check each blob in turn to see if it is near enough to the given point. 05314 if (IsNearBlob(dcMousePos, DocCoord(drBlobRect.lo.x, drBlobRect.hi.y))) 05315 return 1; // top-left 05316 else if (IsNearBlob(dcMousePos, DocCoord(nMidX, drBlobRect.hi.y))) 05317 return 2; // top-mid 05318 else if (IsNearBlob(dcMousePos, drBlobRect.hi)) 05319 return 3; // top-right 05320 else if (IsNearBlob(dcMousePos, DocCoord(drBlobRect.lo.x, nMidY))) 05321 return 4; // mid-left 05322 else if (IsNearBlob(dcMousePos, DocCoord(drBlobRect.hi.x, nMidY))) 05323 return 5; // mid-right 05324 else if (IsNearBlob(dcMousePos, drBlobRect.lo)) 05325 return 6; // bottom-left 05326 else if (IsNearBlob(dcMousePos, DocCoord(nMidX, drBlobRect.lo.y))) 05327 return 7; // bottom-mid 05328 else if (IsNearBlob(dcMousePos, DocCoord(drBlobRect.hi.x, drBlobRect.lo.y))) 05329 return 8; // bottom-right 05330 05331 // It's not near any of them! 05332 return 0; 05333 }
|
|
Called by the info-bar when the user has clicked on the 'Show Bounds/Rotate Blobs' button. Handles keeping a record of the setting, changing the blobs on-screen etc.
Definition at line 4280 of file selector.cpp. 04281 { 04282 if (fShowToolBlobs) 04283 { 04284 // Need to hide the tool's bounds/rotate blobs 04285 pBlobManager->RenderToolBlobsOff(this, SelectionSpread, NULL); 04286 04287 // Record that we aren't showing our tool blobs. 04288 fBlobPref &= ~1; 04289 fShowToolBlobs = FALSE; 04290 } 04291 else 04292 { 04293 // Record which blobs are being displayed. 04294 fBlobPref |= 1; 04295 eCurrentBlobs = (pInfoBarOp->InRotateMode()) ? ROTATE_BLOBS : BOUNDS_BLOBS; 04296 fShowToolBlobs = TRUE; 04297 04298 // Need to draw the tool blobs on if they are needed 04299 pBlobManager->RenderToolBlobsOn(this, SelectionSpread, NULL); 04300 } 04301 }
|
|
|
|
Changes the cursor shape according to thew nBlobID parameter. Each blob has its own cursor shape.
Definition at line 1726 of file selector.cpp. 01727 { 01728 // So we can use just one switch table, just for this function, we give bounds and rotate 01729 // blobs distinct numeric ID's. 01730 if (eCurrentBlobs == ROTATE_BLOBS) nBlobID += 10; 01731 01732 // Choose an appropriate cursor. If the aspect ratio is locked then the cursor over corner 01733 // blobs is different. 01734 Cursor* pNewCursor; 01735 UINT32 nStringID; 01736 BOOL fLocked = pInfoBarOp->IsAspectLocked(); 01737 switch (nBlobID) 01738 { 01739 // Bounds: top-left & bottom-right. 01740 case 1: case 8: 01741 pNewCursor = fLocked ? pNWSECursor : pALLCursor; 01742 nStringID = _R(IDS_SEL_BOUNDSTEXT_1836); 01743 break; 01744 01745 // Bounds: top-middle & bottom-middle. 01746 case 2: case 7: 01747 pNewCursor = pNSCursor; 01748 nStringID = _R(IDS_SEL_BOUNDSTEXT_2745); 01749 break; 01750 01751 // Bounds: top-right & bottom-left. 01752 case 3: case 6: 01753 pNewCursor = fLocked ? pNESWCursor : pALLCursor; 01754 nStringID = _R(IDS_SEL_BOUNDSTEXT_1836); 01755 break; 01756 01757 // Bounds: left-middle & right-middle. 01758 case 4: case 5: 01759 pNewCursor = pWECursor; 01760 nStringID = _R(IDS_SEL_BOUNDSTEXT_2745); 01761 break; 01762 01763 // Rotate: top-left & bottom-right. 01764 case 11: case 18: 01765 pNewCursor = pNESWCursor; 01766 nStringID = _R(IDS_SEL_ROTATETEXT_1836); 01767 break; 01768 01769 // Rotate: top-middle & bottom-middle. 01770 case 12: case 17: 01771 pNewCursor = pWECursor; 01772 nStringID = _R(IDS_SEL_ROTATETEXT_2745); 01773 break; 01774 01775 // Rotate: top-right & bottom-left. 01776 case 13: case 16: 01777 pNewCursor = pNWSECursor; 01778 nStringID = _R(IDS_SEL_ROTATETEXT_1836); 01779 break; 01780 01781 // Rotate: left-middle & right-middle. 01782 case 14: case 15: 01783 pNewCursor = pNSCursor; 01784 nStringID = _R(IDS_SEL_ROTATETEXT_2745); 01785 break; 01786 01787 // Rotate: centre of rotation. 01788 case 9: case 19: 01789 pNewCursor = pDragRotateCursor; 01790 nStringID = _R(IDS_SEL_ROTATETEXT_CENTRE); 01791 break; 01792 01793 default: 01794 ENSURE(FALSE, "Bad blob ID in SelectorTool::ChangeCursor"); 01795 return; 01796 } 01797 01798 // Set the new cursor and the status bar text. 01799 *pStr = String_256(nStringID); 01800 *ppPointerShape = pNewCursor; 01801 01802 }
|
|
Determine what action needs to be taken inresponse to a click.
Definition at line 2961 of file selector.cpp. 02966 { 02967 // If we have found a node then return the specified action code... 02968 if (*ppActionNode) 02969 { 02970 return foundAction; 02971 } 02972 // Else no suitable node so see whether the click occurred over a compound node 02973 else 02974 { 02975 // If click occurred over a compound node then we can return that 02976 // along with the alternative action code... 02977 if (pClickCompoundNode) 02978 { 02979 *ppActionNode = pClickCompoundNode; 02980 return cycleAction; 02981 } 02982 else 02983 // Else if there wasn't even a compound node we must return the information that 02984 // the click occurred over white space... 02985 { 02986 *ppActionNode = NULL; 02987 return CLICKACTION_SELNONE; 02988 } 02989 } 02990 }
|
|
Allows the tool manager to extract information about the tool.
Reimplemented from Tool_v1. Definition at line 593 of file selector.cpp. 00594 { 00595 // Cast structure into the latest one we understand. 00596 ToolInfo_v1* Info = (ToolInfo_v1*) InfoPtr; 00597 Info->InfoVersion = 1; 00598 00599 // You should always have this line. 00600 Info->InterfaceVersion = GetToolInterfaceVersion(); 00601 00602 // These are all arbitrary at present. 00603 Info->Version = 1; 00604 Info->ID = GetID(); 00605 Info->TextID = _R(IDS_SELECTOR_TOOL); 00606 00607 Info->Family = FamilyName; 00608 Info->Name = ToolName; 00609 Info->Purpose = Purpose; 00610 Info->Author = Author; 00611 // Info->ToolBoxBitmap = _R(IDB_SELR_TOOLBOX); 00612 // Info->ToolBoxBitmapActive = _R(IDB_SELR_TOOLBOX_ACTIVE); 00613 00614 Info->InfoBarDialog = 0; 00615 Info->BubbleID = _R(IDBBL_SEL_TOOLICON); 00616 }
|
|
Determine what action needs to be taken inresponse to a click.
Definition at line 2759 of file selector.cpp. 02766 { 02767 *ppActionNode = NULL; 02768 02769 //-------------------------------------- 02770 // Did we click on the transform origin? 02771 if (IsRotateCentreClicked(ClickStart)) 02772 { 02773 return CLICKACTION_BOUNDTRANSFORMORIGIN; 02774 } 02775 02776 // Did we click on a bounds handle? 02777 INT32 BlobID = BoundsBlobHitTest(ClickStart); 02778 if (BlobID!=0) 02779 { 02780 return (SelectorTool::ClickActionCode)((INT32)CLICKACTION_BOUNDTOPLEFT+BlobID); 02781 } 02782 02783 //-------------------------------------- 02784 // Test "leaf" modifier... 02785 if (IsSelectLeafClick(ClickMods)) 02786 { 02787 // Go directly to leaf nodes! 02788 if (pClickSimpleNode!=pClickCompoundNode) 02789 { 02790 *ppActionNode = pClickSimpleNode; 02791 02792 // <<<<< Inclusion by Mike 11/01/96 02793 // this stuff is to check whether any parent is responding to 02794 // AllowSelectInside() and returning FALSE. Selections will not go down 02795 // into these objects if so. 02796 02797 Node* pParentNode = pClickSimpleNode->FindParent(); 02798 while (pParentNode) 02799 { 02800 if (pParentNode->IsLayer()) 02801 break; 02802 if (pParentNode->IsAnObject()) 02803 { 02804 if ( (!pParentNode->AllowSelectInside()) && 02805 ((NodeRenderableInk*)pParentNode)->CanSelectAsCompoundParent() 02806 ) 02807 { 02808 *ppActionNode = (NodeRenderableInk*)(pParentNode); 02809 } 02810 } 02811 if (pParentNode==pClickCompoundNode) 02812 break; 02813 pParentNode = pParentNode->FindParent(); 02814 } 02815 02816 // <<<<< End of inclusion 02817 } 02818 02819 // If we still haven't found what we're looking for 02820 // Cycle round to the top again... 02821 return CycleClickAction(ppActionNode,pClickCompoundNode,CLICKACTION_SELLEAF,CLICKACTION_SELNODE); 02822 } 02823 02824 //-------------------------------------- 02825 // Test "under" modifier... 02826 if (IsSelectUnderClick(ClickMods)) 02827 { 02828 // Try to perform a select under 02829 // First check that the context node is still under the pointer 02830 // If not then all we can do is a normal click operation... 02831 if (!ValidateLastClickUnder(pLastClickNode,pStartSpread,ClickStart)) 02832 return CycleClickAction(ppActionNode,pClickCompoundNode,CLICKACTION_SELUNDERFAIL2,CLICKACTION_SELUNDERFAIL2); 02833 02834 // Find the leaf node at the click position, but only search nodes 02835 // before the last clicked node. 02836 *ppActionNode = NodeRenderableInk::FindSimpleAtPoint(pStartSpread,ClickStart,pLastClickNode); 02837 // Then find a compound node containing the leaf, preferably a sibling 02838 // of the last clicked node. 02839 *ppActionNode = NodeRenderableInk::FindCompoundFromSimple(*ppActionNode,pLastClickNode); 02840 02841 // If the "under" node turns out to be the node we started from 02842 // return a failure code but go ahead and re-select it... 02843 // (If we failed to find anything under the last node, and the last node is the top node) 02844 if (*ppActionNode==NULL && pLastClickNode == pClickCompoundNode) 02845 return CycleClickAction(ppActionNode,pClickCompoundNode,CLICKACTION_SELUNDERFAIL,CLICKACTION_SELUNDERFAIL); 02846 02847 // If we still haven't found what we're looking for 02848 // Cycle round to the top again... 02849 return CycleClickAction(ppActionNode,pClickCompoundNode,CLICKACTION_SELUNDER,CLICKACTION_SELUNDERCYCLE); 02850 } 02851 02852 //-------------------------------------- 02853 // Test "member" modifier... 02854 if (IsSelectMemberClick(ClickMods)) 02855 { 02856 // See if the clicked simple node is a descendent of the last clicked node 02857 if (!ValidateLastClickInside(pLastClickNode,pClickSimpleNode)) 02858 return CycleClickAction(ppActionNode,pClickCompoundNode,CLICKACTION_SELINSIDEFAIL2,CLICKACTION_SELINSIDEFAIL2); 02859 02860 // If the node we're going to look inside is not compound and it's the top node 02861 // return a failure code but go ahead and re-select it... 02862 if (pLastClickNode && !pLastClickNode->IsCompound() && pLastClickNode == pClickCompoundNode) 02863 return CycleClickAction(ppActionNode,pClickCompoundNode,CLICKACTION_SELINSIDEFAIL,CLICKACTION_SELINSIDEFAIL); 02864 02865 // Try to perform a select inside 02866 *ppActionNode = NodeRenderableInk::FindInnerCompound(pClickSimpleNode,pLastClickNode); 02867 02868 // If we still haven't found what we're looking for 02869 // Cycle round to the top again... 02870 return CycleClickAction(ppActionNode,pClickCompoundNode,CLICKACTION_SELINSIDE,CLICKACTION_SELINSIDECYCLE); 02871 } 02872 02873 //-------------------------------------- 02874 // OK, so no modifiers are currently down 02875 // Just try to do a normal click action... 02876 return CycleClickAction(ppActionNode,pClickCompoundNode,CLICKACTION_NONE,CLICKACTION_SELNODE); 02877 }
|
|
Runs a selector tool drag-box operation.
Definition at line 4018 of file selector.cpp. 04019 { 04020 OpSelectorDragBox* pOpDragBox = new OpSelectorDragBox; 04021 if (pOpDragBox == NULL) 04022 { 04023 InformError(_R(IDS_OUT_OF_MEMORY), _R(IDS_OK)); 04024 } 04025 else 04026 { 04027 pOpDragBox->StartDragBox(StartSpread, ClickStart, ClickMods); 04028 } 04029 }
|
|
Runs a drag operation for moving the centre of rotation blob around.
Definition at line 4048 of file selector.cpp. 04049 { 04050 OpDragRotateCentre* pOp = new OpDragRotateCentre; 04051 if (pOp == NULL) 04052 { 04053 InformError(_R(IDS_OUT_OF_MEMORY), _R(IDS_OK)); 04054 } 04055 else 04056 { 04057 // Note that we have to pass the rotate centre position as the point where the 04058 // drag was initiated, to ensure that it is removed cleanly. 04059 pOp->StartDragCentreBlob(StartSpread, dcRotateCentre, ClickMods); 04060 } 04061 }
|
|
Runs a rotation transformation drag on the selection.
Definition at line 3992 of file selector.cpp. 03993 { 03994 // Set the rotation centre. 03995 // tdParams.CentreOfTrans = dcRotateCentre; 03996 03997 // Do the rotation. 03998 StartXformDrag(new OpRotateTrans, DRAGTYPE_NOSCROLL); 03999 }
|
|
Rotates the selection as initiated from the info-bar.
Definition at line 4664 of file selector.cpp. 04665 { 04666 // TRACEUSER( "JustinF", _T("Rotate\n")); 04667 04668 nClickedBoundsBlob = 0; 04669 GetUserParams(); 04670 04671 StartXformImmediate( OPTOKEN_ROTATE, &nAngle); 04672 }
|
|
Runs a scale transformation drag of the selection.
Definition at line 3877 of file selector.cpp. 03878 { 03879 // Get the setting of the "Scale Lines" button, which should only be effective in a 03880 // scale transform. 03881 tdParams.ScaleLines = pInfoBarOp->ShouldScaleLines(); 03882 03883 // Set the centre of the transform to the opposite blob. 03884 tdParams.CentreOfTrans = GetSelPosNearBlob(9 - nClickedBoundsBlob); 03885 03886 // Run the drag. 03887 StartXformDrag(new OpScaleTrans, DRAGTYPE_AUTOSCROLL); 03888 }
|
|
Scales the selected object(s) as initiated from the info-bar.
Definition at line 4514 of file selector.cpp. 04515 { 04516 // TRACEUSER( "JustinF", _T("Scale\n")); 04517 04518 // Work out the relative change in scale. 04519 DocRect SelRect = GetSelectionBounds(pInfoBarOp->DontConsiderAttrs()); 04520 double fpXscale = double(nWidth) / SelRect.Width(); 04521 double fpYscale = double(nHeight) / SelRect.Height(); 04522 04523 // Check if the scale will under- or over-flow the fixed-point numbers used in the 04524 // transform system. 04525 if (BeyondFixedRange(fpXscale) || BeyondFixedRange(fpYscale)) 04526 { 04527 TRACEUSER( "JustinF", _T("Under/overflow in SelectorTool::DoScaleImmediate\n")); 04528 pInfoBarOp->ReportEditError(_R(IDS_SEL_ERROR_TOO_SMALL_OR_LARGE)); 04529 return; 04530 } 04531 04532 // Work out the centre of the transform. 04533 nClickedBoundsBlob = (fValidSelectedBlob) ? nLastSelectedBlob : 0; 04534 GetUserParams(); 04535 04536 // Read the scale lines setting from the info bar, overriding the default setting of 04537 // FALSE. 04538 tdParams.ScaleLines = pInfoBarOp->ShouldScaleLines(); 04539 04540 // Build up the transform's parameter block and do it. 04541 FIXED16 fxParams[2]; 04542 fxParams[0] = fpXscale; 04543 fxParams[1] = fpYscale; 04544 04545 04546 StartXformImmediate( OPTOKEN_SCALE, &fxParams); 04547 }
|
|
As the previous DoScaleImmediate() ( Scales the selected object(s) as initiated by the info-bar ), except omitting calculation of the relative change in scale, and filling the transform's parameter block with the width & height instead, and sending a different optoken. Scales the selection as initiated from the info-bar.
Definition at line 4616 of file selector.cpp. 04617 { 04618 // TRACEUSER( "JustinF", _T("ScalePercent\n")); 04619 04620 // Work out the relative change in scale and check if its in (reasonable) range. 04621 double fpXscale = nWPercent / 100.0; 04622 double fpYscale = nHPercent / 100.0; 04623 if (BeyondFixedRange(fpXscale) || BeyondFixedRange(fpYscale) || 04624 fpXscale > 100 || fpYscale > 100) 04625 { 04626 TRACEUSER( "JustinF", _T("Under/overflow in SelectorTool::DoScalePercentImmediate\n")); 04627 pInfoBarOp->ReportEditError(_R(IDS_SEL_ERROR_TOO_SMALL_OR_LARGE)); 04628 return; 04629 } 04630 04631 // Work out the centre of the transform. 04632 nClickedBoundsBlob = (fValidSelectedBlob) ? nLastSelectedBlob : 0; 04633 GetUserParams(); 04634 04635 // Read the scale lines setting from the info bar, overriding the default setting of 04636 // FALSE. 04637 tdParams.ScaleLines = pInfoBarOp->ShouldScaleLines(); 04638 04639 // Package up the transformation parameters and do it. 04640 FIXED16 fxParams[2]; 04641 fxParams[0] = fpXscale; 04642 fxParams[1] = fpYscale; 04643 04644 StartXformImmediate( OPTOKEN_SCALE, fxParams); 04645 }
|
|
Runs a shear transformation drag on the selection.
Definition at line 3930 of file selector.cpp. 03931 { 03932 tdParams.CentreOfTrans = GetSelPosNearBlob(9 - nClickedBoundsBlob); 03933 StartXformDrag(new OpShearTrans, DRAGTYPE_AUTOSCROLL); 03934 }
|
|
Shears the selection, as initiated from the info-bar.
Definition at line 4691 of file selector.cpp. 04692 { 04693 // TRACEUSER( "JustinF", _T("Shear\n")); 04694 04695 if (fValidSelectedBlob && 04696 (nLastSelectedBlob == 2 || 04697 nLastSelectedBlob == 4 || 04698 nLastSelectedBlob == 5 || 04699 nLastSelectedBlob == 7)) 04700 { 04701 nClickedBoundsBlob = nLastSelectedBlob; 04702 } 04703 else 04704 { 04705 nClickedBoundsBlob = 7; // TEMP: until we work out an axis for shearing? 04706 } 04707 04708 GetUserParams(); 04709 StartXformImmediate( OPTOKEN_SHEAR, &nAngle); 04710 }
|
|
Runs a squash transformation drag on the selection.
Definition at line 3907 of file selector.cpp. 03908 { 03909 tdParams.CentreOfTrans = GetSelPosNearBlob(9 - nClickedBoundsBlob); 03910 StartXformDrag(new OpSquashTrans, DRAGTYPE_AUTOSCROLL); 03911 }
|
|
Runs a translation transformation drag on the selection.
Definition at line 3953 of file selector.cpp. 03954 { 03955 // Override the default transform parameters. 03956 tdParams.CentreOfTrans = ClickStart; 03957 03958 // Set drag pointer shape. 03959 if (CursorStackID!=CURSORID_UNSET) 03960 CursorStack::GSetTop(pALLCursor,CursorStackID); 03961 03962 // Start the translation. 03963 // WEBSTER - markn 14/2/97 03964 // Disable OLE drags in Webster 03965 #ifndef WEBSTER 03966 #if (_OLE_VER >= 0x200) 03967 if (OLEPrefs::DoOLEDrags()) 03968 StartXformDrag(new OpTranslateTrans, DRAGTYPE_OLESCROLL); 03969 else 03970 #endif 03971 #endif // WEBSTER 03972 StartXformDrag(new OpTranslateTrans, DRAGTYPE_AUTOSCROLL); 03973 }
|
|
Runs a translation of the selected object(s) initiated from the info-bar.
Definition at line 4475 of file selector.cpp. 04476 { 04477 TRACEUSER( "Matt", _T("Translate\n")); 04478 04479 // SliceHelper::ModifySelectionToContainWholeButtonElements(); 04480 04481 // Check here if the selection would be moved off the pasteboard? 04482 04483 // Package parameters and transform. 04484 nClickedBoundsBlob = 0; 04485 GetUserParams(); 04486 04487 DocRect SelRect = GetSelectionBounds(pInfoBarOp->DontConsiderAttrs()); 04488 04489 DocCoord coord (nXpos - SelRect.lo.x, nYpos - SelRect.lo.y); 04490 StartXformImmediate( OPTOKEN_TRANSLATE, &coord); 04491 04492 04493 // SliceHelper::RestoreSelection(); 04494 }
|
|
Called by the tool base-class when a drag is finished. In the selector tool this resets the cursor and always returns success. It also makes sure that the info-bar text reflects the selection, even if the drag was cancelled with the ESCAPE key.
Reimplemented from Tool_v1. Definition at line 3803 of file selector.cpp. 03804 { 03805 // Restore our normal non-drag cursor. 03806 ResetCursorNow(); 03807 03808 // If the drag was cancelled then we must manually force an update of the info-bar, 03809 // which will show incorrect bounds for the selection. 03810 if (det == DT_CANCELLED) UpdateSelectionInfo(); 03811 03812 // We always leave cancelling the drag to a capricious user. 03813 return TRUE; 03814 }
|
|
This function is called by the transform operations every time the mouse moves, so that the selector tool can keep the fields in its info bar up to date.
Reimplemented from DragTool. Definition at line 3769 of file selector.cpp. 03770 { 03771 // Debug check - WHY DO WE GET CALLS TO THIS FUNCTION WHEN THERE IS NOTHING SELECTED?!? 03772 if (SelectionSpread == NULL) 03773 { 03774 // TRACEUSER( "JustinF", _T("Null SelectionSpread in SelectorTool::DragMove ?\n")); 03775 return; 03776 } 03777 03778 // Delegate handling of this to the info-bar. 03779 if (pInfoBarOp != NULL) pInfoBarOp->SetEdit_OnDrag(pBoundingData, SelectionSpread); 03780 }
|
|
Ensure that the node passed is an ink node and if not find the next object in the range that IS.
Definition at line 3717 of file selector.cpp. 03718 { 03719 while ( pNode && !pNode->IsAnObject() ) 03720 { 03721 pNode = range->FindNext(pNode); 03722 } 03723 return (NodeRenderableInk*) pNode; 03724 }
|
|
Ensure that the node passed is an ink node and if not find the prev object in the range that IS.
Definition at line 3744 of file selector.cpp. 03745 { 03746 while ( pNode && !pNode->IsAnObject() ) 03747 { 03748 pNode = range->FindPrev(pNode); 03749 } 03750 return (NodeRenderableInk*) pNode; 03751 }
|
|
This routine computes the status line help and the pointer shape for any given mouse position in the Selector tool. It does NOT set either of these values but returns them both to the caller. It's up to the caller to decide whether to use these values or not. The tests done to figure out which pointer shapes, status help (and maybe other stuff one day) is quite complex so it's most efficient to compute them all at once and then let the caller decide which ones to actually use. The precedence of pointer shapes, status messages and other user feedback is determined by the order of the checks within this function (not by flags any more!).
Definition at line 1214 of file selector.cpp. 01221 { 01222 // Initialise the status text string and pointer shape to be "null". 01223 pStr->Empty(); 01224 *ppPointerShape = pNormalCursor; 01225 01226 if (Tool::GetCurrentID()!=TOOLID_SELECTOR) 01227 return; 01228 01229 //------------------------------------------------------------------------- 01230 // Blob cursors are top priority 01231 // 01232 // Check with the fill tool if the cursor is over one of its blobs (it's smart enough 01233 // to check if fill blobs are being displayed or not). 01234 UINT32 nStatusTextID; 01235 if (AttrFillGeometry::CheckForFillControlHit(dcPos, &nStatusTextID)) 01236 { 01237 *ppPointerShape = pGradFillCursor; 01238 *pStr = String_256(nStatusTextID); 01239 return; 01240 } 01241 01242 // If we aren't displaying our own tool blobs then don't do anything. 01243 if (fShowToolBlobs && !(SelectionRect.IsEmpty())) 01244 { 01245 // First check if we've hit the rotation centre. 01246 if (IsRotateCentreClicked(dcPos)) 01247 { 01248 ChangeCursorAndText(9, pStr, ppPointerShape); 01249 return; 01250 } 01251 01252 // Check if we hit any other bounds/rotate blob. 01253 INT32 nBlob = BoundsBlobHitTest(dcPos); 01254 if (nBlob != 0) 01255 { 01256 ChangeCursorAndText(nBlob, pStr, ppPointerShape); 01257 return; 01258 } 01259 } 01260 01261 BOOL DescribeDrag = TRUE; 01262 01263 //------------------------------------------------------------------------- 01264 // Next in priority order is the setting of the pointer shape due to 01265 // key modifiers 01266 if (!cmods.Adjust && !cmods.Constrain && !cmods.Alternative1) 01267 { 01268 *ppPointerShape = pNormalCursor; 01269 Append(pStr,T(_R(IDS_SEL_MODE0),"Normal select mode:")); 01270 goto FigureModeSet; 01271 } 01272 01273 if (cmods.Adjust && !cmods.Constrain && !cmods.Alternative1) 01274 { 01275 *ppPointerShape = pAdjustCursor; 01276 Append(pStr,T(_R(IDS_SEL_MODE1),"Adjust select:")); 01277 goto FigureModeSet; 01278 } 01279 01280 if (!cmods.Adjust && IsSelectUnderClick(cmods)) 01281 { 01282 *ppPointerShape = pUnderCursor; 01283 Append(pStr,T(_R(IDS_SEL_MODE2),"Select under:")); 01284 goto FigureModeSet; 01285 } 01286 01287 if (cmods.Adjust && IsSelectUnderClick(cmods)) 01288 { 01289 *ppPointerShape = pUnderAdjustCursor; 01290 Append(pStr,T(_R(IDS_SEL_MODE3),"Adjust select under:")); 01291 goto FigureModeSet; 01292 } 01293 01294 if (!cmods.Adjust && IsSelectMemberClick(cmods)) 01295 { 01296 *ppPointerShape = pInsideCursor; 01297 Append(pStr,T(_R(IDS_SEL_MODE4),"Force drag/Select member:")); 01298 goto FigureModeSet; 01299 } 01300 01301 if (cmods.Adjust && IsSelectMemberClick(cmods)) 01302 { 01303 *ppPointerShape = pInsideAdjustCursor; 01304 Append(pStr,T(_R(IDS_SEL_MODE5),"Force drag/Adjust select member:")); 01305 goto FigureModeSet; 01306 } 01307 01308 if (!cmods.Adjust && IsSelectLeafClick(cmods)) 01309 { 01310 *ppPointerShape = pLeafCursor; 01311 Append(pStr,T(_R(IDS_SEL_MODE6),"Select inside:")); 01312 goto FigureModeSet; 01313 } 01314 01315 if (cmods.Adjust && IsSelectLeafClick(cmods)) 01316 { 01317 *ppPointerShape = pLeafAdjustCursor; 01318 Append(pStr,T(_R(IDS_SEL_MODE7),"Adjust select inside:")); 01319 goto FigureModeSet; 01320 } 01321 01322 ERROR3("Out-of-range modifier combination in SelectorTool::FigureUserFeedback?!?"); 01323 return; 01324 01325 FigureModeSet: 01326 // Check for direct drag mode and say something about it... 01327 if (IsTranslateShortcut(cmods)) 01328 { 01329 if (SelectRange->FindFirst()) 01330 { 01331 *ppPointerShape = pALLCursor; 01332 Append(pStr,T(_R(IDS_SELINSIDE4),"Drag to move the selected objects")); 01333 } 01334 DescribeDrag = FALSE; 01335 } 01336 01337 01338 // See if there's a non-selectable object (guideline) under the mouse 01339 NodeRenderableInk* pPreProNode = FindPreProcessClickNode(pSpread,dcPos,TRUE); 01340 if (pPreProNode) 01341 { 01342 if (IS_A(pPreProNode,NodeGuideline)) 01343 { 01344 NodeGuideline* pGuideline = (NodeGuideline*)pPreProNode; 01345 if (pGuideline->GetType()==GUIDELINE_HORZ) 01346 { 01347 *ppPointerShape = pHorzGuideCursor; 01348 Append(pStr,T(_R(IDS_SELHORZGUIDE),"Drag up or down to move guideline; Drag onto top ruler to delete it")); 01349 return; 01350 } 01351 01352 if (pGuideline->GetType()==GUIDELINE_VERT) 01353 { 01354 *ppPointerShape = pVertGuideCursor; 01355 Append(pStr,T(_R(IDS_SELVERTGUIDE),"Drag left or right to move guideline; Drag onto left ruler to delete it")); 01356 return; 01357 } 01358 } 01359 } 01360 01361 //------------------------------------------------------------------------- 01362 // If we've got time to do the slow tests then go ahead and do them... 01363 if (DoSlowTests) 01364 { 01365 // Perform a hit-test at the mouse position and set the status bar text 01366 // accordingly. 01367 // Allow the hit-test to be interrupted if the mouse moves! 01368 Node* pInterruptedNode = NULL; 01369 NodeRenderableInk* pSimple = NodeRenderableInk::FindSimpleAtPoint(pSpread, 01370 dcPos, 01371 NULL, 01372 &pInterruptedNode); 01373 // If hit-test was interrupted then don't say anything about what's under the pointer! 01374 if (pInterruptedNode!=NULL) 01375 return; 01376 01377 NodeRenderableInk* pCompound = NodeRenderableInk::FindCompoundFromSimple(pSimple); 01378 01379 // If the SelRange thinks it knows what the last selected node was 01380 // we'll go along with that, otherwise we'll use our own record... 01381 Node* pLastSelNode = SelectRange->GetLastSelectedNode(); 01382 if ( pLastSelNode==NULL || !pLastSelNode->IsAnObject() ) 01383 { 01384 pLastSelNode = pLastClickNode; 01385 } 01386 01387 // Find out what we should do with the click... 01388 ClickActionCode action = CLICKACTION_NONE; 01389 NodeRenderableInk* pActionNode = NULL; 01390 action = DetermineClickAction(&pActionNode,(NodeRenderableInk*)pLastSelNode, 01391 pSimple,pCompound,pSpread,dcPos,cmods); 01392 01393 // Act upon the information... 01394 switch (action) 01395 { 01396 //-------------------------------------------------// 01397 // No action required... 01398 case CLICKACTION_NONE: 01399 break; 01400 01401 //-------------------------------------------------// 01402 // A Bounds handle was clicked on... 01403 case CLICKACTION_BOUNDTOPLEFT: 01404 case CLICKACTION_BOUNDTOP: 01405 case CLICKACTION_BOUNDTOPRIGHT: 01406 case CLICKACTION_BOUNDLEFT: 01407 case CLICKACTION_BOUNDRIGHT: 01408 case CLICKACTION_BOUNDBOTTOMLEFT: 01409 case CLICKACTION_BOUNDBOTTOM: 01410 case CLICKACTION_BOUNDBOTTOMRIGHT: 01411 case CLICKACTION_BOUNDTRANSFORMORIGIN: 01412 break; 01413 01414 //-------------------------------------------------// 01415 // Anything that's selected must be deselected... 01416 case CLICKACTION_SELNONE: 01417 if (!cmods.Adjust) 01418 { 01419 // If there are selected objects append message about clearing. 01420 if (SelectRange && SelectRange->FindFirst()) 01421 Append(pStr,T(_R(IDS_SELNONE1),"Click to clear the selection")); 01422 // Message about marquee drag 01423 if (DescribeDrag) 01424 Append(pStr,T(_R(IDS_SELNONE4),"Drag to marquee select objects")); 01425 Append(pStr,T(_R(IDS_SELNONE2),"Move pointer over object to select")); 01426 } 01427 else 01428 { 01429 // Adjust is held down so describe marquee add. 01430 if (DescribeDrag) 01431 Append(pStr,T(_R(IDS_SELNONE5),"Drag to marquee select objects to add to selection")); 01432 Append(pStr,T(_R(IDS_SELNONE3),"Move pointer over object to add/remove from selection")); 01433 } 01434 break; 01435 01436 //-------------------------------------------------// 01437 // The action node must be selected or toggled... 01438 case CLICKACTION_SELNODE: 01439 if (fShowToolBlobs && !cmods.Adjust && pActionNode->IsSelected()) 01440 if (SelectorInfoBarOp::fRotateMode) 01441 Append(pStr,T(_R(IDS_SELNODE1),"Click to change to scale & stretch bounds mode; Drag to move the selection")); 01442 else 01443 Append(pStr,T(_R(IDS_SELNODE2),"Click to change to rotate & skew bounds mode; Drag to move the selection")); 01444 else 01445 Append(pStr,cmods, 01446 T(_R(IDS_SELNODE3),"Click to select this #1%S alone; Drag to move it"), 01447 T(_R(IDS_SELNODE4),"Click to select this #1%S"), 01448 T(_R(IDS_SELNODE5),"Click to deselect this #1%S"), 01449 pActionNode); 01450 break; 01451 case CLICKACTION_SELUNDER: 01452 Append(pStr,cmods, 01453 T(_R(IDS_SELUNDER1),"Click to select the #1%S under the last selected object alone"), 01454 T(_R(IDS_SELUNDER2),"Click to select the #1%S under the last selected object"), 01455 T(_R(IDS_SELUNDER3),"Click to deselect the #1%S under the last selected object"), 01456 pActionNode); 01457 break; 01458 case CLICKACTION_SELUNDERCYCLE: 01459 Append(pStr,cmods, 01460 T(_R(IDS_SELUNDERCYCLE1),"Click to select the top #1%S alone; (Reached the bottom)"), 01461 T(_R(IDS_SELUNDERCYCLE2),"Click to select the top #1%S; (Reached the bottom)"), 01462 T(_R(IDS_SELUNDERCYCLE3),"Click to deselect the top #1%S; (Reached the bottom)"), 01463 pActionNode); 01464 break; 01465 case CLICKACTION_SELUNDERFAIL: 01466 Append(pStr,cmods, 01467 T(_R(IDS_SELUNDERFAIL1),"Click to select the #1%S alone; (Nothing under the last selected object)"), 01468 T(_R(IDS_SELUNDERFAIL2),"Click to select the #1%S; (Nothing under the last selected object)"), 01469 T(_R(IDS_SELUNDERFAIL3),"Click to deselect the #1%S; (Nothing under the last selected object)"), 01470 pActionNode); 01471 break; 01472 case CLICKACTION_SELUNDERFAIL2: 01473 Append(pStr,cmods, 01474 T(_R(IDS_SELUNDERFAIL21),"Click to select the #1%S alone; (The last selected object is not under the pointer)"), 01475 T(_R(IDS_SELUNDERFAIL22),"Click to select the #1%S; (The last selected object is not under the pointer)"), 01476 T(_R(IDS_SELUNDERFAIL23),"Click to deselect the #1%S; (The last selected object is not under the pointer)"), 01477 pActionNode); 01478 break; 01479 case CLICKACTION_SELINSIDE: 01480 // Append(pStr,T(_R(IDS_SELINSIDE4),"Drag to move selected objects")); <<<< 01481 Append(pStr,cmods, 01482 T(_R(IDS_SELINSIDE1),"Click to select the #1%S member of the last selected object alone"), 01483 T(_R(IDS_SELINSIDE2),"Click to select the #1%S member of the last selected object"), 01484 T(_R(IDS_SELINSIDE3),"Click to deselect the #1%S member of the last selected object"), 01485 pActionNode); 01486 break; 01487 case CLICKACTION_SELINSIDECYCLE: 01488 // Append(pStr,T(_R(IDS_SELINSIDECYCLE4),"Drag to move selected objects")); <<<< 01489 Append(pStr,cmods, 01490 T(_R(IDS_SELINSIDECYCLE1),"Click to select the top #1%S alone; (Reached the simplest object)"), 01491 T(_R(IDS_SELINSIDECYCLE2),"Click to select the top #1%S; (Reached the simplest object)"), 01492 T(_R(IDS_SELINSIDECYCLE3),"Click to deselect the top #1%S; (Reached the simplest object)"), 01493 pActionNode); 01494 break; 01495 case CLICKACTION_SELINSIDEFAIL: 01496 // Append(pStr,T(_R(IDS_SELINSIDEFAIL2),"Drag to move selected objects")); <<<< 01497 Append(pStr,T(_R(IDS_SELINSIDEFAIL1),"Nothing inside this object")); 01498 break; 01499 case CLICKACTION_SELINSIDEFAIL2: 01500 // Append(pStr,T(_R(IDS_SELINSIDEFAIL24),"Drag to move selected objects")); <<<< 01501 Append(pStr,cmods, 01502 T(_R(IDS_SELINSIDEFAIL21),"Click to select the #1%S alone; (The pointer is not over a member of the last selected object)"), 01503 T(_R(IDS_SELINSIDEFAIL22),"Click to select the #1%S; (The pointer is not over a member of the last selected object)"), 01504 T(_R(IDS_SELINSIDEFAIL23),"Click to deselect the #1%S; (The pointer is not over a member of the last selected object)"), 01505 pActionNode); 01506 break; 01507 case CLICKACTION_SELLEAF: 01508 Append(pStr,cmods, 01509 T(_R(IDS_SELLEAF1),"Click to select this #1%S alone"), 01510 T(_R(IDS_SELLEAF2),"Click to select this #1%S"), 01511 T(_R(IDS_SELLEAF3),"Click to deselect this #1%S"), 01512 pActionNode); 01513 break; 01514 //-------------------------------------------------// 01515 default: 01516 ERROR3("Unknown Click action code!"); 01517 break; 01518 }; 01519 01520 // If we're in normal click mode (no modifiers down) then remind the user 01521 // that they can use the modifer keys... 01522 if (!cmods.Adjust && !cmods.Constrain && !cmods.Alternative1) 01523 Append(pStr,_R(IDS_SELOPTIONS)); 01524 } 01525 }
|
|
Front-end short-hand for NodeRenderableInk::FindCompoundFromSimple.
Definition at line 3694 of file selector.cpp. 03695 { 03696 return NodeRenderableInk::FindCompoundFromSimple(pSimpleNode); 03697 }
|
|
This scans the nodes in the spread to see if any of them are interested in the click before it is processed in the normal way.
Currently, only NodeGuidelines can possibly be interested in this type of click
Definition at line 2069 of file selector.cpp. 02070 { 02071 ERROR2IF(pSpread == NULL,NULL,"pSpread is NULL"); 02072 02073 // Init the ptr to the node found that wants to deal with a pre process click 02074 NodeRenderableInk* pFoundNode = NULL; 02075 BOOL Found = FALSE; // Not found a node yet 02076 02077 // Start looking for layers in the spread 02078 Layer* pLayer = pSpread->FindFirstLayer(); 02079 02080 while (pLayer != NULL && !Found) 02081 { 02082 if (pLayer->IsGuide() && !pLayer->IsLocked() && pLayer->IsVisible()) 02083 { 02084 // We have a layer that's also a guide layer 02085 // Now look for the guidelines in this layer 02086 02087 Node* pNodeInLayer = pLayer->FindFirstChild(CC_RUNTIME_CLASS(NodeGuideline)); 02088 while (pNodeInLayer != NULL && !Found) 02089 { 02090 pFoundNode = (NodeGuideline*)pNodeInLayer; 02091 02092 // We have found a guideline 02093 // Get the hit test bounds 02094 DocRect Rect = pFoundNode->GetBoundingRect(FALSE,TRUE); 02095 02096 // If the click lies within its bounds, then we have found an interested node 02097 Found = (Rect.ContainsCoord(ClickPos)); 02098 02099 pNodeInLayer = pNodeInLayer->FindNext(CC_RUNTIME_CLASS(NodeGuideline)); 02100 } 02101 } 02102 02103 pLayer = pLayer->FindNextLayer(); 02104 } 02105 02106 if (Found) 02107 { 02108 // OK, we have found a node interested in a preprocess click 02109 // We now have to ensure that it's not being obscured visually by another node 02110 NodeRenderableInk* pNode = NULL; 02111 if (Interruptible) 02112 { 02113 // Allow the hit-test to be interrupted if the mouse moves! 02114 Node* pInterruptedNode = NULL; 02115 pNode = NodeRenderableInk::FindSimpleAtPoint( pSpread, 02116 ClickPos, 02117 NULL, 02118 &pInterruptedNode); 02119 // If hit-test was interrupted then don't say anything about what's under the pointer! 02120 if (pInterruptedNode!=NULL) 02121 return NULL; 02122 } 02123 else 02124 { 02125 // Can't be interrupted by mouse movement so just go for it... 02126 pNode = NodeRenderableInk::FindSimpleAtPoint(pSpread,ClickPos); 02127 } 02128 02129 if (pNode) 02130 { 02131 // Find out whether the hit node is in front of the guideline or not. 02132 // If it is, then clear the Found flag. 02133 Layer* pLowerLayer = (Layer*) pFoundNode->FindParent(CC_RUNTIME_CLASS(Layer)); // The guideline layer 02134 Layer* pNodeLayer = (Layer*) pNode->FindParent(CC_RUNTIME_CLASS(Layer)); // The layer containing the node 02135 // Make sure GuideLayer comes after NodeLayer 02136 do 02137 { 02138 pLowerLayer = pLowerLayer->FindNextLayer(); // Find the layer above the last one tested 02139 } 02140 while (pLowerLayer && pLowerLayer!=pNodeLayer); // Keep going while there is a layer 02141 // and that layer isn't the one we're looking for 02142 // Get here when either we've run out of layers or we've found the layer we want 02143 if (pLowerLayer && pLowerLayer==pNodeLayer) // If found layer above guide layer 02144 Found=FALSE; // Then flag that the guideline is obscured 02145 } 02146 } 02147 02148 if (!Found) 02149 pFoundNode = NULL; 02150 02151 return pFoundNode; 02152 }
|
|
Called by the info-bar when the user clicks one of the "flip" buttons. Gets default transformation parameters and starts an "immediate" transformation operation.
Definition at line 4366 of file selector.cpp. 04367 { 04368 if (SelectionSpread != NULL) 04369 { 04370 Range* Selection = GetApplication()->FindSelection(); 04371 RangeControl TransFlags = Selection->GetRangeControlFlags(); 04372 TransFlags.IgnoreNoneRenderable=TRUE; 04373 TransFlags.IgnoreInvisibleLayers = TRUE; 04374 Selection->SetRangeControl(TransFlags); 04375 SliceHelper::ModifySelectionToContainWholeButtonElements(); 04376 04377 04378 // Get the info-bar settings. 04379 GetUserParams(); 04380 04381 // Horizontal flips have StartBlob = 2 or 7, vertical flips have StartBlob = 4 or 5. 04382 tdParams.StartBlob = (fIsVertical) ? 4 : 2; 04383 StartXformImmediate( OPTOKEN_FLIP, NULL ); 04384 04385 04386 SliceHelper::RestoreSelection(); 04387 } 04388 }
|
|
Returns a reference to the bounds of the selected object(s). This will be empty if there is no current selection. Used internally by the info-bar.
Definition at line 4857 of file selector.cpp. 04858 { 04859 *pxlArea = xlSelectionArea; 04860 *pxlPerim = xlSelectionPerim; 04861 return TRUE; 04862 }
|
|
Determines the width of the "border" between a selected object and the bounds blobs around it. NB. there must be a selected DocView for this function to work (it relies on the selected view's scale factor).
Definition at line 5531 of file selector.cpp. 05532 { 05533 // We can only do this if there is a current DocView 05534 DocView* pDocView = DocView::GetSelected(); 05535 05536 // Make sure we are not passed in a load of junk 05537 if (pDocView == NULL) 05538 { 05539 ERROR3("No Selected DocView in SelectorTool::InflateByBlobBorder"); 05540 return(0); 05541 } 05542 05543 // We have to inflate the rectangle by (nBlobBorder) mm, so we must calculate how much 05544 // that is in DocCoord units, accounting for the view's scale factor. 05545 INT32 nBorder = (nMPperMM * nBlobBorder) << F16SHIFT; 05546 nBorder /= pDocView->GetViewScale().GetRawLong(); 05547 05548 return(nBorder); 05549 }
|
|
To find out what blobs the selector tool is displaying.
Definition at line 5129 of file selector.cpp. 05130 { 05131 return bsBlobStyle; 05132 }
|
|
Calculates the position of a given blob within the document.
Definition at line 5384 of file selector.cpp. 05385 { 05386 // Get the rectangle describing the position of the bounds blobs, and the 05387 // mid-points along its sides. 05388 DocRect drBlobRect = InflatedSelRect(); 05389 INT32 nMidX = (drBlobRect.lo.x + drBlobRect.hi.x) / 2; 05390 INT32 nMidY = (drBlobRect.lo.y + drBlobRect.hi.y) / 2; 05391 05392 DocCoord dc(0,0); 05393 switch (nBlob) 05394 { 05395 case 0: 05396 dc = DocCoord(nMidX, nMidY); break; 05397 case 1: 05398 dc = DocCoord(drBlobRect.lo.x, drBlobRect.hi.y); break; 05399 case 2: 05400 dc = DocCoord(nMidX, drBlobRect.hi.y); break; 05401 case 3: 05402 dc = drBlobRect.hi; break; 05403 case 4: 05404 dc = DocCoord(drBlobRect.lo.x, nMidY); break; 05405 case 5: 05406 dc = DocCoord(drBlobRect.hi.x, nMidY); break; 05407 case 6: 05408 dc = drBlobRect.lo; break; 05409 case 7: 05410 dc = DocCoord(nMidX, drBlobRect.lo.y); break; 05411 case 8: 05412 dc = DocCoord(drBlobRect.hi.x, drBlobRect.lo.y); break; 05413 default: 05414 ENSURE(FALSE, "Bad blob number in SelectorTool::GetBlobPos"); break; 05415 } 05416 05417 return dc; 05418 }
|
|
Returns the type of tool blobs currently being displayed, either None, Bounds, or Rotate blobs. Used internally by the info-bar.
Definition at line 5150 of file selector.cpp. 05151 { 05152 return eCurrentBlobs; 05153 }
|
|
Reimplemented from Tool_v1. Definition at line 252 of file selector.h. 00252 { return TOOLID_SELECTOR; };
|
|
Definition at line 283 of file selector.h. 00283 { return (bNormalClickCheckProfileDialog); }
|
|
Returns a reference to the bounds of the selected object(s). This will be empty if there is no current selection. Used internally by the info-bar.
Definition at line 4828 of file selector.cpp. 04829 { 04830 if (WithNoAttrs) 04831 return(SelectionRectNoAttr); 04832 04833 return SelectionRect; 04834 }
|
|
Returns a pointer to the spread containing the currently selected object(s). Used internally by the info-bar.
Definition at line 4803 of file selector.cpp. 04804 { 04805 return SelectionSpread; 04806 }
|
|
This returns the nearest point to the given blob on the selected object(s) bounding rectangle.
Definition at line 5439 of file selector.cpp. 05440 { 05441 // Use the selection bounds. If we should include line widths, then we use a large rectangle. 05442 // This means we'll scale the object either so that the edge of the line doesn't move, 05443 // or so that the edge of the object (ignoring line width) doesn't move, depending on 05444 // the mode we're in. This will also affect exactly which bit of the object will snap 05445 // to the grid. 05446 DocRect SelRect = GetSelectionBounds(pInfoBarOp->DontConsiderAttrs()); 05447 05448 // This function should never need to be called if the SelRect is empty. 05449 ERROR3IF(SelRect.IsEmpty(), "Empty SelRect in SelectorTool::InflatedSelRect"); 05450 05451 // Calculate the midpoints of the sides of the rectangle. 05452 INT32 nMidX = (SelRect.lo.x + SelRect.hi.x) / 2; 05453 INT32 nMidY = (SelRect.lo.y + SelRect.hi.y) / 2; 05454 05455 // Here we go . . . 05456 DocCoord dc(0,0); 05457 switch (nBlob) 05458 { 05459 case 0: 05460 dc = DocCoord(nMidX, nMidY); break; 05461 case 1: 05462 dc = DocCoord(SelRect.lo.x, SelRect.hi.y); break; 05463 case 2: 05464 dc = DocCoord(nMidX, SelRect.hi.y); break; 05465 case 3: 05466 dc = SelRect.hi; break; 05467 case 4: 05468 dc = DocCoord(SelRect.lo.x, nMidY); break; 05469 case 5: 05470 dc = DocCoord(SelRect.hi.x, nMidY); break; 05471 case 6: 05472 dc = SelRect.lo; break; 05473 case 7: 05474 dc = DocCoord(nMidX, SelRect.lo.y); break; 05475 case 8: 05476 dc = DocCoord(SelRect.hi.x, SelRect.lo.y); break; 05477 default: 05478 ENSURE(FALSE, "Bad blob number in SelectorTool::GetSelPosNearBlob"); break; 05479 } 05480 return dc; 05481 }
|
|
Figure out what the status text for the Selector tool is at the given position on the given spread with the given click modifiers.
Reimplemented from Tool_v1. Definition at line 1873 of file selector.cpp. 01874 { 01875 ERROR2IF(ptext==NULL,FALSE,"ptext is NULL!"); 01876 01877 // StartSpread = pSpread; 01878 // ClickStart = DocPos; 01879 // ClickMods = cmods; 01880 01881 Cursor* pPtr; // Dummy to hold unused pointer shape computed by FigureUserFeedback 01882 FigureUserFeedback(pSpread, DocPos, cmods, TRUE, ptext, &pPtr); 01883 01884 if (CursorStackID!=CURSORID_UNSET) 01885 CursorStack::GSetTop(pPtr,CursorStackID); 01886 01887 return TRUE; 01888 }
|
|
Sets up the transformation data structure with default values read from the tool's info-bar, as set by the user. Individual transformations can override these settings later.
Definition at line 3835 of file selector.cpp. 03836 { 03837 // Get the button settings. NB. ScaleLines should be FALSE for all except the scale 03838 // transform, or it affects lines of thickness > 0. 03839 tdParams.ScaleLines = FALSE; 03840 tdParams.LockAspect = pInfoBarOp->IsAspectLocked(); 03841 tdParams.StartBlob = nClickedBoundsBlob; 03842 03843 // tdParams.LeaveCopy = pInfoBarOp->ShouldLeaveCopy(); 03844 // tdParams.TransFills = pInfoBarOp->ShouldTransFills(); 03845 tdParams.LeaveCopy = FALSE; 03846 tdParams.TransFills = TRUE; 03847 03848 // Set the default transform centre to the centre of the select object(s), if any. 03849 /* if (SelectionSpread != NULL && !SelectionRect.IsEmpty()) 03850 { 03851 DocRect dr = InflatedSelRect(); 03852 tdParams.CentreOfTrans.x = (dr.lo.x + dr.hi.x) / 2; 03853 tdParams.CentreOfTrans.y = (dr.lo.y + dr.hi.y) / 2; 03854 } */ 03855 03856 tdParams.CentreOfTrans = dcRotateCentre; 03857 tdParams.pRange = 0; 03858 }
|
|
Called when the selector tool must process a mouse button-up event. Note that such events are NOT sent if an Operation etc has run a drag in response to a CLICKTYPE_DRAG.
Definition at line 2566 of file selector.cpp. 02567 { 02568 // If the SelRange thinks it knows what the last selected node was 02569 // we'll go along with that, otherwise we'll use our own record... 02570 Node* pLastSelNode = SelectRange->GetLastSelectedNode(); 02571 if ( pLastSelNode==NULL || !pLastSelNode->IsAnObject() ) 02572 { 02573 pLastSelNode = pLastClickNode; 02574 } 02575 02576 // Find out what we should do with the click... 02577 ClickActionCode action = CLICKACTION_NONE; 02578 NodeRenderableInk* pActionNode = NULL; 02579 action = DetermineClickAction(&pActionNode,(NodeRenderableInk*)pLastSelNode, 02580 pClickSimpleNode,pClickCompoundNode,StartSpread,ClickStart,ClickMods); 02581 02582 // Act upon the information... 02583 switch (action) 02584 { 02585 //-------------------------------------------------// 02586 // No action required... 02587 case CLICKACTION_NONE: 02588 break; 02589 02590 //-------------------------------------------------// 02591 // A Bounds handle was clicked on... 02592 case CLICKACTION_BOUNDTOPLEFT: 02593 case CLICKACTION_BOUNDTOP: 02594 case CLICKACTION_BOUNDTOPRIGHT: 02595 case CLICKACTION_BOUNDLEFT: 02596 case CLICKACTION_BOUNDRIGHT: 02597 case CLICKACTION_BOUNDBOTTOMLEFT: 02598 case CLICKACTION_BOUNDBOTTOM: 02599 case CLICKACTION_BOUNDBOTTOMRIGHT: 02600 case CLICKACTION_BOUNDTRANSFORMORIGIN: 02601 break; 02602 02603 //-------------------------------------------------// 02604 // Anything that's selected must be deselected... 02605 case CLICKACTION_SELNONE: 02606 { 02607 // Don't clear selection if was an adjust click 02608 // (Change requested by Charles and Alan Burns) 02609 if (!ClickMods.Adjust) 02610 { 02611 // Markn 29/9/95: We ignore this if the click happend on a guideline. 02612 // If another type of node needs to behave like this, then a virt func in node 02613 // will be required instead of the hideous IS_A() clause in the 'if' statement 02614 if (pPreProcClickNode == NULL || !IS_A(pPreProcClickNode,NodeGuideline)) 02615 { 02616 // If the selector is not the current tool, get the tool to render its blobs BEFORE the selection changes 02617 RenderOtherToolBlobs(); 02618 02619 02620 NodeRenderableInk::DeselectAll(); 02621 ResetDefaults(); 02622 pLastClickNode = NULL; 02623 InvalidateRotationCentre(); 02624 02625 // If the selector is not the current tool, get the tool to render its blobs AFTER the selection changes 02626 RenderOtherToolBlobs(); 02627 02628 // Make sure the selection range stuff is updated and sends notifications. 02629 SelectRange->Update(TRUE); 02630 } 02631 } 02632 break; 02633 } 02634 02635 //-------------------------------------------------// 02636 // The action node must be selected or toggled... 02637 case CLICKACTION_SELNODE: 02638 case CLICKACTION_SELUNDER: 02639 case CLICKACTION_SELUNDERCYCLE: 02640 case CLICKACTION_SELUNDERFAIL: 02641 case CLICKACTION_SELUNDERFAIL2: 02642 case CLICKACTION_SELINSIDE: 02643 case CLICKACTION_SELINSIDECYCLE: 02644 case CLICKACTION_SELINSIDEFAIL: 02645 case CLICKACTION_SELINSIDEFAIL2: 02646 case CLICKACTION_SELLEAF: 02647 { 02648 ERROR3IF(pActionNode == NULL,"Action and ActionNode don't agree!"); 02649 02650 // If the selector is not the current tool, get the tool to render its blobs BEFORE the selection changes 02651 RenderOtherToolBlobs(); 02652 BOOL ChangedSelection = FALSE; 02653 02654 // Alter final selection behaviour based on state of Adjust modifier... 02655 if (ClickMods.Adjust) 02656 { 02657 // If Adjust is applied, toggle the state of the action node. 02658 if (pActionNode->IsSelected()) 02659 pActionNode->DeSelect(TRUE); 02660 else 02661 pActionNode->Select(TRUE); 02662 ChangedSelection = TRUE; 02663 } 02664 else 02665 { 02666 // Special case: 02667 // If this is a menu click on a selected node then don't upset the selection... 02668 if (pActionNode->IsSelected() 02669 && ClickMods.Menu) 02670 { 02671 // Menu-click on a selected node 02672 // So don't change anything! 02673 } 02674 02675 // Special case: 02676 // Check for clicks on a selected node in the Selector tool with bounds blobs showing... 02677 else if (pActionNode->IsSelected() 02678 && fShowToolBlobs 02679 && Tool::GetCurrentID()==TOOLID_SELECTOR 02680 && !ClickMods.Menu) 02681 { 02682 // Click on a selected node 02683 // So toggle the scale/rotation mode... 02684 BOOL fNewState = !SelectorInfoBarOp::fRotateMode; 02685 if (pInfoBarOp != NULL) 02686 pInfoBarOp->SetRotateMode(fNewState); 02687 else 02688 SelectorInfoBarOp::fRotateMode = fNewState; 02689 // Redraw blobs and update flags etc. 02690 RotateButtonChange(fNewState); 02691 // Didn't change the selection! 02692 } 02693 02694 // Fell through all the special cases so it's a normal click on a normal object 02695 // Deselect any other selected objects and select the clicked object alone 02696 else 02697 { 02698 bNormalClickCheckProfileDialog = TRUE; // need to check the profile dialog 02699 02700 NodeRenderableInk::DeselectAll(); 02701 //InvalidateRotationCentre(); 02702 ResetDefaults(); 02703 pActionNode->Select(TRUE); 02704 ChangedSelection = TRUE; 02705 } 02706 } 02707 02708 // If the selector is not the current tool, get the tool to render its blobs AFTER the selection changes 02709 RenderOtherToolBlobs(); 02710 02711 // If the logic resulted in the selection actually being changed then update things... 02712 if (ChangedSelection) 02713 { 02714 // Record this node as being the last one clicked on. 02715 pLastClickNode = pActionNode; 02716 // Make sure the selection range stuff is updated and sends notifications. 02717 SelectRange->Update(TRUE); 02718 02719 bNormalClickCheckProfileDialog = FALSE; // ensure this is updated 02720 } 02721 02722 break; 02723 } 02724 //-------------------------------------------------// 02725 default: 02726 ERROR3("Unknown Click action code!"); 02727 break; 02728 }; // switch (action) 02729 02730 // Make sure the cursor reflects which keys are down, now that the mouse button has 02731 // been released. 02732 ResetCursorNow(); 02733 }
|
|
Called when the selector tool must process a mouse double-click. Currently does nothing.
Definition at line 2354 of file selector.cpp. 02355 { 02356 if (SelectorTool::bPageDoubleClickOpenFile && pClickSimpleNode==NULL && pClickCompoundNode==NULL) 02357 { 02358 // The user has double-clicked on the page 02359 // Interpret this as a request to open a file 02360 OpDescriptor* pOpDesc = OpDescriptor::FindOpDescriptor( OPTOKEN_FILEOPEN ) ; 02361 if (pOpDesc) 02362 pOpDesc->Invoke(); 02363 return; 02364 } 02365 02366 // Treat double clicks like two single clicks, for now. 02367 HandleSingleClick(); 02368 }
|
|
Called when the selector tool must process a mouse drag.
Definition at line 2387 of file selector.cpp. 02388 { 02389 // First check to see if the user is accidentally dragging with the menu button 02390 // If so then exit immediately! 02391 // Removed by Phil to allow dragging with the menu button 02392 // if (ClickMods.Menu) 02393 // return; 02394 02395 // Karim 12/07/2000 02396 // If the Adjust modifier is set (means the Shift key is pressed), then we'll forget 02397 // our click info, which is the trigger for our marquee-select behaviour. 02398 // This lets you start a marquee select by dragging from on top of an object, which 02399 // previously resulted in the object being dragged instead. 02400 if (ClickMods.Adjust) 02401 { 02402 pClickSimpleNode = NULL; 02403 pClickCompoundNode = NULL; 02404 } 02405 02406 // Next check for the translate keyboard shortcut. If we detect it run the translate 02407 // operation, provided there is something selected. 02408 if (IsTranslateShortcut(ClickMods)) 02409 { 02410 if (SelectionSpread != NULL) 02411 { 02412 // There is a selection, so start a translate drag... 02413 nClickedBoundsBlob = 0; 02414 GetUserParams(); 02415 DoTranslate(); 02416 } 02417 return; 02418 } 02419 02420 // Check if the click is on the rotation centre, so that has priority over all other 02421 // blob actions. 02422 if (IsRotateCentreClicked(ClickStart)) 02423 { 02424 // We are trying to drag the rotation centre blob. 02425 DoDragRotateCentre(); 02426 return; 02427 } 02428 02429 // Next, check if the click is on one of the other tool blobs. Set the transforms' 02430 // parameters according to the way the user has set the info-bar. Code within the 02431 // DoXXXX functions may override fields set here. NB. the call to GetUserParams() 02432 // must come AFTER nClickedBoundsBlob is set. 02433 nClickedBoundsBlob = BoundsBlobHitTest(ClickStart); 02434 GetUserParams(); 02435 if (nClickedBoundsBlob != 0) 02436 { 02437 SelectRange->MakePartialSelectionWhole(); 02438 02439 // Run the appropriate transform for the kind of blob clicked on. 02440 switch (nClickedBoundsBlob) 02441 { 02442 // Corner blob. 02443 case 1: case 3: case 6: case 8: 02444 if (pInfoBarOp->InRotateMode()) DoRotate(); else DoScale(); 02445 break; 02446 02447 // Edge blob. 02448 case 2: case 4: case 5: case 7: 02449 if (pInfoBarOp->InRotateMode()) DoShear(); else DoSquash(); 02450 break; 02451 02452 // That's enough blobs for now. 02453 default: 02454 ERROR3("Bad blob number in SelectorTool::HandleSingleClick"); 02455 break; 02456 } 02457 02458 // Clicks on blobs should have nothing more to do. 02459 return; 02460 } 02461 02462 // Right, that's the blobs dealt with. If we get here we clicked on either an object 02463 // (possibly already selected) or blank paper. First, check if there is an object at 02464 // the click position. 02465 if (pClickCompoundNode == NULL) 02466 { 02467 // There is only blank paper at the click point, so the user must be trying to start 02468 // a marquee selection drag. Run the drag-box operation. 02469 DoDragBox(); 02470 return; 02471 } 02472 02473 // Is the clicked object already selected? Note that the user may be trying to click on 02474 // a simple object selected inside a group that itself is not selected, so we must be 02475 // careful to check the state of the right nodes here. 02476 // 02477 // The logic here is: 02478 // If the clicked simple node or any of it's parents are selected 02479 // Then DON'T alter the selection to reflect the clicked object! 02480 // 02481 BOOL SimpleInSelected = FALSE; // So far haven't encountered any selected nodes 02482 Node* pNode = pClickSimpleNode; // Make a working pointer and initialise it 02483 do 02484 { 02485 if (pNode->IsSelected()) // If the working node is selected 02486 { 02487 SimpleInSelected = TRUE; // Then the simple node or one of its parents are 02488 break; // selected so we don't need to change the selection! 02489 } 02490 pNode = pNode->FindParent(); // Else check the working node's parent 02491 } 02492 while (pNode != pClickCompoundNode->FindParent());// until we've reached the compound node's parent 02493 // (Allows the compound node itself to be checked) 02494 02495 02496 if (!SimpleInSelected) 02497 { 02498 // No. If the click was with the left button we must deselect all other objects. 02499 // If the clicked object isn't selected, we can't run a transform on it. Hence we must 02500 // select it, but we prevent it being redrawn as selected (with its little blobs). 02501 if (!ClickMods.Adjust) 02502 { 02503 // Normal click, so deslect everything before we select the clicked node... 02504 NodeRenderableInk::DeselectAll(); 02505 ResetDefaults(); 02506 } 02507 else 02508 { 02509 // We clicked with the right button, but if the click was in a different spread to 02510 // the selection we have to deselect everything anyway. 02511 Node* pNode = SelectRange->FindFirst(); 02512 if (pNode != NULL && pNode->FindParentSpread() != SelectionSpread) 02513 { 02514 // Clicked node in a different spread from previous selection, so clear selection 02515 NodeRenderableInk::DeselectAll(); 02516 } 02517 } 02518 02519 // Now that the selection state of all other objects is dealt with, make sure the 02520 // clicked object is selected. 02521 pClickCompoundNode->Select(TRUE); 02522 02523 // Force a broadcast etc of the changing selection, so that our SelectionHasChanged 02524 // function gets called. If it doesn't then SelectionSpread will remain NULL and 02525 // the info-bar won't be able to dynamically update as the object is dragged. 02526 SelectRange->Update(TRUE); 02527 } 02528 02529 // Finally, run a transform on the selected object(s). Of course, the user may not be 02530 // trying to drag the selection - if so the button will come up before a significant 02531 // drag has occurred and we can take it from there. 02532 SelectRange->MakePartialSelectionWhole(); 02533 // NOTE! pNode may no longer be selected after MakePartialSelectionWhole! 02534 02535 // MRH 16/5/00 - This is a worthwhile check as doing the DoTranslate function with an 02536 // empy bounding rect results in a major error and screws up camelots selection tool 02537 // from here on! 02538 DocRect SelRect = GetSelectionBounds(pInfoBarOp->DontConsiderAttrs()); 02539 ERROR3IF(SelRect.IsEmpty(), "We've got an Empty Bounding Rect in HandleDragClick!"); 02540 02541 if (!SelRect.IsEmpty()) 02542 { 02543 DoTranslate(); 02544 } 02545 }
|
|
Called when the selector tool must process a button-down mouse event.
Definition at line 2315 of file selector.cpp. 02316 { 02317 // Make sure the mouse cursor reflects which modifiers are active. The keyboard handler 02318 // receives all key events such as Ctrl and SHIFT and sets the cursor appropriately. Here 02319 // we have to check if the user is using the right button, which also means Adjust, but 02320 // which will not have been detected by the key handler. 02321 // if (ClickMods.Adjust) 02322 // { 02323 // "Fake" a call of the key handler to do the work. 02324 SetKeyDownCursor(ClickMods); 02325 // } 02326 02327 // Find out which object, if any, was clicked on. We hit-detect both the simple node 02328 // that was clicked and any top-level compound object it may be part of. 02329 pClickSimpleNode = NodeRenderableInk::FindSimpleAtPoint(StartSpread, ClickStart); 02330 pClickCompoundNode = NodeRenderableInk::FindCompoundFromSimple(pClickSimpleNode); 02331 02332 // NOTE! All click handling takes place in HandleButtonUp using the information cached 02333 // here. This allows drags to be distinguished from clicks in a very clear way. 02334 }
|
|
Called when the selector tool receives a TAB keystroke. Moves the selection to the next object in render-order.
Definition at line 3042 of file selector.cpp. 03043 { 03044 #ifdef NEW_SELECTION_TAB_ITERATION 03045 //[ 03046 // Rules: 03047 // 1. if Shift is pressed, then we move forward through the tree, 03048 // otherwise we move backward. 03049 // 2. if nothing is selected, then we select the backmost or foremost 03050 // object on the spread, depending on whether Shift is pressed or not, 03051 // and taking into account locked/invisible layers. 03052 // 3. we iterate according to the rules defined by our Iterate...() methods. 03053 03054 // ignore invisible and locked layers please, and reset our starting layer to NULL. 03055 BOOL fIgnoreInvisibleLayers = TRUE; 03056 BOOL fIgnoreLockedLayers = TRUE; 03057 m_pIterStartLayer = NULL; 03058 03059 BOOL fMoveForward = fIsShifted; 03060 IterateFlags iterFlags(fIgnoreInvisibleLayers, fIgnoreLockedLayers); 03061 03062 // tell the selrange to match our settings. 03063 RangeControl rc = SelectRange->GetRangeControlFlags(); 03064 RangeControl oldrc = rc; 03065 rc.IgnoreInvisibleLayers = !iterFlags.IgnoreInvisibleLayers; 03066 rc.IgnoreLockedLayers = iterFlags.IgnoreLockedLayers; 03067 SelectRange->Range::SetRangeControl(rc); 03068 03069 Node* pThisNode = NULL; 03070 NodeRenderableInk* pInkNode = NULL; 03071 03072 // if there is a selection, then we start on its first or last member. 03073 if (SelectionSpread != NULL) 03074 { 03075 // assumes that SelectRange has PromoteToParent FALSE, and will return a valid ink-node. 03076 if (fMoveForward) 03077 { 03078 pThisNode = SelectRange->FindLast(); 03079 pThisNode = IteratePreProcess(pThisNode); 03080 pInkNode = IterateNextInk(pThisNode, iterFlags); 03081 } 03082 else 03083 { 03084 pThisNode = SelectRange->FindFirst(); 03085 pThisNode = IteratePreProcess(pThisNode); 03086 pInkNode = IteratePrevInk(pThisNode, iterFlags); 03087 03088 } 03089 03090 // we must remove the current selection before we select our chosen node. 03091 if (pInkNode != NULL) 03092 NodeRenderableInk::DeselectAll(); 03093 } 03094 03095 // no selection, so we'll give the iteration code a bad guess (NULL) in the right spot 03096 // (the first or last layer in the spread), and let it use that guess to choose the node. 03097 else 03098 { 03099 Document* pDoc = Document::GetSelected(); 03100 PORTNOTE("spread", "Multi-spread warning!") 03101 Spread* pSpread = pDoc->FindFirstSpread(); 03102 if (pSpread != NULL) 03103 { 03104 if (fMoveForward) 03105 { 03106 pThisNode = pSpread->FindLastLayer(); 03107 pInkNode = IteratePostProcessNext(NULL, pThisNode, iterFlags); 03108 } 03109 else 03110 { 03111 pThisNode = pSpread->FindFirstLayer(); 03112 pInkNode = IteratePostProcessPrev(NULL, pThisNode, iterFlags); 03113 } 03114 } 03115 } 03116 03117 // ensure the RangeControl of the selrange is reset correctly. 03118 SelectRange->Range::SetRangeControl(oldrc); 03119 03120 // Select the given node, if it exists. 03121 if (pInkNode != NULL) 03122 { 03123 pInkNode->Select(TRUE); 03124 SelectRange->Update(TRUE); 03125 } 03126 //] 03127 #else 03128 //[ 03129 // To begin, make a range that covers the entire document tree but ignores locked layers. 03130 Range rng(NULL, NULL, RangeControl(TRUE, TRUE, TRUE, TRUE)); 03131 03132 // We have two different courses of action, depending on whether there is anything 03133 // currently selected. If neither work then pNode will remain NULL and we do nothing. 03134 NodeRenderableInk* pInkNode = NULL; 03135 if (SelectionSpread != NULL) 03136 { 03137 // Something is selected. Are we tabbing forwards or backwards? 03138 if (!fIsShifted) 03139 { 03140 // Tab - move backwards. 03141 Node* pFirstNode = SelectRange->FindFirst(); 03142 if (pFirstNode != NULL) 03143 { 03144 // Ensure we're in the normal selection surface (not "inside") 03145 pFirstNode = FindFrom((NodeRenderableInk*) pFirstNode); 03146 03147 // Find the next node that could be selected. 03148 pFirstNode = rng.FindPrev(pFirstNode); 03149 pFirstNode = EnsureInkPrev(&rng, pFirstNode); 03150 03151 // If we've run out of "prev" nodes then start from the end again 03152 if (pFirstNode == NULL) 03153 { 03154 pFirstNode = rng.FindLast(); 03155 pFirstNode = EnsureInkPrev(&rng, pFirstNode); 03156 } 03157 03158 if (pFirstNode != NULL) pInkNode = (NodeRenderableInk*) pFirstNode; 03159 else TRACEUSER( "JustinF", _T("nothing in tree ?!?\n")); 03160 } 03161 } 03162 else 03163 { 03164 // Shift tab - move forwards. 03165 Node* pLastNode = SelectRange->FindLast(); 03166 if (pLastNode != NULL) 03167 { 03168 // Ensure we're in the normal selection surface (not "inside") 03169 pLastNode = FindFrom((NodeRenderableInk*) pLastNode); 03170 03171 // Find the next node that could be selected. 03172 pLastNode = rng.FindNext(pLastNode); 03173 pLastNode = EnsureInkNext(&rng, pLastNode); 03174 03175 // If we've run out of "next" nodes then start from the beginning again 03176 if (pLastNode == NULL) 03177 { 03178 pLastNode = rng.FindFirst(); 03179 pLastNode = EnsureInkNext(&rng, pLastNode); 03180 } 03181 03182 if (pLastNode != NULL) pInkNode = (NodeRenderableInk*) pLastNode; 03183 else TRACEUSER( "JustinF", _T("nothing in tree ?!?\n")); 03184 } 03185 } 03186 03187 // Before we select the node we have found, deselect everything else. 03188 if (pInkNode != NULL) NodeRenderableInk::DeselectAll(); 03189 } 03190 else 03191 { 03192 // Nothing is selected. Forwards or backwards? 03193 if (!fIsShifted) 03194 { 03195 // Tab: Backwards - find the frontmost object. 03196 pInkNode = (NodeRenderableInk*) rng.FindLast(); 03197 pInkNode = EnsureInkPrev(&rng, pInkNode); 03198 } 03199 else 03200 { 03201 // Shift-tab: Forwards - find the rearmost object. 03202 pInkNode = (NodeRenderableInk*) rng.FindFirst(); 03203 pInkNode = EnsureInkNext(&rng, pInkNode); 03204 } 03205 } 03206 03207 03208 // Select the given node, if it exists. 03209 if (pInkNode != NULL) 03210 { 03211 pInkNode->Select(TRUE); 03212 SelectRange->Update(TRUE); 03213 } 03214 03215 //] 03216 #endif 03217 }
|
|
Useful public function that adjusts a bounding rectangle by the "border" between a selected object and the bounds blobs around it. NB. there must be a selected DocView for this function to work (it relies on the selected view's scale factor).
Definition at line 5574 of file selector.cpp. 05575 { 05576 ERROR3IF(pdr->IsEmpty(), "Empty rectangle passed to SelectorTool::InflateByBlobBorder"); 05577 05578 if (pdr != NULL) 05579 pdr->Inflate(GetBlobBorderSize()); 05580 }
|
|
Calculates the position of the blobs around a selected object.
Definition at line 5505 of file selector.cpp. 05506 { 05507 DocRect dr = SelectionRect; 05508 InflateByBlobBorder(&dr); 05509 return dr; 05510 }
|
|
Used to check if the Tool was properly constructed.
Reimplemented from Tool_v1. Definition at line 468 of file selector.cpp. 00469 { 00470 /* // Claim the left Alt for our tool. 00471 ToolKeyClaimDetails Mods; 00472 Mods.Value = 0; 00473 Mods.Keys.Alternative1 = TRUE; 00474 ClaimToolKey((Tool*) this, Mods); 00475 */ 00476 // Read in the preferences. 00477 if (!ReadPrefs()) 00478 { 00479 TRACE( _T("Couldn't read Selector tool's preferences!\n")); 00480 return FALSE; 00481 } 00482 00483 // Declare the OpDescriptors of each transform. 00484 if (!OpTranslateTrans::Declare() || 00485 !OpRotateTrans::Declare() || 00486 !OpScaleTrans::Declare() || 00487 // !OpScale2Trans::Declare() || 00488 !OpShearTrans::Declare() || 00489 !OpSquashTrans::Declare() || 00490 !OpFlipTrans::Declare() || 00491 !OpSelectorDragBox::Declare() || 00492 !OpDragRotateCentre::Declare()) 00493 { 00494 ENSURE(FALSE, "Couldn't 'declare' all OpDescriptors in SelectorTool::Init"); 00495 return FALSE; 00496 } 00497 00498 // This should be set to NULL by default. It will be set properly below, if 00499 // everthing is working as it should 00500 pInfoBarOp = new SelectorInfoBarOp; 00501 00502 // In the debug version make sure we can create a bar. 00503 ENSURE(pInfoBarOp != NULL, "Failed to create selector tool info-bar"); 00504 if (pInfoBarOp == NULL) return FALSE; 00505 00506 // Get a permanent pointer to the blob manager. 00507 pBlobManager = GetApplication()->GetBlobManager(); 00508 ENSURE(pBlobManager != NULL, "Selector tool: couldn't get blob manager"); 00509 if (pBlobManager == NULL) return FALSE; 00510 00511 // Get a permanent pointer to the application's SelRange object. 00512 SelectRange = GetApplication()->FindSelection(); 00513 00514 // set the initial state of the blob buttons 00515 bsBlobStyle.Object = (fBlobPref & 2) != 0; 00516 bsBlobStyle.Fill = (fBlobPref & 4) != 0; 00517 bsBlobStyle.Artistic = (fBlobPref & 8) != 0; 00518 bsBlobStyle.ToolObject = TRUE; 00519 bsBlobStyle.Effect = FALSE; 00520 00521 // Object blobs & Tiny blobs are mutually exclusive. 00522 bsBlobStyle.Tiny = !bsBlobStyle.Object; 00523 00524 // If we are displaying tool blobs then decide whether they are bounds or rotate blobs. 00525 fShowToolBlobs = (fBlobPref & 1) != 0; 00526 eCurrentBlobs = (pInfoBarOp->InRotateMode()) ? ROTATE_BLOBS : BOUNDS_BLOBS; 00527 00528 // Success!! 00529 return TRUE; 00530 }
|
|
Tells the selector tool that it should position the centre of rotation in the middle of the selection's bounds, the next time there is a selection.
Definition at line 4256 of file selector.cpp. 04257 { 04258 fRotateCentreIsValid = FALSE; 04259 }
|
|
Tests whether any of the modifiers, eg. Constrain, Adjust etc, apply to the current mouse click (as received by the OnClick function).
Definition at line 3600 of file selector.cpp. 03601 { 03602 return cmods.Adjust || cmods.Constrain || cmods.Alternative1 || cmods.Menu; 03603 }
|
|
Private helper function for SelectorTool::BlobHitTest.
Definition at line 5352 of file selector.cpp. 05353 { 05354 // Get the click radius from the preferences. 05355 DocView* pDocView = DocView::GetCurrent(); 05356 ENSURE(pDocView != NULL, "Null current DocView in SelectorTool::IsNearBlob"); 05357 MILLIPOINT nNearRadius = OSRenderRegion::GetHitTestRadius(pDocView); 05358 05359 // Calculate the blob's rectangle, given it's centre, and inflate it by the 05360 // "is near enough" radius. 05361 DocRect drBlobRect; 05362 pBlobManager->GetBlobRect(DocCoord(dcBlobOrigin), &drBlobRect); 05363 drBlobRect.Inflate(nNearRadius); 05364 05365 // Return TRUE if the test point is within the blob's rectangle (a hit). 05366 return drBlobRect.ContainsCoord(dcTestPoint); 05367 }
|
|
Decides whether the user has clicked the rotation centre blob, correctly handling the case where rotate blobs aren't visible.
Definition at line 3551 of file selector.cpp. 03552 { 03553 return fShowToolBlobs && eCurrentBlobs==ROTATE_BLOBS 03554 && !(SelectionRect.IsEmpty()) && IsNearBlob(dcRotateCentre, ClickStart); 03555 }
|
|
Reports whether the current mouse click meant the user wanted to "select- leaf" or not.
Definition at line 3671 of file selector.cpp. 03672 { 03673 return (cmods.Constrain && !cmods.Alternative1); 03674 }
|
|
Reports whether the current mouse click meant the user wanted to "select- inside" or not.
Definition at line 3648 of file selector.cpp. 03649 { 03650 return (cmods.Constrain && cmods.Alternative1); 03651 }
|
|
Definition at line 273 of file selector.h. 00273 { return fSelectorIsCaching;};
|
|
Decides whether the current click is modified to be an "under" click or not.
Definition at line 3624 of file selector.cpp. 03625 { 03626 return (!cmods.Constrain && cmods.Alternative1); 03627 }
|
|
Detects whether the current mouse click modifiers denote the translate drag operation shortcut.
Definition at line 3576 of file selector.cpp. 03577 { 03578 return cmods.Constrain && cmods.Alternative1; 03579 }
|
|
Iterate over the document. See notes up above for more info. Notes: * Could be made into a non-virtual function in Node or NodeRenderableInk. Recursively calls IteratePostProcessNext().
Definition at line 3308 of file selector.cpp. 03309 { 03310 Node* pParent = (pCurrent == NULL) ? NULL : pCurrent->FindParent(); 03311 Node* pNext = (pCurrent == NULL) ? NULL : pCurrent->FindNextInk(); 03312 return IteratePostProcessNext(pNext, pParent, iterFlags); 03313 }
|
|
IterateNextInk() is brainless - it picks the next sibling of a node. This function makes an informed decision, based on that chosen node, to get the selection-tabbing order correct. See notes above for more info.
Definition at line 3337 of file selector.cpp. 03339 { 03340 // return NULL if we are given no parent. 03341 if (pParent == NULL) 03342 return NULL; 03343 03344 // we're NULL, so post-processing is based on our parent. 03345 if (pCurrent == NULL) 03346 { 03347 if (pParent->ShouldITransformWithChildren()) 03348 return IterateNextInk(pParent, iterFlags); 03349 03350 else if (pParent->IsLayer()) 03351 { 03352 Layer* pNextLayer = ((Layer*)pParent); 03353 03354 pNextLayer = pNextLayer->FindNextLayer( iterFlags.IgnoreInvisibleLayers, 03355 iterFlags.IgnoreLockedLayers ); 03356 if (pNextLayer == NULL) 03357 { 03358 Spread* pSpread = pParent->FindParentSpread(); 03359 if (pSpread != NULL) 03360 { 03361 pNextLayer = pSpread->FindFirstLayer(); 03362 if ( (iterFlags.IgnoreInvisibleLayers && !pNextLayer->IsVisible()) || 03363 (iterFlags.IgnoreLockedLayers && pNextLayer->IsLocked()) ) 03364 pNextLayer = pNextLayer->FindNextLayer( iterFlags.IgnoreInvisibleLayers, 03365 iterFlags.IgnoreLockedLayers ); 03366 } 03367 } 03368 03369 if (pNextLayer == NULL || pNextLayer == m_pIterStartLayer) 03370 return NULL; 03371 03372 if (m_pIterStartLayer == NULL) 03373 m_pIterStartLayer = pNextLayer; 03374 03375 pCurrent = pNextLayer->FindFirstChildInk(); 03376 return IteratePostProcessNext(pCurrent, pNextLayer, iterFlags); 03377 } 03378 03379 else 03380 { 03381 pCurrent = pParent->FindFirstChildInk(); 03382 if (pCurrent != NULL) 03383 pCurrent = IteratePostProcessPrev(pCurrent, pParent, iterFlags); 03384 03385 return (NodeRenderableInk*)pCurrent; 03386 } 03387 } 03388 03389 // we're non-NULL, so post-processing is based on us. 03390 else 03391 { 03392 if (pCurrent->ShouldITransformWithChildren()) 03393 { 03394 pParent = pCurrent; 03395 pCurrent = pCurrent->FindFirstChildInk(); 03396 return IteratePostProcessNext(pCurrent, pParent, iterFlags); 03397 } 03398 else if (pCurrent->IsANodeClipView()) 03399 { 03400 return IterateNextInk(pCurrent, iterFlags); 03401 } 03402 else if (pCurrent->IS_KIND_OF(NodeBlender)) 03403 { 03404 return IterateNextInk(pCurrent, iterFlags); 03405 } 03406 else 03407 return (NodeRenderableInk*)pCurrent; 03408 } 03409 }
|
|
IteratePrevInk() is brainless - it picks the previous sibling of a node. This function makes an informed decision, based on that chosen node, to get the selection-tabbing order correct. See notes above for more info.
Definition at line 3459 of file selector.cpp. 03461 { 03462 // return NULL if we are given no parent. 03463 if (pParent == NULL) 03464 return NULL; 03465 03466 // we're NULL, so post-processing is based on our parent. 03467 if (pCurrent == NULL) 03468 { 03469 if (pParent->ShouldITransformWithChildren()) 03470 return IteratePrevInk(pParent, iterFlags); 03471 03472 else if (pParent->IsLayer()) 03473 { 03474 Layer* pPrevLayer = ((Layer*)pParent); 03475 03476 pPrevLayer = pPrevLayer->FindPrevLayer( iterFlags.IgnoreInvisibleLayers, 03477 iterFlags.IgnoreLockedLayers ); 03478 if (pPrevLayer == NULL) 03479 { 03480 Spread* pSpread = pParent->FindParentSpread(); 03481 if (pSpread != NULL) 03482 { 03483 pPrevLayer = pSpread->FindLastLayer(); 03484 if ( (iterFlags.IgnoreInvisibleLayers && !pPrevLayer->IsVisible()) || 03485 (iterFlags.IgnoreLockedLayers && pPrevLayer->IsLocked()) ) 03486 pPrevLayer = pPrevLayer->FindPrevLayer( iterFlags.IgnoreInvisibleLayers, 03487 iterFlags.IgnoreLockedLayers ); 03488 } 03489 } 03490 03491 if (pPrevLayer == NULL || pPrevLayer == m_pIterStartLayer) 03492 return NULL; 03493 03494 if (m_pIterStartLayer == NULL) 03495 m_pIterStartLayer = pPrevLayer; 03496 03497 pCurrent = pPrevLayer->FindLastChildInk(); 03498 return IteratePostProcessPrev(pCurrent, pPrevLayer, iterFlags); 03499 } 03500 03501 else 03502 { 03503 pCurrent = pParent->FindLastChildInk(); 03504 if (pCurrent != NULL) 03505 pCurrent = IteratePostProcessPrev(pCurrent, pParent, iterFlags); 03506 03507 return (NodeRenderableInk*)pCurrent; 03508 } 03509 } 03510 03511 // we're non-NULL, so post-processing is based on us. 03512 else 03513 { 03514 if (pCurrent->ShouldITransformWithChildren()) 03515 { 03516 pParent = pCurrent; 03517 pCurrent = pCurrent->FindLastChildInk(); 03518 return IteratePostProcessPrev(pCurrent, pParent, iterFlags); 03519 } 03520 else if (pCurrent->IsANodeClipView()) 03521 { 03522 return IteratePrevInk(pCurrent, iterFlags); 03523 } 03524 else if (pCurrent->IS_KIND_OF(NodeBlender)) 03525 { 03526 return IteratePrevInk(pCurrent, iterFlags); 03527 } 03528 else 03529 return (NodeRenderableInk*)pCurrent; 03530 } 03531 }
|
|
Iteration pre-processing. If we're asked to iterate over the selection, and we happen to be on a node, eg a text-character, which is unsuitable for iterating from, then we need to move to a more suitable node.
Definition at line 3278 of file selector.cpp. 03279 { 03280 if (pCurrent == NULL) 03281 return NULL; 03282 03283 if (pCurrent->IsABaseTextClass()) 03284 pCurrent = ((BaseTextClass*)pCurrent)->FindParentStory(); 03285 03286 return pCurrent; 03287 }
|
|
Iterate over the document. See notes up above for more info. Notes: * Could be made into a non-virtual function in Node or NodeRenderableInk. Recursively calls IteratePostProcessPrev().
Definition at line 3430 of file selector.cpp. 03431 { 03432 Node* pParent = (pCurrent == NULL) ? NULL : pCurrent->FindParent(); 03433 Node* pPrev = (pCurrent == NULL) ? NULL : pCurrent->FindPreviousInk(); 03434 return IteratePostProcessPrev(pPrev, pParent, iterFlags); 03435 }
|
|
Dispatches mouse events to the proper handler. The tool is given a chance to handle an event first, which allows it to override the usual behaviour if necessary. If it doesn't handle the event the selected object(s) are given a chance. Finally, any events still not handled are given to the selector tool to deal with.
Reimplemented from DragTool. Definition at line 1917 of file selector.cpp. 01918 { 01919 // This divides the trace output into "click events". 01920 /* if (IsUserName("Phil")) 01921 { 01922 TRACE( _T("===========================================================================\n")); 01923 TRACE( _T("OnClick - Modifiers: ")); 01924 if (cmMods.Adjust) TRACE( _T("Adjust ")); 01925 if (cmMods.Constrain) TRACE( _T("Constrain ")); 01926 if (cmMods.Menu) TRACE( _T("Menu ")); 01927 if (cmMods.Alternative1) TRACE( _T("Alt1 ")); 01928 if (cmMods.Alternative2) TRACE( _T("Alt2 ")); 01929 TRACE( _T("\n")); 01930 } 01931 */ 01932 // We mustn't allow nested drags! 01933 if (Operation::GetCurrentDragOp() != NULL) 01934 { 01935 // TRACEUSER( "JustinF", _T("Drag already running in SelectorTool::OnClick\n")); 01936 return; 01937 } 01938 01939 // If this event marks the beginning of a possible drag then remember the position of the 01940 // mouse etc. 01941 if (ctType == CLICKTYPE_SINGLE) 01942 { 01943 ClickStart = dcPos; 01944 StartSpread = pSpread; 01945 } 01946 01947 // Save the click modifiers etc to save passing them as parameters to lower-level routines. 01948 ClickMods = cmMods; 01949 TypeOfClick = ctType; 01950 SelectRange = GetApplication()->FindSelection(); 01951 01952 // Clicks are processed in three stages. If either of these routines return TRUE then we 01953 // have no further processing to do. 01954 if (PreProcessClick()) return; 01955 if (ProcessObjectClick()) return; 01956 01957 // Here we do the processing normally specific to the selector tool. 01958 PostProcessClick(); 01959 }
|
|
Called on idle events. Performs hit-detection on the current mouse position and updates the status-bar text accordingly.
Reimplemented from Tool_v1. Definition at line 1133 of file selector.cpp. 01134 { 01135 #ifdef SELECTION_AREA_FEATURE 01136 if (m_bComputeAreaDetails) 01137 { 01138 BOOL bNeedsMoreTime = SelectRange->GetAreaDetailsWhileIdle(&xlSelectionArea, &xlSelectionPerim); 01139 if (!bNeedsMoreTime) 01140 { 01141 pInfoBarOp->SetEdit_OnSelectionChange(); 01142 pInfoBarOp->UpdateAllRecords(); 01143 m_bComputeAreaDetails = FALSE; 01144 } 01145 } 01146 #endif 01147 01148 return FALSE; 01149 /* // If the cursor is already over a blob then do nothing, as OnMouseMove will have 01150 // handled it already. We also have a "global" flag to turn idle processing on or off, 01151 // particularly useful during the running of drag Operations. 01152 // if (!fMouseHasMoved || !fAllowIdleProcessing || fCursorOverBlob || fCursorOverGradFillBlob) 01153 return TRUE; 01154 01155 // Clear this flag, so that we remember to check again next time. 01156 fMouseHasMoved = FALSE; 01157 01158 // Make sure the selected Doc is current as well. If there isn't one then what are we 01159 // doing here? 01160 Document* pdoc = Document::GetSelected(); 01161 if (pdoc != NULL) pdoc->SetCurrent(); else return TRUE; 01162 01163 // Check if the mouse is within the "selected" DocView. 01164 Spread* pSpread; 01165 DocCoord dcMousePos; 01166 if (DocView::GetCurrentMousePos(&pSpread, &dcMousePos)) 01167 { 01168 // Call nice central routine to figure out what status text to show... 01169 // Set the status bar text. 01170 String_256 Str; 01171 Cursor* pPtr; 01172 FigureUserFeedback(pSpread, dcMousePos, TRUE, &Str, &pPtr); 01173 SetStatusText( &Str ); 01174 } 01175 01176 // We always want lots more idle time, please. 01177 return TRUE; 01178 */ 01179 }
|
|
Called when a key is pressed of released. If the key is a "click modifier" such as the ALT or CTRL key then the cursor is changed to indicate whatever the tool can do with that modifier.
Reimplemented from Tool_v1. Definition at line 882 of file selector.cpp. 00883 { 00884 // Find the current state of the "click" keyboard modifiers... 00885 ClickMods = ClickModifiers::GetClickModifiers(); 00886 00887 switch (pKey->GetVirtKey()) 00888 { 00889 00890 // >>>> BODGE! These cases are only here to prevent the messages 00891 // being passed on to other key handlers (very slow!) 00892 case CAMKEY(CC_MOD_ADJUST): // bit 0 of fKeyStates (SHIFT) 00893 break; 00894 00895 case CAMKEY(CC_MOD_ALTERNATIVE): // bit 1 of fKeyStates (ALT) 00896 break; 00897 00898 case CAMKEY(CC_MOD_CONSTRAIN): // bit 2 of fKeyStates (CONTROL) 00899 break; 00900 // >>>> End 00901 00902 case CAMKEY(TAB): // moves selection to next rendered node 00903 if( pKey->IsConstrain() ) 00904 return FALSE; // We have other uses for Ctrl+Tab (switch document) 00905 00906 if (pKey->IsPress()) HandleTabKey(ClickMods.Adjust); 00907 break; 00908 00909 case CAMKEY(1): // toggle tool blobs 00910 if (pKey->IsModified()) 00911 { 00912 // if Ctrl/Alt/Shift is down, pass the message on to another handler 00913 // instead of 'absorbing' the keypress 00914 return FALSE; 00915 } 00916 if (pKey->IsPress() && !pKey->IsModified()) 00917 { 00918 BoundsButtonChange(); 00919 if (pInfoBarOp != NULL) 00920 { 00921 pInfoBarOp->SetLongGadgetValue(_R(IDC_SEL_SHOWBOUNDSBLOBS), fShowToolBlobs, FALSE); 00922 } 00923 } 00924 break; 00925 00926 case CAMKEY(2): // toggle edit blobs 00927 if (pKey->IsModified()) 00928 { 00929 return FALSE; 00930 } 00931 if (pKey->IsPress() && !pKey->IsModified()) 00932 { 00933 BlobStyle bs(TRUE); 00934 SelectionBlobChange(bs); 00935 if (pInfoBarOp != NULL) 00936 { 00937 pInfoBarOp->SetLongGadgetValue(_R(IDC_SEL_SHOWOBJECTBLOBS), bsBlobStyle.Object, FALSE); 00938 } 00939 } 00940 break; 00941 00942 case CAMKEY(3): // toggle fill blobs 00943 if (pKey->IsModified()) 00944 { 00945 return FALSE; 00946 } 00947 if (pKey->IsPress() && !pKey->IsModified()) 00948 { 00949 BlobStyle bs(FALSE, FALSE, TRUE); 00950 SelectionBlobChange(bs); 00951 if (pInfoBarOp != NULL) 00952 { 00953 pInfoBarOp->SetLongGadgetValue(_R(IDC_SEL_SHOWFILLBLOBS), bsBlobStyle.Fill, FALSE); 00954 } 00955 } 00956 break; 00957 00958 case CAMKEY(HOME): // select first object in render order 00959 if (pKey->IsPress()) 00960 { 00961 if (SelectionSpread != NULL) NodeRenderableInk::DeselectAll(); 00962 HandleTabKey(FALSE); 00963 } 00964 break; 00965 00966 case CAMKEY(END): // select last object in render order 00967 if (pKey->IsPress()) 00968 { 00969 if (SelectionSpread != NULL) NodeRenderableInk::DeselectAll(); 00970 HandleTabKey(TRUE); 00971 } 00972 break; 00973 00974 case CAMKEY(4): // toggle bounds/rotate blobs 00975 if (pKey->IsModified()) 00976 { 00977 return FALSE; 00978 } 00979 if (pKey->IsPress() && !pKey->IsModified()) 00980 { 00981 RotateButtonChange(SelectorInfoBarOp::fRotateMode = !SelectorInfoBarOp::fRotateMode); 00982 if (pInfoBarOp != NULL) 00983 { 00984 pInfoBarOp->SetLongGadgetValue(_R(IDC_SEL_ROTATEBUTTON), SelectorInfoBarOp::fRotateMode, 00985 FALSE); 00986 } 00987 } 00988 break; 00989 00990 default: // not interested in processing this 00991 return FALSE; 00992 } 00993 00994 // If we processed a click modifier then update the cursor and return that we processed 00995 // the keystroke. 00996 SetKeyDownCursor(ClickMods); 00997 00998 // Yes, we processed this key-event. 00999 return TRUE; 01000 }
|
|
Called by the tool system for the current tool when the mouse is moved outside of a drag. Checks if the mouse is over one of the tool's blobs, changing the cursor appropriately if it is.
Reimplemented from Tool_v1. Definition at line 829 of file selector.cpp. 00830 { 00831 // Note that the mouse has moved so we know to update the status-bar text on the next 00832 // idle event. 00833 fMouseHasMoved = TRUE; 00834 00835 // Make sure the cursor reflects which keys are down. It is possible for the modifier 00836 // keys to change state without key-events being generated, so we must check this on 00837 // every mouse move. 00838 // ResetCursorNow(); 00839 // Make sure the cursor reflects which keys are down. It is possible for the modifier 00840 // keys to change state without key-events being generated, so we must check this on 00841 // every mouse move. 00842 // (That means prepare the global vars for us by GetClickModifiers in FigureUserFeedback) 00843 // StartSpread = pSpread; 00844 // ClickMods = mods; 00845 // ClickStart = dcPos; 00846 00847 // If there isn't any selection, or it's in a different spread, then do nothing. 00848 // if (SelectionSpread == NULL || SelectionSpread != pSpread) 00849 // return; 00850 00851 String_256 str; 00852 Cursor* pPointerShape; 00853 00854 FigureUserFeedback(pSpread, dcPos, mods, FALSE, &str, &pPointerShape); 00855 00856 if (!(str.IsEmpty())) 00857 SetStatusText(&str); 00858 00859 if (CursorStackID!=CURSORID_UNSET) 00860 CursorStack::GSetTop(pPointerShape,CursorStackID); 00861 }
|
|
Last-chance handler for a mouse event. Calls HandleSingleClick for a CLICKTYPE_SINGLE and HandleDragClick for a CLICKTYPE_DRAG etc.
Definition at line 2271 of file selector.cpp. 02272 { 02273 switch (TypeOfClick) 02274 { 02275 case CLICKTYPE_SINGLE: 02276 HandleSingleClick(); 02277 break; 02278 02279 case CLICKTYPE_DOUBLE: 02280 HandleDoubleClick(); 02281 break; 02282 02283 case CLICKTYPE_DRAG: 02284 HandleDragClick(); 02285 break; 02286 02287 case CLICKTYPE_UP: 02288 HandleButtonUp(); 02289 break; 02290 02291 default: 02292 break; 02293 } 02294 }
|
|
This allows a click to be handled before going through the standard selector tool click handling code.
Definition at line 1983 of file selector.cpp. 01984 { 01985 // This isn't very nice but at least it's quick! 01986 // We have to check blob hits BEFORE we allow the Click PreProcessor 01987 // to look for it's hits because they take precedence. 01988 UINT32 nStatusTextID; 01989 if (AttrFillGeometry::CheckForFillControlHit(ClickStart, &nStatusTextID)) 01990 return FALSE; 01991 01992 // If we aren't displaying our own tool blobs then don't do anything. 01993 if (fShowToolBlobs && !(SelectionRect.IsEmpty())) 01994 { 01995 // First check if we've hit the rotation centre. 01996 if (IsRotateCentreClicked(ClickStart)) 01997 return FALSE; 01998 01999 // Check if we hit any other bounds/rotate blob. 02000 INT32 nBlob = BoundsBlobHitTest(ClickStart); 02001 if (nBlob != 0) 02002 return FALSE; 02003 } 02004 02005 // Find a node that might be interested on the click before the selector tool handles it 02006 // in the standard way 02007 pPreProcClickNode = FindPreProcessClickNode(StartSpread,ClickStart); 02008 02009 if (pPreProcClickNode != NULL) 02010 { 02011 if (bGlineSAllowed) 02012 { 02013 // If we have a node that's interested, give 'em a call 02014 if (pPreProcClickNode->OnClick(ClickStart, TypeOfClick, ClickMods, StartSpread)) 02015 return TRUE; 02016 } 02017 else 02018 { 02019 if (!IS_A (pPreProcClickNode, NodeGuideline)) 02020 { 02021 // If we have a node that's interested, give 'em a call 02022 if (pPreProcClickNode->OnClick(ClickStart, TypeOfClick, ClickMods, StartSpread)) 02023 return TRUE; 02024 } 02025 } 02026 } 02027 02028 // No preprocess node, or the preprocess node didn't use the click. 02029 return FALSE; 02030 }
|
|
Iterates over the selector objects, calling the OnClick method of each NodeRenderableInk and AttrFillGeometry.
Definition at line 2173 of file selector.cpp. 02174 { 02175 // Test for a click on a fill attribute first, as they aren't NodeRenderableInks, and so 02176 // won't be included in the tests below. 02177 if (AttrFillGeometry::CheckAttrClick(ClickStart, TypeOfClick, ClickMods, StartSpread)) 02178 { 02179 // TRACEUSER( "JustinF", _T("Click handled by AttrFillGeometry\n")); 02180 return TRUE; 02181 } 02182 02183 // Look for a selected object to pass the click to. 02184 Node* pNode; 02185 if (SelectRange == NULL || (pNode = SelectRange->FindFirst()) == NULL) 02186 { 02187 // TRACEUSER( "JustinF", _T("No selected object to handle click\n")); 02188 return FALSE; 02189 } 02190 02191 // If the click is in a different spread to the selection we don't handle it here. 02192 Spread* pSpread = pNode->FindParentSpread(); 02193 if (pSpread != StartSpread) 02194 { 02195 // TRACEUSER( "JustinF", _T("Click on unselected spread\n")); 02196 return FALSE; 02197 } 02198 02199 // Check if the click is on the rotation centre, so that has priority over all other 02200 // blob actions. 02201 if (IsRotateCentreClicked(ClickStart)) 02202 { 02203 // Someone clicked on the rotate centre, that's not going to do anything... 02204 return FALSE; 02205 } 02206 02207 // Next, check if the click is on one of the other tool blobs. Strictly speaking this 02208 // isn't needed because by definition the bound handles will always be outside the edit 02209 // handles 02210 if (BoundsBlobHitTest(ClickStart) != 0) 02211 { 02212 // Someone clicked on a bounds handle, that's not going to do anything... 02213 return FALSE; 02214 } 02215 02216 if (IsCurrent ()) // only do this processing if we are the current tool! 02217 { 02218 // Providing we are displaying object blobs or tool object blobs, try passing the click 02219 // on to each object in the selection. 02220 BlobManager* pBlobs = GetApplication()->GetBlobManager(); 02221 if ((pBlobs && pBlobs->GetCurrentInterest().Object) || 02222 (pBlobs && pBlobs->GetCurrentInterest().ToolObject) ) 02223 { 02224 // For all selected objects . . . 02225 while (pNode != NULL) 02226 { 02227 // Is this node ink-renderable? 02228 if (pNode->IsAnObject()) 02229 { 02230 // Yes. Does it want the click? 02231 if (((NodeRenderableInk*) pNode)->OnClick(ClickStart, TypeOfClick, 02232 ClickMods, StartSpread)) 02233 { 02234 // An object processed the click, so indicate that there's no more to do. 02235 // TRACEUSER( "JustinF", _T("Object processed click\n")); 02236 return TRUE; 02237 } 02238 } 02239 02240 // Try the next object in the selection. 02241 pNode = SelectRange->FindNext(pNode); 02242 } 02243 } 02244 02245 // If after all that we still haven't processed the click then someone else had better 02246 // have a go. 02247 } 02248 02249 return FALSE; 02250 }
|
|
Definition at line 4728 of file selector.cpp. 04729 { 04730 // only do a drag if there is a selection. 04731 if (SelectionSpread != NULL) 04732 { 04733 nClickedBoundsBlob = 0; 04734 GetUserParams(); 04735 DoTranslate(); 04736 } 04737 }
|
|
Reads settings concerning the selector tool from the .INI file.
Definition at line 549 of file selector.cpp. 00550 { 00551 return Camelot.DeclareSection(TEXT("Selector Tool"), 10) && 00552 Camelot.DeclarePref(TEXT("Selector Tool"), TEXT("BlobBorder"), 00553 &nBlobBorder, 0, 10) && 00554 Camelot.DeclarePref(TEXT("Selector Tool"), TEXT("LockAspect"), 00555 &SelectorInfoBarOp::fLockAspect, FALSE, TRUE) && 00556 // Camelot.DeclarePref(TEXT("Selector Tool"), TEXT("LeaveCopy"), 00557 // &SelectorInfoBarOp::fLeaveCopy, FALSE, TRUE) && 00558 // Camelot.DeclarePref(TEXT("Selector Tool"), TEXT("TransFills"), 00559 // &SelectorInfoBarOp::fTransFills, FALSE, TRUE) && 00560 Camelot.DeclarePref(TEXT("Selector Tool"), TEXT("ScaleLines"), 00561 &SelectorInfoBarOp::fScaleLines, FALSE, TRUE) && 00562 Camelot.DeclarePref(TEXT("Selector Tool"), TEXT("InitialBlobs"), 00563 &SelectorTool::fBlobPref, 0, UINT_MAX) && 00564 Camelot.DeclarePref(TEXT("Selector Tool"), TEXT("AllowCorelToggleClick"), 00565 &SelectorTool::fAllowCorelToggleClick, FALSE, TRUE) && 00566 Camelot.DeclarePref(TEXT("Selector Tool"), TEXT("SelectUnderLikeArtWorks"), 00567 &SelectorTool::fSelectUnderLikeArtWorks, FALSE, TRUE) && 00568 00569 Camelot.DeclarePref(TEXT("Selector Tool"), TEXT("SlaveLineWidthToButton"), &fSlaveLineWidthToButton) && 00570 Camelot.DeclarePref(TEXT("Selector Tool"), TEXT("ConsiderLineWidths"), &fConsiderLineWidths) && 00571 Camelot.DeclarePref(TEXT("Selector Tool"), TEXT("UseScalingFix"), &fUseScalingFix) && 00572 Camelot.DeclarePref(TEXT("Selector Tool"), TEXT("PageDoubleClickOpenFile"), &bPageDoubleClickOpenFile) 00573 ; 00574 }
|
|
This function is called from the RenderToolBlobs function. If the Bounds Blobs should be displayed (ie the user has switch them on) then this function is used to draw them. The blobs appear as a small rect at each corner of the selection rectangle as well as one at the midpoint of each of the sides of the rectangle. This function should not be called directly, but only through RenderToolBlobs().
Definition at line 5601 of file selector.cpp. 05603 { 05604 // Get an XOR render region (may be the first of many). 05605 RenderRegion* pRegion = DocView::RenderOnTop(pClipRect, pSpread, ClippedEOR); 05606 while (pRegion != NULL) 05607 { 05608 // Set the line and fill styles 05609 pRegion->SetLineColour(COLOUR_NONE); 05610 pRegion->SetFillColour(COLOUR_UNSELECTEDBLOB); 05611 05612 // Render a blob at each corner of the Selections bounds 05613 pRegion->DrawBlob(DocCoord(drcBlobRect.lo.x, drcBlobRect.lo.y), BT_SELECTED); 05614 pRegion->DrawBlob(DocCoord(drcBlobRect.hi.x, drcBlobRect.hi.y), BT_SELECTED); 05615 pRegion->DrawBlob(DocCoord(drcBlobRect.lo.x, drcBlobRect.hi.y), BT_SELECTED); 05616 pRegion->DrawBlob(DocCoord(drcBlobRect.hi.x, drcBlobRect.lo.y), BT_SELECTED); 05617 05618 // Find the x- and y-ordinates of the mid-point of each side. 05619 INT32 xMid = (drcBlobRect.lo.x + drcBlobRect.hi.x) / 2; 05620 INT32 yMid = (drcBlobRect.lo.y + drcBlobRect.hi.y) / 2; 05621 05622 // Render the blobs on each of the sides 05623 pRegion->DrawBlob(DocCoord(xMid, drcBlobRect.lo.y), BT_SELECTED); 05624 pRegion->DrawBlob(DocCoord(xMid, drcBlobRect.hi.y), BT_SELECTED); 05625 pRegion->DrawBlob(DocCoord(drcBlobRect.lo.x, yMid), BT_SELECTED); 05626 pRegion->DrawBlob(DocCoord(drcBlobRect.hi.x, yMid), BT_SELECTED); 05627 05628 // Render the rotation centre. 05629 // RenderRotateCentre(pRegion, dcRotateCentre); 05630 05631 // Go on to the next render region, if any. 05632 pRegion = DocView::GetNextOnTop(pClipRect); 05633 } 05634 }
|
|
Called when the selector tool changes the selection, and yet may not be the *current* tool. This can happen nowadays with the right mouse button popping up the menu and changing the selection whilst in any tool.
Definition at line 3012 of file selector.cpp. 03013 { 03014 // Get the current tool 03015 Tool* pTool = Tool::GetCurrent(); 03016 03017 // Get the tool to remove all its blobs before we deselect the nodes. 03018 // Only do this if the current tool is NOT the selector tool, 03019 // because the selector handles the selection itself through sel changed messages. 03020 if (pTool!=NULL && StartSpread!=NULL && !pTool->AreToolBlobsRenderedOnSelection()) 03021 pBlobManager->RenderToolBlobsOff(pTool, StartSpread, NULL); 03022 }
|
|
Draws the blobs that appear when the Rotate/Shear mode of the selector tool is entered. These blobs appear in the same places as the Bounds Blobs, around the edge of the given rectangle. The only difference is their appearance. The blobs at the corner of the selection appear as small curved arrows to indicate rotation and the ones on the side of the selection appear as straight arrows to indicate shearing.
Definition at line 5655 of file selector.cpp. 05656 { 05657 // Get the size of a blob at this scale. 05658 // INT32 nSize = pBlobManager->GetBlobSize(); 05659 05660 // Get an XOR render region (may be the first of many). 05661 RenderRegion* pRegion = DocView::RenderOnTop(pdrClip, pSpread, ClippedEOR); 05662 while (pRegion != NULL) 05663 { 05664 // Render a blob at each corner of the Selections bounds 05665 // This is not the correct shape etc for these blobs, but it will do for now... 05666 pRegion->DrawBitmapBlob(DocCoord(drBlob.lo.x, drBlob.lo.y), _R(IDBMP_HANDLE_6)); 05667 pRegion->DrawBitmapBlob(DocCoord(drBlob.hi.x, drBlob.hi.y), _R(IDBMP_HANDLE_3)); 05668 pRegion->DrawBitmapBlob(DocCoord(drBlob.lo.x, drBlob.hi.y), _R(IDBMP_HANDLE_1)); 05669 pRegion->DrawBitmapBlob(DocCoord(drBlob.hi.x, drBlob.lo.y), _R(IDBMP_HANDLE_8)); 05670 05671 // Find the x- and y-ordinates of the mid-point of each side. 05672 INT32 xMid = (drBlob.lo.x + drBlob.hi.x) / 2; 05673 INT32 yMid = (drBlob.lo.y + drBlob.hi.y) / 2; 05674 05675 // Render the blobs on each of the sides 05676 pRegion->DrawBitmapBlob(DocCoord(xMid, drBlob.lo.y), _R(IDBMP_HANDLE_45)); 05677 pRegion->DrawBitmapBlob(DocCoord(xMid, drBlob.hi.y), _R(IDBMP_HANDLE_45)); 05678 pRegion->DrawBitmapBlob(DocCoord(drBlob.lo.x, yMid), _R(IDBMP_HANDLE_27)); 05679 pRegion->DrawBitmapBlob(DocCoord(drBlob.hi.x, yMid), _R(IDBMP_HANDLE_27)); 05680 05681 // Render the rotation centre. 05682 RenderRotateCentre(pRegion, dcRotateCentre); 05683 05684 // Go on to the next render region, if any. 05685 pRegion = DocView::GetNextOnTop(pdrClip); 05686 } 05687 }
|
|
Draws the rotation centre blob at the given position. This is a separate function so that the drag code can call it as well.
Definition at line 5706 of file selector.cpp. 05707 { 05708 pRegion->DrawBitmapBlob(dcPos, _R(IDBMP_HANDLE_CENTRE)); 05709 }
|
|
Draws the blobs specific to the selector tool. This can include the Bounds blobs that surround the current selection, or the Rotate/Shear blobs that also surround the selection.
Reimplemented from Tool_v1. Definition at line 5169 of file selector.cpp. 05170 { 05171 // Draw the bounds blobs if there is anything to render in a view on the given spread. 05172 if (fShowToolBlobs && DocView::GetSelected() != NULL && 05173 SelectionSpread != NULL && SelectionSpread == pSpread) 05174 { 05175 // Calculate the inflated selection rectangle. 05176 DocRect drBlobRect = InflatedSelRect(); 05177 05178 // Render the appropriate blobs. 05179 switch (eCurrentBlobs) 05180 { 05181 case BOUNDS_BLOBS: 05182 RenderBoundBlobs(pSpread, pClipRect, drBlobRect); 05183 break; 05184 05185 case ROTATE_BLOBS: 05186 RenderRotateBlobs(pSpread, pClipRect, drBlobRect); 05187 break; 05188 05189 default: 05190 ENSURE(FALSE, "Unknown blob type in SelectorTool::RenderToolBlobs"); 05191 return; 05192 } 05193 } 05194 }
|
|
Called when a mouse button-up event or end-of-drag event occurs. It resets the cursor according to which modifier keys are up or down, without a key event having to take place.
Definition at line 1066 of file selector.cpp. 01067 { 01068 // Make sure the cursor reflects which keys are down. It is possible for the modifier 01069 // keys to change state without key-events being generated, so we must check this on 01070 // every mouse move. 01071 SetKeyDownCursor(ClickModifiers::GetClickModifiers()); 01072 }
|
|
Called after a click or drag event if the tool's options should be set back to certain defaults. For example, if the selection is changed to a new object then rotate blobs should be switched back to bounds blobs and the "Leave Copy" button should be OFF.
Definition at line 4759 of file selector.cpp. 04760 { 04761 // Karim 16/10/2000 04762 // We don't want to worry about resetting blobs and stuff 04763 // unless we're actually the current tool in use. 04764 if (Tool::GetCurrentID() != TOOLID_SELECTOR) 04765 return; 04766 04767 // If necessary switch back to bounds blobs. 04768 if (eCurrentBlobs != BOUNDS_BLOBS) 04769 { 04770 // "Fake" a click on the rotate toggle. 04771 pInfoBarOp->SetRotateMode(FALSE); 04772 RotateButtonChange(FALSE); 04773 } 04774 04775 /* 04776 // If necessary switch the "Leave Copy" button to OFF. 04777 if (pInfoBarOp->ShouldLeaveCopy()) 04778 { 04779 // "Fake" a click on the LeaveCopy button. 04780 pInfoBarOp->SetLeaveCopy(FALSE); 04781 } 04782 */ 04783 }
|
|
Called by the info-bar when the user clicks on the "Rotate Blobs" button, that switches between rotate blobs and bounds blobs. Handles updating on-screen blobs etc.
Definition at line 4322 of file selector.cpp. 04323 { 04324 // Hide the current blobs. 04325 pBlobManager->RenderToolBlobsOff(this, SelectionSpread, NULL); 04326 04327 // If we aren't currently displaying tool blobs then switch them on. 04328 if (!fShowToolBlobs) 04329 { 04330 // We "fake" a click on the bounds button. Note that BoundsButtonChange() will render 04331 // the new blobs and update eCurrentBlobs correctly. 04332 if (pInfoBarOp != NULL) 04333 { 04334 pInfoBarOp->SetLongGadgetValue(_R(IDC_SEL_SHOWBOUNDSBLOBS), TRUE, FALSE); 04335 } 04336 BoundsButtonChange(); 04337 return; 04338 } 04339 04340 // Update our records of which blobs should be visible. 04341 eCurrentBlobs = (fNewState) ? ROTATE_BLOBS : BOUNDS_BLOBS; 04342 04343 // Draw the new blobs. 04344 pBlobManager->RenderToolBlobsOn(this, SelectionSpread, NULL); 04345 }
|
|
Updates the centre of rotation, marking it as now 'valid'. This is called by the drag operation on successful completion.
Definition at line 4230 of file selector.cpp. 04231 { 04232 dcRotateCentre = dcNewPos; 04233 fRotateCentreIsValid = TRUE; 04234 fValidSelectedBlob = FALSE; 04235 }
|
|
Called whenever this tool is selected or deselected.
Reimplemented from Tool_v1. Definition at line 638 of file selector.cpp. 00639 { 00640 if (isSelected) 00641 { 00642 // Load the grad-fill cursor etc. 00643 pGradFillCursor = new Cursor(this, _R(IDCSR_SEL_GRADPOINT)); 00644 pNormalCursor = new Cursor(this, _R(IDCSR_SEL_NORMAL)); 00645 pAdjustCursor = new Cursor(this, _R(IDCSR_SEL_ADJUST)); 00646 pUnderCursor = new Cursor(this, _R(IDCSR_SEL_UNDER)); 00647 pInsideCursor = new Cursor(this, _R(IDCSR_SEL_INSIDE)); 00648 pUnderAdjustCursor = new Cursor(this, _R(IDCSR_SEL_UNDERADJUST)); 00649 pInsideAdjustCursor = new Cursor(this, _R(IDCSR_SEL_INSIDEADJUST)); 00650 pALLCursor = new Cursor(this, _R(IDCSR_SEL_GRADPOINT)); 00651 pLeafCursor = new Cursor(this, _R(IDCSR_SEL_LEAF)); 00652 pLeafAdjustCursor = new Cursor(this, _R(IDCSR_SEL_LEAFADJUST)); 00653 pNWSECursor = new Cursor(this, _R(IDCSR_SIZENWSE)); 00654 pNESWCursor = new Cursor(this, _R(IDCSR_SIZENESW)); 00655 pNSCursor = new Cursor(this, _R(IDCSR_SIZENS)); 00656 pWECursor = new Cursor(this, _R(IDCSR_SIZEWE)); 00657 pDragRotateCursor = new Cursor(this, _R(IDCSR_SEL_GRADPOINT)); 00658 pHorzGuideCursor = new Cursor(this, _R(IDCSR_SEL_HGUIDE)); 00659 pVertGuideCursor = new Cursor(this, _R(IDCSR_SEL_VGUIDE)); 00660 00661 // This tool has just been selected. Push an appropriate cursor. 00662 CursorStackID = CursorStack::GPush(pNormalCursor); 00663 00664 // Initially we know of no selection, above or below. 00665 SelectionSpread = NULL; 00666 pClickSimpleNode = NULL; 00667 pClickCompoundNode = NULL; 00668 pLastClickNode = NULL; 00669 pPreProcClickNode = NULL; 00670 00671 // Reset these flags used within the click logic etc. 00672 fIsBlobDrag = fPossibleToggleClick = fIgnoreSelChange = FALSE; 00673 fAllowIdleProcessing = fMouseHasMoved = TRUE; 00674 00675 // Create and display my info bar please 00676 if (pInfoBarOp != NULL) 00677 { 00678 pInfoBarOp->pSelectorTool = this; 00679 if(pInfoBarOp->WindowID == NULL) 00680 { 00681 // set its pointer to me and call its create() function to get it to set its 00682 // controls 00683 pInfoBarOp->Create(); 00684 } 00685 else 00686 { 00687 pInfoBarOp->Open(); 00688 pInfoBarOp->MakeCurrent(); 00689 } 00690 } 00691 00693 // Version 1.0 of Camelot doesn't have ArtLines, so make sure their blobs 00694 // are always OFF. 00695 bsBlobStyle.Artistic = FALSE; 00696 bsBlobStyle.Effect = FALSE; 00698 00699 // Which blobs do I want displayed 00700 // >>>> Commented on advice from Rik 00701 // if (Document::GetCurrent() != NULL) 00702 // { 00703 // Tell the blob manager about our blobs. 00704 if (pBlobManager != NULL) 00705 pBlobManager->ToolInterest(bsBlobStyle); 00706 // } 00707 00708 // Note that whenever we switch to the selector we always start in bounds 00709 // rather than rotate mode. 00710 eCurrentBlobs = BOUNDS_BLOBS; 00711 SelectorInfoBarOp::fRotateMode = FALSE; 00712 if (pInfoBarOp != NULL) 00713 { 00714 // Make sure the info-bar reflects the state of this. 00715 pInfoBarOp->SetRotateMode(SelectorInfoBarOp::fRotateMode); 00716 } 00717 00718 // Get the initial selection, if any, and render the blobs. 00719 if (UpdateSelectionInfo()) pBlobManager->RenderToolBlobsOn(this, SelectionSpread, NULL); 00720 } 00721 else 00722 { 00723 // Deselection - pop the tool's cursor(s). 00724 CursorStack::GPop(CursorStackID); 00725 CursorStackID=CURSORID_UNSET; 00726 00727 // Delete the grad-fill cursor etc. 00728 delete pGradFillCursor; 00729 delete pNormalCursor; 00730 delete pInsideCursor; 00731 delete pAdjustCursor; 00732 delete pUnderCursor; 00733 delete pUnderAdjustCursor; 00734 delete pInsideAdjustCursor; 00735 delete pLeafCursor; 00736 delete pLeafAdjustCursor; 00737 delete pALLCursor; 00738 delete pNWSECursor; 00739 delete pNESWCursor; 00740 delete pNSCursor; 00741 delete pWECursor; 00742 delete pDragRotateCursor; 00743 delete pHorzGuideCursor; 00744 delete pVertGuideCursor; 00745 00746 // Use this flag to avoid an unsightly redraw when simply changing tools. 00747 fSelectorIsCaching = TRUE; 00748 00749 // Hide and destroy the info bar. 00750 if (pInfoBarOp != NULL) 00751 { 00752 // Make sure that the info bars pointer here is set to null and close itself down. 00753 // But NOT if the application is on the way out 00754 if (pInfoBarOp->HasWindow() && !GetApplication()->CamelotIsDying() ) 00755 pInfoBarOp->Close(); 00756 pInfoBarOp->pSelectorTool = NULL; 00757 pInfoBarOp->Delete(); 00758 } 00759 00760 fSelectorIsCaching = FALSE; 00761 00762 // ensure any tool object blobs are removed. 00763 if (pBlobManager != NULL) 00764 { 00765 BlobStyle bsRemoves; 00766 bsRemoves.ToolObject = TRUE; 00767 pBlobManager->RemoveInterest(bsRemoves); 00768 } 00769 00770 // If there is a spread with the selection on it, there is still a view, 00771 // and the tool blobs are being displayed, then render them off 00772 pBlobManager->RenderToolBlobsOff(this, SelectionSpread, NULL); 00773 } 00774 }
|
|
Called when the types of blob that are being displayed is to be changed (ie, someone pressed one of the buttons on the info bar). This function tells the blob manager what it wants to know and will display or remove the Tool blobs as appropriate. You should only have one of the blobs types set to TRUE at a time. ie, only change one type of blob at once.
Definition at line 4954 of file selector.cpp. 04955 { 04956 // Get a pointer to the BlobManager 04957 BlobManager* BlobMgr = GetApplication()->GetBlobManager(); 04958 if (BlobMgr == NULL) return; 04959 04960 // The Object Blobs 04961 if (ChangingBlobs.Object==TRUE) 04962 { 04963 if (bsBlobStyle.Object==TRUE) 04964 { 04965 // Remove the Object blobs from the world 04966 BlobMgr->RemoveInterest(ChangingBlobs); 04967 ChangingBlobs.Object = bsBlobStyle.Object = FALSE; 04968 fBlobPref &= ~2; 04969 04970 // Add Tiny blobs. 04971 ChangingBlobs.Tiny = bsBlobStyle.Tiny = TRUE; 04972 BlobMgr->AddInterest(ChangingBlobs); 04973 } 04974 else 04975 { 04976 // draw the Object blobs in 04977 BlobMgr->AddInterest(ChangingBlobs); 04978 bsBlobStyle.Object = TRUE; 04979 fBlobPref |= 2; 04980 04981 // Remove the tiny blobs 04982 ChangingBlobs.Object = FALSE; 04983 ChangingBlobs.Tiny = TRUE; 04984 BlobMgr->RemoveInterest(ChangingBlobs); 04985 bsBlobStyle.Tiny = FALSE; 04986 } 04987 } 04988 04989 // The fill blobs 04990 if (ChangingBlobs.Fill==TRUE) 04991 { 04992 if (bsBlobStyle.Fill==TRUE) 04993 { 04994 // Remove the Fill blobs from the world 04995 BlobMgr->RemoveInterest(ChangingBlobs); 04996 bsBlobStyle.Fill = FALSE; 04997 fBlobPref &= ~4; 04998 } 04999 else 05000 { 05001 // draw the Fill blobs in 05002 BlobMgr->AddInterest(ChangingBlobs); 05003 bsBlobStyle.Fill = TRUE; 05004 fBlobPref |= 4; 05005 } 05006 } 05007 05008 // The Artistic Blobs 05009 if (ChangingBlobs.Artistic==TRUE) 05010 { 05011 if (bsBlobStyle.Artistic==TRUE) 05012 { 05013 // Remove the Artistic blobs from the world 05014 BlobMgr->RemoveInterest(ChangingBlobs); 05015 bsBlobStyle.Artistic = FALSE; 05016 fBlobPref &= ~8; 05017 } 05018 else 05019 { 05020 // draw the Artistic blobs in 05021 BlobMgr->AddInterest(ChangingBlobs); 05022 bsBlobStyle.Artistic = TRUE; 05023 fBlobPref |= 8; 05024 } 05025 } 05026 }
|
|
Called when the selection changes, allowing the selector tool to do things like update its tools blobs etc.
Definition at line 4878 of file selector.cpp. 04879 { 04880 // If necessary remove the blobs. 04881 pBlobManager->RenderToolBlobsOff(this, SelectionSpread, NULL); 04882 04883 // After interrogating the selection manager, is there now a selection? 04884 if (UpdateSelectionInfo()) 04885 { 04886 // Yes. Draw the tool blobs back in again, if there's a selection. 04887 pBlobManager->RenderToolBlobsOn(this, SelectionSpread, NULL); 04888 } 04889 04890 // Was the cursor over a blob? If so we must reset it. 04891 // Check if the mouse is within the "selected" DocView. 04892 Spread* pSpread; 04893 DocCoord dcMousePos; 04894 if (DocView::GetCurrentMousePos(&pSpread, &dcMousePos)) 04895 { 04896 // Call nice central routine to figure out what status text to show... 04897 // Set the status bar text. 04898 // StartSpread = pSpread; 04899 // ClickStart = dcMousePos; 04900 String_256 Str; 04901 Cursor* pPtr; 04902 FigureUserFeedback(pSpread, dcMousePos, ClickModifiers::GetClickModifiers(), TRUE, &Str, &pPtr); 04903 if (CursorStackID!=CURSORID_UNSET) 04904 CursorStack::GSetTop(pPtr,CursorStackID); 04905 } 04906 04907 // Give the info-bar a chance to update its records of the contents of the 04908 // edit-fields. 04909 pInfoBarOp->UpdateAllRecords(); 04910 04911 }
|
|
Decodes the bit-field fKeyStates, indicating which combination of modifier keys are down, and sets the cursor appropriately.
Definition at line 1020 of file selector.cpp. 01021 { 01022 // Get current position information for call to change pointer shape... 01023 Spread* pSpread; 01024 DocCoord dcMousePos; 01025 if( DocView::GetCurrentMousePos( &pSpread, &dcMousePos ) && 01026 Tool::GetCurrentID()== TOOLID_SELECTOR ) 01027 PORTNOTE("other", "Removed bar drag usage") 01028 #ifndef EXCLUDE_FROM_XARALX 01029 && !BaseBar::IsDragging()) 01030 #endif 01031 { 01032 // StartSpread = pSpread; 01033 // ClickStart = dcMousePos; 01034 // Call nice central routine to figure out what pointer shape to show... 01035 // (Set the status bar text while we're at it.) 01036 String_256 Str; 01037 Cursor* pPtr; 01038 FigureUserFeedback(pSpread, dcMousePos, cmods, TRUE, &Str, &pPtr); 01039 if (CursorStackID!=CURSORID_UNSET) 01040 CursorStack::GSetTop(pPtr,CursorStackID); 01041 if (!(Str.IsEmpty())) 01042 SetStatusText( &Str ); 01043 } 01044 }
|
|
Definition at line 284 of file selector.h. 00284 { bNormalClickCheckProfileDialog = newVal; }
|
|
Responds to a click on the "telephone keypad" by moving the centre of rotation to the given position, as described by a blob number. The blob itself will be redrawn if necessary.
Definition at line 4411 of file selector.cpp. 04412 { 04413 // If there is nothing selected then ignore this call (the "telephone keypad" should 04414 // be disabled. 04415 if (SelectionSpread == NULL) return; 04416 04417 // Remember which blob was chosen as the rotation centre. This can be useful for other 04418 // transformations. 04419 nLastSelectedBlob = nBlob; 04420 fValidSelectedBlob = TRUE; 04421 04422 // Test if the rotate centre blob is currently being displayed. If it is then hide it. 04423 if (eCurrentBlobs==ROTATE_BLOBS && fShowToolBlobs) 04424 { 04425 // Get an XOR render region (may be the first of many). 04426 DocRect drClip = OpDragRotateCentre::CalcBlobClipRect(dcRotateCentre); 04427 RenderRegion* pRegion = DocView::RenderOnTop(&drClip, SelectionSpread, ClippedEOR); 04428 while (pRegion != NULL) 04429 { 04430 // Draw the blob in each render-region. 04431 RenderRotateCentre(pRegion, dcRotateCentre); 04432 pRegion = DocView::GetNextOnTop(&drClip); 04433 } 04434 } 04435 04436 // Move to the given edge/side of the selected object(s) (or the center blob if nBlob==0) 04437 dcRotateCentre = GetSelPosNearBlob(nBlob); 04438 04439 // Mark the rotation centre as "valid", ie. positively set by the user. 04440 fRotateCentreIsValid = TRUE; 04441 04442 // Now redraw it if it was previously being displayed. 04443 if (eCurrentBlobs==ROTATE_BLOBS && fShowToolBlobs) 04444 { 04445 // Get an XOR render region (may be the first of many). 04446 DocRect drClip = OpDragRotateCentre::CalcBlobClipRect(dcRotateCentre); 04447 RenderRegion* pRegion = DocView::RenderOnTop(&drClip, SelectionSpread, ClippedEOR); 04448 while (pRegion != NULL) 04449 { 04450 // Draw the blob in each render-region. 04451 RenderRotateCentre(pRegion, dcRotateCentre); 04452 pRegion = DocView::GetNextOnTop(&drClip); 04453 } 04454 } 04455 }
|
|
Sets the status bar text to the given string.
Definition at line 1821 of file selector.cpp. 01822 { 01823 GetApplication()->UpdateStatusBarText(pStr); 01824 }
|
|
Sets the status bar text to the given string. Alternative to loading the string yourself and calling the other SetStatusText function.
Definition at line 1844 of file selector.cpp. 01845 { 01846 String_256 str(nStringID); 01847 SetStatusText(&str); 01848 }
|
|
Fills in any remaining fields of the transformation data structure(s) and calls the Tranform virtual function that initiates a mouse drag.
Definition at line 4082 of file selector.cpp. 04083 { 04084 // Couldn't allocate the op? 04085 if (pXformDragOp == NULL) 04086 { 04087 InformError(_R(IDS_OUT_OF_MEMORY), _R(IDS_OK)); 04088 return FALSE; 04089 } 04090 04091 // Get the current DocView (there must be one or we wouldn't be here). 04092 DocView* pDocView = DocView::GetCurrent(); 04093 ERROR2IF(pDocView == NULL, FALSE, "Null current DocView in SelectorTool::StartXformDrag"); 04094 04095 ERROR3IF(tdParams.StartBlob < 0 || tdParams.StartBlob > 8, "Bad blob number in SelectorTool::StartXformDrag"); 04096 04097 04098 // Calculate the "offset" from a bounds blob to the corresponding point on a selected object. 04099 // When we're using rectangles including effects of attributes, this is easy, as the offset 04100 // is a constant from the "inclusive" rectangle. However, when using the "exclusive" rect, 04101 // we have to factor in the distance from the appropriate edge of the exclusive rect to 04102 // the same edge of the inclusive rect. (If there is an object with large line thickness on 04103 // one side of the selection, and one with a small line width on the other side, the 04104 // gap between the two rectangles is different on each side!) 04105 04106 // Get the distance of the gap between the selected object (inclusive rect) and its blobs. 04107 INT32 nOffset = GetBlobBorderSize(); 04108 04109 // Get the inside and outside rectangles. The DontConsiderAttrs flag may be FALSE, in which case, 04110 // the 2 rectangles will be identical. Thus the code in the switch statements below is generic, 04111 // and will do nothing extra if we're using the inclusive bounds. 04112 DocRect Small = GetSelectionBounds(pInfoBarOp->DontConsiderAttrs()); 04113 DocRect Large = GetSelectionBounds(FALSE); 04114 04115 DocCoord dcOffset(0, 0); // Default to offsets of 0 04116 04117 // Adjust the sign of x and/or y according to the blob number in the transform 04118 // parameters. 04119 switch (tdParams.StartBlob) // Pass 1: Adjust the X offset if necessary 04120 { 04121 // Cases 0 (no blob), 2, 7 all leave x as zero 04122 04123 case 1: // Left side 04124 case 4: 04125 case 6: 04126 dcOffset.x = nOffset + (Small.lo.x - Large.lo.x); 04127 break; 04128 04129 case 3: // Right side 04130 case 5: 04131 case 8: 04132 dcOffset.x = -nOffset + (Small.hi.x - Large.hi.x); 04133 break; 04134 } 04135 04136 switch (tdParams.StartBlob) // Pass 2: Adjust the Y offset if necessary 04137 { 04138 // Cases 0 (no blob), 4, and 5 all leave y as zero 04139 04140 case 1: // Top edge 04141 case 2: 04142 case 3: 04143 dcOffset.y = -nOffset + (Small.hi.y - Large.hi.y); 04144 break; 04145 04146 case 6: // Bottom edge 04147 case 7: 04148 case 8: 04149 dcOffset.y = nOffset + (Small.lo.y - Large.lo.y); 04150 break; 04151 } 04152 04153 // Fill the Transform Bounding Data structure up here 04154 DocRect SelRect = GetSelectionBounds(pInfoBarOp->DontConsiderAttrs()); 04155 04156 BoundingData.x = SelRect.lo.x; 04157 BoundingData.y = SelRect.lo.y; 04158 BoundingData.Width = SelRect.Width(); 04159 BoundingData.Height = SelRect.Height(); 04160 BoundingData.XScale = (FIXED16) 1; 04161 BoundingData.YScale = (FIXED16) 1; 04162 BoundingData.Rotation = (ANGLE) 0; 04163 BoundingData.Shear = (ANGLE) 0; 04164 04165 // Run the transformation drag operation and return success code. 04166 pXformDragOp->DragStarted(&tdParams, this, &BoundingData, ClickStart, 04167 StartSpread, ClickMods, dcOffset, NULL, dragtype); 04168 return TRUE; 04169 }
|
|
Runs a tranformation Operation in response to the user changing settings on the tool's info-bar. This works through the traditional 'Invoke' method.
Definition at line 4192 of file selector.cpp. 04193 { 04194 // Try to find the OpDescriptor associated with the given token. 04195 OpDescriptor* pOpDesc = OpDescriptor::FindOpDescriptor( const_cast<TCHAR *>(chOpToken) ); 04196 04197 // Did we find it? 04198 if (pOpDesc == NULL) 04199 { 04200 // TRACEUSER( "JustinF", _T("Couldn't find token %s\n"), (LPCTSTR) chOpToken); 04201 ERROR3("Couldn't find OpDescriptor in Selector::StartXformImmediate"); 04202 return FALSE; 04203 } 04204 04205 // Run the transform. 04206 OpParam opparam(&tdParams, pvParam2); 04207 pOpDesc->Invoke( &opparam ); 04208 04209 return TRUE; 04210 }
|
|
deletes the cached infobar and sets it's ID to NULL -this is normally called when the selector is not the current tool - it can be forced however(on close down etc..)
Definition at line 793 of file selector.cpp. 00794 { 00795 if (pInfoBarOp) 00796 { 00797 // normally we would only uncache the infobar if we were not the current tool 00798 // but there are occasions when we might need to force it 00799 if (pInfoBarOp->pSelectorTool == NULL || Force) 00800 { 00801 pInfoBarOp->Delete(); 00802 pInfoBarOp->WindowID = NULL; 00803 } 00804 } 00805 }
|
|
Updates the selector tool's record of the spread and bounding rectangle of the current selection.
Definition at line 5212 of file selector.cpp. 05213 { 05214 // Reset all our infomation about the selection to "no selection". 05215 SelectionSpread = NULL; 05216 SelectionRect.MakeEmpty(); 05217 SelectionRectNoAttr.MakeEmpty(); 05218 xlSelectionArea = 0; 05219 xlSelectionPerim = 0; 05220 05221 // Go find the first node in the selection, so that we can find out about its spread 05222 Node* pFirstNode = SelectRange->FindFirst(); 05223 if (pFirstNode != NULL) 05224 { 05225 // Find the spread that the selection lives on, if any, and its bounds. 05226 SelectionSpread = pFirstNode->FindParentSpread(); 05227 if (SelectionSpread != NULL) 05228 { 05229 // Update the bounding rectangle of the selection. 05230 SelectionRect = SelectRange->GetBoundingRect(); 05231 SelectionRectNoAttr = SelectRange->GetBoundsWithoutAttrs(); 05232 05233 #ifdef SELECTION_AREA_FEATURE 05234 // This needs to be done in the background 05235 m_bComputeAreaDetails = TRUE; 05236 // SelectRange->GetAreaDetails(&xlSelectionArea, &xlSelectionPerim); 05237 #endif 05238 05239 // ENSURE(!SelectionRect.IsEmpty(),"Empty selection bounds in SelectorTool::UpdateSelectionInfo"); 05240 if (SelectionRect.IsEmpty()) 05241 SelectionRect.Inflate(1); 05242 05243 if (SelectionRectNoAttr.IsEmpty()) 05244 SelectionRectNoAttr.Inflate(1); 05245 05246 // If any previous routine has indicated the rotation centre should be moved back 05247 // to the centre of the selection then recalc its position. 05248 if (!fRotateCentreIsValid) 05249 { 05250 // Default rotation centre is the centre of the object. Call GetSelPosNearBlob 05251 // to calculate the position for us. 0 means blob 0, the center blob. 05252 dcRotateCentre = GetSelPosNearBlob(0); 05253 05254 nLastSelectedBlob = 0; 05255 fValidSelectedBlob = TRUE; 05256 // fRotateCentreIsValid = TRUE; 05257 // TRACEUSER( "JustinF", _T("Reseting rotation centre to middle of selection\n")); 05258 } 05259 } 05260 /* #ifdef _DEBUG 05261 else 05262 { 05263 TRACEUSER( "JustinF", _T("Nothing selected cos first node has no parent spread\n")); 05264 } 05265 #endif 05266 */ } /* 05267 #ifdef _DEBUG 05268 else 05269 { 05270 TRACEUSER( "JustinF", _T("Nothing selected cos no first node in SelRange\n")); 05271 } 05272 #endif 05273 */ 05274 // Update the info-bar with the selection's extent. 05275 pInfoBarOp->SetEdit_OnSelectionChange(); 05276 05277 // Return TRUE if there is a selection. 05278 return SelectionSpread != NULL; 05279 }
|
|
Validate that the simple node is inside the last clicked node.
Definition at line 2931 of file selector.cpp. 02932 { 02933 Node* pSearchNode = pClickSimpleNode; 02934 while (pSearchNode && pSearchNode!=pLastClickNode) 02935 pSearchNode = pSearchNode->FindParent(); 02936 return (pSearchNode!=NULL); 02937 }
|
|
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.
Definition at line 2900 of file selector.cpp. 02901 { 02902 NodeRenderableInk* pSearchNode = NULL; 02903 do 02904 { 02905 pSearchNode = NodeRenderableInk::FindSimpleAtPoint(pStartSpread,ClickStart,pSearchNode); 02906 } 02907 while (pSearchNode && pLastClickNode!=NodeRenderableInk::FindCompoundFromSimple(pSearchNode,pLastClickNode)); 02908 02909 return (pSearchNode!=NULL); 02910 }
|
|
When views and documents are changing the selector tool needs to get its selection data correct for the old and new views so that its tool blobs can be removed. This function allows the info bar to get the tool to re-calculate this information and draw the blobs accordingly. The blobs are only drawn once here as this functions real purpose it to get rid of the blobs from the old view and the draw them in on the new view. As a result the info bar calls this function twice after setting up the appropriate docview info.
Definition at line 5046 of file selector.cpp. 05047 { 05048 switch (msg.State) 05049 { 05050 case DocViewMsg::SELABOUTTOCHANGE: 05051 { 05052 // Draw the blobs onto the new view 05053 if (msg.pNewDocView != NULL) 05054 { 05055 // The view is about to change, so get rid of the blobs in this view now 05056 pBlobManager->RenderToolBlobsOff(this, SelectionSpread, NULL); 05058 // Ignore Selection Changed messages until the view has actually changed 05059 // JCF: this has been moved to here so that this flag does *not* get set 05060 // if there is no new view to switch to, otherwise it remains set and the 05061 // info-bar's gadgets don't get disabled. This appears to be due to a 05062 // bug in the messages sent when the Document is closed - the 05063 // SELABOUTTOCHANGE message gets sent *twice*, once before the SELCHANGED 05064 // message and once after!?!? 05065 fIgnoreSelChange = TRUE; 05067 } 05068 05069 // Ignore Selection Changed messages until the view has actually changed 05070 // fIgnoreSelChange = TRUE; 05071 break; 05072 } 05073 05074 case DocViewMsg::SELCHANGED: 05075 { 05076 // This record the document's associated with the old and new views. 05077 Document* pOldViewsDoc = NULL; 05078 Document* pNewViewsDoc = NULL; 05079 05080 // Find out about the document associated with the old view 05081 if (msg.pOldDocView != NULL) 05082 pOldViewsDoc = msg.pOldDocView->GetDoc(); 05083 05084 // Find out about the document associated with the new view 05085 if (msg.pNewDocView != NULL) 05086 pNewViewsDoc = msg.pNewDocView->GetDoc(); 05087 05088 // If the document associated with the new view is different to the document associated 05089 // with the old view, then mark the rotation centre's position as needing updating. 05090 if (pOldViewsDoc != pNewViewsDoc) 05091 fRotateCentreIsValid = FALSE; 05092 05093 // Draw the blobs onto the new view 05094 if (msg.pNewDocView != NULL) 05095 { 05096 // [Removed by Jason] 05097 // SelectRange->Update(); 05098 // There is no need to update the SelRange in this manner - we should now only call this 05099 // method WHEN we HAVE CHANGED the selection. I believe this line was added when the 05100 // SelRange didn't correctly cope with Doc{View} changes; it's unnecessary (bad) these days. 05101 05102 // There is a new view so draw the bounds blobs on it. 05103 if (UpdateSelectionInfo()) 05104 pBlobManager->RenderToolBlobsOn(this, SelectionSpread, NULL); 05105 } 05106 05107 // Stop ignoring the selection changed messages again 05108 fIgnoreSelChange = FALSE; 05109 break; 05110 } 05111 05112 default: 05113 break; 05114 } 05115 }
|
|
Definition at line 705 of file selector.h. |
|
Definition at line 587 of file selector.h. |
|
Reimplemented from DragTool. Definition at line 296 of file selector.h. |
|
Definition at line 695 of file selector.h. |
|
Definition at line 690 of file selector.h. |
|
Definition at line 519 of file selector.h. |
|
Controls whether double-clicking on the page will show the Open dialog. Preference: bPageDoubleClickOpenFile Section: Selector Tool
Definition at line 702 of file selector.h. |
|
Definition at line 646 of file selector.h. |
|
Definition at line 461 of file selector.h. |
|
Definition at line 459 of file selector.h. |
|
Definition at line 298 of file selector.h. |
|
Definition at line 514 of file selector.h. |
|
Definition at line 647 of file selector.h. |
|
If TRUE (the default) allows a single click on a selected object to toggle between bounds blobs & rotate blobs, for compatibility with Corel Draw. This toggling option not allowed when Object blobs are shown, it would be a pain. Preference: AllowCorelToggleClick Section: Selector Tool
Definition at line 683 of file selector.h. |
|
Definition at line 288 of file selector.h. |
|
Reimplemented from DragTool. Definition at line 293 of file selector.h. |
|
Determines which blobs should be initially displayed. This should really be done by the blob manager! Preference: InitialBlobs Section: Selector Tool
Definition at line 682 of file selector.h. |
|
Controls whether attributes (line widths mainly) are considered when calculating bounding rectangles for objects. This is used when displaying and editing width/height information in the infobar. Preference: ConsiderLineWidths Section: Selector Tool
This preference is IGNORED if the "SlaveLineWidthToButton" pref is TRUE. The default setting (FALSE) is to ignore line widths in these displays. Notes: This preference is read by our associated SelectorInfoBarOp This preference is not currently written by camelot Definition at line 700 of file selector.h. |
|
Definition at line 333 of file selector.h. |
|
Definition at line 465 of file selector.h. |
|
Definition at line 289 of file selector.h. |
|
Definition at line 464 of file selector.h. |
|
Definition at line 515 of file selector.h. |
|
Definition at line 290 of file selector.h. |
|
If TRUE then the select-under feature, Alt-Click, works exactly like ArtWorks, so that an Alt-Click on an unselected object selects that object rather than the object underneath. If FALSE then Alt-Click always selects an object underneath the clicked object, irrespective of whether the clicked object was selected or not. The default is FALSE, as this is consistent with the way that select-inside works. Preference: SelectUnderLikeArtWorks Section: Selector Tool
Definition at line 684 of file selector.h. |
|
Definition at line 648 of file selector.h. |
|
Controls whether attributes (line widths mainly) are considered when calculating bounding rectangles for objects. This is used when displaying and editing width/height information in the infobar. Preference: SlaveLineWidthToButton Section: Selector Tool
If TRUE, the "Scale Line Widths" button will also control the behaviour of the function SelectorInfoBarOp::DontConsiderAttrs() - if the button is depressed, Attrs will not be considered, and vice versa. If FALSE, the behaviour will be fixed, and controlled by the preference "ConsiderLineWidths" in the "Selector Tool" section. The default setting (TRUE) is to determine the state from the button setting. Notes: This preference is read by our associated SelectorInfoBarOp This preference is not currently written by camelot Definition at line 699 of file selector.h. |
|
Controls whether my scaling fix is used. Preference: fUseScalingFix Section: Selector Tool
The default setting (FALSE) is to *not* use the new scaling fix Notes: This preference is read by our associated SelectorInfoBarOp This preference is not currently written by camelot Definition at line 701 of file selector.h. |
|
Definition at line 651 of file selector.h. |
|
Definition at line 652 of file selector.h. |
|
Definition at line 377 of file selector.h. |
|
Determines how wide a border, in millimetres, to inflate the bounding rectangle of the selected object, when drawing blobs around it. The default is 4 mm. Preference: BlobBorder Section: Selection Blob Sizes
Definition at line 681 of file selector.h. |
|
Definition at line 463 of file selector.h. |
|
Definition at line 650 of file selector.h. |
|
Definition at line 661 of file selector.h. |
|
Definition at line 669 of file selector.h. |
|
Definition at line 645 of file selector.h. |
|
Definition at line 476 of file selector.h. |
|
Definition at line 475 of file selector.h. |
|
Definition at line 675 of file selector.h. |
|
Definition at line 674 of file selector.h. |
|
Definition at line 676 of file selector.h. |
|
Definition at line 584 of file selector.h. |
|
Definition at line 665 of file selector.h. |
|
Definition at line 663 of file selector.h. |
|
Definition at line 477 of file selector.h. |
|
Definition at line 667 of file selector.h. |
|
Definition at line 666 of file selector.h. |
|
Definition at line 671 of file selector.h. |
|
Definition at line 660 of file selector.h. |
|
Definition at line 672 of file selector.h. |
|
Definition at line 670 of file selector.h. |
|
Definition at line 478 of file selector.h. |
|
Definition at line 664 of file selector.h. |
|
Definition at line 662 of file selector.h. |
|
Reimplemented from DragTool. Definition at line 295 of file selector.h. |
|
Definition at line 677 of file selector.h. |
|
Definition at line 673 of file selector.h. |
|
Definition at line 326 of file selector.h. |
|
Definition at line 327 of file selector.h. |
|
Definition at line 324 of file selector.h. |
|
Definition at line 325 of file selector.h. |
|
Definition at line 460 of file selector.h. |
|
Definition at line 513 of file selector.h. |
|
Reimplemented from DragTool. Definition at line 294 of file selector.h. |
|
Definition at line 462 of file selector.h. |
|
Definition at line 329 of file selector.h. |
|
Definition at line 330 of file selector.h. |