moldedit.h

Go to the documentation of this file.
00001 // $Id: moldedit.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 // Header for the mould tools operations. These operations act as a common
00099 // library for controlling various mould types. 
00100 
00101 #ifndef INC_MOULDEDIT
00102 #define INC_MOULDEDIT
00103 
00104 #include "nodemold.h"
00105 //#include "selop.h" - in camtypes.h [AUTOMATICALLY REMOVED]
00106 //#include "ops.h" - in camtypes.h [AUTOMATICALLY REMOVED]
00107 
00108 class MouldPerspective;
00109 class NodeMouldPath;
00110 
00111 #define OPTOKEN_DRAGVANISHPOINT _T("DragVanishPoint")
00112 
00113 /*******************************************************************************************
00114 
00115 >   class OpMouldLibSel: public SelOperation
00116 
00117     Author:     Mike_Kenny (Xara Group Ltd) <camelotdev@xara.com>
00118     Created:    18/01/95
00119     Purpose:    Provides a library of undoable functions for moulding objects.
00120 
00121 ********************************************************************************************/
00122 
00123 class OpMouldLibSel: public SelOperation
00124 {
00125     CC_DECLARE_DYNCREATE( OpMouldLibSel ) 
00126 
00127     public:
00128         OpMouldLibSel();
00129 
00130     protected:
00131         static BOOL IsAMouldSelected(NodeMould** pNodeMould);
00132 
00133         BOOL        CreateNewMould(Path* pShape,
00134                                    MouldSpace m_space,
00135                                    BOOL FitSelection,
00136                                    BOOL LockAspect);
00137 
00138         BOOL        AllMouldObjects(List* pNodeList);
00139 
00140         NodeMould*  DoCreateMould(Path* pShape, 
00141                                   MouldSpace mSpace,
00142                                   List* NodeList,
00143                                   DocRect* pBounds,
00144                                   BOOL ScaleToFit,
00145                                   BOOL LockAspect);
00146 
00147         BOOL        DoRemoveAllMoulds(List* pNodeList);
00148         
00149         BOOL        DoRemoveMould(NodeMould* pMould, BOOL PutOnClip);
00150         
00151         BOOL        DoReplaceAllMoulds( List* pNodeList,
00152                                         Path* pShape,
00153                                         MouldSpace mSpace,
00154                                         BOOL ScaleToFit,
00155                                         BOOL LockAspect);
00156         
00157         BOOL        DoReplaceMould( NodeMould* pMould,
00158                                     Path* pShape,
00159                                     MouldSpace mSpace,
00160                                     BOOL ScaleToFit,
00161                                     BOOL LockAspect);
00162         
00163         BOOL        DoRecordGeometry(NodeMould* pMould);
00164         
00165         BOOL        DoCreateOrReplaceMould( SelRange* pSelected,
00166                                             Path* pShape,
00167                                             MouldSpace m_space,
00168                                             BOOL ScaleToFit,
00169                                             BOOL LockAspect);
00170 
00171     private:
00172         DocRect*    FindScaleRect(DocRect* pSRect, 
00173                                   DocRect* pDRect,
00174                                   BOOL ScaleToFit,
00175                                   BOOL LockAspect);
00176         
00177         BOOL        LocaliseMouldAttributes(NodeMould* pMould);
00178         BOOL        LocaliseObjectAttrs(NodeRenderableInk* pParent, NodeRenderableInk* pInkNode);
00179         BOOL        HideAllMouldAttrs(NodeMould* pMould);
00180 
00181 };
00182 
00183 
00184 
00185 /*******************************************************************************************
00186 
00187 >   class OpMouldLib: public UndoableOperation
00188 
00189     Author:     Mike_Kenny (Xara Group Ltd) <camelotdev@xara.com>
00190     Created:    18/01/95
00191     Purpose:    Provides a library of undoable functions for moulding objects.
00192 
00193 ********************************************************************************************/
00194 
00195 class OpMouldLib: public UndoableOperation
00196 {
00197     CC_DECLARE_DYNCREATE( OpMouldLib ) 
00198 
00199     public:
00200         OpMouldLib();
00201 
00202     protected:
00203         BOOL        DoRotateMould(NodeMould* pMould);
00204 };
00205 
00206 
00207 
00208 /********************************************************************************************
00209 
00210 >   class RecordGeometryAction: public Action
00211 
00212     Author:     Mike_Kenny (Xara Group Ltd) <camelotdev@xara.com>
00213     Created:    16/03/95
00214     Purpose:    This action records the current mould geometry being used by a particular
00215                 mould node. Once recorded this allows the geometry to be changed. During
00216                 undo the old geometry will be replaced but not initialised.
00217     SeeAlso:    NodeMould::SaveContext()
00218 
00219 ********************************************************************************************/
00220 
00221 class RecordGeometryAction: public Action
00222 {                                
00223     CC_DECLARE_DYNCREATE( RecordGeometryAction )
00224 
00225     public:
00226          RecordGeometryAction(); 
00227         ~RecordGeometryAction();
00228         virtual ActionCode Execute();   
00229      
00230         static ActionCode Init(Operation* const pOp, 
00231                                ActionList* pActionList,
00232                                NodeMould* const pMould,
00233                                Action** NewAction);
00234 
00235         static ActionCode DoRecord( Operation* const pOp, 
00236                                     NodeMould* const pMould);
00237  
00238     private:
00239         NodeMould*      pSavedMould;
00240         MouldGeometry*  pSavedGeometry;
00241 };
00242 
00243 
00244 
00245 /********************************************************************************************
00246 
00247 >   class SaveDetachAction: public Action
00248 
00249     Author:     Mike_Kenny (Xara Group Ltd) <camelotdev@xara.com>
00250     Created:    26/01/95
00251     Purpose:    This action saves and restores the detach flags inside a mould object
00252     SeeAlso:    -
00253 
00254 ********************************************************************************************/
00255 
00256 class SaveDetachAction: public Action
00257 {                                
00258     CC_DECLARE_DYNCREATE( SaveDetachAction )
00259 
00260     public:
00261         SaveDetachAction(); 
00262         virtual ActionCode Execute();   
00263         static ActionCode Save(Operation* const pOp, NodeMould* const pMould); 
00264         static ActionCode Init(Operation* const pOp, 
00265                                ActionList* pActionList,
00266                                NodeMould* const pMould,
00267                                Action** NewAction);
00268  
00269     private:
00270         NodeMould*  pCurrMould;
00271         BOOL        CurrDetached;
00272 };
00273 
00274 
00275 /********************************************************************************************
00276 
00277 >   class InvalidateRectAction: public Action
00278 
00279     Author:     Mike_Kenny (Xara Group Ltd) <camelotdev@xara.com>
00280     Created:    26/01/95
00281     Purpose:    When executed this action will Force a redraw of a bounding rectangle
00282                 over a certain spread
00283     SeeAlso:    -
00284 
00285 ********************************************************************************************/
00286 
00287 class InvalidateRectAction: public Action
00288 {                                
00289     CC_DECLARE_DYNCREATE( InvalidateRectAction )
00290 
00291     public:
00292         InvalidateRectAction(); 
00293         virtual ActionCode Execute();   
00294      
00295         static ActionCode DoRecord( Operation* const pOp, 
00296                                     const DocRect& Rect,
00297                                     Spread* pSpread);
00298 
00299         static ActionCode Init(Operation* const pOp, 
00300                                ActionList* pActionList,
00301                                const DocRect& Rect,
00302                                Spread* pSpread,
00303                                Action** NewAction);
00304 
00305  
00306     private:
00307         DocRect InvalidRect;
00308         Spread* InvalidSpread;
00309 
00310 };
00311 
00312 
00313 
00314 /********************************************************************************************
00315 
00316 >   class RedrawBoundsAction : public Action
00317 
00318     Author:     Mike_Kenny (Xara Group Ltd) <camelotdev@xara.com>
00319     Created:    18/12/95
00320     Purpose:    An action to record the bounds of the mould. This op differs from
00321                 RecordBoundsAction in that it does not use GetUnionBlobBounds() which is
00322                 really bad for perspectives as this includes the vanishing points which
00323                 results in a vast area of the document being redrawn. So we have to do
00324                 everything separately
00325     SeeAlso:
00326         
00327 ********************************************************************************************/
00328 
00329 class RedrawBoundsAction : public Action
00330 {
00331     CC_DECLARE_DYNCREATE(RedrawBoundsAction)
00332 
00333     public:
00334         RedrawBoundsAction();
00335         virtual ActionCode Execute();
00336         
00337         static ActionCode DoRecord( Operation* pOp,
00338                                     NodeMould* WhichNode,
00339                                     BOOL Redraw);
00340         
00341         static ActionCode Init( Operation* pOp,
00342                                 ActionList* pActionList,
00343                                 NodeMould* WhichNode,
00344                                 Action** NewAction);
00345 
00346         static void RedrawNode(Operation* pOp, NodeMould* pNode);
00347     
00348     protected:
00349         NodeMould* ChangedNode;
00350 };
00351 
00352 
00353 /***********************************************************************************************
00354 
00355 >   class OpDragOrigin : public UndoableOperation
00356 
00357     Author:     Mike_Kenny (Xara Group Ltd) <camelotdev@xara.com>
00358     Created:    25/01/95
00359     Purpose:    defines an operation for dragging perspective mould vanishing points around
00360 
00361 ***********************************************************************************************/
00362 
00363 class OpDragOrigin : public UndoableOperation
00364 {
00365     CC_DECLARE_DYNCREATE(OpDragOrigin);
00366 
00367     public:
00368         OpDragOrigin();
00369 
00370         static BOOL Init();
00371         static OpState GetState(String_256* Description, OpDescriptor*);
00372 
00373                 void DoDragVanishPoint(Spread*, const DocCoord&, ClickModifiers, NodeMould*, BOOL);
00374         virtual void DragPointerMove(DocCoord Pos, ClickModifiers Mods, Spread* pSpread, BOOL bSolidDrag);
00375         virtual void DragFinished(DocCoord Pos, ClickModifiers Mods, Spread* pSpread, BOOL Success, BOOL bSolidDrag);
00376         virtual void RenderDragBlobs(DocRect, Spread*, BOOL bSolidDrag);
00377         virtual void GetOpName(String_256* OpName);
00378 
00379     private:
00380         DocRect CalcBlobClipRect();
00381 
00382     private:
00383         Spread*             StartSpread;
00384         NodeMould*          pEditMould;
00385         NodeMouldPath*      pEditMouldPath;
00386         Path*               pEditPath;
00387         MouldPerspective*   pEditGeometry;
00388         DocRect             EditRect;
00389         DocCoord            Blob;
00390 };
00391 
00392 
00393 
00394 /********************************************************************************************
00395 
00396 >   class BuildMouldAction: public Action
00397 
00398     Author:     Mike_Kenny (Xara Group Ltd) <camelotdev@xara.com>
00399     Created:    26/01/95
00400     Purpose:    When executed this action will get the mould to rebuild itself.
00401     SeeAlso:    -
00402 
00403 ********************************************************************************************/
00404 
00405 class BuildMouldAction: public Action
00406 {                                
00407     CC_DECLARE_DYNCREATE( BuildMouldAction )
00408 
00409     public:
00410         BuildMouldAction(); 
00411         virtual ActionCode Execute();   
00412      
00413         static ActionCode DoRecord( Operation* const pOp, NodeMould* pMould);
00414 
00415         static ActionCode Init(Operation* const pOp, 
00416                                ActionList* pActionList,
00417                                NodeMould* pMould,
00418                                Action** NewAction);
00419 
00420     private:
00421         NodeMould* pBuildMould;
00422 };
00423 
00424 
00425 
00426 /********************************************************************************************
00427 
00428 >   class StartRebuildMouldAction: public Action
00429 
00430     Author:     Mike_Kenny (Xara Group Ltd) <camelotdev@xara.com>
00431     Created:    26/01/95
00432     Purpose:    When executed this action will get the mould to rebuild itself.
00433     SeeAlso:    -
00434 
00435 ********************************************************************************************/
00436 
00437 class StartRebuildMouldAction: public Action
00438 {                                
00439     CC_DECLARE_DYNCREATE( StartRebuildMouldAction )
00440 
00441     public:
00442         StartRebuildMouldAction(); 
00443         virtual ActionCode Execute();   
00444      
00445         static ActionCode DoRecord( Operation* const pOp, NodeMould* pMould);
00446 
00447         static ActionCode Init(Operation* const pOp, 
00448                                ActionList* pActionList,
00449                                NodeMould* pMould,
00450                                Action** NewAction);
00451 
00452     private:
00453         NodeMould* pRebuildMould;
00454 };
00455 
00456 
00457 /********************************************************************************************
00458 
00459 >   class EndRebuildMouldAction: public Action
00460 
00461     Author:     Mike_Kenny (Xara Group Ltd) <camelotdev@xara.com>
00462     Created:    26/01/95
00463     Purpose:    When executed this action will get the mould to rebuild itself.
00464     SeeAlso:    -
00465 
00466 ********************************************************************************************/
00467 
00468 class EndRebuildMouldAction: public Action
00469 {                                
00470     CC_DECLARE_DYNCREATE( EndRebuildMouldAction )
00471 
00472     public:
00473         EndRebuildMouldAction(); 
00474         virtual ActionCode Execute();   
00475      
00476         static ActionCode DoRecord( Operation* const pOp, NodeMould* pMould);
00477 
00478         static ActionCode Init(Operation* const pOp, 
00479                                ActionList* pActionList,
00480                                NodeMould* pMould,
00481                                Action** NewAction);
00482 
00483     private:
00484         NodeMould* pRebuildMould;
00485 };
00486 #endif  
00487 

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