OpZoomFitSpreadDescriptor Class Reference

OpDescriptor for the zoom tool's "Fit to spread" button. More...

#include <zoomops.h>

Inheritance diagram for OpZoomFitSpreadDescriptor:

OpZoomDescriptor OpDescriptor MessageHandler ListItem CCObject SimpleCCObject List of all members.

Public Member Functions

 OpZoomFitSpreadDescriptor ()
 Constructs an OpDescriptor for the "Zoom to spread" button.

Protected Member Functions

virtual DocRect GetRect (Spread *pSpread)
 Provides the rectangle that OpZoomDescriptor::HandleButtonMsg will zoom in on.
virtual void AdjustRect (DocRect *pRect) const
 Override the base class version of the fcuntion which inflates the given document rectangle by 5% in each direction for one which inflates it by 2%.

Private Attributes

BOOL m_DontScale

Detailed Description

OpDescriptor for the zoom tool's "Fit to spread" button.

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

Definition at line 446 of file zoomops.h.


Constructor & Destructor Documentation

OpZoomFitSpreadDescriptor::OpZoomFitSpreadDescriptor  ) 
 

Constructs an OpDescriptor for the "Zoom to spread" 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 1981 of file zoomops.cpp.

01982   : OpZoomDescriptor(OPTOKEN_ZOOMSPREAD, _R(IDS_ZOOMSPREADSTATUSTEXT),
01983                      0, _R(IDBBL_FIT_TO_SPREAD))
01984 {
01985     // default to always scaling in AdjustRect
01986     m_DontScale = TRUE;
01987 }


Member Function Documentation

void OpZoomFitSpreadDescriptor::AdjustRect DocRect pRect  )  const [protected, virtual]
 

Override the base class version of the fcuntion which inflates the given document rectangle by 5% in each direction for one which inflates it by 2%.

Author:
Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com>
Date:
9/2/95
Parameters:
pRect pointer to a DocRect to adjust [INPUTS]
The adjusted DocRect. [OUTPUTS]
Returns:
-

Errors: -

See also:
OpZoomDescriptor::AdjustRect; OpZoomDescriptor::GetRect

Reimplemented from OpZoomDescriptor.

Definition at line 2068 of file zoomops.cpp.

02069 {
02070     if (m_DontScale)
02071     {
02072         INT32 xinc = pRect->Width() / 50;           // find 2% of the width and height
02073         INT32 yinc = pRect->Height() / 50;
02074         if (xinc < 1) xinc = 1;                     // make sure we inflate by some amount
02075         if (yinc < 1) yinc = 1;
02076         pRect->lo.x -= xinc;                        // inflate the given rectangle
02077         pRect->lo.y -= yinc;
02078         pRect->hi.x += xinc;
02079         pRect->hi.y += yinc;
02080     }
02081 }

DocRect OpZoomFitSpreadDescriptor::GetRect Spread pSpread  )  [protected, virtual]
 

Provides the rectangle that OpZoomDescriptor::HandleButtonMsg will zoom in on.

Author:
Justin_Flude (Xara Group Ltd) <camelotdev@xara.com>
Date:
26/5/94
Parameters:
pSpread pointer to a spread [INPUTS]
- [OUTPUTS]
Returns:
The "page bounds" of the given spread.

Errors: -

See also:
OpZoomDescriptor::HandleButtonMsg; OpZoomFitSpreadDescriptor::AdjustRect; Spread::GetPageBounds

Reimplemented from OpZoomDescriptor.

Definition at line 2006 of file zoomops.cpp.

02007 {
02008 /*
02009 #ifdef _DEBUG
02010     if (IsUserName("JustinF"))
02011     {
02012         static DocRect drOld = pSpread->GetPageBounds();
02013         DocRect drNew = pSpread->GetPageBounds();
02014         
02015         if (drNew != drOld)
02016         {
02017             TRACE( _T("In OpZoomFitSpreadDesriptor - Spread::GetPageBounds has changed!\n")
02018                   "\t- drOld is %ld x %ld\n\t- drNew is %ld x %ld\n",
02019                     (INT32) drOld.Width(), (INT32) drOld.Height(),
02020                     (INT32) drNew.Width(), (INT32) drNew.Height());
02021         }
02022                 
02023         return drOld = drNew;
02024     }
02025 #endif
02026 */
02027     // These are both in Document coords not spread coords!
02028     DocRect SpreadSize = pSpread->GetPageBounds();
02029     DocRect PasteBoardSize = pSpread->GetPasteboardRect(FALSE);
02030     // If the two sizes are the same then this means we have a zero sized pasteboard
02031     // In this case, we should not try and scale up the resulting rectangle in AdjustRect
02032     // So note this state for later use.
02033     // Cannot do a straight equality check as we will have rounding errors.
02034     const MILLIPOINT delta = 1000;
02035     if (
02036         (SpreadSize.lo.x > PasteBoardSize.lo.x - delta) && (SpreadSize.lo.x < PasteBoardSize.lo.x + delta) &&
02037         (SpreadSize.hi.x > PasteBoardSize.hi.x - delta) && (SpreadSize.hi.x < PasteBoardSize.hi.x + delta) &&
02038         (SpreadSize.lo.y > PasteBoardSize.lo.y - delta) && (SpreadSize.lo.y < PasteBoardSize.lo.y + delta) &&
02039         (SpreadSize.hi.y > PasteBoardSize.hi.y - delta) && (SpreadSize.hi.y < PasteBoardSize.hi.y + delta)
02040        )
02041     {
02042         m_DontScale = FALSE;
02043     }
02044     else
02045     {
02046         m_DontScale = TRUE;
02047     }
02048 
02049     return SpreadSize;
02050 }


Member Data Documentation

BOOL OpZoomFitSpreadDescriptor::m_DontScale [private]
 

Definition at line 456 of file zoomops.h.


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