[Date Prev][Date Next][Thread Prev][Thread Next][Thread Index]
[XaraXtreme-commits] Commit Complete
Commit by : luke
Repository : xara
Revision : 1757
Date : Wed Sep 20 10:36:30 BST 2006
Changed paths:
M /Trunk/XaraLX/tools/zoomops.cpp
M /Trunk/XaraLX/tools/zoomops.h
M /Trunk/XaraLX/wxOil/xrc/EN/justin-strings.xrc
M /Trunk/XaraLX/wxOil/xrc/EN/xaralx-bars.xrc
Back port of Camelot "zoom to 100%" code
Diff:
Index: Trunk/XaraLX/tools/zoomops.cpp
===================================================================
--- Trunk/XaraLX/tools/zoomops.cpp (revision 1756)
+++ Trunk/XaraLX/tools/zoomops.cpp (revision 1757)
@@ -149,6 +149,10 @@
CC_IMPLEMENT_DYNCREATE(OpZoom, OpCentredDragBox)
CC_IMPLEMENT_DYNCREATE(OpZoomIn, OpZoom)
CC_IMPLEMENT_DYNCREATE(OpZoomOut, OpZoom)
+CC_IMPLEMENT_DYNCREATE(OpZoomTo100, OpZoom)
+CC_IMPLEMENT_DYNCREATE(OpZoomTo200, OpZoom)
+CC_IMPLEMENT_DYNCREATE(OpZoomTo300, OpZoom)
+CC_IMPLEMENT_DYNCREATE(OpZoomTo400, OpZoom)
#if !defined(EXCLUDE_FROM_RALPH)
CC_IMPLEMENT_DYNCREATE(ZoomInfoBarOp, InformationBarOp)
@@ -641,7 +645,35 @@
}
+/********************************************************************************************
+> void OpZoom::ZoomTo(const WorkCoord& wcZoom, int nPercent, BOOL fEndOp = TRUE)
+ Author: JustinF
+ Created: 23/4/95
+ Inputs: wcZoom the point to zoom in at
+ fEndOp whether to end this operation after this zoom
+ Purpose: Zooms into the current DocView by one step. By default this function
+ will call the End() function for this operation afterwards.
+********************************************************************************************/
+
+void OpZoom::ZoomTo(const WorkCoord& wcZoom, int nPercent, BOOL fEndOp)
+{
+ // Find out the current view.
+ DocView* pDocView = DocView::GetCurrent();
+ ERROR3IF(pDocView == 0, "No current DocView in OpZoom::ZoomIn");
+
+ if (pDocView)
+ {
+ // Do the zoom. We will (optionally) end the operation.
+ FIXED16 f16Scale = FIXED16(nPercent) / 100;
+ ZoomAtPoint(wcZoom, f16Scale, FALSE);
+ }
+
+ // End the operation if the caller wants us to.
+ if (fEndOp) End();
+}
+
+
/********************************************************************************************
> void OpZoom::ZoomIn(const WorkCoord& wcZoom, BOOL fEndOp = TRUE)
@@ -1017,7 +1049,11 @@
!new OpZoomFitSpreadDescriptor ||
!new OpZoomFitDrawingDescriptor ||
!new OpZoomFitSelectedDescriptor ||
- !new OpZoomFitRectDescriptor,
+ !new OpZoomFitRectDescriptor ||
+ !OpZoomTo100::Init() ||
+ !OpZoomTo200::Init() ||
+ !OpZoomTo300::Init() ||
+ !OpZoomTo400::Init(),
_R(IDE_NOMORE_MEMORY),
FALSE);
@@ -1132,6 +1168,277 @@
////////////////////////////////////////////////////////////////////////////////////////////
+// class OpZoomTo100
+OpZoomTo100::OpZoomTo100()
+{
+}
+
+BOOL OpZoomTo100::Init()
+{
+ BOOL ok = RegisterOpDescriptor(
+ 0,
+ _R(IDS_ZOOMTO100),
+ CC_RUNTIME_CLASS(OpZoomTo100),
+ OPTOKEN_ZOOMTO100,
+ OpZoomTo100::GetState,
+ 0, /* help ID */
+ _R(IDBBL_ZOOMTO100),/* bubble ID */
+ 0 /* bitmap ID */
+ );
+ return ok;
+}
+
+/***********************************************************************************************
+
+> static OpState OpZoomToo100::GetState(String_256* Description, OpDescriptor*)
+
+ Author: Luke Hart
+ Created: 18/09/06
+ Inputs: Description = ptr to place description of why this op can't happen
+ pOpDesc = ptr to the Op Desc associated with this op
+ Outputs: -
+ Returns: An OpState object
+ Purpose: Func for determining the usability of this op
+ SeeAlso: -
+
+***********************************************************************************************/
+OpState OpZoomTo100::GetState(String_256* Description, OpDescriptor*)
+{
+ OpState State;
+ return State;
+}
+
+/********************************************************************************************
+
+> virtual void OpZoomToo100::Do(OpDescriptor* pOpDesc)
+
+ Author: Luke Hart
+ Created: 18/09/06
+ Inputs: pointer to the OpZoomDescriptor being invoked
+ Purpose: Calls the base class function to zoom to 100%!
+
+********************************************************************************************/
+void OpZoomTo100::Do(OpDescriptor *pOpDesc)
+{
+ // Ok! lets zoom in!
+ DocView* pDocView = DocView::GetCurrent();
+
+ if(pDocView)
+ {
+ const WorkRect ZoomRect = pDocView->GetViewRect();
+ ZoomTo( ZoomRect.Centre(), 100 );
+ }
+ else
+ {
+ ERROR3IF(pDocView == 0, "No current DocView found!");
+ }
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////
+// class OpZoomTo200
+OpZoomTo200::OpZoomTo200()
+{
+}
+
+BOOL OpZoomTo200::Init()
+{
+ BOOL ok = RegisterOpDescriptor(
+ 0,
+ _R(IDS_ZOOMTO200),
+ CC_RUNTIME_CLASS(OpZoomTo200),
+ OPTOKEN_ZOOMTO200,
+ OpZoomTo200::GetState,
+ 0, /* help ID */
+ _R(IDBBL_ZOOMTO200),/* bubble ID */
+ 0 /* bitmap ID */
+ );
+ return ok;
+}
+
+/***********************************************************************************************
+
+> static OpState OpZoomTo200::GetState(String_256* Description, OpDescriptor*)
+
+ Author: Luke Hart
+ Created: 18/09/06
+ Inputs: Description = ptr to place description of why this op can't happen
+ pOpDesc = ptr to the Op Desc associated with this op
+ Outputs: -
+ Returns: An OpState object
+ Purpose: Func for determining the usability of this op
+ SeeAlso: -
+
+***********************************************************************************************/
+OpState OpZoomTo200::GetState(String_256* Description, OpDescriptor*)
+{
+ OpState State;
+ return State;
+}
+
+/********************************************************************************************
+
+> virtual void OpZoomTo200::Do(OpDescriptor* pOpDesc)
+
+ Author: Luke Hart
+ Created: 18/09/06
+ Inputs: pointer to the OpZoomDescriptor being invoked
+ Purpose: Calls the base class function to zoom to 200%!
+
+********************************************************************************************/
+void OpZoomTo200::Do(OpDescriptor *pOpDesc)
+{
+ // Ok! lets zoom in!
+ DocView* pDocView = DocView::GetCurrent();
+
+ if(pDocView)
+ {
+ const WorkRect ZoomRect = pDocView->GetViewRect();
+ ZoomTo( ZoomRect.Centre(), 200 );
+ }
+ else
+ {
+ ERROR3IF(pDocView == 0, "No current DocView found!");
+ }
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////
+// class OpZoomTo400
+OpZoomTo300::OpZoomTo300()
+{
+}
+
+BOOL OpZoomTo300::Init()
+{
+ BOOL ok = RegisterOpDescriptor(
+ 0,
+ _R(IDS_ZOOMTO300),
+ CC_RUNTIME_CLASS(OpZoomTo300),
+ OPTOKEN_ZOOMTO300,
+ OpZoomTo300::GetState,
+ 0, /* help ID */
+ _R(IDBBL_ZOOMTO300),/* bubble ID */
+ 0 /* bitmap ID */
+ );
+
+ return ok;
+}
+
+/***********************************************************************************************
+
+> static OpState OpZoomToo100::GetState(String_256* Description, OpDescriptor*)
+
+ Author: Luke Hart
+ Created: 18/09/06
+ Inputs: Description = ptr to place description of why this op can't happen
+ pOpDesc = ptr to the Op Desc associated with this op
+ Outputs: -
+ Returns: An OpState object
+ Purpose: Func for determining the usability of this op
+ SeeAlso: -
+
+***********************************************************************************************/
+OpState OpZoomTo300::GetState(String_256* Description, OpDescriptor*)
+{
+ OpState State;
+ return State;
+}
+
+/********************************************************************************************
+
+> virtual void OpZoomTo300::Do(OpDescriptor* pOpDesc)
+
+ Author: Luke Hart
+ Created: 18/09/06
+ Inputs: pointer to the OpZoomDescriptor being invoked
+ Purpose: Calls the base class function to zoom to 300%!
+
+********************************************************************************************/
+void OpZoomTo300::Do(OpDescriptor *pOpDesc)
+{
+ // Ok! lets zoom in!
+ DocView* pDocView = DocView::GetCurrent();
+
+ if(pDocView)
+ {
+ const WorkRect ZoomRect = pDocView->GetViewRect();
+ ZoomTo( ZoomRect.Centre(), 300 );
+ }
+ else
+ {
+ ERROR3IF(pDocView == 0, "No current DocView found!");
+ }
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////
+// class OpZoomTo400
+OpZoomTo400::OpZoomTo400()
+{
+}
+
+BOOL OpZoomTo400::Init()
+{
+ BOOL ok = RegisterOpDescriptor(
+ 0,
+ _R(IDS_ZOOMTO400),
+ CC_RUNTIME_CLASS(OpZoomTo400),
+ OPTOKEN_ZOOMTO400,
+ OpZoomTo400::GetState,
+ 0, /* help ID */
+ _R(IDBBL_ZOOMTO400),/* bubble ID */
+ 0 /* bitmap ID */
+ );
+
+ return ok;
+}
+
+/***********************************************************************************************
+
+> static OpState OpZoomToo100::GetState(String_256* Description, OpDescriptor*)
+
+ Author: Luke Hart
+ Created: 18/09/06
+ Inputs: Description = ptr to place description of why this op can't happen
+ pOpDesc = ptr to the Op Desc associated with this op
+ Outputs: -
+ Returns: An OpState object
+ Purpose: Func for determining the usability of this op
+ SeeAlso: -
+
+***********************************************************************************************/
+OpState OpZoomTo400::GetState(String_256* Description, OpDescriptor*)
+{
+ OpState State;
+ return State;
+}
+
+/********************************************************************************************
+
+> virtual void OpZoomToo100::Do(OpDescriptor* pOpDesc)
+
+ Author: Luke Hart
+ Created: 18/09/06
+ Inputs: pointer to the OpZoomDescriptor being invoked
+ Purpose: Calls the base class function to zoom to 400%!
+
+********************************************************************************************/
+void OpZoomTo400::Do(OpDescriptor *pOpDesc)
+{
+ // Ok! lets zoom in!
+ DocView* pDocView = DocView::GetCurrent();
+
+ if(pDocView)
+ {
+ const WorkRect ZoomRect = pDocView->GetViewRect();
+ ZoomTo( ZoomRect.Centre(), 400 );
+ }
+ else
+ {
+ ERROR3IF(pDocView == 0, "No current DocView found!");
+ }
+}
+
+
+////////////////////////////////////////////////////////////////////////////////////////////
// class OpZoomIn
OpZoomIn::OpZoomIn()
{
Index: Trunk/XaraLX/tools/zoomops.h
===================================================================
--- Trunk/XaraLX/tools/zoomops.h (revision 1756)
+++ Trunk/XaraLX/tools/zoomops.h (revision 1757)
@@ -116,6 +116,10 @@
#define OPTOKEN_ZOOMRECT TEXT("ZoomRect")
#define OPTOKEN_ZOOMIN TEXT("ZoomIn")
#define OPTOKEN_ZOOMOUT TEXT("ZoomOut")
+#define OPTOKEN_ZOOMTO100 TEXT("Zoom100")
+#define OPTOKEN_ZOOMTO200 TEXT("Zoom200")
+#define OPTOKEN_ZOOMTO300 TEXT("Zoom300")
+#define OPTOKEN_ZOOMTO400 TEXT("Zoom400")
// Graeme (11/11/99) - Definition of the minimum size of the drag rectangle.
#define ZOOM_MIN_DRAG 5000
@@ -182,14 +186,16 @@
BOOL DoDrag(Spread* pStartSpread, const DocCoord& dcStartPos, ClickModifiers cmods);
virtual BOOL SnappingDrag() { return FALSE; }
- // Zoom in or out by the next scale factor in the ZoomTable table. These are normally
- // called on click events by the OpZoom user.
+ // Zoom in or out by the next scale factor in the ZoomTable table (also zoom direct to 100%).
+ // These are normally called on click events by the OpZoom user.
void ZoomOut(const WorkCoord& wcZoom, BOOL fEndOp = TRUE);
void ZoomOut(Spread* pZoomSpread, const DocCoord& dcZoomPos, BOOL fEndOp = TRUE);
void ZoomIn(const WorkCoord& wcZoom, BOOL fEndOp = TRUE);
void ZoomIn(Spread* pZoomSpread, const DocCoord& dcZoomPos, BOOL fEndOp = TRUE);
+ void ZoomTo( const WorkCoord& wcZoom, int Percent, BOOL fEndOp = TRUE);
+
// Zoom so that the given rectangle within the current view completely fills the
// current view's view-port.
void ZoomInOnRect(const WorkRect& wrZoom, BOOL fEndOp = TRUE);
@@ -293,6 +299,110 @@
};
/********************************************************************************************
+> class OpZoomTo100 : public OpZoom
+
+ Author: Luke Hart
+ Created: 15/09/06
+ Purpose: This op has been written so that we can use the NumPad Plus key to fire off
+ a zoom in operation. We can`t use the zoom op directly as the hotkey code
+ calls the Do() function instead of the DoWithParam(). What this class does
+ is basically call the ZoomOps DoWithParam() from it`s Do() function.
+********************************************************************************************/
+class OpZoomTo100 : public OpZoom
+{
+public:
+ // Creation & destruction.
+ OpZoomTo100();
+
+ // A do function (at long last) so that menu and keyboard short cuts work.
+ virtual void Do(OpDescriptor*);
+ static BOOL Init();
+ static OpState GetState(String_256* Description, OpDescriptor*);
+
+private:
+ // Run-time typing.
+ CC_DECLARE_DYNCREATE(OpZoomTo100);
+};
+
+/********************************************************************************************
+> class OpZoomTo200 : public OpZoom
+
+ Author: Luke Hart
+ Created: 15/09/06
+ Purpose: This op has been written so that we can use the NumPad Plus key to fire off
+ a zoom in operation. We can`t use the zoom op directly as the hotkey code
+ calls the Do() function instead of the DoWithParam(). What this class does
+ is basically call the ZoomOps DoWithParam() from it`s Do() function.
+********************************************************************************************/
+class OpZoomTo200 : public OpZoom
+{
+public:
+ // Creation & destruction.
+ OpZoomTo200();
+
+ // A do function (at long last) so that menu and keyboard short cuts work.
+ virtual void Do(OpDescriptor*);
+ static BOOL Init();
+ static OpState GetState(String_256* Description, OpDescriptor*);
+
+private:
+ // Run-time typing.
+ CC_DECLARE_DYNCREATE(OpZoomTo200);
+};
+
+/********************************************************************************************
+> class OpZoomTo300 : public OpZoom
+
+ Author: Luke Hart
+ Created: 15/09/06
+ Purpose: This op has been written so that we can use the NumPad Plus key to fire off
+ a zoom in operation. We can`t use the zoom op directly as the hotkey code
+ calls the Do() function instead of the DoWithParam(). What this class does
+ is basically call the ZoomOps DoWithParam() from it`s Do() function.
+********************************************************************************************/
+class OpZoomTo300 : public OpZoom
+{
+public:
+ // Creation & destruction.
+ OpZoomTo300();
+
+ // A do function (at long last) so that menu and keyboard short cuts work.
+ virtual void Do(OpDescriptor*);
+ static BOOL Init();
+ static OpState GetState(String_256* Description, OpDescriptor*);
+
+private:
+ // Run-time typing.
+ CC_DECLARE_DYNCREATE(OpZoomTo300);
+};
+
+/********************************************************************************************
+> class OpZoomTo400 : public OpZoom
+
+ Author: Luke Hart
+ Created: 15/09/06
+ Purpose: This op has been written so that we can use the NumPad Plus key to fire off
+ a zoom in operation. We can`t use the zoom op directly as the hotkey code
+ calls the Do() function instead of the DoWithParam(). What this class does
+ is basically call the ZoomOps DoWithParam() from it`s Do() function.
+********************************************************************************************/
+class OpZoomTo400 : public OpZoom
+{
+public:
+ // Creation & destruction.
+ OpZoomTo400();
+
+ // A do function (at long last) so that menu and keyboard short cuts work.
+ virtual void Do(OpDescriptor*);
+ static BOOL Init();
+ static OpState GetState(String_256* Description, OpDescriptor*);
+
+private:
+ // Run-time typing.
+ CC_DECLARE_DYNCREATE(OpZoomTo400);
+};
+
+/********************************************************************************************
> class OpZoomDescriptor : public OpDescriptor
Author: Justin_Flude (Xara Group Ltd) <camelotdev@xxxxxxxx>
Index: Trunk/XaraLX/wxOil/xrc/EN/xaralx-bars.xrc
===================================================================
--- Trunk/XaraLX/wxOil/xrc/EN/xaralx-bars.xrc (revision 1756)
+++ Trunk/XaraLX/wxOil/xrc/EN/xaralx-bars.xrc (revision 1757)
@@ -1004,6 +1004,14 @@
<camartstyle>wxCACS_PUSHBUTTON|wxCACS_ALLOWHOVER</camartstyle>
<optoken>ZoomPrev</optoken>
</object>
+ </object>
+ <object class="sizeritem">
+ <flag>wxALIGN_CENTER_VERTICAL|wxALL</flag>
+ <border>1</border>
+ <object class="wxCamArtControl" name="IDPB_ZOOM_100_BUTTON">
+ <camartstyle>wxCACS_PUSHBUTTON|wxCACS_ALLOWHOVER</camartstyle>
+ <optoken>Zoom100</optoken>
+ </object>
</object>
<object class="sizeritem">
<flag>wxALIGN_CENTER_VERTICAL|wxALL</flag>
@@ -3494,7 +3502,20 @@
<flag>wxALIGN_CENTER_VERTICAL|wxALL</flag>
<border>1</border>
<size>3,28</size>
+ </object>
+ <object class="sizeritem">
+ <flag>wxALIGN_CENTER_VERTICAL|wxALL</flag>
+ <border>1</border>
+ <object class="wxCamArtControl" name="IDPB_ZOOM_100_BUTTON">
+ <camartstyle>wxCACS_PUSHBUTTON|wxCACS_ALLOWHOVER</camartstyle>
+ <optoken>Zoom100</optoken>
+ </object>
</object>
+ <object class="spacer">
+ <flag>wxALIGN_CENTER_VERTICAL|wxALL</flag>
+ <border>1</border>
+ <size>3,28</size>
+ </object>
<object class="sizeritem">
<flag>wxALIGN_CENTER_VERTICAL|wxALL</flag>
<border>1</border>
Index: Trunk/XaraLX/wxOil/xrc/EN/justin-strings.xrc
===================================================================
--- Trunk/XaraLX/wxOil/xrc/EN/justin-strings.xrc (revision 1756)
+++ Trunk/XaraLX/wxOil/xrc/EN/justin-strings.xrc (revision 1757)
@@ -78,6 +78,30 @@
</object>
<object class="sizeritem">
<flag>wxALIGN_LEFT|wxALL|wxADJUST_MINSIZE</flag>
+ <object class="wxStaticText" name="IDBBL_ZOOMTO100">
+ <label>Zoom to 100%</label>
+ </object>
+ </object>
+ <object class="sizeritem">
+ <flag>wxALIGN_LEFT|wxALL|wxADJUST_MINSIZE</flag>
+ <object class="wxStaticText" name="IDBBL_ZOOMTO200">
+ <label>Zoom to 200%</label>
+ </object>
+ </object>
+ <object class="sizeritem">
+ <flag>wxALIGN_LEFT|wxALL|wxADJUST_MINSIZE</flag>
+ <object class="wxStaticText" name="IDBBL_ZOOMTO300">
+ <label>Zoom to 300%</label>
+ </object>
+ </object>
+ <object class="sizeritem">
+ <flag>wxALIGN_LEFT|wxALL|wxADJUST_MINSIZE</flag>
+ <object class="wxStaticText" name="IDBBL_ZOOM4O100">
+ <label>Zoom to 400%</label>
+ </object>
+ </object>
+ <object class="sizeritem">
+ <flag>wxALIGN_LEFT|wxALL|wxADJUST_MINSIZE</flag>
<object class="wxStaticText" name="IDBBL_PUSH_TOOLICON">
<label>Push Tool Shift+F8</label>
</object>
@@ -1170,6 +1194,12 @@
</object>
<object class="sizeritem">
<flag>wxALIGN_LEFT|wxALL|wxADJUST_MINSIZE</flag>
+ <object class="wxStaticText" name="IDS_ZOOMTO100">
+ <label>Zoom to &100%;Zooms current drawing to 100%;Zoom to &100%</label>
+ </object>
+ </object>
+ <object class="sizeritem">
+ <flag>wxALIGN_LEFT|wxALL|wxADJUST_MINSIZE</flag>
<object class="wxStaticText" name="IDS_ZOOMOUT">
<label>Zoom Out of &page;Zooms out of the current drawing;Zoom Out of &page</label>
</object>
Xara