ZoomTool Class Reference

This class is to allow the user to Zoom in and out of the document at will. It provides an interface to the tool system for the zoom mouse-drag Operation. More...

#include <zoomtool.h>

Inheritance diagram for ZoomTool:

Tool_v1 List of all members.

Public Member Functions

 ZoomTool ()
 Dummy Constructor.
virtual ~ZoomTool ()
 Destructor (Virtual).
virtual BOOL Init ()
 To Test if the tool had started up ok.
virtual void Describe (void *InfoPtr)
 The tool declares what versions of the tool module interface it can understand as well as its name, family etc.
virtual UINT32 GetID ()
virtual void SelectChange (BOOL fIsSelected)
 Called when the tool is selected or deselected. Creates and pushes the tool's cursor; pops and destroys it.
virtual BOOL OnKeyPress (KeyPress *pKey)
virtual void OnMouseMove (DocCoord dcMousePos, Spread *pSpread, ClickModifiers mods)
 immediately updates status line text
virtual void OnClick (DocCoord, ClickType, ClickModifiers, Spread *)
 Handle a mouse click and perform a zoom if needed. If we decided to do a zoom we first have to create an operation and a drag is started on it. If the user was just clicking on the window, then the drag will be very short lived and the operation will be able to detect that is was in reality just a click. Once the drag has been started our part of the program is complete and it is up to the operation to actually change the zoom factor and get the document to redraw.
virtual BOOL GetStatusLineText (String_256 *ptext, Spread *pSpread, DocCoord DocPos, ClickModifiers ClickMods)
 generate up-to-date text for the status line (called on idles)
void ValidateStatusText ()
 Checks if the text in the status-bar needs updating, for example if a new zoom factor has been selected since it was last painted, and does what is required.

Static Public Member Functions

static BOOL IsSelectedTool ()
static void InvalidateStatusText ()
 Checks if the zoom tool is the currently active ("selected") tool, and if it is then "invalidates" the status-bar text, forcing it to be updated on receipt of the next call to OnMouseMove.

Private Member Functions

 CC_DECLARE_MEMDUMP (ZoomTool)

Private Attributes

BOOL Inited
CursorpcZoomCursor
CursorpcZoomOutCursor
CursorMyCurrentCursor
INT32 CurrentCursorID
ZoomInfoBarOppZoomInfoBarOp
String_256psStatusText
BOOL bStatusTextValid

Static Private Attributes

static TCHARFamilyName = _T("View Tools")
static TCHARToolName = _T("Zoom Tool")
static TCHARPurpose = _T("To zoom in on a document")
static TCHARAuthor = _T("JustinF")
static BOOL bIsActive = FALSE

Detailed Description

This class is to allow the user to Zoom in and out of the document at will. It provides an interface to the tool system for the zoom mouse-drag Operation.

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

Definition at line 126 of file zoomtool.h.


Constructor & Destructor Documentation

ZoomTool::ZoomTool  ) 
 

Dummy Constructor.

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

Definition at line 177 of file zoomtool.cpp.

00178   : Inited(FALSE),
00179     pcZoomCursor(NULL),
00180     pcZoomOutCursor(NULL),
00181     pZoomInfoBarOp(NULL),
00182     psStatusText(NULL),
00183     bStatusTextValid(FALSE)
00184 {
00185     // Empty.
00186 }

ZoomTool::~ZoomTool  )  [virtual]
 

Destructor (Virtual).

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

Definition at line 198 of file zoomtool.cpp.

00199 {
00200     // Empty
00201 }


Member Function Documentation

ZoomTool::CC_DECLARE_MEMDUMP ZoomTool   )  [private]
 

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

The tool declares what versions of the tool module interface it can understand as well as its name, family etc.

Author:
Rik_Heywood (Xara Group Ltd) <camelotdev@xara.com>
Date:
8/7/93
Parameters:
InfoPtr - Pointer to a block that will hold the name data [INPUTS]

Reimplemented from Tool_v1.

Definition at line 268 of file zoomtool.cpp.

