#include <zoomops.h>
Inheritance diagram for OpZoomPrevZoomDescriptor:
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. |
Definition at line 530 of file zoomops.h.
|
Constructs an OpDescriptor for the "Previous zoom" button.
Definition at line 2329 of file zoomops.cpp. 02330 : OpZoomDescriptor(OPTOKEN_ZOOMPREV, _R(IDS_ZOOMPREVSTATUSTEXT), 0, _R(IDBBL_PREV_ZOOM)) 02331 { 02332 // Empty. 02333 }
|
|
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.
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 }
|
|
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.
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 }
|
|
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.
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 }
|
|
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.
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 }
|