OpPush Class Reference

This is the Push operation that slides the document about. More...

#include <pushtool.h>

Inheritance diagram for OpPush:

Operation MessageHandler ListItem CCObject SimpleCCObject List of all members.

Public Member Functions

 OpPush ()
 Constructor. This simply sets a few of the operation flags to say that it can not be added to the undo system and that it should be deleted when it ends.
void DoDrag (DocCoord Anchor)
 To start up the dragging of the document around. It records the starting point of the drag as this is used to calculate the offsets that are needed as the mouse moves about.
virtual BOOL SnappingDrag ()
virtual void DragPointerMove (DocCoord PointerPos, ClickModifiers ClickMods, Spread *, BOOL bSolidDrag)
 This function will change the scroll offsets of the current view to track the mouse moving about. This will give the effect of sliding the document around with the mouse.
virtual void DragFinished (DocCoord Pos, ClickModifiers Mods, Spread *, BOOL Success, BOOL bSolidDrag)
 Finishes the scrolling around the document and ends the drag operation.
BOOL GetStatusLineText (String_256 *ptext, Spread *, DocCoord, ClickModifiers)
 Get status line help text for push tool when dragging.

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 (OpPush)

Private Attributes

WorkCoord AnchorPoint

Detailed Description

This is the Push operation that slides the document about.

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

Definition at line 194 of file pushtool.h.


Constructor & Destructor Documentation

OpPush::OpPush  ) 
 

Constructor. This simply sets a few of the operation flags to say that it can not be added to the undo system and that it should be deleted when it ends.

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

Definition at line 578 of file pushtool.cpp.

00579 {
00580 }


Member Function Documentation

OpPush::CC_DECLARE_DYNCREATE OpPush   )  [private]
 

BOOL OpPush::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

Definition at line 713 of file pushtool.cpp.

00714 {
00715     return (RegisterOpDescriptor(
00716                                 0, 
00717                                 _R(IDS_PUSH_TOOL),
00718                                 CC_RUNTIME_CLASS(OpPush), 
00719                                 OPTOKEN_PUSH,
00720                                 OpPush::GetState,
00721                                 0,  /* help ID */
00722                                 _R(IDBBL_PUSHTOOLOP),
00723                                 0   /* bitmap ID */));
00724 
00725 }

void OpPush::DoDrag DocCoord  Anchor  ) 
 

To start up the dragging of the document around. It records the starting point of the drag as this is used to calculate the offsets that are needed as the mouse moves about.

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]

Definition at line 597 of file pushtool.cpp.

00598 {
00599     // Find out the selected Document View
00600     DocView* pDocView = DocView::GetSelected(); 
00601     ENSURE( pDocView != NULL, "OpPush::DoDrag - No selected DocView" );
00602     if (pDocView==NULL)
00603         return;
00604 
00605     // Get the mouse position in work coords
00606     AnchorPoint = pDocView -> GetClickWorkCoord();
00607     
00608     // and start a drag (pass in FALSE for KeepAccuracy, because we want this drag to
00609     // reflect the cursor position at all times - we're not really interested in the
00610     // intermediate mouse movements when there are lots of them).
00611     StartDrag( DRAGTYPE_NOSCROLL, NULL, NULL, FALSE );
00612 
00613 #if !defined(EXCLUDE_FROM_RALPH) && !defined(EXCLUDE_FROM_XARALX)
00614     String_256 text("");
00615     if (text.Load(_R(IDS_PUSHOP_STATUSHELP)))
00616         GetApplication()->UpdateStatusBarText(&text);
00617 #endif
00618 }

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

Finishes the scrolling around the document and ends the drag operation.

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.

Definition at line 682 of file pushtool.cpp.

00683 {
00684     // Put up the hourglass as we have to
00685     BeginSlowJob();
00686 
00687     // End the Drag
00688     EndDrag();
00689     
00690     // If the drag failed, then fail the operation
00691     if (!Success) FailAndExecute();
00692 
00693     // End the operation
00694     End();
00695 
00696     // Send a message saying that the screen has changed, so that the brush tool can update
00697     BROADCAST_TO_ALL(ScreenChangeMsg());
00698 
00699 }

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

This function will change the scroll offsets of the current view to track the mouse moving about. This will give the effect of sliding the document around with the mouse.

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 638 of file pushtool.cpp.

00639 {
00640     DocView* pDocView = DocView::GetSelected();
00641     ENSURE( pDocView != NULL, "OpPush::DragPointerMove - DocView was NULL" );
00642     if (pDocView==NULL)
00643         return;
00644 
00645     // Declare a few WorkCoords we will need
00646     WorkCoord ScrollOffsets;
00647     WorkCoord Change;   
00648     WorkCoord MoveClick = pDocView->GetClickWorkCoord();
00649     
00650     // How Much has it changed
00651     Change.x = AnchorPoint.x - MoveClick.x;
00652     Change.y = AnchorPoint.y - MoveClick.y;
00653     
00654     // Find the Scroll Offsets and change them
00655     ScrollOffsets = pDocView->GetScrollOffsets(); 
00656     ScrollOffsets.x += Change.x;
00657     ScrollOffsets.y += Change.y;
00658     
00659     // Make sure the ScrollOffsets are valid and then set them
00660     if ( ScrollOffsets.x < 0 ) ScrollOffsets.x = 0;
00661     if ( ScrollOffsets.y > 0 ) ScrollOffsets.y = 0;
00662     pDocView->SetScrollOffsets( ScrollOffsets, TRUE );
00663 }

OpState OpPush::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 push tool
Returns:
The state of the operation, so that menu items (ticks and greying can be done properly

Definition at line 742 of file pushtool.cpp.

00743 {
00744     OpState Blobby;
00745     return Blobby;
00746 }

BOOL OpPush::GetStatusLineText String_256 pText,
Spread ,
DocCoord  ,
ClickModifiers 
[virtual]
 

Get status line help text for push tool when dragging.

Author:
Ed_Cornes (Xara Group Ltd) <camelotdev@xara.com>
Date:
26/1/95
Parameters:
Spread*,DocCoords,ClickModifiers - unused [INPUTS]
pText - [OUTPUTS]
Returns:
TRUE if pText holds valid text

Errors: this==NULL

Reimplemented from Operation.

Definition at line 762 of file pushtool.cpp.

00763 {
00764     ERROR2IF(this==NULL,FALSE,"OpPush::GetStatusLineText() - this==NULL");
00765 
00766     return pText->Load(_R(IDS_PUSHOP_STATUSHELP));
00767 }

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

Reimplemented from Operation.

Definition at line 205 of file pushtool.h.

00205 { return FALSE; }


Member Data Documentation

WorkCoord OpPush::AnchorPoint [private]
 

Definition at line 218 of file pushtool.h.


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