00269 {
00270     // Cast structure into the latest one we understand.
00271     ToolInfo_v1* Info = (ToolInfo_v1*) InfoPtr;
00272     Info->InfoVersion = 1;
00273     
00274     // You should always have this line.
00275     Info->InterfaceVersion = GetToolInterfaceVersion();
00276         
00277     // These are all arbitrary at present.
00278     Info->Version = 1;
00279     Info->ID      = GetID();
00280     Info->TextID  = _R(IDS_ZOOM_TOOL);
00281 
00282     // Make a note of the tools description.
00283     Info->Family  = FamilyName;
00284     Info->Name    = ToolName;
00285     Info->Purpose = Purpose;
00286     Info->Author  = Author;
00287     
00288     // this tool uses the infobar, so supply a dialog id to put in the info bar.
00289     Info->InfoBarDialog = _R(IDD_ZOOMINFO);
00290     Info->BubbleID = _R(IDBBL_ZOOM_TOOLICON);
00291 }

UINT32 ZoomTool::GetID void   )  [virtual]
 

Author:
Justin_Flude (Xara Group Ltd) <camelotdev@xara.com>
Date:
12/5/94
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
-

Errors: -

See also:
-

Reimplemented from Tool_v1.

Definition at line 308 of file zoomtool.cpp.

00309 {
00310     return TOOLID_ZOOM;
00311 }

BOOL ZoomTool::GetStatusLineText String_256 ptext,
Spread pSpread,
DocCoord  DocPos,
ClickModifiers  ClickMods
[virtual]
 

generate up-to-date text for the status line (called on idles)

Author:
Ed_Cornes (Xara Group Ltd) <camelotdev@xara.com>
Date:
23/11/94
Parameters:
pSpread - pointer to spread under mouse (else NULL) [INPUTS] DocPos - position of mouse in doc (in spread coords) ClickMods - mouse click modifiers
ptext - text for status line [OUTPUTS]
Returns:
TRUE if outputting valid text

Reimplemented from Tool_v1.

Definition at line 768 of file zoomtool.cpp.

00769 {
00770 #if !defined(EXCLUDE_FROM_RALPH) && !defined(EXCLUDE_FROM_XARALX)
00771     ERROR3IF(ptext==NULL,"ZoomTool::GetStatusLineText() - ptext passed as null");
00772 
00773     ValidateStatusText();
00774     if (psStatusText==NULL) return FALSE;
00775 
00776     *ptext=*psStatusText;
00777     return TRUE;
00778 #else
00779     return FALSE;
00780 #endif
00781 }

BOOL ZoomTool::Init void   )  [virtual]
 

To Test if the tool had started up ok.

Author:
Justin_Flude (Xara Group Ltd) <camelotdev@xara.com>
Date:
4/5/94
Returns:
TRUE if the Zoom Tool initialised OK, FALSE otherwise.

Errors: Sends warning to debugging terminal if the info-bar can't be initialised.

Reimplemented from Tool_v1.

Definition at line 216 of file zoomtool.cpp.

00217 {
00218     // Don't initialise twice, dummy!
00219     if (Inited) return FALSE;       
00220     Inited = TRUE;
00221 
00222 #if defined(EXCLUDE_FROM_RALPH)
00223     return OpZoom::Declare();
00224 #else
00225     pZoomInfoBarOp = new ZoomInfoBarOp(_R(IDD_ZOOMINFO));
00226     BOOL ok=(pZoomInfoBarOp!=NULL) && OpZoom::Declare();
00227 #if 0
00228     // Load in the info-bar stuff.
00229     CCResTextFile       file;               // Resource File
00230     ZoomInfoBarOpCreate BarCreate;          // Object that creates ZoomInfoBarOp objects
00231 
00232     // Register the OpDescriptors and THEN open the bar resource file!
00233     BOOL    ok = OpZoom::Declare() && file.open(_R(IDM_ZOOM_BAR), _R(IDT_INFO_BAR_RES));
00234     if (ok) ok = DialogBarOp::ReadBarsFromFile(file, BarCreate);  // Read & create bar
00235     if (ok) file.close();                                         // Close resource
00236 
00237     ENSURE(ok, "Unable to load ZOOMBAR.INI from resource\n"); 
00238 
00239     if (ok)
00240     {
00241         // Info bar now exists.  Now get a pointer to it.
00242         String_32 str(_R(IDS_ZOOMTOOL_INFOBARNAME));
00243         DialogBarOp* pDialogBarOp = DialogBarOp::FindDialogBarOp(str);
00244 
00245                 ok = (pDialogBarOp != NULL);
00246         if (ok) ok = pDialogBarOp->IsKindOf(CC_RUNTIME_CLASS(ZoomInfoBarOp));
00247         if (ok) pZoomInfoBarOp = (ZoomInfoBarOp*) pDialogBarOp;
00248 
00249         ENSURE(ok, "Couldn't find zoom tool info bar");
00250     }
00251 #endif
00252     return ok;
00253 #endif
00254 }

