opbevel.h

Go to the documentation of this file.
00001 // $Id: opbevel.h 1752 2006-09-15 09:13:05Z luke $
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 // Header for the Bevel tool operations
00099 
00100 #ifndef INC_OPBevel
00101 #define INC_OPBevel
00102 
00103 #if BUILDSHADOWS
00104 
00105 //#include "selop.h"
00106 
00107 #define OPTOKEN_CREATEBEVEL _T("CreateBevel")
00108 #define OPTOKEN_REMOVEBEVEL _T("RemoveBevel")
00109 #define OPTOKEN_CHANGEBEVEL _T("ChangeBevel")
00110 #define OPTOKEN_CHANGEATTRIBUTE _T("ChangeAttribute")
00111 #define OPTOKEN_SELECTBEVEL _T("SelectBevel")
00112 
00113 class BevelInfo;
00114 
00115 
00116 /********************************************************************************************
00117 >   class BevelTools
00118 
00119     Author:     David_McClarnon (Xara Group Ltd) <camelotdev@xara.com>
00120     Created:    23/3/99
00121     Purpose:    Useful static functions for bevel manipulations
00122 ********************************************************************************************/
00123 
00124 class BevelTools
00125 {
00126 public:
00127     // builds a list of all selected nodes of given class
00128     static BOOL BuildListOfSelectedNodes(List *pList,
00129                                 const CCRuntimeClass * pClass,
00130                                 BOOL bPromoteToParents = TRUE);
00131 
00132     // recursion down to find nodes
00133     static BOOL GetAllNodesUnderNode(const Node * pNode, List * pList,
00134         const CCRuntimeClass * pClass, INT32 depth = 0);
00135 
00136     // whether any of the child nodes of this node are selected
00137     static BOOL HasSelectedChild(NodeRenderableInk * pNode);
00138 
00139 private:
00140     static BOOL IsNodeInList(List * pList, const Node * pNode);
00141 };
00142 
00143 
00144 /********************************************************************************************
00145 >   class OpCreateBevel : public SelOperation
00146 
00147     Author:     Peter_Arnold (Xara Group Ltd) <camelotdev@xara.com> & Olivier
00148     Created:    21/11/96
00149     Purpose:    Create a Bevel object in the tree giving the current selection a Bevel.
00150 ********************************************************************************************/
00151 class OpCreateBevel : public SelOperation
00152 {
00153 
00154 CC_DECLARE_DYNCREATE(OpCreateBevel)
00155 
00156 public:
00157     // Construction/Destruction
00158     OpCreateBevel();
00159     ~OpCreateBevel();
00160 
00161     virtual void Do(OpDescriptor *pOpDesc);
00162     virtual void DoWithParam(OpDescriptor* pOp, OpParam* pParam);
00163 
00164 //  BOOL GenerateBitmapShapes(NodeBevel* pCurrent, SelRange SelectionRng);
00165 
00166     // These functions required for the OpDescriptor class
00167     static BOOL Declare();
00168     static OpState GetState(String_256* Description, OpDescriptor*);
00169 
00170     void GetOpName(String_256*);
00171 
00172     // sjk 26/09/2000 - see UndoableOperation base implementation.
00173     virtual BOOL MayChangeNodeBounds() const { return TRUE; }
00174 
00175 private:
00176     void ApplyBevelToNode(Node * pNode, BevelInfo* pParam);
00177     
00178     // converts all nodes (recursively) into paths
00179     void ConvertToPaths(Node * pNode);
00180 
00181     NodeAttribute * DoDepthSearchForFill(Node * pStart);
00182 
00183     // the resource ID of the name of the op
00184     UINT32 m_NameID;
00185 };
00186 
00192 
00193 
00194 /********************************************************************************************
00195 >   class OpRemoveBevel : public SelOperation
00196 
00197     Author:     Olivier_Gascoin (Xara Group Ltd) <camelotdev@xara.com>
00198     Created:    21/11/96
00199     Purpose:    Remove a Bevel object 
00200 ********************************************************************************************/
00201 class OpRemoveBevel : public SelOperation
00202 {
00203 
00204 CC_DECLARE_DYNCREATE(OpRemoveBevel)
00205 
00206 public:
00207     // Construction/Destruction
00208     OpRemoveBevel();
00209     ~OpRemoveBevel();
00210 
00211     virtual void Do(OpDescriptor *pOpDesc);
00212         
00213     // These functions required for the OpDescriptor class
00214     static BOOL Declare();
00215     static OpState GetState(String_256* Description, OpDescriptor*);
00216 
00217     void GetOpName(String_256*);
00218 
00219     // sjk 26/09/2000 - see UndoableOperation base implementation.
00220     virtual BOOL MayChangeNodeBounds() const { return TRUE; }
00221 };
00222 
00228 /********************************************************************************************
00229 >   class BevelInfo : public OpParam
00230 
00231     Author:     David_McClarnon (Xara Group Ltd) <camelotdev@xara.com> Mc
00232     Created:    9/10/98
00233     Purpose:    Bevel information structure
00234 ********************************************************************************************/
00235 
00236 class BevelInfo : public OpParam
00237 {
00238 CC_DECLARE_DYNCREATE(BevelInfo)
00239 
00240 public:
00241     BevelInfo()
00242     {
00243         m_BevelType                 = 0;
00244         m_Indent                    = 0;
00245         m_LightAngle                = 135;
00246         m_bOuter                    = FALSE;
00247         m_Contrast                  = 100;
00248         m_Tilt                      = 32;
00249         m_bBevelTypeChanged         = FALSE;
00250         m_bBevelIndentChanged       = FALSE;
00251         m_bBevelLightAngleChanged   = FALSE;
00252         m_bBevelContrastChanged     = FALSE;
00253         m_bBevelDirectionChanged    = FALSE;
00254         m_bBevelLightTiltChanged    = FALSE;
00255         m_bCreateNewBevels          = FALSE;
00256         m_bJointTypeChanged         = FALSE;
00257     }
00258     
00259     INT32           m_BevelType;                // the kind of bevel
00260     BOOL        m_bBevelTypeChanged;        // has the bevel type changed ?
00261     INT32           m_Indent;                   // the bevel distance in/out (in millipoints)
00262     BOOL        m_bBevelIndentChanged;      // has the indent changed ?
00263     double      m_LightAngle;               // the angle (from -ve left, clockwise) of the light source
00264     BOOL        m_bBevelLightAngleChanged;  // has the light angle changed ?
00265     BOOL        m_bOuter;                   // whether its an inner or outer bevel
00266     BOOL        m_bBevelDirectionChanged;   // has the direction changed ?
00267     INT32       m_Contrast;                 // the contrast setting (0 - 100)
00268     BOOL        m_bBevelContrastChanged;    // has the contrast changed ?
00269     double      m_Tilt;
00270     BOOL        m_bBevelLightTiltChanged;
00271     JointType   m_JointType;
00272     BOOL        m_bJointTypeChanged;
00273 
00274     BOOL        m_bCreateNewBevels;         // whether to create new bevels or not
00275 };
00276 
00277 /********************************************************************************************
00278 >   class OpChangeLightAnglesParam : public OpParam
00279 
00280     Author:     David_McClarnon (Xara Group Ltd) <camelotdev@xara.com>
00281     Created:    21/11/96
00282     Purpose:    Param used by OpChangeAttribute
00283 ********************************************************************************************/
00284 class OpChangeLightAnglesParam : public OpParam
00285 {
00286 public:
00287     OpChangeLightAnglesParam()
00288     {
00289         pNodes = NULL;
00290         NewLightAngle = 0;
00291         OldLightAngle = 0;
00292     }
00293 
00294     List * pNodes;
00295     INT32 NewLightAngle;
00296     INT32 OldLightAngle;
00297 };
00298 
00299 /********************************************************************************************
00300 >   class OpChangeBevelLightAngle : public SelOperation
00301 
00302     Author:     David_McClarnon (Xara Group Ltd) <camelotdev@xara.com>
00303     Created:    21/11/96
00304     Purpose:    Changes the light angle in the given attribute list
00305                 Used by dragging to change the attributes
00306 ********************************************************************************************/
00307 class OpChangeBevelLightAngle : public SelOperation
00308 {
00309 
00310 CC_DECLARE_DYNCREATE(OpChangeBevelLightAngle)
00311 
00312 public:
00313     // Construction/Destruction
00314     OpChangeBevelLightAngle();
00315     ~OpChangeBevelLightAngle();
00316 
00317     virtual void DoWithParam(OpDescriptor* pOp, OpParam * pBevParam);
00318         
00319     // These functions required for the OpDescriptor class
00320     static BOOL Declare();
00321     static OpState GetState(String_256* Description, OpDescriptor*);
00322 
00323     void GetOpName(String_256 *);
00324 };
00325 
00326 /********************************************************************************************
00327 >   class RegenerateBevelAction : public Action
00328 
00329     Author:     David_McClarnon (Xara Group Ltd) <camelotdev@xara.com>
00330     Created:    17/3/99
00331     Purpose:    Forces a regeneration of the bevel in all nodes in the list
00332                 Used by NodeBevelcontroller::OnChildChange to force redraws in undos/redos
00333 ********************************************************************************************/
00334 class RegenerateBevelAction : public Action
00335 {
00336 
00337 CC_DECLARE_DYNCREATE(RegenerateBevelAction)
00338 
00339 public:
00340     RegenerateBevelAction();
00341     ~RegenerateBevelAction();
00342     virtual ActionCode Execute();
00343     static ActionCode Init( Operation* pOp,
00344                             ActionList* pActionList,
00345                             List * pNodes,
00346                             RegenerateBevelAction** NewAction,
00347                             BOOL bCache = FALSE);
00348 protected:
00349     List * m_pNodes;
00350     BOOL m_bCache;
00351 };
00352 
00353 /********************************************************************************************
00354 >   class RegenerateBevelBitmapAction : public Action
00355 
00356     Author:     David_McClarnon (Xara Group Ltd) <camelotdev@xara.com>
00357     Created:    17/3/99
00358     Purpose:    Forces a regeneration of the bevel bitmap in all nodes in the list
00359                 Mainly a performance enhancement so that instead of using RegenerateBevelAction,
00360                 which causes a bevel to regenerate its path as well as the bitmap,
00361                 you can instruct the bevel to just regenerate its bitmap
00362                 Used by NodeBevelcontroller::OnChildChange to force redraws in undos/redos
00363 ********************************************************************************************/
00364 class RegenerateBevelBitmapAction : public Action
00365 {
00366 
00367 CC_DECLARE_DYNCREATE(RegenerateBevelBitmapAction)
00368 
00369 public:
00370     RegenerateBevelBitmapAction();
00371     ~RegenerateBevelBitmapAction();
00372     virtual ActionCode Execute();
00373     static ActionCode Init( Operation* pOp,
00374                             ActionList* pActionList,
00375                             List * pNodes,
00376                             RegenerateBevelBitmapAction** NewAction);
00377 protected:
00378     List * m_pNodes;
00379 };
00380 
00381 
00382 /********************************************************************************************
00383 >   class ChangeLightAnglesAction : public Action
00384 
00385     Author:     David_McClarnon (Xara Group Ltd) <camelotdev@xara.com>
00386     Created:    17/3/99
00387     Purpose:    Changes the light angles on the given list of bevel controller nodes in
00388                 an undoable way
00389 ********************************************************************************************/
00390 class ChangeLightAnglesAction : public Action
00391 {
00392 
00393 CC_DECLARE_DYNCREATE(ChangeLightAnglesAction)
00394 
00395 public:
00396     ChangeLightAnglesAction();
00397     ~ChangeLightAnglesAction();
00398     virtual ActionCode Execute();
00399     static ActionCode Init( Operation* pOp,
00400                             ActionList* pActionList,
00401                             List * pNodes,
00402                             INT32 NewAngle,
00403                             INT32 OldAngle,
00404                             ChangeLightAnglesAction** NewAction);
00405 protected:
00406     List m_NodeList;
00407     INT32 m_NewAngle;
00408     INT32 m_OldAngle;
00409 };
00410 
00411 /********************************************************************************************
00412 >   class RemoveBevelAttributesAction : public Action
00413 
00414     Author:     David_McClarnon (Xara Group Ltd) <camelotdev@xara.com>
00415     Created:    20/3/2000
00416     Purpose:    Removes all bevel attributes from the tree
00417 ********************************************************************************************/
00418 class RemoveBevelAttributesAction : public Action
00419 {
00420 
00421 CC_DECLARE_DYNCREATE(RemoveBevelAttributesAction)
00422 
00423 public:
00424     RemoveBevelAttributesAction();
00425     ~RemoveBevelAttributesAction();
00426     virtual ActionCode Execute();
00427     static ActionCode Init( Operation* pOp,
00428                             ActionList* pActionList,
00429                             NodeRenderableInk * pNode,
00430                             BOOL m_bShouldDo, 
00431                             RemoveBevelAttributesAction** NewAction);
00432 protected:
00433     NodeRenderableInk * m_pNode;
00434     BOOL m_bShouldDo;
00435     List m_AttrList;
00436 };
00437 
00438 
00439 /********************************************************************************************
00440 >   class OpSelectBevel : public Operation
00441 
00442     Author:     David_McClarnon (Xara Group Ltd) <camelotdev@xara.com>
00443     Created:    21/11/96
00444     Purpose:    Selects bevel inking nodes in the selection
00445 ********************************************************************************************/
00446 class OpSelectBevel : public Operation
00447 {
00448 
00449 CC_DECLARE_DYNCREATE(OpSelectBevel)
00450 
00451 public:
00452     // Construction/Destruction
00453     OpSelectBevel();
00454     ~OpSelectBevel();
00455 
00456     virtual void Do(OpDescriptor* pOp);
00457         
00458     // These functions required for the OpDescriptor class
00459     static BOOL Declare();
00460     static OpState GetState(String_256* Description, OpDescriptor*);
00461 };
00462 
00463 
00464 #endif
00465 #endif

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