OpSelectorDragBox Class Reference

This operation is started when the user does a drag over the document, that started in empty space. A drag box will be drawn out over the document as the user moves the mouse about and when the drag ends, all the objects wholly inside the box will be selected. More...

#include <selector.h>

Inheritance diagram for OpSelectorDragBox:

Operation MessageHandler ListItem CCObject SimpleCCObject OpSliceDragBox List of all members.

Public Member Functions

 OpSelectorDragBox ()
 Constructor. This simply sets a few of the operation flags.
void StartDragBox (Spread *pSpread, DocCoord Anchor, ClickModifiers)
 This is called when a Drag operation has been detected.
virtual BOOL SnappingDrag ()
virtual void DragPointerMove (DocCoord, ClickModifiers, Spread *, BOOL bSolidDrag)
 This is called every time the mouse moves, during a drag. All it really does is update the EORed bounding box.
virtual void DragFinished (DocCoord, ClickModifiers, Spread *, BOOL, BOOL bSolidDrag)
 This is called when a drag operation finishes. This removes the EORed drag rect from the screen and then selects all the objects that were in it.
void RenderDragBlobs (DocRect, Spread *, BOOL bSolidDrag)
 EORs a rectangle onto the screen to mark out the size of the current selection.

Static Public Member Functions

static BOOL Declare ()
 Adds the operation to the list of all known operations.
static OpState GetState (String_256 *Description, OpDescriptor *)
 Find out the state of the operation at the specific time.

Private Member Functions

 CC_DECLARE_DYNCREATE (OpSelectorDragBox)

Private Attributes

SpreadStartSpread
DocCoord StartPoint
DocCoord LastMousePosition

Detailed Description

This operation is started when the user does a drag over the document, that started in empty space. A drag box will be drawn out over the document as the user moves the mouse about and when the drag ends, all the objects wholly inside the box will be selected.

Author:
Rik_Heywood (Xara Group Ltd) <camelotdev@xara.com>
Date:
1/7/93

Definition at line 132 of file selector.h.


Constructor & Destructor Documentation

OpSelectorDragBox::OpSelectorDragBox  ) 
 

Constructor. This simply sets a few of the operation flags.

Author:
Rik_Heywood (Xara Group Ltd) <camelotdev@xara.com>
Date:
20/7/93

Definition at line 5742 of file selector.cpp.

05743 {
05744     // Empty.
05745 }


Member Function Documentation

OpSelectorDragBox::CC_DECLARE_DYNCREATE OpSelectorDragBox   )  [private]
 

BOOL OpSelectorDragBox::Declare  )  [static]
 

Adds the operation to the list of all known operations.

Author:
Rik_Heywood (Xara Group Ltd) <camelotdev@xara.com>
Date:
5/7/93
Returns:
TRUE if all went OK, False otherwise

Reimplemented in OpSliceDragBox.

Definition at line 5930 of file selector.cpp.

void OpSelectorDragBox::DragFinished DocCoord  PointerPos,
ClickModifiers  ClickMods,
Spread Spread,
BOOL  Success,
BOOL  bSolidDrag
[virtual]
 

This is called when a drag operation finishes. This removes the EORed drag rect from the screen and then selects all the objects that were in it.

Author:
Rik_Heywood (Xara Group Ltd) <camelotdev@xara.com>
Date:
5/7/93
Parameters:
PointerPos - The position of the mouse at the end of the drag [INPUTS] ClickMods - the key modifiers being pressed Success - TRUE if the drag was terminated properly, FALSE if it was ended with the escape key being pressed
See also:
ClickModifiers

Reimplemented from Operation.

Reimplemented in OpSliceDragBox.

Definition at line 5829 of file selector.cpp.

05831 {
05832     // Build the rectangle of the drag box at the end of the drag
05833     DocRect BoundingRect(MIN(StartPoint.x, LastMousePosition.x),
05834                          MIN(StartPoint.y, LastMousePosition.y),
05835                          MAX(StartPoint.x, LastMousePosition.x),
05836                          MAX(StartPoint.y, LastMousePosition.y));
05837                                   
05838     // First Rub out the old box
05839     RenderDragBlobs(BoundingRect, StartSpread, bSolidDrag);
05840 
05841     // Put the hourglass up
05842     BeginSlowJob();
05843 
05844     // Go and try and select a few things
05845     if (Success)
05846     {
05847         // If we didn't drag with the right button then deselect everything prior to selecting
05848         // the "lasso-ed" objects, and remember to restore the rotation centre to the middle of
05849         // the selection.
05850         if (!ClickMods.Adjust)
05851         {
05852             NodeRenderableInk::DeselectAll();
05853             ((SelectorTool*) Tool::GetCurrent())->InvalidateRotationCentre();
05854         }
05855 
05856         // Select the objects in the BoundingRect
05857         NodeRenderableInk::SelectAllInRect(BoundingRect, Spread,
05858                                            NodeRenderableInk::SET);
05859 /*
05860         // This old code makes right-button marquee consistent with the right-button selection toggle.
05861         // Unfortunately Charles & Burns don't like it (this week).
05862         NodeRenderableInk::SelectAllInRect(BoundingRect, Spread,
05863                                            ClickMods.Adjust ? NodeRenderableInk::SelStateAction::TOGGLE
05864                                                             : NodeRenderableInk::SelStateAction::SET);
05865 */
05866         // Reenable the tool's idle processing.
05867         SelectorTool::AllowIdleWork(TRUE);
05868 
05869         // End the Drag
05870         if (!EndDrag()) FailAndExecute();
05871     }
05872     else
05873     {
05874         // Reenable the tool's idle processing.
05875         SelectorTool::AllowIdleWork(TRUE);
05876 
05877         // Set up the flags that say it all went wrong.
05878         EndDrag();
05879         FailAndExecute();
05880     }
05881 
05882     // Final end of the operation.
05883     End();
05884 
05885 }