void ZoomTool::InvalidateStatusText  )  [static]
 

Checks if the zoom tool is the currently active ("selected") tool, and if it is then "invalidates" the status-bar text, forcing it to be updated on receipt of the next call to OnMouseMove.

Author:
Justin_Flude (Xara Group Ltd) <camelotdev@xara.com>
Date:
28/6/94
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
-

Errors: -

See also:
ZoomTool::OnMouseMove

Definition at line 819 of file zoomtool.cpp.

00820 {
00821 #if !defined(EXCLUDE_FROM_RALPH) && !defined(EXCLUDE_FROM_XARALX)
00822     // If we are the current tool and have a status-bar text string, then "invalidate" it.
00823     if (IsSelectedTool())
00824     {
00825         ZoomTool* pTool = (ZoomTool*) Tool::GetCurrent();
00826         ENSURE(pTool != NULL, "Null current Tool* in ZoomTool::InvalidateStatusText");
00827         if (pTool->psStatusText != NULL) pTool->bStatusTextValid = FALSE;
00828     }
00829 #endif
00830 }

BOOL ZoomTool::IsSelectedTool  )  [static]
 

Author:
Justin_Flude (Xara Group Ltd) <camelotdev@xara.com>
Date:
28/6/94
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
TRUE if the zoom tool is the currently active ("selected") tool.

Errors: -

See also:
ZoomTool::SelectChange

Definition at line 797 of file zoomtool.cpp.

00798 {
00799     return bIsActive;
00800 }

void ZoomTool::OnClick DocCoord  dcMousePos,
ClickType  ctype,
ClickModifiers  cmods,
Spread pMouseSpread
[virtual]
 

Handle a mouse click and perform a zoom if needed. If we decided to do a zoom we first have to create an operation and a drag is started on it. If the user was just clicking on the window, then the drag will be very short lived and the operation will be able to detect that is was in reality just a click. Once the drag has been started our part of the program is complete and it is up to the operation to actually change the zoom factor and get the document to redraw.

Author:
Justin_Flude (Xara Group Ltd) <camelotdev@xara.com>
Date:
23/4/95
Parameters:
dcMousePos - The Coords (in DocCoords) of the point where the mouse [INPUTS] button was clicked. ctype - Describes the type of click that was detected. cmods - Indicates which buttons caused the click and which modifers were pressed at the same time. pMouseSpread - The spread that the click was on
Returns:
TRUE if it handled the Click, FALSE otherwise

Reimplemented from Tool_v1.

Definition at line 478 of file zoomtool.cpp.

