layermgr.h

Go to the documentation of this file.
00001 // $Id: layermgr.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 /*
00100 */ 
00101 
00102 /* Declaration of the following classes
00103     LyrDetails
00104     LayerManager
00105     OpLayerChange
00106 */
00107 
00108 #ifndef INC_LAYERMGR
00109 #define INC_LAYERMGR
00110 
00111 // Include files 
00112 #include "layer.h"
00113 //#include "listitem.h" - in camtypes.h [AUTOMATICALLY REMOVED]
00114 //#include "list.h" - in camtypes.h [AUTOMATICALLY REMOVED]
00115 //#include "undoop.h"         - in camtypes.h [AUTOMATICALLY REMOVED]
00116 //#include "selop.h" - in camtypes.h [AUTOMATICALLY REMOVED]
00117 
00118 #define OPTOKEN_LYRCHNG _T("LayerChange")   // Optoken for the layer change operation 
00119 #define OPTOKEN_MOVE_SEL_TO_ACTIVE_LAYER _T("MoveSelToActiveLayer")
00120 
00121 class String_256; 
00122 
00123 
00124 /********************************************************************************************
00125 
00126 >   class LyrDetails: public ListItem 
00127 
00128     Author:     Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com>
00129     Created:    4/1/94
00130     Purpose:    LyrDetails objects are stored in a list within the LayerManager. 
00131                 They record changes made to a layer. 
00132 
00133     SeeAlso:    LayerManager
00134 
00135 ********************************************************************************************/
00136 
00137 
00138 class LyrDetails: public ListItem 
00139 {
00140     CC_DECLARE_MEMDUMP(LyrDetails);
00141 
00142 public:
00143     LyrDetails();       // Constructor 
00144     Layer *m_pLayer;    // A pointer to the Layer that the LyrDetails record describes. 
00145                         // NULL if the layer is New
00146 
00147     LayerStatus Status; // The LayerStatus structure contains all the layer details which the 
00148                         // user can change 
00149 
00150     BOOL New;           // Flag indicating if the layer is new. i.e. it does not exist in the 
00151                         // Camelot tree. 
00152 
00153     BOOL Deleted;       // Flag indicating if the layer has been deleted 
00154 
00155 };
00156 
00157 /********************************************************************************************
00158 
00159 >   class LayerManager: public CCObject
00160 
00161     Author:     Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com>
00162     Created:    7/1/94
00163     Purpose:    The LayerManager is used to make changes to layers in the document tree. It 
00164                 holds a pointer to a current spread, and a list of layer details for the 
00165                 current spread (LyrDetLst). The layerDlg and InfoBar make changes to layers 
00166                 in the current spread indirectly by changing the LyrDetList. Layer changes 
00167                 are deferred until the CommitLayerChanges() method is called. Changes made 
00168                 to the LyrDetList can also be cancelled by calling the CancelLayerChanges() 
00169                 method.  
00170 
00171     SeeAlso:    LyrDetails
00172     SeeAlso:    LayerDlg
00173     SeeAlso:    OpLayerChange 
00174 
00175 ********************************************************************************************/
00176 
00177 class LayerManager:public CCObject
00178 {
00179 public:
00180 
00181     LayerManager();          // Constructor 
00182     ~LayerManager();             // Destructor 
00183     
00184     String_256 CreateUniqueLayerID();        // Creates a layer name which is unique for 
00185                                              // the current spread.  
00186                                                 
00187     BOOL CommitLayerChanges();               // Performs a LayerChangeOp which modifies the 
00188                                              // layers in the Camelot tree based on changes 
00189                                              // made to the LyrDetList. 
00190 
00191     BOOL NewCurrentSpread(Spread* NewCurrentSpread); // NewCurrentSpread becomes the 
00192                                                      // new current spread 
00193 
00194     Spread* GetCurrentSpread();              // Returns the current spread 
00195 
00196     BOOL CancelLayerChanges();               // Causes the changes made to the LyrDetList 
00197                                              // to be discarded and new values read. 
00198 
00199     BOOL RefreshLayerDetails();              // Refreshes the layer details list 
00200 
00201     void UpdateInterface();                  // Called to update the interface 
00202 
00203 
00204 
00205     // The layer details list is a list of LyrDetails for the current spread.
00206     List LyrDetList; 
00207 
00208 private:    
00209     Spread* CurrentSpread;           // The current spread 
00210 
00211     void DeleteLayerDetList();       // Deletes the contents of the LyrDetList 
00212     BOOL ReadSpreadLayerDetails();   // Read the current spread's layer details into the 
00213                                      // LyrDetList
00214     void BroadcastNewCurrentSpread();// Makes calls to other subsystems that need to know 
00215                                      // that the current spread has changed. 
00216     BOOL LayerDetailsChanged();      // Used to determine if the layer details have been 
00217                                      // changed. We don't want to generate a LayerChangeOp
00218                                      // if nothing has changed. 
00219 
00220 };
00221 
00222 
00223    
00224 /********************************************************************************************
00225 
00226 >   class OpLayerChange: public UndoableOperation
00227 
00228     Author:     Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com>
00229     Created:    9/7/93
00230     Purpose:    This class represents the LayerChange operation which is created by the 
00231                 LayerManager to make changes to the layers of the current spread. 
00232     SeeAlso:    LayerManager
00233 
00234 ********************************************************************************************/
00235 
00236 class CCAPI OpLayerChange: public UndoableOperation
00237 {         
00238 
00239     CC_DECLARE_DYNCREATE( OpLayerChange );
00240 
00241 public:
00242     OpLayerChange();                                
00243     static BOOL     Init();             
00244     static OpState  GetState(String_256*, OpDescriptor*);       
00245     void            Do(OpDescriptor*);
00246 
00247     virtual BOOL Undo(); 
00248     virtual BOOL Redo();    
00249 };  
00250 
00251 /********************************************************************************************
00252 
00253 >   class ChangeLyrAttribAction: public Action
00254 
00255     Author:     Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com>
00256     Created:    13/1/94
00257     Purpose:    When executed the ChangeLyrAttribAction changes a layer's Status
00258     SeeAlso:    -
00259 
00260 ********************************************************************************************/
00261 
00262 class CCAPI ChangeLyrAttribAction: public Action
00263 {                                
00264     CC_DECLARE_DYNCREATE( ChangeLyrAttribAction )
00265 
00266 public:
00267     ChangeLyrAttribAction(); 
00268     ~ChangeLyrAttribAction();
00269     virtual ActionCode Execute();    
00270     static ActionCode Init(Operation* const pOp, 
00271                            ActionList* pActionList,     
00272                            UINT32 ActionSize,
00273                            LayerStatus& Status,  // The layer status which is restored 
00274                                                  // when we execute the action. 
00275                            Layer* Layer,         // The layer to change when we execute 
00276                            Action** NewAction); 
00277 
00278 private:
00279     Layer* ChangeLayer; // The layer to change 
00280     LayerStatus Status; // the new attributes of the layer 
00281 };   
00282        
00283 
00284 
00285 
00286 
00287 /********************************************************************************************
00288 
00289 >   class CCAPI OpMoveToLayer: public UndoableOperation
00290 
00291     Author:     Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com> K
00292     Created:    3/5/00
00293     Purpose:    An op to move the selection from where-ever it is to the active layer.
00294 
00295 ********************************************************************************************/
00296 class CCAPI OpMoveToLayer: public SelOperation
00297 {         
00298 
00299     CC_DECLARE_DYNCREATE( OpMoveToLayer );
00300 
00301 public:
00302     static BOOL     Init();             
00303     static OpState  GetState(String_256*, OpDescriptor*);       
00304     void            Do(OpDescriptor*);
00305 };  
00306 
00307 
00308 
00309 
00310 
00311 #endif
00312                     
00313 

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