OpZoomPrevZoomDescriptor Class Reference

OpDescriptor for the zoom tool's "Previous Zoom" button. More...

#include <zoomops.h>

Inheritance diagram for OpZoomPrevZoomDescriptor:

OpZoomDescriptor OpDescriptor MessageHandler ListItem CCObject SimpleCCObject List of all members.

Public Member Functions

 OpZoomPrevZoomDescriptor ()
 Constructs an OpDescriptor for the "Previous zoom" button.
virtual BOOL DoZoom (OpZoom *pZoomOp)
 Overrides the base zoom descriptor class function for performing a zoom operation. This one is different as it just needs to invoke the previous zoom that was in operation. Performs the zoom, after saving the current zoom settings, then updates the zoom combo box. Similar button to HandleButtonMsg but is designed to be called by the Do() operator in OpZoom and hence from keyboard short-cuts or menu operations.

Static Public Member Functions

static void SaveZoom (DocView *pDocView)
 Saves the given DocView's view-scale, scroll-offsets, and index into OpZoom::ZoomTable. Used by the "Previous zoom" button. This function is called by all zoom tool routines that perform a zoom.

Private Member Functions

virtual BOOL IsAvailable ()
 Decides whether the "Previous zoom" button is enabled, which it is if there is a "selected" DocView and at least one zoom has been performed upon it.
virtual MsgResult HandleButtonMsg (DialogOp *popdlgThis, CGadgetID gidThis)
 Responds to a click on the "Previous zoom" button by reading the saved zoom parameters in the "selected" DocView, if any, and resetting the DocView to them.

Detailed Description

OpDescriptor for the zoom tool's "Previous Zoom" button.

Author:
Justin_Flude (Xara Group Ltd) <camelotdev@xara.com>
Date:
13/5/93

Definition at line 530 of file zoomops.h.


Constructor & Destructor Documentation

OpZoomPrevZoomDescriptor::OpZoomPrevZoomDescriptor  ) 
 

Constructs an OpDescriptor for the "Previous zoom" button.

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

Errors: -

See also:
class OpZoomDescriptor

Definition at line 2329 of file zoomops.cpp.

02330   : OpZoomDescriptor(OPTOKEN_ZOOMPREV, _R(IDS_ZOOMPREVSTATUSTEXT), 0, _R(IDBBL_PREV_ZOOM))
02331 {
02332     // Empty.
02333 }


Member Function Documentation

BOOL OpZoomPrevZoomDescriptor::DoZoom OpZoom pZoomOp  )  [virtual]
 

Overrides the base zoom descriptor class function for performing a zoom operation. This one is different as it just needs to invoke the previous zoom that was in operation. Performs the zoom, after saving the current zoom settings, then updates the zoom combo box. Similar button to HandleButtonMsg but is designed to be called by the Do() operator in OpZoom and hence from keyboard short-cuts or menu operations.

Author:
Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com>
Date:
21/9/95
Parameters:
pZoomOp pointer to the OpZoom to be used, can be 0 for this. [INPUTS]
Returns:
True if operation has happened correctly

Errors: -

See also:
OpZoom::Do; OpZoomDescriptor::DoZoom; OpZoomDescriptor::GetSpread; OpZoomDescriptor::GetRect; OpZoomDescriptor::AdjustRect

Reimplemented from OpZoomDescriptor.

Definition at line 2421 of file zoomops.cpp.

02422 {
02423     // ZoomOp can be null.
02424 //  ERROR2IF(pZoomOp == 0, FALSE, "No operation in OpZoomPrevZoomDescriptor::DoZoom")
02425 
02426     // Get the selected DocView.
02427     DocView* pDocView = DocView::GetCurrent();
02428     ERROR2IF(pDocView == 0, FAIL, "No DocView in OpZoomPrevZoomDescriptor::HandleClickMsg");
02429 
02430     DialogBarOp::SetSystemStateChanged();
02431 
02432     // Record the current scale and scroll offset.
02433     INT32 nIndex = pDocView->GetZoomTableIndex();
02434     FIXED16 fxScale = pDocView->GetViewScale();
02435     WorkCoord wcOffset = pDocView->GetScrollOffsets();
02436     
02437     // Restore the previous scale factor and scroll offsets.
02438     pDocView->SetZoomTableIndex(pDocView->GetPrevZoomIndex());
02439     pDocView->SetViewScale(pDocView->GetPrevZoomScale());
02440     pDocView->SetScrollOffsets(pDocView->GetPrevZoomOffset(), FALSE);
02441 
02442     // Remember the "previous previous" zoom . . .
02443     pDocView->SetPrevZoomIndex(nIndex);
02444     pDocView->SetPrevZoomScale(fxScale);
02445     pDocView->SetPrevZoomOffset(wcOffset);
02446 
02447 #ifndef RALPH
02448     // Update the combo-box etc.
02449     OpZoomComboDescriptor::Update();
02450     ZoomTool::InvalidateStatusText();
02451 #endif
02452 
02453     // Finally, force a redraw and return the success code.
02454     pDocView->ForceRedraw(TRUE);
02455     
02456     // End the operation as we have finished
02457     if (pZoomOp)
02458         pZoomOp->End();
02459     
02460     // tell people things have changed on screen
02461     TRACEUSER( "Diccon", _T("DoZoom\n"));
02462     BROADCAST_TO_ALL(ScreenChangeMsg(TRUE));
02463     return TRUE;    
02464 }

