layergal.h

Go to the documentation of this file.
00001 // $Id: layergal.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 // The Layers Gallery header file
00099 
00100 #ifndef INC_LAYERGAL
00101 #define INC_LAYERGAL
00102 
00103 //#include "dialogop.h" - in camtypes.h [AUTOMATICALLY REMOVED]
00104 //#include "undoop.h" - in camtypes.h [AUTOMATICALLY REMOVED]
00105 #include "layer.h"
00106 
00107 class LayerSGallery;
00108 
00109 //-------------------------------------------------------------------------------
00110 //-------------------------------------------------------------------------------
00111 //-------------------------------------------------------------------------------
00112 //-------------------------------------------------------------------------------
00113 
00114 enum MoveLayerType
00115 {
00116     MOVELAYER_UPONE,
00117     MOVELAYER_DOWNONE
00118 };
00119 
00120 
00121 
00122 //-------------------------------------------------------------------------------
00123 //-------------------------------------------------------------------------------
00124 //-------------------------------------------------------------------------------
00125 //-------------------------------------------------------------------------------
00126 
00127 
00128 
00129 /********************************************************************************************
00130 
00131 >   class OpLayerGalParam: 
00132 
00133     Author:     Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
00134     Created:    4/8/94
00135     Purpose:    Holds the parameters for the OpLayerGalChange to perform its stuff on
00136     SeeAlso:    -
00137 
00138 ********************************************************************************************/
00139 
00140 enum OpLayerGalReason
00141 {
00142     LAYER_NONE,
00143     LAYER_NEW,
00144     LAYER_DELETE,
00145     LAYER_CHANGE,
00146     LAYER_CHANGE_NAME,
00147     LAYER_MOVE,
00148     LAYER_COPY,
00149     LAYER_VISIBLE,
00150     LAYER_ALLVISIBLE,
00151     LAYER_LOCKED,
00152     LAYER_MULTILAYER,
00153     LAYER_TOGGLEBACKGROUND,
00154     // special frame flags
00155     LAYER_SOLID,
00156     LAYER_OVERLAY,
00157     LAYER_MAKEFRAME,
00158     LAYER_ACTIVE,
00159     // special frame related items
00160     FRAME_SELECT,
00161     FRAME_NEW,
00162     FRAME_COPY,
00163     FRAME_DELETE,
00164     FRAME_MOVE,
00165     FRAME_ALLVISIBLE,
00166     FRAME_MULTILAYER,
00167     // Special page background reason 
00168     PAGEBACKGROUND_DEFAULT      // actually deletes the page background layer
00169 };
00170 
00171 class OpLayerGalParam
00172 {
00173 public:
00174 
00175     Layer*              pLayer;
00176     LayerStatus         Status;
00177     BOOL                NewState;
00178     BOOL                ToggleBackground;
00179     Node*               pContextNode;
00180     LayerSGallery*      pLayerSGal;
00181     AttachNodeDirection AttDir;
00182     BOOL                MoveRedraw; // Flag that tells the LAYER_MOVE code whether it should redraw after the op
00183 
00184     // Vars used by LAYER_CHANGE
00185     BOOL        OldVisibleState;
00186     BOOL        OldLockedState;
00187     String_256  OldName;
00188     BOOL        VisibleState;
00189     BOOL        LockedState;
00190     String_256  NewName;
00191 
00192     OpLayerGalParam(OpLayerGalParam& Other)
00193     {
00194         pLayer           = Other.pLayer;
00195         Status           = Other.Status;
00196         NewState         = Other.NewState;
00197         ToggleBackground = Other.ToggleBackground;
00198         pContextNode     = Other.pContextNode;
00199         pLayerSGal       = Other.pLayerSGal;
00200         AttDir           = Other.AttDir;
00201         MoveRedraw       = Other.MoveRedraw;
00202 
00203         VisibleState     = Other.VisibleState;
00204         LockedState      = Other.LockedState;
00205         OldVisibleState  = Other.OldVisibleState;
00206         OldLockedState   = Other.OldLockedState;
00207         OldName          = Other.OldName;
00208         NewName          = Other.NewName;
00209 
00210         Reason           = Other.Reason;
00211         pParentSpread    = Other.pParentSpread;
00212     }
00213 
00214 //-------------
00215     OpLayerGalParam(OpLayerGalReason ThisReason,Spread* pThisParentSpread)
00216      :  pLayer(NULL), ToggleBackground(FALSE),
00217         pContextNode(NULL), pLayerSGal(NULL),
00218         Reason(ThisReason), pParentSpread(pThisParentSpread)  { /* empty */ }
00219 
00220     OpLayerGalParam() : pLayer(NULL), ToggleBackground(FALSE),
00221         pContextNode(NULL), pLayerSGal(NULL),
00222         Reason(LAYER_NONE), pParentSpread(NULL)  { /* empty */ }
00223 
00224     Spread*             GetParentSpread()   { return pParentSpread; }
00225     OpLayerGalReason    GetReason()         { return Reason; }
00226 
00227 private:
00228     // These params can only be initialised via the constructor
00229     OpLayerGalReason    Reason;
00230     Spread*             pParentSpread;
00231 };
00232 
00233 
00234 //-----------------------------------------------------------------------
00235 //-----------------------------------------------------------------------
00236 
00237 /********************************************************************************************
00238 
00239 >   class LayerStateAction : public Action
00240 
00241     Author:     Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
00242     Created:    21/11/94
00243     Purpose:    An action which changes the state of a layer or the layer system
00244     SeeAlso:    -
00245 
00246 ********************************************************************************************/
00247 
00248 class LayerStateAction : public Action
00249 {
00250 
00251 CC_DECLARE_DYNCREATE(LayerStateAction)
00252 
00253 public:
00254     LayerStateAction();
00255     ~LayerStateAction();
00256     virtual ActionCode Execute();
00257     static ActionCode Init( UndoableOperation* pOp,
00258                             ActionList* pActionList,
00259                             OpLayerGalParam Param);
00260 protected:
00261     OpLayerGalParam Param;
00262 };
00263 
00264 /********************************************************************************************
00265 
00266 >   class OpLayerGalChange: public UndoableOperation
00267 
00268     Author:     Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
00269     Created:    4/8/94
00270     Purpose:    Performs an undoable change (new, delete, change) to a single layer.
00271     SeeAlso:    -
00272 
00273 ********************************************************************************************/
00274 
00275 #define OPTOKEN_LAYERGALCHANGE      _T("LayerGalChange")        // Optoken for the layer gallery change operation 
00276 
00277 class CCAPI OpLayerGalChange: public UndoableOperation
00278 {         
00279 
00280     CC_DECLARE_DYNCREATE( OpLayerGalChange );
00281 
00282 public:
00283     OpLayerGalChange();                             
00284     static BOOL     Init();             
00285     static OpState  GetState(String_256*, OpDescriptor*);       
00286     void            DoWithParam(OpDescriptor*, OpParam* pOpParam);            
00287     void            GetOpName(String_256* OpName);
00288     static BOOL     IsFrameMode();          
00289 
00290     BOOL DoInvalidateLayerRegion(Layer* pLayer);
00291 
00292     virtual BOOL Undo(); 
00293     virtual BOOL Redo();    
00294 
00295     // Karim 21/01/2000 - see UndoableOperation base implementation.
00296     virtual BOOL MayChangeNodeBounds() const { return TRUE; }
00297 
00298 private:
00299     OpLayerGalReason    Reason;
00300     Spread*             pSpread;
00301     Layer*              pOpUndoLayer;   // Ptr to a layer relevent to op reason when an Undo occurs
00302     Layer*              pOpRedoLayer;   // Ptr to a layer relevent to op reason when a Redo occurs
00303     UINT32              UndoIDS;
00304     BOOL                BroadcastLayerChanges;
00305 };  
00306 
00307 /********************************************************************************************
00308 
00309 >   class CCAPI OpDeletePageBackground : public OpLayerGalChange
00310 
00311     Author:     Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com>
00312     Created:    10/4/97
00313     Purpose:    Performs an undoable change of deleting the page background layer.
00314     SeeAlso:    -
00315 
00316 ********************************************************************************************/
00317 
00318 #define OPTOKEN_DELETEPAGEBACKGROUND    _T("DeletePageBackground")
00319 
00320 class CCAPI OpDeletePageBackground : public OpLayerGalChange
00321 {         
00322     CC_DECLARE_DYNCREATE( OpDeletePageBackground );
00323 
00324 public:
00325     OpDeletePageBackground();
00326     
00327     static OpState  GetState(String_256*, OpDescriptor*);       
00328 
00329     void Do( OpDescriptor * pOpDesc );
00330 };  
00331 
00332 
00333 
00334 //-------------------------------------------------------------------------------
00335 //-------------------------------------------------------------------------------
00336 //-------------------------------------------------------------------------------
00337 //-------------------------------------------------------------------------------
00338 
00339 
00340 
00341 /********************************************************************************************
00342 
00343 >   class LayerDlgParam: 
00344 
00345     Author:     Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
00346     Created:    10/8/94
00347     Purpose:    Holds the parameters for the LayerNameDlg to perform its stuff on
00348     SeeAlso:    -
00349 
00350 ********************************************************************************************/
00351 
00352 class LayerDlgParam
00353 {
00354 public:
00355 
00356     LayerDlgParam(OpLayerGalReason ThisReason,Spread* pThisSpread,Layer* pThisLayer)
00357      : Reason(ThisReason),pSpread(pThisSpread), pLayer(pThisLayer) { /* empty */ }
00358 
00359     OpLayerGalReason    GetReason() { return Reason; }
00360     Spread*             GetSpread() { return pSpread; }
00361     Layer*              GetLayer()  { return pLayer; }
00362 
00363 private:
00364     // These params can only be initialised via the constructor
00365     OpLayerGalReason    Reason;
00366     Spread*             pSpread;
00367     Layer*              pLayer;
00368 };
00369 
00370 
00371 
00372 #define OPTOKEN_LAYERNAMEDLG _T("LayerNameDlg")
00373 
00374 /********************************************************************************************
00375 
00376 >   class LayerNameDlg: public DialogOp
00377 
00378     Author:     Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
00379     Created:    20/6/94
00380     Purpose:    Allows the user to edit the parts of a layer.
00381     SeeAlso:    -
00382 
00383 ********************************************************************************************/
00384 
00385 class LayerNameDlg: public DialogOp
00386 {         
00387     CC_DECLARE_DYNCREATE( LayerNameDlg )  
00388 public:
00389 
00390     LayerNameDlg();
00391     void DoWithParam(OpDescriptor*,OpParam*);       // "DoWithParam" function        
00392     BOOL Create(); 
00393 
00394     static const INT32 IDD;
00395     static const CDlgMode Mode;
00396 
00397     static OpState GetState(String_256*, OpDescriptor*);    
00398     static BOOL Init();                        
00399     static void StartUp(LayerDlgParam* pParam);
00400 
00401     virtual MsgResult Message(Msg* Message);
00402 
00403     void ShowLayerDetails();
00404     void CommitDialogValues();
00405 
00406 private:
00407     static void CreateUniqueLayerCopyName(const String_256& strName, String_256* pCopyName);
00408 
00409     Layer*              pLayer;
00410     Spread*             pSpread;
00411     OpLayerGalReason    Reason;
00412 
00413     static BOOL          IsOpen;
00414     static LayerNameDlg* pLayerNameDlg;
00415 }; 
00416 
00417 
00418 
00419 //-------------------------------------------------------------------------------
00420 //-------------------------------------------------------------------------------
00421 //-------------------------------------------------------------------------------
00422 //-------------------------------------------------------------------------------
00423 
00424 #define OPTOKEN_DISPLAYLAYERGALLERY _T("DisplayLayerGallery")   // Optoken for the display layer gallery operation
00425 
00426 /********************************************************************************************
00427 
00428 >   class OpDisplayLayerGallery: public Operation
00429 
00430     Author:     Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
00431     Created:    11/8/94
00432     Purpose:    Displays the layers gallery. This op can be attached to a menu, button or keypress
00433     SeeAlso:    -
00434 
00435 ********************************************************************************************/
00436 
00437 class CCAPI OpDisplayLayerGallery: public Operation
00438 {         
00439     CC_DECLARE_DYNCREATE( OpDisplayLayerGallery );
00440 
00441 public:
00442     static BOOL     Init();             
00443     static OpState  GetState(String_256*, OpDescriptor*);       
00444     void            Do(OpDescriptor*);
00445 };  
00446 
00447 
00448 //-------------------------------------------------------------------------------
00449 //-------------------------------------------------------------------------------
00450 //-------------------------------------------------------------------------------
00451 //-------------------------------------------------------------------------------
00452 
00453 #define OPTOKEN_DISPLAYFRAMEGALLERY _T("DisplayFrameGallery")   // Optoken for the display frame gallery operation
00454 
00455 PORTNOTE("galleries", "Disable frame gallery")
00456 #ifndef EXCLUDE_FROM_XARALX
00457 /********************************************************************************************
00458 
00459 >   class OpDisplayFrameGallery: public Operation
00460 
00461     Author:     Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com>
00462     Created:    16/4/97
00463     Purpose:    Displays the frame gallery. This op can be attached to a menu, button or keypress
00464     SeeAlso:    -
00465 
00466 ********************************************************************************************/
00467 
00468 class CCAPI OpDisplayFrameGallery: public Operation
00469 {         
00470     CC_DECLARE_DYNCREATE( OpDisplayFrameGallery );
00471 
00472 public:
00473     static BOOL     Init();             
00474     static OpState  GetState(String_256*, OpDescriptor*);       
00475     void            Do(OpDescriptor*);
00476 };  
00477 #endif // EXCLUDE_FROM_XARALX
00478 
00479 #endif  // INC_LAYERGAL
00480 

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