void OpSelectorDragBox::DragPointerMove DocCoord  PointerPos,
ClickModifiers  ClickMods,
Spread pSpread,
BOOL  bSolidDrag
[virtual]
 

This is called every time the mouse moves, during a drag. All it really does is update the EORed bounding box.

Author:
Rik_Heywood (Xara Group Ltd) <camelotdev@xara.com>
Date:
5/7/93
Parameters:
PointerPos - The current position of the mouse in Doc Coords [INPUTS] ClickMods - Which key modifiers are being pressed
See also:
ClickModifiers

Reimplemented from Operation.

Definition at line 5788 of file selector.cpp.

05790 {
05791     // First Rub out the old box
05792     DocRect Rect = DocRect(MIN(StartPoint.x, LastMousePosition.x),
05793                            MIN(StartPoint.y, LastMousePosition.y),
05794                            MAX(StartPoint.x, LastMousePosition.x),
05795                            MAX(StartPoint.y, LastMousePosition.y));
05796     RenderDragBlobs(Rect, StartSpread, bSolidDrag);
05797 
05798     // Update the box and draw in the new one
05799     if (pSpread != StartSpread)
05800     {
05801         PointerPos = MakeRelativeToSpread(StartSpread, pSpread, PointerPos);
05802     }
05803 
05804     LastMousePosition = PointerPos;
05805     Rect = DocRect(MIN(StartPoint.x, LastMousePosition.x),
05806                    MIN(StartPoint.y, LastMousePosition.y),
05807                    MAX(StartPoint.x, LastMousePosition.x),
05808                    MAX(StartPoint.y, LastMousePosition.y));
05809     RenderDragBlobs(Rect, StartSpread, bSolidDrag);
05810 }

OpState OpSelectorDragBox::GetState String_256 Description,
OpDescriptor
[static]
 

Find out the state of the operation at the specific time.

Author:
Rik_Heywood (Xara Group Ltd) <camelotdev@xara.com>
Date:
5/7/93
Parameters:
Description - GetState fills this string with an approriate description [OUTPUTS] of the current state of the selector tool
Returns:
The state of the operation, so that menu items (ticks and greying can be done properly

Reimplemented in OpSliceDragBox.

Definition at line 5950 of file selector.cpp.

05951 {
05952     OpState Blobby;
05953     return Blobby;
05954 }

void OpSelectorDragBox::RenderDragBlobs DocRect  Rect,
Spread pSpread,
BOOL  bSolidDrag
[virtual]
 

EORs a rectangle onto the screen to mark out the size of the current selection.

Author:
Rik_Heywood (Xara Group Ltd) <camelotdev@xara.com>
Date:
6/9/93

Reimplemented from Operation.

Definition at line 5897 of file selector.cpp.

05898 {
05899     RenderRegion* pRegion = DocView::RenderOnTop(&Rect, pSpread, ClippedEOR);
05900     while (pRegion)
05901     {
05902         // Set the line colour 
05903         pRegion->SetLineColour(COLOUR_XORSELECT);
05904 
05905         // And Draw the rect
05906         DocRect RubberBox = DocRect(MIN(StartPoint.x, LastMousePosition.x),
05907                                     MIN(StartPoint.y, LastMousePosition.y),
05908                                     MAX(StartPoint.x, LastMousePosition.x),
05909                                     MAX(StartPoint.y, LastMousePosition.y));
05910         
05911         // Draw the rectangle
05912         pRegion->DrawDragRect(&RubberBox);
05913 
05914         // Get the Next render region
05915         pRegion = DocView::GetNextOnTop(&Rect);
05916     }
05917 }

virtual BOOL OpSelectorDragBox::SnappingDrag  )  [inline, virtual]
 

Reimplemented from Operation.

Definition at line 141 of file selector.h.

00141 { return FALSE; }

void OpSelectorDragBox::StartDragBox Spread pSpread,
DocCoord  Anchor,
ClickModifiers  ClickMods
 

This is called when a Drag operation has been detected.

Author:
Rik_Heywood (Xara Group Ltd) <camelotdev@xara.com>
Date:
5/7/93
Parameters:
Anchor - The position of the mouse at the start of the Drag [INPUTS]

Reimplemented in OpSliceDragBox.

Definition at line 5758 of file selector.cpp.

05759 {
05760     // We had better take a note of the starting point of the drag
05761     StartSpread = pSpread;
05762     StartPoint = Anchor;
05763     LastMousePosition = Anchor;
05764 
05765     // Put some helpful text in the status bar.
05766     SelectorTool::AllowIdleWork(FALSE);
05767     SelectorTool::SetStatusText(_R(IDS_SEL_DRAGBOXTEXT));
05768     
05769     // And tell the Dragging system that we need drags to happen
05770     StartDrag(DRAGTYPE_AUTOSCROLL);
05771 }


Member Data Documentation

DocCoord OpSelectorDragBox::LastMousePosition [private]
 

Definition at line 161 of file selector.h.

DocCoord OpSelectorDragBox::StartPoint [private]
 

Definition at line 160 of file selector.h.

Spread* OpSelectorDragBox::StartSpread [private]
 

Definition at line 159 of file selector.h.


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