00480 {
00481     // We only act on single clicks.
00482     if (ctype != CLICKTYPE_SINGLE) return;
00483     if (cmods.Menu) return;                         // Don't do anything if the user clicked the Menu button
00484 
00485 #ifdef RALPH
00486     //Graham 20/9/96: If we're in Ralph, clicking on a Hot Link activates it.
00487     //The one exception to this rule is if CTRL or SHIFT is pressed, in which case
00488     //the tool acts as normal.
00489 
00490     //That way CTRL acts as a "Don't activate Hot Links" key, and SHIFT-clicks
00491     //work as normal
00492 
00493     //So, is CTRL or SHIFT pressed?
00494     if (!(cmods.Constrain) && !(cmods.Adjust))
00495     {
00496         //No. Are we on a Hot Link? Let's try and find one.
00497 
00498         //First, find a Hot Link
00499     
00500         Node* pHotLinkNode= DocView::FindHotLinkNode(dcMousePos);
00501 
00502         //If we've found one, go to that Hot Link
00503         if (pHotLinkNode)
00504         {
00505             DocView::GoToHotLink((AttrUser*) pHotLinkNode);
00506             return;
00507         }
00508     }
00509 
00510     //If CTRL was pressed, or if we weren't over a Hot Link, we treat
00511     //the click as a normal Zoom click. Read on...
00512 
00513 #endif //Ralph
00514 
00515     // Try to make a zoom operation.
00516     OpZoom* pZoomOp = new OpZoom;
00517     if (pZoomOp == NULL)
00518     {
00519         // We're out of memory, so we can't do the operation.
00520         InformError(_R(IDE_NOMORE_MEMORY));
00521         return;
00522     }
00523 
00524     // If the click is with the adjust button we zoom out, otherwise we always start
00525     // a drag with a non-adjust click.  If it turns out that the drag is insignificant
00526     // we will zoom in, ignoring the drag.
00527     if (cmods.Adjust)
00528     {
00529         DocView* pDocView = DocView::GetCurrent();
00530         ERROR3IF(pDocView == NULL, "Null current DocView in ZoomTool::OnClick");
00531         pZoomOp->ZoomOut(pDocView->GetClickWorkCoord());
00532     }
00533     else
00534     {
00535         pZoomOp->DoDrag(pMouseSpread, dcMousePos, cmods);
00536     }
00537 }

BOOL ZoomTool::OnKeyPress KeyPress pKey  )  [virtual]
 

Author:
Alex_Bligh (Xara Group Ltd) <camelotdev@xara.com>
Date:
23/02/2004
Parameters:
pKey - pointer to a KeyPress [INPUTS]

Reimplemented from Tool_v1.

Definition at line 430 of file zoomtool.cpp.

00431 {
00432     // Find the current state of the "click" keyboard modifiers...
00433     ClickModifiers ClickMods = ClickModifiers::GetClickModifiers();
00434     Cursor* pPointerShape = pcZoomCursor;
00435 
00436     // if the shift key is pressed...
00437     if (ClickMods.Adjust && !ClickMods.Constrain && !ClickMods.Alternative1)
00438     {
00439         pPointerShape = pcZoomOutCursor;
00440     }
00441 
00442     // only change if this cursor is different from the current cursor
00443     if (pPointerShape != MyCurrentCursor)
00444     {
00445         // set this cursor as the current cursor and immediately display it
00446         CursorStack::GSetTop(pPointerShape, CurrentCursorID);
00447         // remember this is our current cursor
00448         MyCurrentCursor = pPointerShape;
00449     }
00450 
00451     // return FALSE so that the key press gets passed on (e.g. Space needs to be passed
00452     // on so that the "swap to selector tool" works.
00453     return FALSE;
00454 }

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

immediately updates status line text

Author:
Ed_Cornes (Xara Group Ltd) <camelotdev@xara.com>
Date:
23/11/94
Parameters:
(not used) ...except in Ralph (says Graham) [INPUTS]

Reimplemented from Tool_v1.

Definition at line 550 of file zoomtool.cpp.

