rulers.h

Go to the documentation of this file.
00001 // $Id: rulers.h 1535 2006-07-25 16:50:32Z alex $
00002 /* @@tag:xara-cn@@ DO NOT MODIFY THIS LINE
00003 ================================XARAHEADERSTART===========================
00004  
00005                Xara LX, a vector drawing and manipulation program.
00006                     Copyright (C) 1993-2006 Xara Group Ltd.
00007        Copyright on certain contributions may be held in joint with their
00008               respective authors. See AUTHORS file for details.
00009 
00010 LICENSE TO USE AND MODIFY SOFTWARE
00011 ----------------------------------
00012 
00013 This file is part of Xara LX.
00014 
00015 Xara LX is free software; you can redistribute it and/or modify it
00016 under the terms of the GNU General Public License version 2 as published
00017 by the Free Software Foundation.
00018 
00019 Xara LX and its component source files are distributed in the hope
00020 that it will be useful, but WITHOUT ANY WARRANTY; without even the
00021 implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
00022 See the GNU General Public License for more details.
00023 
00024 You should have received a copy of the GNU General Public License along
00025 with Xara LX (see the file GPL in the root directory of the
00026 distribution); if not, write to the Free Software Foundation, Inc., 51
00027 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
00028 
00029 
00030 ADDITIONAL RIGHTS
00031 -----------------
00032 
00033 Conditional upon your continuing compliance with the GNU General Public
00034 License described above, Xara Group Ltd grants to you certain additional
00035 rights. 
00036 
00037 The additional rights are to use, modify, and distribute the software
00038 together with the wxWidgets library, the wxXtra library, and the "CDraw"
00039 library and any other such library that any version of Xara LX relased
00040 by Xara Group Ltd requires in order to compile and execute, including
00041 the static linking of that library to XaraLX. In the case of the
00042 "CDraw" library, you may satisfy obligation under the GNU General Public
00043 License to provide source code by providing a binary copy of the library
00044 concerned and a copy of the license accompanying it.
00045 
00046 Nothing in this section restricts any of the rights you have under
00047 the GNU General Public License.
00048 
00049 
00050 SCOPE OF LICENSE
00051 ----------------
00052 
00053 This license applies to this program (XaraLX) and its constituent source
00054 files only, and does not necessarily apply to other Xara products which may
00055 in part share the same code base, and are subject to their own licensing
00056 terms.
00057 
00058 This license does not apply to files in the wxXtra directory, which
00059 are built into a separate library, and are subject to the wxWindows
00060 license contained within that directory in the file "WXXTRA-LICENSE".
00061 
00062 This license does not apply to the binary libraries (if any) within
00063 the "libs" directory, which are subject to a separate license contained
00064 within that directory in the file "LIBS-LICENSE".
00065 
00066 
00067 ARRANGEMENTS FOR CONTRIBUTION OF MODIFICATIONS
00068 ----------------------------------------------
00069 
00070 Subject to the terms of the GNU Public License (see above), you are
00071 free to do whatever you like with your modifications. However, you may
00072 (at your option) wish contribute them to Xara's source tree. You can
00073 find details of how to do this at:
00074   http://www.xaraxtreme.org/developers/
00075 
00076 Prior to contributing your modifications, you will need to complete our
00077 contributor agreement. This can be found at:
00078   http://www.xaraxtreme.org/developers/contribute/
00079 
00080 Please note that Xara will not accept modifications which modify any of
00081 the text between the start and end of this header (marked
00082 XARAHEADERSTART and XARAHEADEREND).
00083 
00084 
00085 MARKS
00086 -----
00087 
00088 Xara, Xara LX, Xara X, Xara X/Xtreme, Xara Xtreme, the Xtreme and Xara
00089 designs are registered or unregistered trademarks, design-marks, and/or
00090 service marks of Xara Group Ltd. All rights in these marks are reserved.
00091 
00092 
00093       Xara Group Ltd, Gaddesden Place, Hemel Hempstead, HP2 6EX, UK.
00094                         http://www.xara.com/
00095 
00096 =================================XARAHEADEREND============================
00097  */
00098 // Encapsulate the kernel'ly bits of the rulers
00099 
00100 
00101 #ifndef INC_RULERS
00102 #define INC_RULERS
00103 
00104 #include "oilruler.h"
00105 #include "userrect.h"
00106 #include "contmenu.h"
00107 
00108 class RulerPair;
00109 class DocView;
00110 class NodeRenderableInk;
00111 
00112 // WEBSTER - markn 15/1/97
00113 // No rulers in Webster, same as RALPH
00114 #ifndef WEBSTER
00115 #if !defined(EXCLUDE_FROM_RALPH)
00116 
00117 /********************************************************************************************
00118 >   class RulerBase : public CCObject
00119 
00120     Author:     Ed_Cornes (Xara Group Ltd) <camelotdev@xara.com>
00121     Created:    30/8/95
00122     Purpose:    Common base class for a ruler (X and Y derived)
00123 ********************************************************************************************/
00124 
00125 class RulerBase : public CC_CLASS_MEMDUMP
00126 {
00127     CC_DECLARE_MEMDUMP(RulerBase);
00128 
00129 public:
00130     RulerBase();
00131     virtual ~RulerBase() {} // suppress warnings
00132 
00133     RulerPair* GetpRulerPair() { return pRulerPair; }
00134     OILRuler*  GetpOILRuler()  { return pOILRuler; }
00135 
00136     virtual MILLIPOINT    GetOrd(const UserCoord& coord) = 0;
00137     virtual UserCoord  MakeCoord(const MILLIPOINT ord)   = 0;
00138     virtual BOOL    IsHorizontal()                       = 0;
00139 
00141     // OilRuler interface
00142 
00143     // Called by the OIL ruler when the ruler needs to be redrawn.
00144     // We do all the platform independent computations and call the
00145     // OIL ruler back to render specific things (e.g., graticules)
00146     BOOL Redraw(OilRect* pOilRect);
00147     virtual BOOL GetStatusLineText(String_256* pText, OilCoord PointerPos);
00148     virtual BOOL OnRulerClick(OilCoord, ClickType, ClickModifiers);
00149 
00151     // Tool interface
00152     
00153     // For use by tools that wish to render extra things on the ruler
00154     // (by responding to the RenderRulerBlobs method)
00155     BOOL HighlightSection(MILLIPOINT ord_lo, MILLIPOINT ord_hi);
00156     BOOL DrawBitmap(MILLIPOINT ord, ResourceID BitmapID);
00157     // Allow tools to start a drag after receiving an OnRulerClick call.
00158     // Drag events will be dispatched via OnRulerClick.
00159     BOOL StartToolDrag(ClickModifiers Mods, UserCoord, String_256* pOpToken, OpParam* pParam);
00160 
00161 protected:
00162     UserCoord OilToToolCoords(OilCoord PointerPos, Spread* pSpread);
00163     RulerPair* pRulerPair;
00164     OILRuler*  pOILRuler;
00165 };
00166 
00167 
00168 /********************************************************************************************
00169 >   class HorizontalRuler : public RulerBase
00170 
00171     Author:     Ed_Cornes (Xara Group Ltd) <camelotdev@xara.com>
00172     Created:    30/8/95
00173     Purpose:    Encapsulates horizontal ruler
00174 ********************************************************************************************/
00175 
00176 class HorizontalRuler : public RulerBase
00177 {
00178     CC_DECLARE_MEMDUMP(HorizontalRuler);
00179 
00180 public:
00181     HorizontalRuler();
00182     BOOL Init(RulerPair* pRulers, OILHorizontalRuler* pOILHRuler);
00183 
00184     virtual MILLIPOINT    GetOrd(const UserCoord& coord) { return coord.x; }
00185     virtual UserCoord  MakeCoord(const MILLIPOINT ord)   { return UserCoord(ord,0); }
00186     virtual BOOL    IsHorizontal() { return TRUE; }
00187 };
00188 
00189 
00190 /********************************************************************************************
00191 >   class VerticalRuler : public RulerBase
00192 
00193     Author:     Ed_Cornes (Xara Group Ltd) <camelotdev@xara.com>
00194     Created:    30/8/95
00195     Purpose:    Encapsulates vertical ruler
00196 ********************************************************************************************/
00197 
00198 class VerticalRuler : public RulerBase
00199 {
00200     CC_DECLARE_MEMDUMP(VerticalRuler);
00201 
00202 public:
00203     VerticalRuler();
00204     BOOL Init(RulerPair* pRulers, OILVerticalRuler* pOILVRuler);
00205 
00206     virtual MILLIPOINT    GetOrd(const UserCoord& coord) { return coord.y; }
00207     virtual UserCoord  MakeCoord(const MILLIPOINT ord)   { return UserCoord(0,ord); }
00208     virtual BOOL    IsHorizontal() { return FALSE; }
00209 };
00210 
00211 
00212 /********************************************************************************************
00213 >   struct RulerRedrawData
00214 
00215     Author:     Ed_Cornes (Xara Group Ltd) <camelotdev@xara.com>
00216     Created:    8/9/95
00217     Purpose:    structure containing semi-permenent redraw data
00218 ********************************************************************************************/
00219 
00220 struct RulerRedrawData
00221 {
00222     UserRect   PasteBoardUserRect;
00223     INT32       GratStep;
00224     double     GratStepSize;
00225     INT32       MinorGrats;
00226     double     MinorGratStepSize;
00227     double     GratUnitSize;
00228     double     ScaleFactor;
00229     String_32  LegendStr;
00230 };
00231 
00232 
00233 /********************************************************************************************
00234 >   class RulerPair : public MessageHandler
00235 
00236     Author:     Ed_Cornes (Xara Group Ltd) <camelotdev@xara.com>
00237     Created:    30/8/95
00238     Purpose:    Encapsulates a horizontal and vertical ruler pair
00239 ********************************************************************************************/
00240 
00241 class RulerPair : public MessageHandler
00242 {
00243     CC_DECLARE_MEMDUMP(RulerPair);
00244 
00245 public:
00246     RulerPair();
00247     BOOL Init(DocView* pDView, OILHorizontalRuler* pOILHRuler, OILVerticalRuler* pOILVRuler,
00248               OriginGadget* pOGadget);
00249 
00250     MsgResult Message(Msg* Msg);
00251     BOOL      GetStatusLineText(String_256* pText, WinCoord MousePos, CWindowID hWnd);
00252     BOOL      Update();
00253     BOOL      UpdateRedrawData();
00254 
00255     BOOL     UpdateMouseFollowers(DocCoord* pDocCoord);
00256     BOOL     GetMouseFollowerVisibility() { return MouseFollowerVisibility; }
00257     DocCoord GetMouseFollowerPosition()   { return MouseFollowerPosition; }
00258 
00259     DocView*         GetpDocView()         { return pDocView; }
00260     Spread*          GetpSpread()          { return pSpread; }
00261     OriginGadget*    GetpOriginGadget()    { return pOriginGadget; }
00262     HorizontalRuler* GetpHorizontalRuler() { return &HRuler; }
00263     VerticalRuler*   GetpVerticalRuler()   { return &VRuler; }
00264     RulerRedrawData* GetpRedrawData()      { return &RedrawData; }
00265 
00266 protected:
00267     DocView*        pDocView;
00268     Spread*         pSpread;
00269     OriginGadget*   pOriginGadget;
00270     HorizontalRuler HRuler;
00271     VerticalRuler   VRuler;
00272     RulerRedrawData RedrawData;
00273 
00274     BOOL     MouseFollowerVisibility;
00275     DocCoord MouseFollowerPosition;
00276 };
00277 
00278 
00279 /******************************************************************************
00280 >   class RulerContextMenu : public ContextMenu
00281 
00282     Author:     Ed_Cornes (Xara Group Ltd) <camelotdev@xara.com>
00283     Created:    9/10/95
00284     Purpose:    Implements the Ruler context sensitive menu
00285 ******************************************************************************/
00286 
00287 class RulerContextMenu : public ContextMenu
00288 {
00289     CC_DECLARE_MEMDUMP(RulerContextMenu);
00290 
00291 public:
00292     virtual BOOL Build();
00293 };
00294 
00295 
00296 /******************************************************************************
00297 >   class OriginContextMenu : public ContextMenu
00298 
00299     Author:     Ed_Cornes (Xara Group Ltd) <camelotdev@xara.com>
00300     Created:    9/10/95
00301     Purpose:    Implements the Ruler context sensitive menu
00302 ******************************************************************************/
00303 
00304 class OriginContextMenu : public ContextMenu
00305 {
00306     CC_DECLARE_MEMDUMP(OriginContextMenu);
00307 
00308 public:
00309     virtual BOOL Build();
00310 };
00311 #endif
00312 #endif  // WEBSTER
00313 #endif  // INC_RULERS

Generated on Sat Nov 10 03:46:46 2007 for Camelot by  doxygen 1.4.4