PushTool Class Reference

This class handles the Push Tool that is used to slide the document about in a more convienient way than using the scroll bars. Most of the hard work is done in the OpPush (The push operation). More...

#include <pushtool.h>

Inheritance diagram for PushTool:

Tool_v1 List of all members.

Public Member Functions

 PushTool ()
 Dummp Constructor - It does nothing. All the real initialisation is done in PushTool::Init which is called by the Tool Manager.
virtual ~PushTool ()
 Destructor. Does nothing.
virtual BOOL Init ()
 Used to check if the Tool was properly constructed.
virtual void Describe (void *InfoPtr)
 Allows the tool manager to extract information about the tool.
virtual UINT32 GetID ()
virtual void SelectChange (BOOL)
 When selected, creates a push-tool cursor object and pushes it on the cursor stack; when deselected pops the cursor from the stack and deletes it.
virtual void OnClick (DocCoord, ClickType, ClickModifiers, Spread *)
 To handle a Mouse Click event for the Push Tool. It starts up a Push Operation.
BOOL GetStatusLineText (String_256 *ptext, Spread *, DocCoord, ClickModifiers)
 Get status line help text for push tool when over doc.
void OnMouseMove (DocCoord, Spread *, ClickModifiers)
 immediately updates status line text

Private Member Functions

 CC_DECLARE_MEMDUMP (PushTool)

Private Attributes

CursorpcPushCursor
INT32 CurrentCursorID
ZoomInfoBarOppPushInfoBarOp

Static Private Attributes

static TCHARFamilyName = _T("View Tools")
static TCHARToolName = _T("Push Tool")
static TCHARPurpose = _T("To push the document around")
static TCHARAuthor = _T("Rik")

Detailed Description

This class handles the Push Tool that is used to slide the document about in a more convienient way than using the scroll bars. Most of the hard work is done in the OpPush (The push operation).

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

Definition at line 137 of file pushtool.h.


Constructor & Destructor Documentation

PushTool::PushTool  ) 
 

Dummp Constructor - It does nothing. All the real initialisation is done in PushTool::Init which is called by the Tool Manager.

Author:
Rik_Heywood (Xara Group Ltd) <camelotdev@xara.com>
Date:
21/6/93
See also:
PushTool::Init

Definition at line 160 of file pushtool.cpp.

00161   : pcPushCursor(NULL),
00162     pPushInfoBarOp(NULL)
00163 {
00164     // Dummy constructor
00165 }

PushTool::~PushTool  )  [virtual]
 

Destructor. Does nothing.

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

Definition at line 181 of file pushtool.cpp.

00182 {
00183     // Dummy destructor
00184 }


Member Function Documentation

PushTool::CC_DECLARE_MEMDUMP PushTool   )  [private]
 

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

Allows the tool manager to extract information about the tool.

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

Reimplemented from Tool_v1.

Definition at line 268 of file pushtool.cpp.

00269 {
00270     // Cast structure into the latest one we understand.
00271     ToolInfo_v1 *Info = (ToolInfo_v1 *) InfoPtr;
00272 
00273     Info -> InfoVersion = 1;
00274     
00275     Info -> InterfaceVersion = GetToolInterfaceVersion();  // You should always have this line.
00276         
00277     // These are all arbitrary at present.
00278     Info -> Version = 1;
00279     Info -> ID      = GetID();
00280     Info -> TextID  = _R(IDS_PUSH_TOOL);
00281 
00282     Info -> Family  = FamilyName;
00283     Info -> Name    = ToolName;
00284     Info -> Purpose = Purpose;
00285     Info -> Author  = Author;
00286     
00287     Info -> InfoBarDialog = 0;
00288     Info->BubbleID = _R(IDBBL_PUSH_TOOLICON);
00289 }

virtual UINT32 PushTool::GetID void   )  [inline, virtual]
 

Reimplemented from Tool_v1.

Definition at line 148 of file pushtool.h.

00148 { return TOOLID_PUSH; };

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

Get status line help text for push tool when over doc.

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 Tool_v1.

Definition at line 464 of file pushtool.cpp.

00465 {
00466     ERROR2IF(this==NULL, FALSE,"PushTool::GetStatusLineText() - this==NULL");
00467     ERROR2IF(pText==NULL,FALSE,"PushTool::GetStatusLineText() - pText==NULL");
00468 
00469     return pText->Load(_R(IDS_PUSHTOOL_STATUSHELP));
00470 }

