00001 // $Id: sgframe.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 // SGFrame.h - the FrameSGallery (Frame SuperGallery) class 00100 // Looks remarkably like the layer gallery but looks aren't everything! 00101 00102 #ifndef INC_SGFRAME 00103 #define INC_SGFRAME 00104 00105 //#include "sgallery.h" - in camtypes.h [AUTOMATICALLY REMOVED] 00106 //#include "sgtree.h" - in camtypes.h [AUTOMATICALLY REMOVED] 00107 00108 #include "layergal.h" 00109 00110 #include "sglayer.h" 00111 #include "bmpprefs.h" // For PALETTE Type 00112 //#include "quality.h" - in camtypes.h [AUTOMATICALLY REMOVED] 00113 //#include "paldefs.h" - in camtypes.h [AUTOMATICALLY REMOVED] 00114 //#include "animparams.h" - in camtypes.h [AUTOMATICALLY REMOVED] 00115 00116 class DocView; 00117 class UndoableOperation; 00118 00119 #ifndef EXCLUDE_GALS 00120 /*********************************************************************************************** 00121 00122 > class SGDisplayFrame : public SGDisplayLayer 00123 00124 Author: Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com> (Based on Jason's Layer gallery code) 00125 Created: 16/4/97 (Based on Jason's Layer gallery code) 00126 Purpose: This DisplayTree node is used by the Layer SuperGallery 00127 It is responsible for providing the ability to handle/redraw one Layer 00128 displayed in said gallery. 00129 00130 SeeAlso: FrameSGallery; SuperGallery; SGDisplayItem 00131 00132 ***********************************************************************************************/ 00133 00134 class CCAPI SGDisplayFrame : public SGDisplayLayer 00135 { 00136 friend class SGLayerGroup; // Allows access to CalculateButtonRects 00137 friend class SGFrameGroup; // Allows access to CalculateButtonRects 00138 00139 CC_DECLARE_DYNAMIC(SGDisplayFrame); 00140 00141 public: 00142 SGDisplayFrame(); 00143 SGDisplayFrame(Layer *LayerToDisplay); 00144 ~SGDisplayFrame(); 00145 00146 virtual BOOL HandleEvent(SGEventType EventType, void *EventInfo, 00147 SGMiscInfo *MiscInfo); 00148 00149 virtual void MoveLayer(SGDisplayNode *NodeToMove,BOOL Before,BOOL ToggleBackground); 00150 00151 protected: // Internal handlers 00152 virtual void HandleRedraw(SGRedrawInfo *RedrawInfo, SGMiscInfo *MiscInfo); 00153 // Redraws the item into the current FormatRect 00154 00155 virtual void DoChangeState(OpLayerGalReason Reason,BOOL NewState); 00156 // Changes the state of the layer this object displays, in some way 00157 00158 virtual void ChangeRangeState(SGDisplayFrame *Start, SGDisplayFrame *End, 00159 BOOL Range, INT32 WhichButton, SGMiscInfo *MiscInfo); 00160 // Changes the state (visible or locked) of a range of layers 00161 00162 00163 private: // Special member variables 00164 static SGDisplayFrame *LastClickedLayer; // Remembers the last layer clicked on (for shift-clicks) 00165 }; 00166 00167 00168 00169 /*********************************************************************************************** 00170 00171 > class SGFrameGroup : public SGLayerGroup 00172 00173 Author: Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com> (Based on Jason's Layer gallery code) 00174 Created: 16/4/97 (Based on Jason's Layer gallery code) 00175 Purpose: This is a display tree group specifically for the layer gallery - it disables 00176 group things like folding, and provides column headings for the layers display. 00177 SeeAlso: SuperGallery; SGDisplayGroup; 00178 00179 ***********************************************************************************************/ 00180 00181 00182 class CCAPI SGFrameGroup : public SGLayerGroup 00183 { 00184 CC_DECLARE_DYNAMIC(SGFrameGroup); 00185 00186 public: 00187 SGFrameGroup(SuperGallery *ParentGal, 00188 Document *ParentDoc = NULL, Library *ParentLib = NULL, BOOL IsForeground = TRUE); 00189 00190 virtual BOOL HandleEvent(SGEventType EventType, void *EventInfo, 00191 SGMiscInfo *MiscInfo); 00192 // Handles a display list event (redraw, mouse click, etc) 00193 00194 // Is this group the foreground layer group (TRUE) or the background layer group (FALSE) 00195 BOOL IsForeground() { return Foreground; } 00196 00197 private: 00198 BOOL Foreground; 00199 }; 00200 00201 #endif 00202 00203 00204 /*********************************************************************************************** 00205 00206 > class FrameSGallery : public LayerSGallery 00207 00208 Author: Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com> (Based on Jason's Layer gallery code) 00209 Created: 16/4/97 (Based on Jason's Layer gallery code) 00210 Purpose: The Layer SuperGallery class 00211 00212 Notes: SuperGalleries are specced in a number of docs including 00213 specs\sgallery.doc ("super" gallery extensions) 00214 specs\propui.doc (gallery basic ui) 00215 There is also howtouse\sgallery.doc which describes creating a supergallery 00216 00217 SeeAlso: SuperGallery; SGDisplayFrame 00218 00219 ***********************************************************************************************/ 00220 00221 #ifdef EXCLUDE_GALS 00222 class FrameSGallery : public Operation 00223 #else 00224 class FrameSGallery : public LayerSGallery 00225 #endif 00226 { 00227 CC_DECLARE_DYNCREATE(FrameSGallery) 00228 00229 public: 00230 FrameSGallery(); 00231 ~FrameSGallery(); 00232 00233 #ifndef EXCLUDE_GALS 00234 virtual MsgResult Message(Msg* Message); 00235 00236 00237 protected: // Overridden upcall methods 00238 virtual BOOL PostCreate(void); 00239 00240 virtual BOOL ApplyAction(SGActionType Action); 00241 00242 virtual void DoShadeGallery(BOOL ShadeIt); 00243 00244 public: // Overridden Command interface (for Ops and menu support) 00245 virtual BOOL InitMenuCommands(void); 00246 // Called on startup to initialise any desired menu commands. Will make repeated calls 00247 // to InitMenuCommand(), below. 00248 00249 virtual BOOL BuildCommandMenu(GalleryContextMenu *TheMenu, SGMenuID MenuID); 00250 // Builds the command menu for the given menu pop-up (over an item, or options button) 00251 00252 virtual OpState GetCommandState(StringBase *CommandID, String_256 *ShadeReason); 00253 // Returns an OpState indicating the state of this command, much like an Op GetState 00254 00255 virtual void DoCommand(StringBase *CommandID); 00256 // Attempts to "do" the given command. Should call down to the base class to handle 00257 // any commands it can't deal with. 00258 00259 00260 public: // Personal/Internal methods 00261 virtual void CreateNewSubtree(Document *ParentDoc, SGDisplayGroup *ExistingGroup = NULL); 00262 // Creates a new subtree group to display the Layers for the given document 00263 // If ExistingGroup != NULL, that group will be re-cached for the given doc 00264 00265 00266 protected: // Internal methods (directly ported from old LayerGallery class) 00267 virtual void EnsureSelSpreadSelectionIntegrity(); 00268 #endif 00269 00270 public: // Public so SGDisplayLayer items can call them 00271 static void MakeActiveLayer(Layer* pNewActiveLayer, UndoableOperation * pUndoOp = NULL); 00272 00273 public: // Public access functions for everybody who wants 'em 00274 static void SetActive(Document* pDoc,Layer* pLayer,BOOL state); 00275 static String_256 CreateUniqueLayerID(Spread* pSpread, const String_256 * pBaseName = NULL); 00276 00277 // This function should be called before any frame related actions are carried out 00278 // It will ensure that all the visible layers are frame layers 00279 static BOOL EnsureFrameLayerIntegrity(Spread* pSpread); 00280 static BOOL DoHideNode(Node* pNodeToHide); 00281 00282 #ifndef EXCLUDE_GALS 00283 protected: 00284 virtual SGDisplayLayer *GetSelectedLayerGalItem(); 00285 00286 virtual void DoMoveLayer(MoveLayerType Reason); 00287 00288 virtual BOOL DoDeleteSelection(void); 00289 virtual void DoCreateNewItem(void); 00290 virtual void DoCopyLayer(); 00291 00292 // Special frame gallery related items 00293 virtual BOOL DoSaveAnimation(); 00294 virtual BOOL DoPreviewAnimation(); 00295 virtual BOOL DoFrameProperties(); 00296 virtual BOOL DoRegenerateFrames(); 00297 virtual BOOL DoRegenerateSingleFrame(); 00298 00299 // Ensure that the frame related buttons are greyed/ungreyed 00300 BOOL UpdateFrameRelatedButtons(); 00301 00302 // Function to determine the document mode. 00303 BOOL IsFrameMode(Document* pDoc); 00304 00305 // Function to close the frame gallery 00306 BOOL CloseFrameGallery(); 00307 00308 // Function to open the Layer gallery 00309 BOOL OpenLayerGallery(); 00310 00311 // Access functions to determine when a new document is born. 00312 void SetNewDocBorn(BOOL Val) { m_NewDocBorn = Val; } 00313 BOOL GetNewDocBorn() { return m_NewDocBorn; } 00314 00315 public: 00316 // new specific frame gallery related functions 00317 static void DoChangeSolid(Layer* pLayer,BOOL Solid); 00318 static void DoChangeOverlay(Layer* pLayer,BOOL Overlay); 00319 // solid and overlay flags have changed or a new layer has become active 00320 // so fix up the visibility and locked nature of the other layers 00321 static void FixOtherLayers(Spread* pSpread); 00322 static void FixOtherLayersFromActive(Layer * pActiveLayer, UndoableOperation * pUndoOp = NULL); 00323 00324 protected: 00325 BOOL m_NewDocBorn; // Flag to determine when a new doc. is born. 00326 00327 #endif 00328 }; 00329 00330 #endif 00331