00551 {
00552 #ifdef RALPH
00553     //Graham 20/9/96.
00554     //We need to check if the zoom tool's over a Hot Link. If it is, the cursor changes
00555     //to a pointing hand
00556 
00557     //The one exception is if CTRL's pressed, in which case the cursor is the 
00558     //normal Zoom cursor.
00559 
00560         //First, try and find a node with a Hot Link
00561     AttrUser* pHotLinkNode= (AttrUser*) DocView::FindHotLinkNode(dcPoint);
00562 
00563     if (pHotLinkNode && !(mods.Constrain) && !(mods.Adjust))
00564     {
00565         //Yes. So change the cursor to a pointing hand
00566         ChangeCursor(Cursor::PointingHand);
00567 
00568         //And now to update the status bar of the browser
00569 
00570         //So first get a pointer to the document
00571                 
00572         //And a pointer to the Ralph document...
00573         Document* ThisDoc=Document::GetSelected();
00574         RalphDocument* ThisRalphDoc=ThisDoc->GetRalphDoc();
00575 
00576         ERROR3IF(ThisRalphDoc==NULL, "DocView::OnMouseMoveWithNoTool has no Ralph Doc");
00577 
00578         //Then get the base URL of this Ralph document as a Web Address
00579         WebAddress wBase(ThisRalphDoc->GetBaseURL());
00580 
00581         //And get the URL of this node as a Web Address
00582         WebAddress wEmbedded(pHotLinkNode->GetWebAddress());
00583 
00584         //This function makes wEmbedded into an absolute URL (if necessary)
00585         wEmbedded.Combine(wBase);
00586 
00587         //Make the Web Address into a normal string
00588         String_256 strEmbedded=wEmbedded.GetWebAddress();
00589 
00590         //Now get the full status bar string and put the URL into it
00591         String_256 sZoomTool;
00592 
00593         sZoomTool.MakeMsg(_R(IDS_ZOOMTOOL_HOTLINK), (TCHAR*) strEmbedded);
00594         
00595         //And tell the Ralph document to show the string in the browser's status
00596         //bar
00597         ThisRalphDoc->SetStatusBar(&sZoomTool);
00598     }
00599     else
00600     {
00601         //No, the cursor is not over a Hot Link
00602         //Change the cursor to the standard selector-style "arrow"
00603         ChangeCursor(pcZoomCursor);
00604 
00605         //And get the status bar text
00606         ValidateStatusText();
00607         if (psStatusText) DocView::SetBrowserStatusBar(psStatusText);
00608 
00609     }
00610 #else
00611 
00612     //If we're in Camelot rather than Ralph
00613 
00614     ValidateStatusText();
00615 
00616     if (psStatusText) GetApplication()->UpdateStatusBarText(psStatusText);
00617 #endif //Ralph
00618 
00619 }

void ZoomTool::SelectChange BOOL  fIsSelected  )  [virtual]
 

Called when the tool is selected or deselected. Creates and pushes the tool's cursor; pops and destroys it.

Author:
Justin_Flude (Xara Group Ltd) <camelotdev@xara.com>
Date:
23/11/93
Parameters:
isSelected - TRUE if the tool is becoming selected [INPUTS]
Returns:
Errors: Sends warning to debugging terminal if creating the cursor fails.
See also:
ZoomTool::IsSelectedTool

Reimplemented from Tool_v1.

Definition at line 327 of file zoomtool.cpp.

00328 {
00329     if (fIsSelected)
00330     {
00331         // This tool has just been selected.  Set the internal global flag so this
00332         // can be easily checked.
00333         bIsActive = TRUE;
00334 //      TRACEUSER( "JustinF", _T("===================================== into ZOOM TOOL\n"));
00335 
00336         // Try to load our cursors.
00337         pcZoomCursor = new Cursor(this, _R(IDC_ZOOMTOOLCURSOR));
00338         pcZoomOutCursor = new Cursor(this, _R(IDC_ZOOMOUTTOOLCURSOR));
00339 
00340 #ifdef RALPH
00341         //Graham 20/9/96. This cursor is needed to activate
00342         //HotLinks (TM) in Ralph (TM). The cursor is a static member of
00343         //the Cursor class and so we don't need to delete it.
00344         pcHotLinkCursor = Cursor::PointingHand;
00345 #endif //Ralph
00346 
00347         if (pcZoomCursor == NULL || !pcZoomCursor->IsValid())
00348             return;
00349 
00350         // Push cursor, but don't display now.
00351         CurrentCursorID = CursorStack::GPush(pcZoomCursor, FALSE);
00352         
00353 #if !defined(EXCLUDE_FROM_RALPH)
00354         // Show the info-bar.
00355         pZoomInfoBarOp->Create();
00356 #endif
00357 
00358         // Allocate the string used for status-bar text, if necessary.
00359         // Graham 7/9/96: We now do this in Ralph too.
00360 
00361         if (psStatusText == NULL)
00362         {
00363             psStatusText = new String_256;
00364             #ifdef _DEBUG
00365                 if (psStatusText == NULL)
00366                     TRACE( _T("Couldn't allocate a String for zoom tool status bar text!\n") );
00367             #endif
00368             bStatusTextValid = FALSE;
00369         }
00370 
00371 
00372         // Which blobs do I want displayed?
00373         // Used to declare an interest in no blobs which meant that all blobs disappeared
00374         // when this tool is selected. Now try not to affect this by not declaring an
00375         // interest.
00376         // Changed by Neville 16/8/94
00377         //  BlobManager* BlobMgr = GetApplication()->GetBlobManager();
00378         //  if ((BlobMgr != NULL) && (Document::GetCurrent() != NULL))
00379         //  {
00380         //      // Decide which blobs to display
00381         //      BlobStyle MyBlobs;
00382         //  
00383         //      // We want them all off, which is the default
00384         //      // tell the blob manager
00385         //      BlobMgr->ToolInterest(MyBlobs);
00386         //  }
00387     }
00388     else
00389     {
00390 //      TRACEUSER( "JustinF", _T("------------------------------------- out of ZOOM TOOL\n"));
00391         
00392         // No longer the selected tool.
00393         bIsActive = FALSE;
00394 
00395         // Deselection - destroy the tool's cursor, if there is one.
00396         if (pcZoomCursor != NULL)
00397         {
00398             CursorStack::GPop(CurrentCursorID);
00399             delete pcZoomCursor;
00400             delete pcZoomOutCursor;
00401             CurrentCursorID = 0;
00402         }
00403 #if !defined(EXCLUDE_FROM_RALPH)
00404         // Hide the info-bar.
00405         pZoomInfoBarOp->Delete();
00406 #endif
00407     
00408         // Deallocate the status-bar text "mask".
00409         // Graham 7/9/96: And we now do this in Ralph too.
00410         delete psStatusText;
00411         psStatusText = NULL;
00412 
00413     }
00414 }