BOOL PushTool::Init void   )  [virtual]
 

Used to check if the Tool was properly constructed.

Author:
Rik_Heywood (Xara Group Ltd) <camelotdev@xara.com>
Date:
21/6/93
Returns:
FALSE if it does not want to be created, TRUE otherwise
See also:
PushTool::PushTool

Reimplemented from Tool_v1.

Definition at line 200 of file pushtool.cpp.

00201 {
00202 /*  // Claim right-alt for our tool.
00203     ToolKeyClaimDetails Mods;
00204     Mods.Value = 0;
00205     Mods.Keys.Alternative2 = TRUE;
00206     ClaimToolKey((Tool*) this, Mods);
00207 */
00208     // Initially, no cursor.
00209     pcPushCursor = 0;
00210 
00211     // RALPH don't need no sissy infobar
00212 #if defined(EXCLUDE_FROM_RALPH)
00213     return OpPush::Declare();
00214 #else
00215 
00216     pPushInfoBarOp = new ZoomInfoBarOp(_R(IDD_PUSHINFO)); // Push tool uses a zoom info bar
00217     BOOL ok=(pPushInfoBarOp!=NULL);
00218 
00219 #if 0
00220     // Load in the info-bar stuff.
00221     CCResTextFile       file;               // Resource File
00222     ZoomInfoBarOpCreate BarCreate;          // Object that creates PushInfoBarOp objects
00223 
00224     BOOL    ok = file.open(_R(IDM_PUSH_BAR), _R(IDT_INFO_BAR_RES));       // Open resource
00225     if (ok) ok = DialogBarOp::ReadBarsFromFile(file, BarCreate);  // Read & create bar
00226     if (ok) file.close();                                         // Close resource
00227 
00228     ENSURE(ok,"Unable to load PUSHBAR.INI from resource\n"); 
00229 
00230     if (ok)
00231     {
00232             // Info bar now exists.  Now get a pointer to it.
00233         String_32 str(_R(IDS_PUSHTOOL_INFOBARNAME));
00234         DialogBarOp* pDialogBarOp = DialogBarOp::FindDialogBarOp(str);
00235 
00236                 ok = (pDialogBarOp != NULL);
00237         if (ok) ok = pDialogBarOp->IsKindOf(CC_RUNTIME_CLASS(ZoomInfoBarOp));
00238         if (ok) pPushInfoBarOp = (ZoomInfoBarOp*) pDialogBarOp;
00239 
00240         ENSURE(ok,"Couldn't find push tool info bar");
00241     }
00242 #endif
00243 
00244     // Register our push operation.
00245     return ok && OpPush::Declare();
00246 #endif
00247 }

void PushTool::OnClick DocCoord  PointerPos,
ClickType  Click,
ClickModifiers  ClickMods,
Spread pSpread
[virtual]
 

To handle a Mouse Click event for the Push Tool. It starts up a Push Operation.

Author:
Rik_Heywood (Xara Group Ltd) <camelotdev@xara.com>
Date:
21/6/93
Parameters:
PointerPos - The Coords (in DocCoords) of the point where the mouse button [INPUTS] was clicked Click - Describes the type of click that was detected. ClickMods - Indicates which buttons caused the click and which modifers were pressed at the same time pSpread - Pointer to the spread that the click was on
Returns:
TRUE if it handled the Click, FALSE otherwise
See also:
Tool::MouseClick; ClickType; ClickModifiers

Reimplemented from Tool_v1.

Definition at line 316 of file pushtool.cpp.

