appprefs.h

Go to the documentation of this file.
00001 // $Id: appprefs.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 // 
00099 // Header file for AppPrefs.cpp
00100 //
00101 // 
00102 
00103 #ifndef INC_APPPREFS
00104 #define INC_APPPREFS
00105 
00106 //#include "prefsdlg.h"
00107 //#include "dialogop.h" - in camtypes.h [AUTOMATICALLY REMOVED]
00108 //#include "unittype.h" - in camtypes.h [AUTOMATICALLY REMOVED]
00109 //#include "units.h"        // units e.g. Millimeters - in camtypes.h [AUTOMATICALLY REMOVED]
00110 #include "pagesize.h"   // page sizes
00111 //#include "nev.h"      // _R(IDN_APPLICATIONOPTS)
00112 
00113 /********************************************************************************************
00114 
00115 >   class AppPrefsDlg : public DialogTabOp
00116 
00117     Author:     Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com> 
00118     Created:    23/08/94
00119     Purpose:    The application preference's dialog box
00120     
00121                 Allows the user to set options like:-
00122                     Nudge distance, constraint angle, Duplicate distance x,y
00123                     Page sizes in document
00124                     Document units
00125                     Colour bar display mode
00126 
00127                 Uses the OptionsTabs class which is declared and initialised by this class.
00128                 This uses any application options pages which have been declared to the
00129                 options tabs list. The document options uses the same system.
00130                 Also, declares the PageSizes class to the system so that they are available
00131                 to all options tabs.
00132 
00133     SeeAlso:    DocPrefsDlg; OptionsTabs; PageSize; PageSizesList;
00134                 
00135 ********************************************************************************************/
00136 #define OPTOKEN_UTILOPTIONS _T("UtilOptions")
00137 //#define OPTOKEN_APPPREFSDLG "AppPrefsDlg"
00138 
00139 class AppPrefsDlg : public DialogTabOp
00140 {
00141     CC_DECLARE_DYNCREATE( AppPrefsDlg )
00142 
00143 public:
00144     AppPrefsDlg();                                  // constructor
00145     AppPrefsDlg(INT32 StartingPage);                    // constructor
00146     ~AppPrefsDlg();                                 // destructor
00147 
00148     void Do(OpDescriptor*);                         // "Do" function
00149 
00150     static BOOL Init();                             // Setup function
00151     static void Deinit();                           // Remove function
00152 
00153     // No create function as this is handled by the main tab dialog code
00154 
00155     static OpState GetState(String_256*, OpDescriptor*);
00156                                                     // Return the state of this operation
00157     virtual MsgResult Message(Msg* Message);        // Message handler
00158     virtual BOOL RegisterYourPagesInOrderPlease();  // Add in tab pages
00159     
00160     // Set up explicit details about this dialog box such as id, type (MODE or MODELESS)
00161     static const CDlgResID IDD;             // Dialog box id
00162     static const CDlgMode Mode;             // Dialog box mode of operation (mode or modeless)
00163 
00164     // Function to allow the application exiting code to work out if save preferences
00165     // on exit option is set.
00166     static BOOL IsSaveOnExitSet();          // Returns state of save on exit flag
00167     static BOOL SetSaveOnExit(BOOL NewState);// Allows new state of save on exit flag to be set
00168 
00169     static PageSizesList *pPageSizesList;   // List of available page sizes
00170 
00171     // Functions to commit the values on the dialog box and its sections on ok
00172     BOOL CommitDialogValues();
00173 
00174     BOOL HasImages() {return TRUE;}
00175     TabType GetTabType() {return TABTYPE_TREE/*TABTYPE_LIST*/;}
00176 
00177 private:
00178     String_256 TitleString;                 // title of dialog box
00179 };
00180 
00181 
00182 /********************************************************************************************
00183 
00184 >   class UnitsTabAppPrefsDlg : public DialogTabOp
00185 
00186     Author:     Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com> 
00187     Created:    14/12/94
00188     Purpose:    To open up the document preference's dialog box with the units tab
00189                 selected. This is used by the units button on the tool bars.
00190 
00191     SeeAlso:    AppPrefsDlg; OptionsTabs; PageSize; PageSizesList;
00192     
00193 ********************************************************************************************/
00194 
00195 class UnitsTabAppPrefsDlg : public AppPrefsDlg
00196 {
00197 // Defines the OPTOKEN_UNITDLG as this now links to the units tab in
00198 // this document options dialog box.
00199 #define OPTOKEN_UNITDLG _T("UnitSetupDlg")
00200 
00201     CC_DECLARE_DYNCREATE( UnitsTabAppPrefsDlg )
00202 
00203 public:
00204     UnitsTabAppPrefsDlg();                  // constructor
00205 
00206     // All other functionality comes from the DocPrefsDlg class.
00207 };
00208 
00209 /********************************************************************************************
00210 
00211 >   class ScaleTabDocPrefsDlg : public AppPrefsDlg 
00212 
00213     Author:     Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com> 
00214     Created:    14/12/94
00215     Purpose:    To open up the application preference's dialog box with the scale tab
00216                 selected. This is used by the scale button on the tool bars.
00217 
00218     SeeAlso:    AppPrefsDlg; OptionsTabs; PageSize; PageSizesList;
00219     
00220 ********************************************************************************************/
00221 
00222 class ScaleTabAppPrefsDlg : public AppPrefsDlg
00223 {
00224 // Defines the OPTOKEN_UNITDLG as this now links to the units tab in
00225 // this document options dialog box.
00226 #define OPTOKEN_SCALEDLG _T("ScaleFactorDlg")
00227 
00228     CC_DECLARE_DYNCREATE( ScaleTabAppPrefsDlg )
00229 
00230 public:
00231     ScaleTabAppPrefsDlg();                  // constructor
00232 
00233     // All other functionality comes from the AppPrefsDlg class.
00234 };
00235 
00236 /********************************************************************************************
00237 
00238 >   class PageTabDocPrefsDlg : public AppPrefsDlg 
00239 
00240     Author:     Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com> 
00241     Created:    12/4/95
00242     Purpose:    To open up the application preference's dialog box with the page tab
00243                 selected. This is used by the pop up menu when on the page.
00244 
00245     SeeAlso:    AppPrefsDlg; OptionsTabs; PageSize; PageSizesList;
00246     
00247 ********************************************************************************************/
00248 
00249 class PageTabAppPrefsDlg : public AppPrefsDlg
00250 {
00251 // Defines the OPTOKEN_UNITDLG as this now links to the units tab in
00252 // this document options dialog box.
00253 #define OPTOKEN_PAGESIZEDLG _T("PageSetupDlg")
00254 
00255     CC_DECLARE_DYNCREATE( PageTabAppPrefsDlg )
00256 
00257 public:
00258     PageTabAppPrefsDlg();                   // constructor
00259 
00260     // All other functionality comes from the AppPrefsDlg class.
00261 };
00262 
00263 /********************************************************************************************
00264 
00265 >   class GridTabDocPrefsDlg : public AppPrefsDlg 
00266 
00267     Author:     Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com> 
00268     Created:    5/10/95
00269     Purpose:    To open up the application preference's dialog box with the grid tab
00270                 selected. This is used by the pop up menu when on the ruler.
00271 
00272     SeeAlso:    AppPrefsDlg; OptionsTabs; PageSize; PageSizesList;
00273     
00274 ********************************************************************************************/
00275 
00276 class GridTabAppPrefsDlg : public AppPrefsDlg
00277 {
00278 // Defines the OPTOKEN_GRIDANDRULERSDLG as this now links to the units tab in
00279 // this document options dialog box.
00280 #define OPTOKEN_GRIDANDRULERSDLG _T("GridRulersDlg")
00281 
00282     CC_DECLARE_DYNCREATE( GridTabAppPrefsDlg )
00283 
00284 public:
00285     GridTabAppPrefsDlg();                   // constructor
00286 
00287     // All other functionality comes from the AppPrefsDlg class.
00288 };
00289 
00290 /********************************************************************************************
00291 
00292 >   class PlugsTabAppPrefsDlg : public AppPrefsDlg
00293 
00294     Author:     Priestley (Xara Group Ltd) <camelotdev@xara.com> - from Neville's UnitsTabAppPrefsDlg class (above)
00295     Created:    13/09/2000
00296     Purpose:    To open up the document preference's dialog box with the plug-ins tab
00297                 selected. This is used by the plug-ins menu item (under 'Bitmap Effects & Plug-Ins').
00298 
00299     SeeAlso:    AppPrefsDlg; OptionsTabs; PageSize; PageSizesList;
00300     
00301 ********************************************************************************************/
00302 
00303 class PlugsTabAppPrefsDlg : public AppPrefsDlg
00304 {
00305 // Defines the OPTOKEN_UNITDLG as this now links to the units tab in
00306 // this document options dialog box.
00307 #define OPTOKEN_PLUGSDLG    _T("PlugSetupDlg")
00308 
00309     CC_DECLARE_DYNCREATE( PlugsTabAppPrefsDlg )
00310 
00311 public:
00312     PlugsTabAppPrefsDlg();                  // constructor
00313 
00314     // All other functionality comes from the DocPrefsDlg class.
00315 };
00316 
00317 
00318 /********************************************************************************************
00319 
00320 >   class OptionsTabs : public ListItem
00321 
00322     Author:     Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com> 
00323     Created:    07/12/94
00324     Purpose:    These encompass all the tabs available for the options dialog box to use.
00325 
00326 ********************************************************************************************/
00327 class CCAPI OptionsTabs : public ListItem
00328 {
00329     CC_DECLARE_DYNAMIC(OptionsTabs);
00330 
00331 public:
00332     OptionsTabs();                          // Constructor
00333 
00334     static BOOL InitOptionsTabs();          // set up all option tabs available
00335     static BOOL DeinitOptionsTabs();        // remove all option tabs available
00336     static OptionsTabs *GetFirst();
00337     static OptionsTabs *GetNext(OptionsTabs*);
00338 
00339     virtual BOOL Init();                    // Initialisation
00340 
00341     // Function to declare a tab/section to the options system
00342     BOOL DeclareOptionsTab(OptionsTabs *pOptionsTab);
00343 
00344     // Overridable by the tab section handlers
00345     virtual CDlgResID GetPageID()           =0; // Return section/page id system
00346     virtual BOOL InitSection()              =0; // Called when page first opened
00347     virtual BOOL CommitSection()            =0; // Called when ok action is required
00348     virtual BOOL HandleMsg(DialogMsg* Msg)  =0; // Called when DIALOG messages arrive
00349 
00350     virtual MsgResult Message(Msg *pMessage);   // Called when ANY unhandled messages arrive
00351                                                 // (see below for special message upcalls)
00352 
00353     // Some special handlers for things like new default units being specified or the last
00354     // document being closed.
00355     // These are the virtual handlers which each tab should specify, if not required then
00356     // these base class definitions can be used.
00357     virtual BOOL NewUnitsInSection();       // Called when new default units chosen
00358     virtual BOOL GreySection();             // Called when the user has closed all documents
00359     virtual BOOL UngreySection();           // Called when the user has opened a document
00360     virtual BOOL UpdateSection(String_256 *DocumentName);   // Called when the user has switched to a new document
00361 
00362     // Some functions to determine whether this is a Document or Program option
00363     virtual BOOL IsDocumentOption()         =0; // Return True if document option  
00364     virtual BOOL IsProgramOption()          =0; // Return True if program option
00365     virtual BOOL IsPrintingOption();            // Return True if printing option
00366 
00367     static DialogTabOp *pPrefsDlg;          // pointer to the main dialog box
00368 
00369     static BOOL SetUpDocUnits();            // function to set up CurrentPageUnits
00370 
00371     static BOOL GetApplyNowState();         // Get current state of ApplyNow flag
00372     static BOOL SetApplyNowState(BOOL NewState);    // set new state for ApplyNow 
00373     static BOOL GreyApplyNow();             // grey the apply now button
00374     static BOOL UngreyApplyNow();           // grey the apply now button
00375 
00376     static BOOL SetInitMessageState(BOOL NewState); // set new state of InitMessage
00377     static BOOL GetInitMessageState();      // get current state of InitMessage
00378 
00379     // The following are used to open the specific options tab
00380     // These are the main application/document based options dialog box
00381     static UINT32 UnitsAppTabNumber;            // Tab number assigned to the units tab
00382     static UINT32 ScaleAppTabNumber;            // Tab number assigned to the scale tab
00383     static UINT32 PageAppTabNumber;         // Tab number assigned to the page tab
00384     static UINT32 GridAppTabNumber;         // Tab number assigned to the grid and rulers tab
00385 
00386     static UINT32 PlugsAppTabNumber;            // Tab number assigned to the plug-ins tab
00387 
00388     // These are the print options dialog box
00389     static UINT32 PrintTabNumber;               // Tab number assigned to print tab in print options term   
00390 
00391     static Document *pScopeDocument;        // current document (for message broadcasts) 
00392 
00393     static String_256 *GetDocumentName();   // returns the name of the selected document
00394     static void SetDocumentName(Document *pDoc);    // reads the current name of the selected document
00395                                             // and stores this in the class variable
00396     static void SetDocumentName(String_256 *DocumentName);  // sets the name of the selected document
00397 
00398     static void SetCurrentDocAndSpread(Document *pDoc); // set up the spread that we are currently workign on
00399     static void SetDefaultUnits();          // set up our default display units
00400 
00401     virtual BOOL PageSizeHasChanged();      // sent when the page size has been changed
00402 
00403 protected:
00404     // Allow the options tabs access but nobody else to these useful variables
00405     static Document *pDocument;             // The document we are working on
00406     static Spread   *pSpread;               // The spread we are working on 
00407 
00408     static UnitType CurrentPageUnits;       // The units used to display page measurements
00409     static UnitType CurrentScaledUnits;     // The units to display scaled measurements
00410     static UnitType CurrentFontUnits;       // The units used to display font measurements
00411 
00412 private:
00413     static BOOL InitMessage;                // True if handling an init message
00414     static BOOL ApplyNow;                   // True if Apply now should be ungreyed
00415 
00416     // The list of options tabs that is understood.
00417     static List OptionsTabsList;            // list of available tabs
00418 
00419     static String_256 DocName;              // name of current document
00420 };
00421 
00422 #endif  // INC_APPPREFS
00423 
00424 

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