void ZoomTool::ValidateStatusText  ) 
 

Checks if the text in the status-bar needs updating, for example if a new zoom factor has been selected since it was last painted, and does what is required.

Author:
Justin_Flude (Xara Group Ltd) <camelotdev@xara.com>
Date:
24/6/95
Parameters:
validates string pointed to by psStatusText [OUTPUTS]
Graham 7/9/96: We now get status line text in Ralph too.

Definition at line 634 of file zoomtool.cpp.

00635 {
00636     // If there is some status text to update ...
00637     if (psStatusText == NULL) return;
00638 
00639 #ifndef RALPH
00640     // If the zoom factor has not changed since we last created the string ...
00641     // Graham 7/10/96: In Ralph, we assume the status bar text is always invalid
00642     if (bStatusTextValid) return;
00643 #endif
00644 
00645     // Get the selected DocView, if any.
00646     DocView* pDocView = DocView::GetSelected();
00647     if (pDocView == NULL) return;           
00648 
00649     // Get the view's index into the zoom table, if initialised.
00650     INT32 nIndex = DocView::GetSelected()->GetZoomTableIndex();
00651     if (nIndex == cUninitZoomIndex) return;
00652 
00653     // Check if we have a 'fractional' zoom index that is equivalent to a preset
00654     // zoom factor.  If we have then convert it now to the equivalent preset, as
00655     // it makes the logic simpler, if slightly slower.
00656     INT32 nFracPercent = (pDocView->GetViewScale() * 100 + FIXED16_DBL(0.5)).MakeInt();
00657     if (nIndex == cFractionalZoomIndex)
00658     {
00659         // Convert the fractional index into a percentage.
00660         for (INT32 i = 0; i < cZoomTableSize; i++)
00661         {
00662             // If it's the same is the preset set it to the preset.
00663             if (nFracPercent == OpZoom::GetPresetZoomPercent(i))
00664             {
00665                 pDocView->SetZoomTableIndex(nIndex = i);
00666                 break;
00667             }
00668         }
00669     }   
00670 
00671     // Work out what percentages we get if we zoom in and zoom out from the current zoom
00672     // factor.  If we are at the maximum or minimum zoom we note this here as well.
00673     INT32 nInPercent, nOutPercent;
00674     if (nIndex != cFractionalZoomIndex)
00675     {
00676         // Handle a zoom factor that appears in the zoom table.
00677         if (nIndex == 0)
00678         {
00679             // Can't zoom in any further.  Use the special code for that, a 0% zoom.
00680             nInPercent  = 0;
00681             nOutPercent = OpZoom::GetPresetZoomPercent(1);
00682         }
00683         else if (nIndex == cZoomTableSize - 1)
00684         {
00685             // Can't zoom out any further.
00686             nInPercent  = OpZoom::GetPresetZoomPercent(cZoomTableSize - 2);
00687             nOutPercent = 0;
00688         }
00689         else
00690         {
00691             // The in/out factors are the next and previous presets.
00692             nInPercent  = OpZoom::GetPresetZoomPercent(nIndex - 1);
00693             nOutPercent = OpZoom::GetPresetZoomPercent(nIndex + 1);
00694         }
00695     }
00696     else
00697     {
00698         // Handle a zoom factor that doesn't appear in the zoom table.
00699         // Search the zoom factor table looking for two consequetive entries that
00700         // bracket the current percentage.
00701         INT32 i;
00702         for (i = 0; i < cZoomTableSize; i++)
00703             if (nFracPercent > OpZoom::GetPresetZoomPercent(i)) break;
00704 
00705         // Convert the found bounds into "in" and "out" percentages.
00706         if (i == 0)
00707         {
00708             // Can't zoom in any further, and more than the maximum preset.
00709             nInPercent  = 0;
00710             nOutPercent = OpZoom::GetPresetZoomPercent(0);
00711         }
00712         else if (i == cZoomTableSize)
00713         {
00714             // Can't zoom out any further, and less than the minimum preset.
00715             nInPercent  = OpZoom::GetPresetZoomPercent(cZoomTableSize - 1);
00716             nOutPercent = 0;
00717         }
00718         else
00719         {
00720             // Current zoom percentage lies within the bounds of the table.
00721             nInPercent  = OpZoom::GetPresetZoomPercent(i - 1);
00722             nOutPercent = OpZoom::GetPresetZoomPercent(i);
00723         }
00724     }
00725 
00726 #ifdef RALPH
00727     //Graham 7/9/96: In Ralph, the status bar text only refers to the current zoom
00728     psStatusText->Empty();
00729 
00730     String_256 s;
00731     s.MakeMsg(_R(IDS_RALPH_ZOOMTOOLSTR), nFracPercent);
00732     *psStatusText+=s;
00733 
00734 #else
00735     // (Re)create the status-bar text string from the two string-sub masks.
00736     psStatusText->Empty();
00737     if (nInPercent != 0) psStatusText->MakeMsg(_R(IDS_STATUS_ZOOM_IN_MASK), nInPercent);
00738     if (nOutPercent != 0)
00739     {
00740         String_256 s;
00741         s.MakeMsg(_R(IDS_STATUS_ZOOM_OUT_MASK), nOutPercent);
00742         *psStatusText += s;
00743     }
00744 
00745     // Append some text about dragging.
00746     *psStatusText += String_256(_R(IDS_STATUS_ZOOM_DRAG_TEXT));
00747 
00748     // Mark the status-bar text as now valid.
00749     bStatusTextValid = TRUE;
00750 #endif //Ralph
00751 }


