00001 // $Id: opbezier.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 // Operations supplied by the Line tool 00099 00100 #ifndef INC_OPBEZIER 00101 #define INC_OPBEZIER 00102 00103 //#include "doccoord.h" - in camtypes.h [AUTOMATICALLY REMOVED] 00104 //#include "undoop.h" - in camtypes.h [AUTOMATICALLY REMOVED] 00105 00106 class BezierTool; 00107 class Cursor; 00108 00109 #define OPTOKEN_INSERTFLOATER _T("OpInsertFloater") 00110 #define OPTOKEN_REMOVEFLOATER _T("OpRemoveFloater") 00111 00112 /******************************************************************************************** 00113 00114 > class OpSelectPathPoints : public UndoableOperation 00115 00116 Author: Jim_Lynn (Xara Group Ltd) <camelotdev@xara.com> 00117 Created: 29/6/94 00118 Purpose: This is the operation that marquee selects points in paths 00119 00120 ********************************************************************************************/ 00121 00122 class OpSelectPathPoints : public UndoableOperation 00123 { 00124 00125 CC_DECLARE_DYNCREATE(OpSelectPathPoints); 00126 00127 public: 00128 // Construction/Destruction 00129 OpSelectPathPoints(); 00130 00131 // The all important Do functions 00132 void DoDrag( DocCoord Anchor, Spread*, BOOL isAdjust, BezierTool* toolptr, ClickModifiers ); 00133 00134 // Virtual functions needed for the dragging operations to work 00135 virtual void DragPointerMove( DocCoord PointerPos, ClickModifiers ClickMods, Spread*, BOOL bSolidDrag); 00136 virtual void DragFinished( DocCoord PointerPos, 00137 ClickModifiers ClickMods, 00138 Spread*, 00139 BOOL Success, BOOL bSolidDrag); 00140 00141 // Some Render functions to will draw the EORed path 00142 void RenderDragBlobs( DocRect, Spread*, BOOL bSolidDrag); 00143 00144 // These functions required for the OpDescriptor class 00145 static BOOL Declare(); 00146 static OpState GetState(String_256* Description, OpDescriptor*); 00147 static BOOL Init(); 00148 00149 static BOOL DragInProgress(); 00150 00151 private: 00152 DocCoord StartPoint; // The start of the rectangle 00153 Spread * StartSpread; 00154 DocCoord PreviousPoint; // So that we don't update too often. 00155 BOOL AdjustDrag; // Is the drag adjust or not? 00156 BezierTool* BezToolPtr; // Points back to the bezier tool 00157 ClickModifiers Mods; // which modifiers were in evidence from the original click 00158 static BOOL DragUnderway; // This op is not re-entrant. 00159 00160 Cursor* pcMarqueeCursor; // Normal freehand cursor 00161 void ChangeCursor(Cursor* cursor); // function to change cursor 00162 void PushCursor(Cursor* cursor); // Push this cursor onto the cursor stack 00163 void PopCursor(); // Pop our cursor off the stack 00164 void RemoveDragBlobs(BOOL, BOOL); // Restores the selection blobs to pre-drag state 00165 void RenderRubberRect(DocRect* Rect); 00166 void RenderRubberSelection(RenderRegion* pRegion); 00167 }; 00168 00169 00170 00171 /******************************************************************************************** 00172 00173 > class OpRemoveFloater : public UndoableOperation 00174 00175 Author: Peter_Arnold (Xara Group Ltd) <camelotdev@xara.com> 00176 Created: 06/12/94 00177 Purpose: This is the operation that the line tool uses to remove the floating endpoint 00178 in an undoable kind of way. 00179 00180 ********************************************************************************************/ 00181 00182 class OpRemoveFloater : public UndoableOperation 00183 { 00184 00185 CC_DECLARE_DYNCREATE(OpRemoveFloater); 00186 00187 public: 00188 OpRemoveFloater(); 00189 static BOOL Declare(); 00190 static OpState GetState(String_256* Description, OpDescriptor*); 00191 void DoWithParam(OpDescriptor*, OpParam* pOpParam); 00192 }; 00193 00194 00195 00196 /******************************************************************************************** 00197 00198 > class OpInsertFloater : public UndoableOperation 00199 00200 Author: Peter_Arnold (Xara Group Ltd) <camelotdev@xara.com> 00201 Created: 06/12/94 00202 Purpose: This is the operation that the line tool uses to insert the floating endpoint 00203 in an undoable kind of way. 00204 00205 ********************************************************************************************/ 00206 00207 class OpInsertFloater : public UndoableOperation 00208 { 00209 00210 CC_DECLARE_DYNCREATE(OpInsertFloater); 00211 00212 public: 00213 OpInsertFloater(); 00214 static BOOL Declare(); 00215 static OpState GetState(String_256* Description, OpDescriptor*); 00216 void DoWithParam(OpDescriptor*, OpParam* pOpParam); 00217 }; 00218 00219 00220 00221 /******************************************************************************************** 00222 00223 > class InsertFloaterParam : public OpParam 00224 00225 Author: Peter_Arnold (Xara Group Ltd) <camelotdev@xara.com> 00226 Created: 06/12/94 00227 Purpose: This is the OpParam object passed to OpInsertFloater to position the floating 00228 endpoint 00229 00230 ********************************************************************************************/ 00231 class InsertFloaterParam : public OpParam 00232 { 00233 CC_DECLARE_MEMDUMP(InsertFloaterParam); 00234 00235 public: 00236 InsertFloaterParam(DocCoord* pInsertPos, Spread* pInsertSpread, BezierTool* pLineTool, Document* pWorkDoc); 00237 00238 DocCoord InsertPos; 00239 Spread* InsertSpread; 00240 BezierTool* pTool; 00241 Document* pOpWorkingDocument; 00242 }; 00243 00244 00245 00246 /******************************************************************************************** 00247 00248 > class InsertFloaterAction : public Action 00249 00250 Author: Peter_Arnold (Xara Group Ltd) <camelotdev@xara.com> 00251 Created: 05/12/94 00252 Purpose: An action to provide the Line tool with an undoable way of inserting the 00253 floating endpoint. This isn't stored in the document, which makes life 00254 tricky. 00255 SeeAlso: 00256 00257 ********************************************************************************************/ 00258 00259 class InsertFloaterAction : public Action 00260 { 00261 00262 CC_DECLARE_DYNCREATE(InsertFloaterAction) 00263 00264 public: 00265 InsertFloaterAction(); 00266 ~InsertFloaterAction(); 00267 virtual ActionCode Execute(); 00268 static ActionCode Init( Operation* pOp, 00269 ActionList* pActionList, 00270 Action** NewAction); 00271 static ActionCode DoInsert( Operation* pOp, 00272 ActionList* pActionList, 00273 BezierTool* pTool, 00274 DocCoord* pPoint, 00275 Spread* pSpread); 00276 // Data members 00277 BezierTool* pLineTool; 00278 DocCoord Point; 00279 Spread* pSpread; 00280 }; 00281 00282 00283 /******************************************************************************************** 00284 00285 > class RemoveFloaterAction : public Action 00286 00287 Author: Peter_Arnold (Xara Group Ltd) <camelotdev@xara.com> 00288 Created: 05/12/94 00289 Purpose: An action to provide the Line tool with an undoable way of removing the 00290 floating endpoint. This isn't stored in the document, which makes life 00291 tricky. 00292 SeeAlso: 00293 00294 ********************************************************************************************/ 00295 00296 class RemoveFloaterAction : public Action 00297 { 00298 00299 CC_DECLARE_DYNCREATE(RemoveFloaterAction) 00300 00301 public: 00302 RemoveFloaterAction(); 00303 ~RemoveFloaterAction(); 00304 virtual ActionCode Execute(); 00305 static ActionCode Init( Operation* pOp, 00306 ActionList* pActionList, 00307 BezierTool* pTool, 00308 Action** NewAction); 00309 static ActionCode DoRemove( Operation* pOp, 00310 ActionList* pActionList, 00311 BezierTool* pTool); 00312 protected: 00313 BezierTool* pLineTool; 00314 }; 00315 00316 00317 #endif // INC_OPBEZIER 00318 00319 00320 00321