pathops.h

Go to the documentation of this file.
00001 // $Id: pathops.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 // More path releated operations - pathedit.cpp is getting big
00099 
00100 #ifndef INC_PATHOPS
00101 #define INC_PATHOPS
00102 
00103 #define OPTOKEN_MOVEPATHPOINT   _T("MovePathPoint")
00104 #define OPTOKEN_MAKELINESOP     _T("MakeLines")
00105 #define OPTOKEN_MAKECURVESOP    _T("MakeCurves")
00106 #define OPTOKEN_SELECTALLPATHPOINTS _T("SelectAllPathPoints")
00107 #define OPTOKEN_DESELECTALLPATHPOINTS _T("DeSelectAllPathPoints")
00108 
00109 //#include "opdesc.h" - in camtypes.h [AUTOMATICALLY REMOVED]
00110 #include "transop.h"
00111 //#include "selop.h" - in camtypes.h [AUTOMATICALLY REMOVED]
00112 //#include "msg.h" - in camtypes.h [AUTOMATICALLY REMOVED]
00113 
00114 
00115 /********************************************************************************************
00116 
00117 >   class OpBaseConvertPathSegment : public SelOperation
00118 
00119     Author:     Peter_Arnold (Xara Group Ltd) <camelotdev@xara.com>
00120     Created:    16/8/95
00121     Purpose:    This is the base class for the two operations that convert curve segments into
00122                 line segments and vice-versa.
00123     SeeAlso:    OpMakeSegmentsCurves, OpMakeSegmentsLines
00124 
00125 ********************************************************************************************/
00126 
00127 class OpBaseConvertPathSegment: public SelOperation
00128 {         
00129     CC_DECLARE_DYNCREATE( OpBaseConvertPathSegment )    
00130 
00131 public:
00132     OpBaseConvertPathSegment();
00133     void Do(OpDescriptor*);
00134     static OpState BaseGetState(INT32 PathType);
00135 
00136 protected:
00137     virtual INT32 GetProcessPathType() { ERROR3("Dont call the base class"); return 0;}
00138     virtual INT32 GetPathType() { ERROR3("Dont call the base class"); return 0;}
00139     virtual BOOL ProcessSegment(NodePath* pPath, INT32* Index, INT32 PrevIndex) { ERROR3("Dont call the base class"); return 0;}
00140 };  
00141 
00142 
00143 
00144 
00145 /********************************************************************************************
00146 
00147 >   class OpMakeSegmentsLines : public OpBaseConvertPathSegment
00148 
00149     Author:     Peter_Arnold (Xara Group Ltd) <camelotdev@xara.com>
00150     Created:    30/9/94
00151     Purpose:    This class will change all the selected segments in all selected paths from
00152                 curves into lines (ignoring segments that are already lines!).
00153     SeeAlso:    OpMakeSegmentsCurves
00154 
00155 ********************************************************************************************/
00156 
00157 class OpMakeSegmentsLines: public OpBaseConvertPathSegment
00158 {         
00159     CC_DECLARE_DYNCREATE( OpMakeSegmentsLines )    
00160 
00161 public:
00162     OpMakeSegmentsLines();                              
00163     static BOOL Init();
00164     static OpState GetState(String_256*, OpDescriptor*);        
00165 
00166 protected:
00167     virtual INT32 GetProcessPathType() {return PT_BEZIERTO;}
00168     virtual INT32 GetPathType() {return PT_LINETO;}
00169     BOOL ProcessSegment(NodePath* pPath, INT32* Index, INT32 PrevIndex);
00170 };
00171 
00172 
00173 
00174  /********************************************************************************************
00175 
00176 >   class OpMakeSegmentsCurves : public OpBaseConvertPathSegment
00177 
00178     Author:     Peter_Arnold (Xara Group Ltd) <camelotdev@xara.com>
00179     Created:    30/9/94
00180     Purpose:    This class will change all the selected segments in all selected paths from
00181                 lines into curves (ignoring segments that are already curves!).
00182     SeeAlso:    OpMakeSegmentsLines
00183 
00184 ********************************************************************************************/
00185 
00186 class OpMakeSegmentsCurves: public OpBaseConvertPathSegment
00187 {         
00188     CC_DECLARE_DYNCREATE( OpMakeSegmentsCurves )    
00189 
00190 public:
00191     OpMakeSegmentsCurves();                             
00192     static BOOL Init();             
00193     static OpState GetState(String_256*, OpDescriptor*);        
00194     static BOOL CarryOut(INT32, INT32, NodePath*, UndoableOperation*, ActionList* pActions);
00195 
00196 protected:
00197     virtual INT32 GetProcessPathType() {return PT_LINETO;}
00198     virtual INT32 GetPathType() {return PT_BEZIERTO;}
00199     virtual BOOL ProcessSegment(NodePath* pPath, INT32* Index, INT32 PrevIndex);
00200 };  
00201 
00202 
00203 
00204 /***********************************************************************************************
00205 
00206 >   class MovePointsParams : public OpParam
00207 
00208     Author:     Peter_Arnold (Xara Group Ltd) <camelotdev@xara.com>
00209     Created:    1/11/94
00210     Purpose:    The OpParam to use when calling OpMovePathPoints.  Used to pass in the path to
00211                 alter and which coords to change.
00212     SeeAlso:    OpMovePathPoint::DoWithParam
00213 
00214 ***********************************************************************************************/
00215 
00216 struct ElementCoord
00217 {
00218     INT32       Element;
00219     DocCoord    Coordinate;
00220 };
00221 
00222 class MovePointsParams : public OpParam
00223 {
00224     CC_DECLARE_MEMDUMP(MovePointsParams)    
00225 
00226 public:
00227     MovePointsParams(NodePath* pPath, ElementCoord* ChangeData, INT32 NumChanges);
00228 
00229     NodePath        *PathToEdit;
00230     ElementCoord    *PathChanges;
00231     INT32               ChangesCount;
00232 };
00233 
00234 
00235 /********************************************************************************************
00236 
00237 >   class OpMovePathPoint : public TransOperation
00238 
00239     Author:     Peter_Arnold (Xara Group Ltd) <camelotdev@xara.com>
00240     Created:    17/10/94
00241     Purpose:    This operation allows the exact positioning of elements in a path.
00242 
00243 ********************************************************************************************/
00244 
00245 class OpMovePathPoint: public TransOperation
00246 {         
00247     CC_DECLARE_DYNCREATE( OpMovePathPoint )    
00248 
00249 public:
00250     OpMovePathPoint();                              
00251     static BOOL     Init();             
00252     static OpState  GetState(String_256*, OpDescriptor*);       
00253     void            DoWithParam(OpDescriptor*, OpParam*);
00254 
00255 private:
00256     BOOL ClearSmoothAndRotate(NodePath* pPath, INT32 PathIndex);
00257 };  
00258 
00259 
00260 
00261 /*********************************************************************************************
00262 >   class NewPathCreatedMsg : public Msg
00263 
00264     Author:     Peter_Arnold (Xara Group Ltd) <camelotdev@xara.com>
00265     Created:    06/12/94
00266     Purpose:    This message is sent whenever a new path is created.  The only client of this
00267                 message (at the moment) is the Line tool, which needs to clear it's floating
00268                 endpoint when a new path is created.
00269     SeeAlso:    OpNewPath, BezierTool
00270 
00271 *********************************************************************************************/
00272 
00273 class NewPathCreatedMsg : public Msg
00274 {
00275     CC_DECLARE_DYNAMIC(NewPathCreatedMsg)
00276 
00277 public:
00278     NodePath*   NewPath;                // Points to the new path   
00279     Operation*  CurrentOp;              // Points to the active operation
00280     ActionList* UndoActs;               // Points to the operations undo list
00281 
00282     NewPathCreatedMsg(NodePath* pPath, Operation* CurOp, ActionList* Undos);
00283 };
00284 
00285 
00286 
00287 /*********************************************************************************************
00288 >   class PathEditedMsg : public Msg
00289 
00290     Author:     Peter_Arnold (Xara Group Ltd) <camelotdev@xara.com>
00291     Created:    07/12/94
00292     Purpose:    This message is sent whenever a single control point or an endpoint on a path
00293                 is edited.  A client of this message is the Line tool, which uses the data in
00294                 this message to update the edit fields in its infobar.
00295     SeeAlso:    OpEditControlPoint, OpEditEndPoint, BezierTool
00296 
00297 *********************************************************************************************/
00298 
00299 class PathEditedMsg : public Msg
00300 {
00301     CC_DECLARE_DYNAMIC(PathEditedMsg)
00302 
00303 public:
00304     Path*       EditPath;               // Points to the edited path    
00305     Spread*     EditSpread;             // The spread containing the path
00306     INT32       EndPoint;               // The edited endpoint OR the endpoint next to the
00307                                         // edited control point
00308 
00309     PathEditedMsg(Path* pPath, Spread* pSpread, INT32 Index);
00310 };
00311 
00312 
00313 
00314 /********************************************************************************************
00315 >   class OpMenuSelectPathPoints : public Operation
00316 
00317     Author:     Peter_Arnold (Xara Group Ltd) <camelotdev@xara.com>
00318     Created:    30/04/95
00319     Purpose:    This operation is the base of select/deselect all endpoints in a path
00320 ********************************************************************************************/
00321 
00322 class OpMenuSelectPathPoints: public Operation
00323 {         
00324     CC_DECLARE_DYNCREATE( OpMenuSelectPathPoints )    
00325 
00326 public:
00327     OpMenuSelectPathPoints() {};                                
00328     static BOOL     Init();             
00329     static OpState  GetState(String_256*, OpDescriptor*);   
00330 
00331 protected:
00332     BOOL DoAction(BOOL SelectPoints);   
00333 };  
00334 
00335 
00336 
00337 /********************************************************************************************
00338 >   class OpSelectAllPathPoints : public OpMenuSelectPathPoints
00339 
00340     Author:     Peter_Arnold (Xara Group Ltd) <camelotdev@xara.com>
00341     Created:    30/04/95
00342     Purpose:    This operation is used to select all endpoints in a path
00343 ********************************************************************************************/
00344 
00345 class OpSelectAllPathPoints: public OpMenuSelectPathPoints
00346 {         
00347     CC_DECLARE_DYNCREATE( OpSelectAllPathPoints )    
00348 
00349 public:
00350     OpSelectAllPathPoints() {};                             
00351     void Do(OpDescriptor*);
00352 };  
00353 
00354 
00355 
00356 /********************************************************************************************
00357 >   class OpDeSelectAllPathPoints : public OpMenuSelectPathPoints
00358 
00359     Author:     Peter_Arnold (Xara Group Ltd) <camelotdev@xara.com>
00360     Created:    30/04/95
00361     Purpose:    This operation is used to deselect all endpoints in a path
00362 ********************************************************************************************/
00363 
00364 class OpDeSelectAllPathPoints: public OpMenuSelectPathPoints
00365 {         
00366     CC_DECLARE_DYNCREATE( OpDeSelectAllPathPoints )    
00367 
00368 public:
00369     OpDeSelectAllPathPoints() {};                               
00370     void Do(OpDescriptor*);
00371 };
00372 
00373 
00374 
00375 /********************************************************************************************
00376 
00377 >   class OpChangeFillProfile : public SelOperation
00378 
00379     Author:     Chris_Snook (Xara Group Ltd) <camelotdev@xara.com>
00380     Created:    7/2/2000
00381     Purpose:    The operation class that is responsible for changing fill profiles.
00382     SeeAlso:    -
00383 
00384 ********************************************************************************************/
00385 
00386 #define OPTOKEN_REVERSEPATH _T("ReversePath")               // our all important optoken!
00387 
00388 class OpReversePath : public SelOperation
00389 {
00390     CC_DECLARE_DYNCREATE (OpReversePath)
00391 
00392 public:
00393     OpReversePath ();
00394     ~OpReversePath ();
00395     
00396     static BOOL Init();
00397     static OpState GetState (String_256* Description, OpDescriptor*);
00398 
00399     void Do (OpDescriptor*);
00400 };
00401 
00402 
00403 
00404 #endif  // INC_PATHOPS

Generated on Sat Nov 10 03:46:26 2007 for Camelot by  doxygen 1.4.4