00318 {
00319     if (ClickMods.Menu) return;                         // Don't do anything if the user clicked the Menu button
00320 
00321     // Make sure this click is one that we want
00322     if ( Click == CLICKTYPE_SINGLE )
00323     {
00324 
00325 #ifdef RALPH
00326         //Graham 20/9/96: If we're in Ralph, clicking on a Hot Link activates it.
00327         //The one exception to this rule is if CTRL is pressed, in which case
00328         //the tool acts as normal.
00329 
00330         //So, is CTRL pressed?
00331         if (!(ClickMods.Constrain))
00332         {
00333             //No. Are we on a Hot Link? Let's try and find one.
00334 
00335             //First, find a Hot Link
00336     
00337             Node* pHotLinkNode= DocView::FindHotLinkNode(PointerPos);
00338 
00339             //If we've found one, go to that Hot Link
00340             if (pHotLinkNode)
00341             {
00342                 DocView::GoToHotLink((AttrUser*) pHotLinkNode);
00343                 return;
00344             }
00345         }
00346 
00347         //If CTRL was pressed, or if we weren't over a Hot Link, we treat
00348         //the click as a normal Push drag. Read on...
00349 
00350 #endif //Ralph
00351 
00352         // Just what we wanted - Someone is dragging the mouse about
00353         // We need to make an operation to perform the drag with
00354         OpPush* pOpPush = new OpPush;
00355         if (pOpPush == NULL)
00356         {
00357             // Failed to get the memory to do the job
00358             // I guess we should just ignore the click, though the user is going to
00359             // wonder just what is happening!
00360 //          TRACE( _T("The Push Operation could not start due to lack of memory\n") );
00361 
00362             // Inform the person doing the clicking that life is not looking so good
00363             InformError( _R(IDS_OUT_OF_MEMORY), _R(IDS_OK) );
00364         }
00365         else
00366         {
00367             // Start the drag operation and pass in the Anchor Point to the push operation
00368             pOpPush -> DoDrag( PointerPos );
00369         }
00370     }
00371 }

void PushTool::OnMouseMove DocCoord  dcPoint,
Spread pSpread,
ClickModifiers  mods
[virtual]
 

immediately updates status line text

Author:
Ed_Cornes (Xara Group Ltd) <camelotdev@xara.com>
Date:
26/1/95
Parameters:
DocCoord,Spread* ClickModifiers - only used in Ralph [INPUTS]
In Ralph, updates status line text and changes the cursor.

Reimplemented from Tool_v1.

Definition at line 484 of file pushtool.cpp.

00485 {
00486 #ifdef RALPH
00487     //Graham 20/9/96.
00488     //We need to check if the zoom tool's over a Hot Link. If it is, the cursor changes
00489     //to a pointing hand.
00490 
00491     //The one exception is if CTRL is pressed, in which case the cursor is the
00492     //normal Push tool cursor (Disabled at the moment)
00493 
00494     //First, try and find a node with a Hot Link
00495 
00496     AttrUser* pHotLinkNode= (AttrUser*) DocView::FindHotLinkNode(dcPoint);
00497 
00498     if (pHotLinkNode && !(mods.Constrain))
00499     {
00500         //Yes. So change the cursor to a pointing hand
00501         ChangeCursor(Cursor::PointingHand);
00502 
00503         //And now to update the status bar of the browser
00504 
00505         //So first get a pointer to the document
00506                 
00507         //And a pointer to the Ralph document...
00508         Document* ThisDoc=Document::GetSelected();
00509         RalphDocument* ThisRalphDoc=ThisDoc->GetRalphDoc();
00510 
00511         ERROR3IF(ThisRalphDoc==NULL, "DocView::OnMouseMoveWithNoTool has no Ralph Doc");
00512 
00513         //Then get the base URL of this Ralph document as a Web Address
00514         WebAddress wBase(ThisRalphDoc->GetBaseURL());
00515 
00516         //And get the URL of this node as a Web Address
00517         WebAddress wEmbedded(pHotLinkNode->GetWebAddress());
00518 
00519         //This function makes wEmbedded into an absolute URL (if necessary)
00520         wEmbedded.Combine(wBase);
00521 
00522         //Make the Web Address into a normal string
00523         String_256 strEmbedded=wEmbedded.GetWebAddress();
00524 
00525         //And put that URL into the status bar string
00526         String_256 sPushTool;
00527 
00528         sPushTool.MakeMsg(_R(IDS_PUSHTOOL_HOTLINK), (TCHAR*) strEmbedded);
00529         
00530         //And tell the Ralph document to show the string in the browser's status
00531         //bar
00532         ThisRalphDoc->SetStatusBar(&sPushTool);
00533 
00534     }
00535     else
00536     {
00537         //No, the cursor is not over a Hot Link or CTRL is pressed
00538         //Change the cursor to the standard Push tool cursor
00539         //and display a standard message in the browser status bar
00540         ChangeCursor(pcPushCursor);
00541 
00542         String_256 StringToPass(_R(IDS_RALPH_PUSHTOOLSTR));
00543 
00544         DocView::SetBrowserStatusBar(&StringToPass);
00545     }
00546 
00547 #endif //RALPH
00548 #if !defined(EXCLUDE_FROM_RALPH) && !defined(EXCLUDE_FROM_XARALX)
00549     if (this!=NULL)
00550     {
00551         String_256 text("");
00552         if (text.Load(_R(IDS_PUSHTOOL_STATUSHELP)))
00553             GetApplication()->UpdateStatusBarText(&text);
00554     }
00555     else
00556         ERROR3("PushTool::OnMouseMove() - this==NULL");
00557 #endif
00558 }