Member Data Documentation

TCHAR * ZoomTool::Author = _T("JustinF") [static, private]
 

Definition at line 180 of file zoomtool.h.

BOOL ZoomTool::bIsActive = FALSE [static, private]
 

Definition at line 181 of file zoomtool.h.

BOOL ZoomTool::bStatusTextValid [private]
 

Definition at line 175 of file zoomtool.h.

INT32 ZoomTool::CurrentCursorID [private]
 

Definition at line 172 of file zoomtool.h.

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

Definition at line 177 of file zoomtool.h.

BOOL ZoomTool::Inited [private]
 

Definition at line 158 of file zoomtool.h.

Cursor* ZoomTool::MyCurrentCursor [private]
 

Definition at line 161 of file zoomtool.h.

Cursor* ZoomTool::pcZoomCursor [private]
 

Definition at line 159 of file zoomtool.h.

Cursor* ZoomTool::pcZoomOutCursor [private]
 

Definition at line 160 of file zoomtool.h.

String_256* ZoomTool::psStatusText [private]
 

Definition at line 174 of file zoomtool.h.

TCHAR * ZoomTool::Purpose = _T("To zoom in on a document") [static, private]
 

Definition at line 179 of file zoomtool.h.

ZoomInfoBarOp* ZoomTool::pZoomInfoBarOp [private]
 

Definition at line 173 of file zoomtool.h.

TCHAR * ZoomTool::ToolName = _T("Zoom Tool") [static, private]
 

Definition at line 178 of file zoomtool.h.


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