ngprop.h

Go to the documentation of this file.
00001 // $Id: ngprop.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: /wxCamelot/Kernel/ngprop.h 13    13/07/05 9:26 Luke $
00100     Attribute gallery named set properties.
00101 */
00102 
00103 #ifndef NGPROP_H
00104 #define NGPROP_H
00105 
00106 //#include "undoop.h" - in camtypes.h [AUTOMATICALLY REMOVED]
00107 #include "extender.h"   // for extend byte-flags
00108 #include <list>
00109 
00110 class SGNameItem;
00111 class CXaraFileRecord;
00112 class BitmapExportOptions;
00113 class OpExportSets;
00114 
00115 
00116 /***********************************************************************************************
00117 >   class CCAPI SGNameProp : public CC_CLASS_MEMDUMP
00118 
00119     Author:     Justin_Flude (Xara Group Ltd) <camelotdev@xara.com>
00120     Created:    27/8/99
00121     Purpose:    Abstract base class for the various kinds of properties associated
00122                 with SGNameItems.
00123     SeeAlso:    NamedTickboxProp; SGNameItem; NameGallery
00124 ***********************************************************************************************/
00125 
00126 class CCAPI SGNameProp : public CC_CLASS_MEMDUMP
00127 {
00128     CC_DECLARE_MEMDUMP(SGNameProp);
00129 public:
00130     // Range of valid property indices: 0 ... (nPropertyCount - 1)
00131     enum { nPropertyCount = 3 };
00132 
00133     // Creation & destruction.
00134     SGNameProp(const StringBase& strName, INT32 nIndex);
00135     SGNameProp(const SGNameProp& other);
00136     virtual ~SGNameProp();
00137 
00138     // Create a default attribute of the given index (type) for the given item.
00139     static SGNameProp* CreateDefault(const StringBase& strName, INT32 nIndex);
00140 
00141     // Return type information for this property.
00142     const StringBase& GetName() const       { return m_strName; }
00143     INT32 GetIndex() const                  { return m_nIndex; }
00144 
00145     // Returns TRUE if this property has been edited at some time, FALSE if has not
00146     // been edited since it was first created.
00147     BOOL IsVirgin() const                   { return m_fIsVirgin; }
00148     void SetDirty()                         { m_fIsVirgin = FALSE; }
00149 
00150 PORTNOTE("other","Removed SuperGallery usage")
00151 #ifndef EXCLUDE_FROM_XARALX
00152     // Event & redraw handlers are extensions of the given SGNameItem's.
00153     virtual BOOL HandleMouse(SGNameItem*, SGMouseInfo*, SGMiscInfo*) = 0;
00154     virtual void CalcUiBounds(SGNameItem*, SGFormatInfo*, SGMiscInfo*, DocRect*) = 0;
00155     virtual BOOL HandleRedraw(SGNameItem*, SGRedrawInfo*, SGMiscInfo*, const DocRect&) = 0;
00156 #endif
00157 
00158     // Version 2 native streaming.  Derived classes must override these to read into
00159     // or write from this object.
00160     virtual BOOL Write(CXaraFileRecord* pRec);
00161     virtual BOOL Read(CXaraFileRecord* pRec);
00162 
00163     // Makes a copy of this kind of SGNameProp.  Derived classes must override this
00164     // to return a copy of themselves in the heap.
00165     virtual SGNameProp* Clone() = 0;
00166 
00167 
00168 protected:  
00169     // Runs OpChangeSetProperty to change the item's NodeSetProperty in the tree. The
00170     // optional third parameter, if supplied, renames the item as well.
00171     virtual BOOL Change(SGNameItem* pItem, SGNameProp* pNewProp, StringBase* pstrNewName = 0);
00172 
00173 private:
00174     // Data.
00175     StringBase  m_strName;          // name of set (SGNameItem) associated with this property
00176     INT32           m_nIndex;           // index of this property
00177     BOOL        m_fIsVirgin;        // TRUE if just created and has never been edited
00178 
00179 #if DEBUG_TREE
00180 public:
00181     virtual void GetDebugInfo(StringBase* pStr) = 0;
00182 #endif
00183 };
00184 
00185 
00186 
00187 /***********************************************************************************************
00188 >   class CCAPI NamedTickboxProp : public SGNameProp
00189 
00190     Author:     Justin_Flude (Xara Group Ltd) <camelotdev@xara.com>
00191     Created:    27/8/99
00192     Purpose:    Abstract base class for the various kinds of properties associated with
00193                 SGNameItems that have a UI of a (tri-state) tick-box.
00194     SeeAlso:    SGNameProp; SGNameItem; NameGallery
00195 ***********************************************************************************************/
00196 
00197 class CCAPI NamedTickboxProp : public SGNameProp
00198 {
00199 public:
00200     // Returns the state of this property's tickbox.
00201     INT32 GetState() const
00202         { return m_nState; }
00203 
00204 protected:
00205     // Creation & destruction.
00206     NamedTickboxProp(const StringBase& strName, INT32 nIndex, INT32 nState = 0);
00207     NamedTickboxProp(const NamedTickboxProp& other);
00208 
00209 PORTNOTE("other","Removed SuperGallery usage")
00210     // Event & redraw handlers.
00211 #ifndef EXCLUDE_FROM_XARALX
00212     virtual BOOL HandleMouse(SGNameItem*, SGMouseInfo*, SGMiscInfo*);
00213     virtual void CalcUiBounds(SGNameItem*, SGFormatInfo*, SGMiscInfo*, DocRect*);
00214     virtual BOOL HandleRedraw(SGNameItem*, SGRedrawInfo*, SGMiscInfo*, const DocRect&);
00215 #endif
00216 
00217     // Version 2 native streaming.  Writes out tickbox state.
00218     virtual BOOL Write(CXaraFileRecord* pRec);
00219     virtual BOOL Read(CXaraFileRecord* pRec);
00220 
00221     // Data.
00222     INT32 m_nState;
00223 };
00224 
00225 
00226 
00227 /***********************************************************************************************
00228 >   class CCAPI NamedExportProp : public SGNameProp
00229 
00230     Author:     Justin_Flude (Xara Group Ltd) <camelotdev@xara.com>
00231     Created:    27/8/99
00232     Purpose:    Class to manage the UI and execution of batch-export properties.
00233     SeeAlso:    SGNameProp; NamedTickboxProp; SGNameItem; NameGallery
00234 ***********************************************************************************************/
00235 
00236 class CCAPI NamedExportProp : public SGNameProp
00237 {
00238 public:
00239     // Creation & destruction.
00240     NamedExportProp(const StringBase& strName);
00241     NamedExportProp(const NamedExportProp& other);
00242     virtual ~NamedExportProp();
00243 
00244     // The index (offset into array of properties) of this kind of SGNameProp.
00245     enum { nIndex = 0 };
00246 
00247     // Access the stored export path and options.
00248     Filter* GetFilter() const;
00249     PathName& GetPath();
00250     BitmapExportOptions* GetOptions() const;
00251 
00252     void SetFilter(Filter* pFilter);
00253     void SetPath(const PathName& path);
00254     BitmapExportOptions* SetOptions(BitmapExportOptions* pOptions);
00255 
00256     // The export dialogs should check this and use an Apply button rather than an
00257     // Export button if it is true.
00258     static BOOL m_fApplyNotExport;
00259     BOOL ExportPropertiesToLocationDlg(SGNameItem* &pItem);
00260 
00261 #if DEBUG_TREE
00262     virtual void GetDebugInfo(StringBase* pStr);
00263 #endif
00264 
00265 protected:
00266     virtual SGNameProp* Clone();
00267     virtual BOOL Write(CXaraFileRecord* pRec);
00268     virtual BOOL Read(CXaraFileRecord* pRec);
00269 
00270 PORTNOTE("other","Removed SuperGallery usage")
00271 #ifndef EXCLUDE_FROM_XARALX
00272     virtual BOOL HandleMouse(SGNameItem*, SGMouseInfo*, SGMiscInfo*);
00273     virtual void CalcUiBounds(SGNameItem*, SGFormatInfo*, SGMiscInfo*, DocRect*);
00274     virtual BOOL HandleRedraw(SGNameItem*, SGRedrawInfo*, SGMiscInfo*, const DocRect&);
00275 #endif
00276     // Data.
00277     Filter* m_pFilter;                      // the filter used to export
00278     BitmapExportOptions* m_pOptions;        // the dialog options for the export
00279     PathName m_Path;                        // path to the exported file
00280     DocRect m_drPathInvoker;                // bounds of choose filter/path invoker gadget
00281 };
00282 
00283 
00284 
00285 /********************************************************************************************
00286 >   class CCAPI NamedSliceProp : public NamedTickboxProp
00287 
00288     Author:     Justin_Flude (Xara Group Ltd) <camelotdev@xara.com>
00289     Created:    27/8/99
00290     Purpose:    Class to manage the UI and execution of slice properties.
00291     SeeAlso:    SGNameProp; NamedTickboxProp; SGNameItem; NameGallery
00292 ********************************************************************************************/
00293 
00294 class CCAPI NamedSliceProp : public NamedTickboxProp
00295 {
00296 public:
00297     // Creation & destruction.
00298     NamedSliceProp(const StringBase& strName, INT32 nState = 0);
00299 
00300     // The index (offset into array of properties) of this kind of SGNameProp.
00301     enum { nIndex = 1 };
00302 
00303 protected:
00304     virtual SGNameProp* Clone();
00305     virtual BOOL Write(CXaraFileRecord* pRec);
00306     virtual BOOL Read(CXaraFileRecord* pRec);
00307 
00308 #if DEBUG_TREE
00309 public:
00310     virtual void GetDebugInfo(StringBase* pStr);
00311 #endif
00312 };
00313 
00314 
00315 
00316 /***********************************************************************************************
00317 >   class CCAPI NamedStretchProp : public NamedTickboxProp
00318 
00319     Author:     Justin_Flude (Xara Group Ltd) <camelotdev@xara.com>
00320     Created:    27/8/99
00321     Purpose:    Class to manage the UI and execution of stretch/extend properties.
00322     SeeAlso:    SGNameProp; NamedTickboxProp; SGNameItem; NameGallery
00323 ***********************************************************************************************/
00324 
00325 // This represents a "trigger" (source) set.
00326 struct CCAPI TriggerSet
00327 {
00328     // Creation & destruction.
00329     TriggerSet(const StringBase& strSet);
00330     TriggerSet(const TriggerSet& other);
00331 
00332     // Attributes.
00333     INT32 operator==(const StringBase& strName) const
00334         { return strName == m_strSet; }
00335 
00336     // Data.
00337     StringBase m_strSet;    // the name of the trigger set
00338 };
00339 
00340 
00341 
00342 class CCAPI NamedStretchProp : public NamedTickboxProp
00343 {
00344 public:
00345     // Creation & destruction.
00346     NamedStretchProp(const StringBase& strName, BYTE nStretchType = X_EXTEND | Y_EXTEND ,INT32 nState = 0);
00347     NamedStretchProp(const NamedStretchProp& other);
00348 
00349     // The index (offset into array of properties) of this kind of SGNameProp.
00350     enum { nIndex = 2 };
00351 
00352     // Add and remove a trigger set that stretches/extends etc.
00353     void AddTrigger(const StringBase& strSet);
00354     void RemoveTrigger(const StringBase& strSet);
00355     BOOL HasTrigger(const StringBase& strSet);
00356 
00357     // Bounds of triggers and targets.
00358     const DocRect& GetRefTargetBounds() const;
00359     const DocRect& GetRefUnionTriggerBounds() const;
00360     void SetRefTargetBounds(const DocRect& rRefTarget);
00361     void SetRefUnionTriggerBounds(const DocRect& rRefTriggers);
00362 
00363     // Return a read-only reference to the list of triggers.
00364     std::list<TriggerSet>& GetTriggers()    { return m_Triggers; }
00365 
00366     // Set/get the stretch/extend mode for the triggers.
00367     void SetStretchType(BYTE nType)             { m_nStretchType = nType; }
00368     BYTE GetStretchType() const             { return m_nStretchType; }
00369 
00370 
00371     // Matt - 13/02/2001
00372     // We need some method of checking through the currently selected stretchy stuff to warn the
00373     // user if they have a NodeRegularShape in their stretchy selection - as they don't extend
00374     // predictably...
00375     BOOL ValidateStretchingObjects(SGNameItem *pItem);
00376 
00377 
00378 protected:
00379     virtual SGNameProp* Clone();
00380     virtual BOOL Write(CXaraFileRecord* pRec);
00381     virtual BOOL Read(CXaraFileRecord* pRec);
00382 
00383 PORTNOTE("other","Removed SuperGallery usage")
00384 #ifndef EXCLUDE_FROM_XARALX
00385     virtual BOOL HandleMouse(SGNameItem*, SGMouseInfo*, SGMiscInfo*);
00386     virtual void CalcUiBounds(SGNameItem*, SGFormatInfo*, SGMiscInfo*, DocRect*);
00387     virtual BOOL HandleRedraw(SGNameItem*, SGRedrawInfo*, SGMiscInfo*, const DocRect&);
00388 #endif
00389 
00390     // Data.
00391     std::list<TriggerSet> m_Triggers;   // source sets which stretch/extend this set
00392     DocRect     m_drInvoker;            // bounds of trigger dialog invoker gadget
00393     BYTE        m_nStretchType;         // how they stretch, eg. X_EXTEND | Y_STRETCH
00394     DocRect     m_rTargetBounds;        // reference bounds of this set as a target
00395     DocRect     m_rTriggerBounds;       // reference bounds of union of set's triggers
00396 
00397 #if DEBUG_TREE
00398 public:
00399     virtual void GetDebugInfo(StringBase* pStr);
00400 #endif
00401 };
00402 
00403 #endif  /* !NGPROP_H */

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