void PushTool::SelectChange BOOL  isSelected  )  [virtual]
 

When selected, creates a push-tool cursor object and pushes it on the cursor stack; when deselected pops the cursor from the stack and deletes it.

Author:
Justin_Flude (Xara Group Ltd) <camelotdev@xara.com>
Date:
17/11/93
Parameters:
A flag which if TRUE means the tool has just been selected, if FALSE that [INPUTS] the tool is being deselected.
- [OUTPUTS]
Returns:
-

Errors: -

See also:
Tool_v1::SelectChange

Reimplemented from Tool_v1.

Definition at line 393 of file pushtool.cpp.

00394 {
00395     if (isSelected)
00396     {
00397         // This tool has just been selected.  Create our cursor and push it on the cursor
00398         // stack.
00399         pcPushCursor = new Cursor(this, _R(IDC_PUSHTOOLCURSOR));
00400 
00401 #ifdef RALPH
00402         //Graham 20/9/96. This cursor is needed to activate
00403         //HotLinks (TM) in Ralph (TM). The cursor is a static member of
00404         //the Cursor class and so we don't need to delete it.
00405         pcHotLinkCursor = Cursor::PointingHand;
00406 #endif //Ralph
00407 
00408         if (!pcPushCursor)
00409         {
00410             TRACE( _T("Couldn't create push-tool cursor!\n"));
00411             return;
00412         }
00413 
00414         CurrentCursorID = CursorStack::GPush(pcPushCursor, FALSE);          // don't display just yet
00415 #if !defined(EXCLUDE_FROM_RALPH)
00416         pPushInfoBarOp->Create();
00417 #endif
00418         // good to see Neville's back into his old habits of leaving huge swathes of redundant code all over the place
00419         // Which blobs do I want displayed
00420         // Used to declare an interest in no blobs which meant that all blobs disappeared
00421         // when this tool is selected. Now try not to affect this by not declaring an
00422         // interest.
00423         // Changed by Neville 16/8/94
00424         //  BlobManager* BlobMgr = GetApplication()->GetBlobManager();
00425         //  if ((BlobMgr != NULL) && (Document::GetCurrent() != NULL))
00426         //  {
00427         //      // Decide which blobs to display
00428         //      BlobStyle MyBlobs;
00429         //      // We want them all off, which is the default
00430 
00431         //      // tell the blob manager
00432         //      BlobMgr->ToolInterest(MyBlobs);
00433         //  }
00434     }
00435     else
00436     {
00437         // This tool is being deselected, so pop our cursor from the stack and deallocate it.
00438         if (pcPushCursor)
00439         {
00440             CursorStack::GPop(CurrentCursorID);
00441             delete pcPushCursor;
00442             CurrentCursorID = 0;
00443         }
00444 #if !defined(EXCLUDE_FROM_RALPH)
00445             pPushInfoBarOp->Delete();
00446 #endif
00447 
00448     }
00449 }


Member Data Documentation

TCHAR * PushTool::Author = _T("Rik") [static, private]
 

Definition at line 177 of file pushtool.h.

INT32 PushTool::CurrentCursorID [private]
 

Definition at line 170 of file pushtool.h.

TCHAR * PushTool::FamilyName = _T("View Tools") [static, private]
 

Definition at line 174 of file pushtool.h.

Cursor* PushTool::pcPushCursor [private]
 

Definition at line 157 of file pushtool.h.

ZoomInfoBarOp* PushTool::pPushInfoBarOp [private]
 

Definition at line 171 of file pushtool.h.

TCHAR * PushTool::Purpose = _T("To push the document around") [static, private]
 

Definition at line 176 of file pushtool.h.

TCHAR * PushTool::ToolName = _T("Push Tool") [static, private]
 

Definition at line 175 of file pushtool.h.


The documentation for this class was generated from the following files:
Generated on Sat Nov 10 04:00:13 2007 for Camelot by  doxygen 1.4.4