strkattr.h

Go to the documentation of this file.
00001 // $Id: strkattr.h 1688 2006-08-10 12:05:20Z gerry $
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 // strkattr.h - Path stroking attributes
00099 
00100 #ifndef INC_STRKATTR
00101 #define INC_STRKATTR
00102 
00103 //#include "attrval.h" - in camtypes.h [AUTOMATICALLY REMOVED]
00104 //#include "cxfrech.h" - in camtypes.h [AUTOMATICALLY REMOVED]
00105 //#include "nodeattr.h" - in camtypes.h [AUTOMATICALLY REMOVED]
00106 
00107 
00108 class PathProcessorStroke;
00109 class ValueFunction;
00110 class BecomeA;
00111 
00112 /********************************************************************************************
00113 
00114 >   enum StrokeTypeID
00115 
00116     Author:     Jason_Williams (Xara Group Ltd) <camelotdev@xara.com>
00117     Created:    10/1/97
00118     Purpose:    A unique identifier UINT32 for each predefined stroke type.
00119                 This is used to save predefined strokes in XAR files in a minimal format
00120 
00121 ********************************************************************************************/
00122 
00123 typedef enum
00124 {
00125     StrokeType_SimpleVarWidth = 0,
00126 } StrokeTypeID;
00127 
00128 
00129 
00130 /********************************************************************************************
00131 
00132 >   class StrokeTypeAttrValue : public AttributeValue
00133 
00134     Author:     Jason_Williams (Xara Group Ltd) <camelotdev@xara.com>
00135     Created:    7/1/97
00136 
00137     Purpose:    StrokeType attribute value
00138                 StrokeType attributes describe the stroking characteristics for a path
00139 
00140     Notes:      This AttrValue just contains a pointer to a path processor which will
00141                 stroke paths after some given fashion. The pointer may be NULL, in which
00142                 case new-style stroking is disabled, and old-style "lines" will be
00143                 rendered.
00144 
00145 ********************************************************************************************/
00146 
00147 class StrokeTypeAttrValue : public AttributeValue
00148 {
00149     CC_DECLARE_DYNAMIC(StrokeTypeAttrValue)
00150 
00151 public:         // Construction/Initialisation
00152     StrokeTypeAttrValue(PathProcessorStroke *pPathProcessor = NULL);
00153     ~StrokeTypeAttrValue();
00154 
00155     static BOOL Init(void);
00156 
00157 
00158 public:         // Overridden access methods
00159     virtual void Render(RenderRegion *pRegion, BOOL Temp = FALSE);
00160     virtual void Restore(RenderRegion *pRegion, BOOL Temp);
00161     virtual void GoingOutOfScope(RenderRegion *pRegion);
00162 
00163     virtual void SimpleCopy(AttributeValue *pValue);
00164     virtual NodeAttribute *MakeNode();
00165 
00166     virtual BOOL IsDifferent(AttributeValue *pAttr);
00167 
00168     virtual StrokeTypeAttrValue &operator=(StrokeTypeAttrValue &Attrib);
00169     virtual INT32 operator==(const StrokeTypeAttrValue &Attrib);
00170 
00171 
00172 public:     // Specialised interface
00173     void SetPathProcessor(PathProcessorStroke *pNewProcessor);
00174     PathProcessorStroke *GetPathProcessor(void) const   { return(pProcessor); };
00175             // Get the path processor for this stroke type (may be NULL)
00176 
00177     BOOL DoBecomeA(BecomeA* pBecomeA, Node* pParent);
00178 private:
00179     PathProcessorStroke *pProcessor;            // Pointer to the PPS we use (if any)
00180 };
00181 
00182 
00183 
00184 /***********************************************************************************************
00185 
00186 >   class AttrStrokeType : public NodeAttribute
00187 
00188     Author:     Jason_Williams (Xara Group Ltd) <camelotdev@xara.com>
00189     Created:    7/1/97
00190 
00191     Purpose:    StrokeType attribute
00192                 StrokeType attributes are very simple, and merely contain a StrokeTypeAttrValue,
00193                 which is the entity which holds all the info and does all the work.
00194 
00195 ***********************************************************************************************/
00196 
00197 class AttrStrokeType : public NodeAttribute
00198 {
00199     CC_DECLARE_DYNCREATE(AttrStrokeType)
00200 
00201 public:     // Constructors
00202     AttrStrokeType();
00203     AttrStrokeType(Node *ContextNode,
00204                      AttachNodeDirection Direction,
00205                      BOOL Locked    = FALSE,
00206                      BOOL Mangled   = FALSE,
00207                      BOOL Marked    = FALSE,
00208                      BOOL Selected  = FALSE);
00209 
00210 public:
00211     virtual void Render(RenderRegion *pRender);
00212     virtual void CopyNodeContents(AttrStrokeType *NodeCopy);
00213     virtual void PolyCopyNodeContents(NodeRenderable* pNodeCopy);
00214     virtual INT32 operator==(const NodeAttribute& NodeAttrib);
00215     virtual Node *SimpleCopy();
00216     virtual UINT32 GetAttrNameID(void);
00217     virtual AttrIndex GetAttributeIndex () { return ATTR_STROKETYPE; }
00218     virtual void GetDebugDetails(StringBase *Str);
00219     virtual UINT32 GetNodeSize() const;
00220 
00221     virtual BOOL WritePreChildrenWeb(BaseCamelotFilter *pFilter);
00222     virtual BOOL WritePreChildrenNative(BaseCamelotFilter *pFilter);
00223 
00224     virtual AttributeValue* GetAttributeValue()     { return(&Value); };
00225 
00226     virtual BOOL NeedsTransparency() const;
00227 
00228     BOOL DoBecomeA(BecomeA* pBecomeA, Node* pParent);
00229     BOOL HasPathProcessor();
00230     PathProcessorStroke* GetPathProcessor();
00231 
00232 protected:
00233     StrokeTypeAttrValue Value;
00234 };
00235 
00236 
00237 
00238 
00239 
00240 
00241 /********************************************************************************************
00242 
00243 >   enum VariableWidthID
00244 
00245     Author:     Jason_Williams (Xara Group Ltd) <camelotdev@xara.com>
00246     Created:    10/1/97
00247     Purpose:    A unique identifier UINT32 for each predefined variable width stroke function.
00248                 This is used to save predefined varwidths in XAR files in a minimal format.
00249 
00250 ********************************************************************************************/
00251 
00252 typedef enum
00253 {
00254     VarWidth_NotPredefined = 0,     // For fns which aren't "simple" predefined ones
00255 
00256     VarWidth_Constant   = -1,       // All values are negative (positive values are used
00257     VarWidth_LinRamp    = -2,       // as references to complex function records)
00258     VarWidth_SRamp      = -3,
00259 } VariableWidthID;
00260 
00261 
00262 
00263 /********************************************************************************************
00264 
00265 >   class VariableWidthAttrValue : public AttributeValue
00266 
00267     Author:     Jason_Williams (Xara Group Ltd) <camelotdev@xara.com>
00268     Created:    7/1/97
00269 
00270     Purpose:    VariableWidth attribute value
00271                 VariableWidth attributes describe the width characteristics for a path
00272 
00273 ********************************************************************************************/
00274 
00275 class VariableWidthAttrValue : public AttributeValue
00276 {
00277     CC_DECLARE_DYNAMIC(VariableWidthAttrValue)
00278 
00279 public:         // Construction/Initialisation
00280     VariableWidthAttrValue(ValueFunction *pValueFunction = NULL);
00281     ~VariableWidthAttrValue();
00282 
00283     static BOOL Init(void);
00284 
00285 
00286 public:         // Overridden access methods
00287     virtual void Render(RenderRegion *pRegion, BOOL Temp = FALSE);
00288     virtual void Restore(RenderRegion *pRegion, BOOL Temp);
00289 
00290     virtual void SimpleCopy(AttributeValue *pValue);
00291     virtual NodeAttribute *MakeNode();
00292 
00293     virtual BOOL IsDifferent(AttributeValue *pAttr);
00294 
00295     virtual VariableWidthAttrValue &operator=(VariableWidthAttrValue &Attrib);
00296     virtual INT32 operator==(const VariableWidthAttrValue &Attrib);
00297 
00298 
00299 public:         // Specialised methods
00300     void SetWidthFunction(VariableWidthID PredefinedFuncID);
00301     void SetWidthFunction(ValueFunction *pNewFunction);
00302 
00303     ValueFunction *GetWidthFunction(void)       { return(WidthFunction); };
00304     VariableWidthID GetWidthFunctionID(void)    { return(PredefinedFunctionID); };
00305 
00306 private:
00307     VariableWidthID PredefinedFunctionID;
00308     ValueFunction   *WidthFunction;
00309 };
00310 
00311 
00312 
00313 /***********************************************************************************************
00314 
00315 >   class AttrVariableWidth : public NodeAttribute
00316 
00317     Author:     Jason_Williams (Xara Group Ltd) <camelotdev@xara.com>
00318     Created:    7/1/97
00319 
00320     Purpose:    VariableWidth attribute
00321                 VariableWidth attributes are very simple, and merely contain a VariableWidthAttrValue,
00322                 which is the entity which holds all the info and does all the work.
00323 
00324 ***********************************************************************************************/
00325 
00326 class AttrVariableWidth : public NodeAttribute
00327 {
00328     CC_DECLARE_DYNCREATE(AttrVariableWidth)
00329 
00330 // the stroke path-processor needs access to our value.
00331 friend class PathProcessorStroke;
00332 
00333 public:     // Constructors
00334     AttrVariableWidth();
00335     AttrVariableWidth(Node *ContextNode,
00336                      AttachNodeDirection Direction,
00337                      BOOL Locked    = FALSE,
00338                      BOOL Mangled   = FALSE,
00339                      BOOL Marked    = FALSE,
00340                      BOOL Selected  = FALSE);
00341 public:
00342     virtual void Render(RenderRegion *pRender);
00343     virtual void CopyNodeContents(AttrVariableWidth *NodeCopy);
00344     virtual void PolyCopyNodeContents(NodeRenderable* pNodeCopy);
00345     virtual INT32 operator==(const NodeAttribute& NodeAttrib);
00346     virtual Node *SimpleCopy();
00347     virtual UINT32 GetAttrNameID(void);
00348     virtual AttrIndex GetAttributeIndex () { return ATTR_VARWIDTH; }
00349     virtual void GetDebugDetails(StringBase *Str);
00350     virtual UINT32 GetNodeSize() const;
00351 
00352     virtual BOOL WritePreChildrenWeb(BaseCamelotFilter *pFilter);
00353     virtual BOOL WritePreChildrenNative(BaseCamelotFilter *pFilter);
00354 
00355     virtual AttributeValue* GetAttributeValue()             { return(&Value); };
00356 
00357     BOOL DoBecomeA(BecomeA* pBecomeA, Node* pParent);
00358 
00359     BOOL HasActiveValueFunction();
00360 protected:
00361     VariableWidthAttrValue Value;
00362 };
00363 
00364 
00365 
00366 
00367 
00368 
00369 
00370 
00371 /***********************************************************************************************
00372 
00373 >   class StrokeAttrRecordHandler : public CamelotRecordHandler
00374 
00375     Author:     Jason_Williams (Xara Group Ltd) <camelotdev@xara.com>
00376     Created:    7/1/97
00377     Purpose:    Handles the reading of all Stroke attribute records in the v2 file format
00378                 This includes StrokeType Attributes and VariableWidth attributes
00379 
00380 ***********************************************************************************************/
00381 
00382 class CXaraFileRecord;
00383 
00384 class StrokeAttrRecordHandler : public CamelotRecordHandler
00385 {
00386     CC_DECLARE_DYNAMIC(StrokeAttrRecordHandler);
00387 
00388 public:
00389     StrokeAttrRecordHandler() : CamelotRecordHandler() {}
00390     ~StrokeAttrRecordHandler() {}
00391 
00392     // functions that must be implemented.
00393     virtual UINT32 *GetTagList();
00394     virtual BOOL HandleRecord(CXaraFileRecord *pCXaraFileRecord);
00395 
00396     // handling of atomic TAG_STROKEDEFINITION tags
00397     virtual BOOL BeginSubtree(UINT32 Tag);
00398     virtual BOOL EndSubtree(UINT32 Tag);
00399 
00400 #ifdef XAR_TREE_DIALOG
00401     virtual void GetRecordDescriptionText(CXaraFileRecord* pRecord, StringBase* pStr);
00402 #endif
00403 };
00404 
00405 #endif
00406 

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