optspage.h

Go to the documentation of this file.
00001 // $Id: optspage.h 1282 2006-06-09 09:46:49Z 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 // Header for the handling code for the Page tab of the options dialog box 
00099 
00100 #ifndef INC_OPTSPAGE
00101 #define INC_OPTSPAGE
00102 
00103 //#include "unittype.h" - in camtypes.h [AUTOMATICALLY REMOVED]
00104 //#include "dialogop.h" - in camtypes.h [AUTOMATICALLY REMOVED]
00105 //#include "units.h" - in camtypes.h [AUTOMATICALLY REMOVED]
00106 #include "appprefs.h"
00107 
00108 //#include "undoop.h"
00109 #include "transop.h"
00110 #include "grid.h" 
00111 
00112 #define OPTOKEN_OPPAGERESIZE  _T("OpPageResize")    
00113 
00114 typedef struct
00115 {
00116     Spread  *pSpread;                   // The spread to be changed
00117 
00118     // Page resize parameters
00119     MILLIPOINT Width;                   // The required new page width
00120     MILLIPOINT Height;                  // The required new page height
00121     MILLIPOINT Margin;                  // The required new margin around the spread
00122     MILLIPOINT Bleed;                   // The required new spread bleed
00123     BOOL Portrait;                      // The portrait state (Not reaaly used apart from updating old value)
00124     BOOL Dps;                           // The required new single/double page
00125                                         // spread state
00126     BOOL ShowDropShadow;                // The required new page shadow state
00127 
00128     BOOL ResizeAndCentre;               // Flag a resize and centre operation
00129 
00130 } PageResizeInfo;
00131 
00132 
00133 /********************************************************************************************
00134 
00135 >   class PageTab: public OptionsTabs
00136 
00137     Author:     Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com>
00138     Created:    07/12/94
00139     Purpose:    Allows the user to set any options which are normally associated
00140                 with the document's page. This includes such things as:-
00141                     The size of the page as either a predefined page size or
00142                     A custom page with explicit width/height control.
00143                     Choice of Portrait or Landscape.
00144                     Bleed size.
00145                     Show page shadow switch
00146 
00147     SeeAlso:    OptionsTabs; AppPrefsDlg; DocPrefsDlg; PageSize; PageSizesList;
00148 
00149 ********************************************************************************************/
00150 
00151 class PageTab: public OptionsTabs
00152 {         
00153     CC_DECLARE_DYNCREATE( PageTab )  
00154 public:
00155 
00156     PageTab();
00157     ~PageTab();
00158 
00159     virtual BOOL Init();                        
00160 
00161     // Function to handle the messages for this tab/pane window
00162     virtual BOOL HandleMsg(DialogMsg* Msg);
00163 
00164     // Function to set up the values on this tab when being opened
00165     virtual BOOL InitSection();
00166 
00167     // Function to commit the values on this tab on ok
00168     virtual BOOL CommitSection();
00169 
00170     // Function called when new default units come into operation.
00171     virtual BOOL NewUnitsInSection();
00172 
00173     // Functions to handle document changing messages
00174     virtual BOOL GreySection();         // Called when the user has closed all documents
00175     virtual BOOL UngreySection();       // Called when the user has opened a document
00176     BOOL ChangeControlStatus(const BOOL Status); // used to grey/ungrey all controls
00177     virtual BOOL UpdateSection(String_256 *DocumentName);   // Called when the user has switched to a new document
00178 
00179     BOOL UpdatePageSection();           // Called when the user has undone a page resize
00180 
00181     virtual CDlgResID GetPageID();      // Return section/page id system
00182 
00183     virtual BOOL IsDocumentOption();    // Return True if document option  
00184 
00185     virtual BOOL IsProgramOption();     // Return True if program option
00186 
00187 protected:
00188     // Lots of controlling and handling functions specific to this section
00189     BOOL InitPageSection();
00190 
00191     BOOL SetUpPageSizeList();
00192 
00193     INT32    GetPageSizeItem(const MILLIPOINT Width, const MILLIPOINT Height);  // translates width/height to list position
00194     BOOL HandlePageList(INT32 ItemClicked, BOOL Portrait);// sets up height/width fields
00195     BOOL PortraitSelected;
00196 // WEBSTER-ranbirr-13/11/96
00197 #ifndef WEBSTER
00198     BOOL HandlePortraitLandscape();     // Handles portrait/Landscape switches
00199 #endif //webster
00200     // finds out the page details and allows setting of new details
00201     BOOL GetSizeOfPage(MILLIPOINT *Width, MILLIPOINT *Height, MILLIPOINT *Margin, MILLIPOINT *Bleed,
00202                        BOOL *Portrait, BOOL *Dps, BOOL *ShowDropShadow);
00203 //  BOOL SetNewSizeOfPage(MILLIPOINT Width, MILLIPOINT Height, MILLIPOINT Margin, MILLIPOINT Bleed,
00204 //                     BOOL Portrait, BOOL Dps, BOOL ShowDropShadow);
00205 
00206 public:
00207     // New function for doing the page resize and change of the default grid as one operation.
00208     BOOL InvokeResize(PageResizeInfo *Param);
00209     BOOL InvokeResizeAndCentre(PageResizeInfo *Param);
00210 
00211 private:
00212 //  DocRect OldPageRect;        // entry state page size and position
00213     MILLIPOINT OldPageWidth;    // entry page width
00214     MILLIPOINT OldPageHeight;   // entry page height
00215     BOOL OldDpsState;           // entry state of dps
00216     BOOL OldPortraitState;      // entry portrait/landscape state
00217     MILLIPOINT OldBleedSize;    // entry page bleed size
00218     MILLIPOINT OldMarginSize;   // entry page bleed size
00219     BOOL OldDropShadowState;    // entry drop shadow state 
00220     
00221     BOOL GreyStatus;            // Remember the state that we are currently in
00222 
00223     BOOL InitedPageSizeList;    // Is the page size list set up
00224 }; 
00225 
00226 
00227 
00228 
00229 
00230 /****************************************************************************
00231 
00232 >   class OpPageResize: public UndoableOperation
00233 
00234     Author:     Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com>
00235     Created:    13/02/95
00236     Purpose:    This class represents the Undo-able operation to resize the
00237                 page and spread.
00238     SeeAlso:    ActionPageResize
00239 
00240 ****************************************************************************/
00241 #define OPTOKEN_PAGERESIZE _T("PageResize") // Optoken for the page resize operation
00242 
00243 
00244 
00245 class OpPageResize: public TransOperation //UndoableOperation
00246 {         
00247     CC_DECLARE_DYNCREATE(OpPageResize)
00248 
00249 public:
00250     OpPageResize(); 
00251     ~OpPageResize();    
00252 
00253     static  BOOL Init();                        
00254     static  OpState GetState(String_256*, OpDescriptor*);
00255 
00256     void    Do(OpDescriptor *);
00257     void    DoWithParam(OpDescriptor* pOp, OpParam* pResizeParam);       
00258 
00259     //virtual BOOL Undo();
00260     //virtual BOOL Redo();
00261 
00262 private:
00263     // Function to try and reposition all of the objects on the new page structure
00264     BOOL MoveObjectsOnPage(Spread *pSpread,
00265                            MILLIPOINT Width, MILLIPOINT Height,
00266                            MILLIPOINT Margin, BOOL Dps,
00267                            MILLIPOINT OldWidth, MILLIPOINT OldHeight,
00268                            MILLIPOINT OldMargin, BOOL OldDps,
00269                            Range  *pSearchRange,
00270                            BOOL ResizeAndCentre);
00271 
00272     DocRect PasteboardRect;
00273 }; 
00274 
00275 /********************************************************************************************
00276 
00277 >   class ActionPageResize: public Action
00278 
00279     Author:     Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com>
00280     Created:    15/2/95
00281     Purpose:    When executed, this sets up an action to redo/undo a page resize.
00282     
00283     SeeAlso:    OpPageResize
00284 
00285 ********************************************************************************************/
00286 
00287 class CCAPI ActionPageResize : public Action
00288 {
00289     CC_DECLARE_DYNCREATE( ActionPageResize )
00290 
00291 public:
00292     ActionPageResize();
00293     ~ActionPageResize();
00294     virtual ActionCode Execute();
00295     static ActionCode Init(Operation* const pOp,
00296                             ActionList *pActionList,
00297                             UINT32 ActionSize,
00298                             Spread *pSpread,
00299                             MILLIPOINT Width,
00300                             MILLIPOINT Height,
00301                             MILLIPOINT Margin,
00302                             MILLIPOINT Bleed,
00303                             BOOL Dps,
00304                             BOOL ShowDropShadow,
00305                             Action **NewAction);
00306 
00307 protected:
00308 
00309 private:
00310     Spread *pSpread;
00311 
00312     DocRect PasteboardRect;
00313     DocRect PageRect;
00314 
00315     MILLIPOINT Width;                   // page width
00316     MILLIPOINT Height;                  // page height
00317     MILLIPOINT Margin;                  // margin around the spread
00318     MILLIPOINT Bleed;                   // spread bleed
00319     BOOL Dps;                           // single/double page spread state
00320     BOOL ShowDropShadow;                // page shadow state
00321 };
00322 
00323 #endif // INC_OPTSPAGE

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