MsgResult OpZoomPrevZoomDescriptor::HandleButtonMsg DialogOp popdlgThis,
CGadgetID  gidThis
[private, virtual]
 

Responds to a click on the "Previous zoom" button by reading the saved zoom parameters in the "selected" DocView, if any, and resetting the DocView to them.

Author:
Justin_Flude (Xara Group Ltd) <camelotdev@xara.com>
Date:
26/5/94
Parameters:
(not used, see OpZoomDescriptor::HandleButtonMsg) [INPUTS]
- [OUTPUTS]
Returns:
The message result code (always OK)

Errors: -

See also:
OpZoomPrevZoomDescriptor::SaveZoom; DocView::SetZoomTableIndex; DocView::SetPrevZoomIndex; DocView::SetPrevZoomOffset; DocView::SetPrevZoomScale

Reimplemented from OpZoomDescriptor.

Definition at line 2483 of file zoomops.cpp.

02484 {
02485     // Just call the DoZoom operator but with 0 as we have no valid operation
02486     return DoZoom(0) ? OK : FAIL;
02487 }

BOOL OpZoomPrevZoomDescriptor::IsAvailable  )  [private, virtual]
 

Decides whether the "Previous zoom" button is enabled, which it is if there is a "selected" DocView and at least one zoom has been performed upon it.

Author:
Justin_Flude (Xara Group Ltd) <camelotdev@xara.com>
Date:
26/5/94
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
TRUE if the "previous zoom" button is available

Errors: -

See also:
OpZoom::GetState; OpZoomDescriptor::IsAvailable

Reimplemented from OpZoomDescriptor.

Definition at line 2352 of file zoomops.cpp.

02353 {
02354     // Check for a selected DocView, if any (the base class IsAvailable does this), and
02355     // "grey" the button if it doesn't exist or hasn't been zoomed previously.
02356     DocView* pDocView = DocView::GetCurrent();
02357     return pDocView != 0 && pDocView->GetPrevZoomIndex() != cUninitZoomIndex;
02358 }

void OpZoomPrevZoomDescriptor::SaveZoom DocView pDocView  )  [static]
 

Saves the given DocView's view-scale, scroll-offsets, and index into OpZoom::ZoomTable. Used by the "Previous zoom" button. This function is called by all zoom tool routines that perform a zoom.

Author:
Justin_Flude (Xara Group Ltd) <camelotdev@xara.com>
Date:
26/5/94
Parameters:
pDocView the DocView whose current "zoom setting" is to be saved [INPUTS]
- [OUTPUTS]
Returns:
-

Errors: -

See also:
OpZoomPrevZoomDescriptor::HandleButtonMsg; DocView::SetPrevZoomIndex; DocView::SetPrevZoomScale; DocView::SetPrevZoomOffset

Definition at line 2378 of file zoomops.cpp.

02379 {
02380     // Save data about the current zoom.
02381     ERROR3IF(pDocView == 0, "No DocView in OpZoomPrevZoomDescriptor::SaveZoom");
02382     if (pDocView != 0)
02383     {
02384         pDocView->SetPrevZoomIndex(pDocView->GetZoomTableIndex());
02385         pDocView->SetPrevZoomScale(pDocView->GetViewScale());
02386         pDocView->SetPrevZoomOffset(pDocView->GetScrollOffsets());
02387     }
02388 
02389 #if !defined(EXCLUDE_FROM_RALPH)
02390     // Force the GetState function to be called again.
02391     DialogBarOp::SetSystemStateChanged();
02392 
02393     // If we have saved a "previous zoom" then there is a new zoom, hence the status-
02394     // bar text must have become invalid.
02395     ZoomTool::InvalidateStatusText();
02396 #endif
02397 }


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