00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #ifndef __WXCANCOM_H__
00020 #define __WXCANCOM_H__
00021
00022 #ifndef WX_PRECOMP
00023 #include "wx/wx.h"
00024 #endif
00025
00026 #include "wx/cmdproc.h"
00027
00028 #include "wx/canvas/canglob.h"
00029 #include "wx/canvas/candoc.h"
00030 #include "wx/canvas/tools.h"
00031 #include "wx/docview/doccom.h"
00032 #include "wx/canvas/booloper.h"
00033 #include "wx/canvas/canvas.h"
00034 #include "wx/canvas/canimage.h"
00035 #include <wx/tokenzr.h>
00036 #include <wx/uri.h>
00037 #include <wx/numdlg.h>
00038
00039 #if wxART2D_USE_GDSIO
00040 #include "wx/gdsio/gdsio.h"
00041 #endif //wxART2D_USE_GDSIO
00042
00043 #if wxART2D_USE_KEYIO
00044 #include "wx/keyio/keyio.h"
00045 #endif //wxART2D_USE_KEYIO
00046
00047 #define CMDP (((a2dCanvasDocument*)GetCurrentDocument())->GetCanvasCommandProcessor())
00048
00049 extern const a2dMenuIdItem CmdMenu_ChangeCanvasObjectStyle;
00050 extern const a2dMenuIdItem CmdMenu_ChangeCentralStyle;
00051 extern const a2dMenuIdItem CmdMenu_SetLayer;
00052 extern const a2dMenuIdItem CmdMenu_SetTarget;
00053 extern const a2dMenuIdItem CmdMenu_SetDrawWireFrame;
00054 extern const a2dMenuIdItem CmdMenu_DrawGridLines;
00055 extern const a2dMenuIdItem CmdMenu_DrawGridAtFront;
00056 extern const a2dMenuIdItem CmdMenu_SetYAxis;
00057 extern const a2dMenuIdItem CmdMenu_Option_SplinePoly;
00058 extern const a2dMenuIdItem CmdMenu_Option_CursorCrosshair;
00059 extern const a2dMenuIdItem CmdMenu_Option_RescaleAtReSize;
00060 extern const a2dMenuIdItem CmdMenu_Option_ReverseLayers;
00061
00062 extern const a2dMenuIdItem CmdMenu_Refresh;
00063 extern const a2dMenuIdItem CmdMenu_ZoomOut;
00064 extern const a2dMenuIdItem CmdMenu_ZoomOut2;
00065 extern const a2dMenuIdItem CmdMenu_ZoomIn2;
00066 extern const a2dMenuIdItem CmdMenu_EmptyShownObject;
00067 extern const a2dMenuIdItem CmdMenu_DrawGrid;
00068 extern const a2dMenuIdItem CmdMenu_SetSnap;
00069 extern const a2dMenuIdItem CmdMenu_SetSnapFeatures;
00070 extern const a2dMenuIdItem CmdMenu_SetSnapFeature;
00071 extern const a2dMenuIdItem CmdMenu_SetStroke;
00072 extern const a2dMenuIdItem CmdMenu_SetFill;
00073 extern const a2dMenuIdItem CmdMenu_SetStrokeColour;
00074 extern const a2dMenuIdItem CmdMenu_SetFillColour;
00075 extern const a2dMenuIdItem CmdMenu_SetContourWidth;
00076 extern const a2dMenuIdItem CmdMenu_SetPathType;
00077 extern const a2dMenuIdItem CmdMenu_SetNormalizeFactor;
00078
00079 extern const a2dMenuIdItem CmdMenu_GdsIoSaveTextAsPolygon;
00080 extern const a2dMenuIdItem CmdMenu_KeyIoSaveTextAsPolygon;
00081 extern const a2dMenuIdItem CmdMenu_SetGdsIoSaveFromView;
00082 extern const a2dMenuIdItem CmdMenu_SetKeyIoSaveFromView;
00083
00084 extern const a2dMenuIdItem CmdMenu_PushInto;
00085 extern const a2dMenuIdItem CmdMenu_NewGroup;
00086 extern const a2dMenuIdItem CmdMenu_NewPin;
00087 extern const a2dMenuIdItem CmdMenu_SaveLayers;
00088 extern const a2dMenuIdItem CmdMenu_SaveLayersHome;
00089 extern const a2dMenuIdItem CmdMenu_SaveLayersLastDir;
00090 extern const a2dMenuIdItem CmdMenu_SaveLayersCurrentDir;
00091 extern const a2dMenuIdItem CmdMenu_LoadLayers;
00092 extern const a2dMenuIdItem CmdMenu_LoadLayersHome;
00093 extern const a2dMenuIdItem CmdMenu_LoadLayersLastDir;
00094 extern const a2dMenuIdItem CmdMenu_LoadLayersCurrentDir;
00095
00096 extern const a2dMenuIdItem CmdMenu_SetCursor;
00097 extern const a2dMenuIdItem CmdMenu_SetRelativeStart;
00098 extern const a2dMenuIdItem CmdMenu_AddMeasurement;
00099 extern const a2dMenuIdItem CmdMenu_ClearMeasurements;
00100
00101 extern const a2dMenuIdItem CmdMenu_GdsIoSaveFromView;
00102 extern const a2dMenuIdItem CmdMenu_KeyIoSaveFromView;
00103 extern const a2dMenuIdItem CmdMenu_SetLayersProperty;
00104
00105 extern const a2dMenuIdItem CmdMenu_Selected_SelectAll;
00106 extern const a2dMenuIdItem CmdMenu_Selected_DeSelectAll;
00107 extern const a2dMenuIdItem CmdMenu_Selected_Delete;
00108 extern const a2dMenuIdItem CmdMenu_Selected_Group;
00109 extern const a2dMenuIdItem CmdMenu_Selected_ImageToRectangles;
00110 extern const a2dMenuIdItem CmdMenu_Selected_ToTop;
00111 extern const a2dMenuIdItem CmdMenu_Selected_ToBack;
00112 extern const a2dMenuIdItem CmdMenu_Selected_SetStyle;
00113 extern const a2dMenuIdItem CmdMenu_Selected_ConvertToPolygonPolylinesWithArcs;
00114 extern const a2dMenuIdItem CmdMenu_Selected_ConvertToPolygonPolylinesWithoutArcs;
00115 extern const a2dMenuIdItem CmdMenu_Selected_ConvertToPolylines;
00116 extern const a2dMenuIdItem CmdMenu_Selected_ConvertLinesArcs;
00117 extern const a2dMenuIdItem CmdMenu_Selected_ConvertToVPaths;
00118 extern const a2dMenuIdItem CmdMenu_Selected_ConvertPolygonToArcs;
00119 extern const a2dMenuIdItem CmdMenu_Selected_ConvertPolylineToArcs;
00120 extern const a2dMenuIdItem CmdMenu_Selected_ConvertPolygonToSurface;
00121 extern const a2dMenuIdItem CmdMenu_Selected_ConvertSurfaceToPolygon;
00122 extern const a2dMenuIdItem CmdMenu_Selected_ConvertPathToPolygon;
00123 extern const a2dMenuIdItem CmdMenu_Selected_UnGroup;
00124 extern const a2dMenuIdItem CmdMenu_Selected_UnGroupDeep;
00125 extern const a2dMenuIdItem CmdMenu_Selected_Merge;
00126 extern const a2dMenuIdItem CmdMenu_Selected_Offset;
00127 extern const a2dMenuIdItem CmdMenu_Selected_CreateRing;
00128
00129 extern const a2dMenuIdItem CmdMenu_GroupAB_Offset;
00130 extern const a2dMenuIdItem CmdMenu_GroupAB_Smooth;
00131 extern const a2dMenuIdItem CmdMenu_GroupAB_CreateRing;
00132 extern const a2dMenuIdItem CmdMenu_GroupAB_Delete;
00133 extern const a2dMenuIdItem CmdMenu_GroupAB_Move;
00134 extern const a2dMenuIdItem CmdMenu_GroupAB_Copy;
00135 extern const a2dMenuIdItem CmdMenu_GroupAB_ToArcs;
00136 extern const a2dMenuIdItem CmdMenu_GroupAB_Or;
00137 extern const a2dMenuIdItem CmdMenu_GroupAB_And;
00138 extern const a2dMenuIdItem CmdMenu_GroupAB_Exor;
00139 extern const a2dMenuIdItem CmdMenu_GroupAB_AsubB;
00140 extern const a2dMenuIdItem CmdMenu_GroupAB_BsubA;
00141 extern const a2dMenuIdItem CmdMenu_GroupAB_ConvertPolygonToSurface;
00142 extern const a2dMenuIdItem CmdMenu_GroupAB_ConvertSurfaceToPolygon;
00143
00144
00145
00146
00147
00148
00149
00150
00151 class A2DCANVASDLLEXP a2dCentralCanvasCommandProcessor : public a2dDocumentCommandProcessor
00152 {
00153 #if defined(_DEBUG) && defined (SMART_POINTER_DEBUG)
00154 a2dInitCurrentSmartPointerOwner m_initCurrentSmartPointerOwner;
00155 #endif
00156
00157 A2D_DECLARE_EVENT_TABLE()
00158 DECLARE_CLASS(a2dCentralCanvasCommandProcessor)
00159
00160
00161 public:
00162
00163 friend class a2dCommand_GroupAB;
00164
00165
00166 a2dCentralCanvasCommandProcessor(long flags = a2dDEFAULT_DOCUMENT_FLAGS,
00167 bool initialize = true,
00168 int maxCommands = -1 );
00169
00170
00171 a2dCentralCanvasCommandProcessor( a2dDocumentCommandProcessor* other );
00172
00173
00174 ~a2dCentralCanvasCommandProcessor();
00175
00176 void OnUpdateMenu(wxUpdateUIEvent& event);
00177
00178
00179 void OnMenu( wxCommandEvent& event );
00180
00181
00182 a2dCanvasDocument* GetCanvasDocument() { return wxDynamicCast( m_currentDocument, a2dCanvasDocument ); }
00183
00184
00185 double GetUnitsScaleOfDocument();
00186
00187
00188
00189
00190
00191
00192
00193
00194
00195
00196
00197
00198 bool SetParentObject( a2dCanvasObject* obj = 0 );
00199
00200
00201
00202 a2dCanvasObject* GetParentObject() { return m_parent; }
00203
00204 void SetPopBeforePush( bool popBeforePush ) { m_popBeforePush = popBeforePush; }
00205
00206 bool GetPopBeforePush() { return m_popBeforePush; }
00207
00208
00209 void SetOneShotTools( bool oneShotTools ) { m_oneShotTools = oneShotTools; }
00210
00211
00212 bool GetOneShotTools() { return m_oneShotTools; }
00213
00214
00215 void SetEditAtEndTools( bool editAtEndTools ) { m_editAtEndTools = editAtEndTools; }
00216
00217
00218 bool GetEditAtEndTools() { return m_editAtEndTools; }
00219
00220
00221
00222
00223
00224
00225
00226
00227
00228
00229 a2dCanvasObject* AddCurrent( a2dCanvasObject* objectToAdd, bool withUndo = false, a2dPropertyIdList* setStyles = NULL, a2dCanvasObject* parentObject = NULL );
00230
00231 bool CvgString( const wxString& cvgString );
00232
00233
00234
00235
00236
00237
00238
00239
00240
00241
00242
00243
00244 bool SetPropertyToObject(const wxString& objectname, const wxString& propertyname, const wxString& value = wxT("") );
00245
00246
00247
00248
00249
00250
00251
00252
00253
00254
00255
00256 bool SetPropertyToObject( const wxString& objectname, a2dNamedProperty *property );
00257
00258
00259
00260
00261
00262
00263
00264 bool SetLayerProperty(long layer, const wxString &propertyname, const wxString& value );
00265
00266
00267 a2dCanvasObject* GetCurrentCanvasObject() { return m_currentobject; }
00268
00269
00270
00271
00272
00273
00274
00275
00276
00277
00278
00279
00280
00281
00282 void SetCurrentCanvasObject( a2dCanvasObject* currentcanvasobject, bool takeOverProperties = true );
00283
00284
00285
00286
00287
00288
00289 const a2dStroke& GetStroke() const { return m_currentstroke; }
00290
00291
00292
00293
00294
00295
00296 const a2dFill& GetFill() const { return m_currentfill; }
00297
00298
00299 void SetStroke( const a2dStroke& stroke );
00300
00301
00302 void SetStroke(const unsigned char red, const unsigned char green, const unsigned char blue);
00303
00304
00305
00306
00307
00308 void SetFill( const a2dFill& fill );
00309
00310
00311 void SetFill(const unsigned char red, const unsigned char green, const unsigned char blue);
00312
00313
00314 bool GetSpline() const {return m_spline;}
00315
00316 void SetSpline( bool spline ){ m_spline = spline; }
00317
00318
00319
00320 a2dCanvasObject* GetLineBegin() const { return m_currentBegin;}
00321
00322
00323
00324 a2dCanvasObject* GetLineEnd() const { return m_currentEnd;}
00325
00326
00327 void SetLineBegin( a2dCanvasObject* begin ){ m_currentBegin = begin; }
00328
00329
00330 void SetLineEnd( a2dCanvasObject* end ){ m_currentEnd = end; }
00331
00332
00333 void SetEndScaleX(double xs) { m_currentXscale = xs; }
00334
00335
00336 void SetEndScaleY(double ys) { m_currentYscale = ys; }
00337
00338
00339 double GetEndScaleX() const {return m_currentXscale;}
00340
00341
00342 double GetEndScaleY() const {return m_currentYscale;}
00343
00344
00345
00346
00347
00348
00349 void SetContourWidthInDataBaseUnits( double width );
00350
00351
00352
00353
00354 void SetContourWidth( const a2dDoMu& currentContourWidth );
00355
00356
00357
00358
00359
00360
00361 double GetContourWidthInDataBaseUnits() const;
00362
00363
00364 const a2dDoMu& GetContourWidth() const { return m_currentContourWidth; }
00365
00366
00367 void SetPathType( a2dPATH_END_TYPE pathtype ) { m_pathtype = pathtype; }
00368
00369
00370 a2dPATH_END_TYPE GetPathType() { return m_pathtype; }
00371
00372
00373 void SetFont( const a2dFont& font );
00374
00375
00376 const a2dFont& GetFont() const { return m_font; }
00377
00378
00379
00380 void SetLayer( wxUint16 layer, bool setStyleOfLayer = false );
00381
00382
00383 inline wxUint16 GetLayer() const { return m_layer; }
00384
00385
00386
00387
00388
00389 a2dBaseTool* GetActiveTool();
00390
00391
00392
00393
00394
00395 a2dBaseTool* PopTool();
00396
00397
00398 bool SetShowObject(int index);
00399
00400
00401 bool Zoom( double x1,double y1, double x2, double y2, bool upp );
00402
00403
00404 bool Update();
00405
00406
00407 bool Select( double x1,double y1, double x2, double y2 );
00408
00409
00410 bool DeSelect( double x1,double y1, double x2, double y2 );
00411
00412
00413 a2dCanvasView* CheckDrawer() const;
00414
00415
00416 a2dCanvasDocument* CheckCanvasDocument() const;
00417
00418
00419 a2dCanvasCommandProcessor* GetDocCmdh()
00420 {
00421 wxASSERT_MSG( CheckCanvasDocument(), wxT("current document needs to be a a2dCanvasDocument") );
00422 return CheckCanvasDocument()->GetCanvasCommandProcessor();
00423 }
00424
00425
00426 void SetGroupA( const a2dLayerGroup& groupA ) { m_groupA = groupA; }
00427
00428
00429 void SetGroupB( const a2dLayerGroup& groupB ) { m_groupB = groupB; }
00430
00431
00432 a2dLayerGroup& GetGroupA() { return m_groupA; }
00433
00434
00435 a2dLayerGroup& GetGroupB() { return m_groupB; }
00436
00437
00438 void AddGroupA( wxUint16 layer ) { m_groupA.push_back( layer ); }
00439
00440
00441 void AddGroupB( wxUint16 layer ) { m_groupB.push_back( layer ); }
00442
00443
00444 void SetTarget( wxUint16 target ) { m_target = target; }
00445
00446
00447 wxUint16 GetTarget() { return m_target; }
00448
00449
00450 void SetSelectedOnlyA( bool selectedOnlyA ) { m_selectedOnlyA = selectedOnlyA; }
00451
00452
00453 bool GetSelectedOnlyA() const { return m_selectedOnlyA; }
00454
00455
00456 void SetSelectedOnlyB( bool selectedOnlyB ) { m_selectedOnlyB = selectedOnlyB; }
00457
00458
00459 bool GetSelectedOnlyB() const { return m_selectedOnlyB; }
00460
00461
00462 void SetBooleanEngineMarge( const a2dDoMu& marge ) { m_MARGE = marge; }
00463
00464 void SetBooleanEngineGrid( long grid ) { m_GRID = grid; }
00465
00466 void SetBooleanEngineDGrid( double dgrid ) { m_DGRID = dgrid; }
00467
00468 void SetBooleanEngineCorrectionAber( const a2dDoMu& aber ) { m_CORRECTIONABER = aber; }
00469
00470 void SetBooleanEngineCorrectionFactor( const a2dDoMu& aber ) { m_CORRECTIONFACTOR = aber; }
00471
00472 void SetBooleanEngineMaxlinemerge( const a2dDoMu& maxline ) { m_MAXLINEMERGE = maxline; }
00473
00474 void SetBooleanEngineWindingRule( bool rule ) { m_WINDINGRULE = rule; }
00475
00476 void SetBooleanEngineRoundfactor( double roundfac ) { m_ROUNDFACTOR = roundfac; }
00477 void SetBooleanEngineSmoothAber( const a2dDoMu& aber ) { m_SmoothAber = aber; }
00478 void SetBooleanEngineLinkHoles( bool doLinkHoles ) { m_LinkHoles = doLinkHoles; }
00479
00480 void SetRadiusMin( const a2dDoMu& radiusMin ) { m_radiusMin = radiusMin; }
00481
00482 void SetRadiusMax( const a2dDoMu& radiusMax ) { m_radiusMax = radiusMax; }
00483
00484 void SetAberPolyToArc( const a2dDoMu& aber );
00485
00486 void SetAberArcToPoly( const a2dDoMu& aber );
00487
00488 void SetSmall( const a2dDoMu& smallest );
00489
00490 bool GdsIoSaveTextAsPolygon( bool onOff );
00491 bool KeyIoSaveTextAsPolygon( bool onOff );
00492
00493
00494 const a2dDoMu& GetRadiusMin() const { return m_radiusMin; }
00495
00496 const a2dDoMu& GetRadiusMax() const { return m_radiusMax; }
00497
00498 const a2dDoMu& GetAberPolyToArc() const { return m_AberPolyToArc; }
00499
00500 const a2dDoMu& GetAberArcToPoly() const { return m_AberArcToPoly; }
00501
00502 const a2dDoMu& GetSmall() const { return m_small; }
00503
00504
00505 void SetGridX( const a2dDoMu& gridX );
00506
00507 void SetGridY( const a2dDoMu& gridY );
00508
00509
00510 const a2dDoMu& GetBooleanEngineMarge() const { return m_MARGE; }
00511
00512 long GetBooleanEngineGrid() const { return m_GRID; }
00513
00514 double GetBooleanEngineDGrid() const { return m_DGRID; }
00515
00516 const a2dDoMu& GetBooleanEngineCorrectionAber() const { return m_CORRECTIONABER; }
00517
00518 const a2dDoMu& GetBooleanEngineCorrectionFactor() const { return m_CORRECTIONFACTOR; }
00519
00520 const a2dDoMu& GetBooleanEngineMaxlinemerge() const { return m_MAXLINEMERGE; }
00521
00522 bool GetBooleanEngineWindingRule() const { return m_WINDINGRULE; }
00523
00524 double GetBooleanEngineRoundfactor() const { return m_ROUNDFACTOR; }
00525
00526 const a2dDoMu& GetBooleanEngineSmoothAber() const { return m_SmoothAber; }
00527
00528 bool GetBooleanEngineLinkHoles() const { return m_LinkHoles; }
00529
00530
00531
00532
00533
00534
00535
00536 void SetLastXyEntry( double x, double y ) { m_lastX = x; m_lastY = y; }
00537
00538
00539 double GetLastXEntry() const { return m_lastX; }
00540
00541 double GetLastYEntry() const { return m_lastY; }
00542
00543
00544
00545
00546
00547 void SetRelativeStart( double x, double y ) { m_RelativeStartX = x; m_RelativeStartY = y; }
00548
00549
00550 double GetRelativeStartX() const { return m_RelativeStartX; }
00551
00552 double GetRelativeStartY() const { return m_RelativeStartY; }
00553
00554
00555
00556
00557
00558 void SetClearTarget( bool clearTarget ) { m_clearTarget = clearTarget; }
00559
00560
00561 bool GetClearTarget() const { return m_clearTarget; }
00562
00563
00564 a2dCanvasObject* Add_a2dCanvasObject( double x = 0, double y = 0);
00565
00566
00567 a2dCanvasObjectReference* Add_a2dCanvasObjectReference( double x, double y, a2dCanvasObject* obj );
00568
00569
00570
00571
00572 a2dOrigin* Add_a2dOrigin( double w, double h );
00573
00574
00575 a2dHandle* Add_a2dHandle( double xc, double yc, int w, int h, double angle = 0 , int radius = 0 );
00576
00577
00578 a2dRectC* Add_a2dRectC( double xc, double yc, double w, double h, double angle =0 , double radius=0 );
00579
00580
00581 a2dArrow* Add_a2dArrow( double xt, double yt, double l1, double l2, double b, bool spline = false );
00582
00583
00584 a2dRect* Add_a2dRect( double x, double y, double w, double h , double radius=0 );
00585
00586
00587 a2dCircle* Add_a2dCircle( double x, double y, double radius );
00588
00589
00590 a2dEllipse* Add_a2dEllipse( double xc, double yc, double width, double height );
00591
00592
00593 a2dEllipticArc* Add_a2dEllipticArc( double xc, double yc, double width, double height, double start, double end );
00594
00595
00596 a2dArc* Add_a2dArc( double xc, double yc, double radius, double start, double end );
00597
00598
00599 a2dSLine* Add_a2dSLine( double x1, double y1, double x2, double y2 );
00600
00601
00602 a2dEndsLine* Add_a2dEndsLine( double x1, double y1, double x2, double y2 );
00603
00604
00605 a2dImage* Add_a2dImage( const wxImage &image, double xc, double yc, double w, double h );
00606
00607
00608 a2dImage* Add_a2dImage( const wxString &imagefile, wxBitmapType type, double xc, double yc, double w, double h );
00609
00610
00611 a2dText* Add_a2dText( const wxString &text, double x, double y, double angle, const a2dFont& font );
00612
00613
00614 a2dPolygonL* Add_a2dPolygonL(a2dVertexList* points, bool spline = false );
00615
00616
00617 a2dPolylineL* Add_a2dPolylineL(a2dVertexList* points, bool spline = false );
00618
00619
00620 bool Add_Point( double x, double y );
00621
00622
00623 bool Move_Point( int index ,double x, double y );
00624
00625 void FillLibraryPoints();
00626
00627 a2dCanvasDocument* GetLibraryPoints() const { return m_librarypoints.Get(); }
00628
00629 protected:
00630
00631 const a2dFill& MX_GetFill() const { return m_currentfill; }
00632 void MX_SetFill( const a2dFill& value ) { m_currentfill = value; }
00633 const a2dStroke& MX_GetStroke() const { return m_currentstroke; }
00634 void MX_SetStroke( const a2dStroke& value ) { m_currentstroke = value; }
00635 const a2dFont& MX_GetFont() const { return m_font; }
00636 void MX_SetFont( const a2dFont& value ) { m_font = value; }
00637
00638
00639
00640
00641
00642 void OnActivateView( a2dViewEvent& viewevent );
00643
00644
00645 void OnBusyBegin( a2dCommandProcessorEvent& WXUNUSED(event) );
00646
00647
00648 void OnBusyEnd( a2dCommandProcessorEvent& WXUNUSED(event) );
00649
00650 void OnChangedDocument( a2dCommandEvent& event );
00651
00652
00653 bool m_popBeforePush;
00654
00655
00656 bool m_oneShotTools;
00657
00658
00659 bool m_editAtEndTools;
00660
00661
00662 a2dLayerGroup m_groupA;
00663
00664
00665 a2dLayerGroup m_groupB;
00666
00667
00668 wxUint16 m_target;
00669
00670
00671 bool m_selectedOnlyA;
00672
00673 bool m_selectedOnlyB;
00674
00675 bool m_clearTarget;
00676
00677 a2dDoMu m_MARGE;
00678
00679 long m_GRID;
00680
00681 double m_DGRID;
00682
00683 a2dDoMu m_CORRECTIONABER;
00684
00685 a2dDoMu m_CORRECTIONFACTOR;
00686
00687 a2dDoMu m_SMOOTHABER;
00688
00689 a2dDoMu m_MAXLINEMERGE;
00690
00691 bool m_WINDINGRULE;
00692
00693 double m_ROUNDFACTOR;
00694
00695 a2dDoMu m_SmoothAber;
00696
00697 bool m_LinkHoles;
00698
00699 a2dDoMu m_radiusMin;
00700
00701 a2dDoMu m_radiusMax;
00702
00703 a2dDoMu m_AberPolyToArc;
00704
00705 a2dDoMu m_AberArcToPoly;
00706
00707 a2dDoMu m_small;
00708
00709
00710 a2dDoMu m_gridX;
00711
00712 a2dDoMu m_gridY;
00713
00714
00715
00716 a2dCanvasObjectPtr m_parent;
00717
00718
00719 a2dCanvasObjectPtr m_currentobject;
00720
00721
00722 a2dFill m_currentfill;
00723
00724
00725 a2dStroke m_currentstroke;
00726
00727
00728 a2dCanvasObjectPtr m_currentBegin;
00729
00730
00731 a2dCanvasObjectPtr m_currentEnd;
00732
00733
00734 bool m_spline;
00735
00736
00737 double m_currentXscale;
00738
00739
00740 double m_currentYscale;
00741
00742
00743 a2dDoMu m_currentContourWidth;
00744
00745
00746 a2dPATH_END_TYPE m_pathtype;
00747
00748
00749 wxUint16 m_layer;
00750
00751
00752 bool m_AppendOrPrepend;
00753
00754
00755 a2dFont m_font;
00756
00757
00758 double m_lastX;
00759
00760 double m_lastY;
00761
00762
00763 double m_RelativeStartX;
00764
00765
00766 double m_RelativeStartY;
00767
00768 bool m_keySaveTextAsPolygon;
00769 bool m_gdsiiSaveTextAsPolygon;
00770 bool m_keySaveFromView;
00771 bool m_gdsiiSaveFromView;
00772
00773 a2dSmrtPtr<a2dCanvasDocument> m_librarypoints;
00774
00775 public:
00776
00777
00778 static a2dPropertyIdCanvasObject* PROPID_Begin;
00779 static a2dPropertyIdCanvasObject* PROPID_End;
00780 static a2dPropertyIdDouble* PROPID_EndScaleX;
00781 static a2dPropertyIdDouble* PROPID_EndScaleY;
00782 static a2dPropertyIdBool* PROPID_Spline;
00783
00784 static a2dPropertyIdFill* PROPID_Fill;
00785 static a2dPropertyIdStroke* PROPID_Stroke;
00786 static a2dPropertyIdFont* PROPID_Font;
00787 static a2dPropertyIdUint16* PROPID_Layer;
00788
00789 static a2dPropertyIdBool* PROPID_PopBeforePush;
00790 static a2dPropertyIdBool* PROPID_OneShotTools;
00791 static a2dPropertyIdBool* PROPID_EditAtEndTools;
00792 static a2dPropertyIdBool* PROPID_Snap;
00793
00794 DECLARE_PROPERTIES()
00795 };
00796
00797 A2DCANVASDLLEXP extern a2dDrawer2D *a2dGetDrawer2D();
00798
00799 A2DCANVASDLLEXP extern a2dCentralCanvasCommandProcessor* a2dGetCmdh();
00800
00801
00802
00803
00804
00805
00806
00807
00808
00809
00810 class A2DCANVASDLLEXP a2dCanvasCommandProcessor : public a2dCommandProcessor
00811 {
00812
00813 public:
00814 a2dCanvasCommandProcessor( a2dCanvasDocument* doc, int maxCommands = -1);
00815 ~a2dCanvasCommandProcessor();
00816
00817
00818
00819
00820
00821 virtual bool Submit(a2dCommand* command, bool storeIt = true);
00822
00823
00824 virtual bool SubmitMultiple( a2dCommand* command, a2dCanvasObjectList *objects, bool storeIt = true );
00825
00826 a2dCanvasDocument* GetCanvasDocument() { return m_doc; }
00827
00828
00829
00830
00831
00832 a2dCanvasObjectList* ConvertToPolygons( a2dCanvasObject* canvasobject, bool transform );
00833
00834
00835
00836
00837 a2dCanvasObjectList* ConvertToVpath( a2dCanvasObject* canvasobject, bool transform );
00838
00839
00840
00841
00842
00843
00844
00845
00846
00847
00848 DECLARE_CLASS(a2dCanvasCommandProcessor);
00849
00850
00851 protected:
00852
00853
00854
00855 a2dCanvasDocument *m_doc;
00856 };
00857
00858
00859
00860
00861
00862
00863 class A2DCANVASDLLEXP a2dCommand_AddObject: public a2dCommand
00864 {
00865 DECLARE_DYNAMIC_CLASS(a2dCommand_AddObject)
00866
00867 public:
00868
00869
00870
00871 static const a2dCommandId Id;
00872
00873 a2dCommand_AddObject() { m_canvasobject = NULL; m_parent = NULL; }
00874
00875 a2dCommand_AddObject( a2dCanvasObject* parent, a2dCanvasObject* object );
00876
00877 ~a2dCommand_AddObject(void);
00878
00879 bool Do();
00880 bool Undo();
00881
00882 inline a2dCanvasCommandProcessor *GetCanvasCmp() { return wxStaticCast( m_cmp, a2dCanvasCommandProcessor); }
00883
00884 a2dCanvasObject *GetCanvasObject() { return m_canvasobject; }
00885 a2dCanvasObject *GetParent() { return m_parent; }
00886
00887 protected:
00888 a2dCanvasObjectPtr m_canvasobject;
00889 a2dCanvasObjectPtr m_parent;
00890 };
00891
00892
00893
00894
00895
00896
00897 class A2DCANVASDLLEXP a2dCommand_ReleaseObject: public a2dCommand
00898 {
00899 DECLARE_DYNAMIC_CLASS(a2dCommand_ReleaseObject)
00900
00901 public:
00902
00903
00904
00905
00906 static const a2dCommandId Id;
00907
00908 a2dCommand_ReleaseObject() { m_canvasobject = NULL; m_parent = NULL; m_index = 0; m_now = true; }
00909
00910 a2dCommand_ReleaseObject( a2dCanvasObject* parent, a2dCanvasObject* object, bool now = true );
00911
00912 ~a2dCommand_ReleaseObject(void);
00913
00914 bool Do();
00915 bool Undo();
00916
00917 a2dCanvasObject *GetCanvasObject() { return m_canvasobject; }
00918 a2dCanvasObject *GetParent() { return m_parent; }
00919
00920 inline a2dCanvasCommandProcessor *GetCanvasCmp() { return wxStaticCast( m_cmp, a2dCanvasCommandProcessor); }
00921
00922 protected:
00923
00924 a2dCanvasObjectPtr m_canvasobject;
00925 a2dCanvasObjectPtr m_parent;
00926 int m_index;
00927 bool m_now;
00928 };
00929
00930
00931
00932
00933
00934
00935 class A2DCANVASDLLEXP a2dCommand_ReplaceObject: public a2dCommand
00936 {
00937 DECLARE_DYNAMIC_CLASS(a2dCommand_ReplaceObject)
00938
00939 public:
00940
00941
00942
00943 static const a2dCommandId Id;
00944
00945 a2dCommand_ReplaceObject() { m_canvasobject = NULL; m_canvasobject2 = NULL; m_parent = NULL; }
00946
00947 a2dCommand_ReplaceObject( a2dCanvasObject* parent, a2dCanvasObject* oldobject, a2dCanvasObject* newobject );
00948
00949 ~a2dCommand_ReplaceObject(void);
00950
00951 bool Do();
00952 bool Undo();
00953
00954 inline a2dCanvasCommandProcessor *GetCanvasCmp() { return wxStaticCast( m_cmp, a2dCanvasCommandProcessor); }
00955
00956 protected:
00957
00958 a2dCanvasObjectPtr m_canvasobject;
00959 a2dCanvasObjectPtr m_canvasobject2;
00960 a2dCanvasObjectPtr m_parent;
00961 };
00962
00963
00964
00965
00966 class A2DCANVASDLLEXP a2dCommand_SetFlags: public a2dCommand
00967 {
00968 DECLARE_DYNAMIC_CLASS(a2dCommand_SetFlags)
00969 public:
00970
00971
00972
00973
00974 static const a2dCommandId Id;
00975
00976 a2dCommand_SetFlags() { m_parent = NULL; }
00977
00978
00979 a2dCommand_SetFlags( a2dCanvasObject* parent, a2dCanvasObjectFlagsMask which, bool value, const a2dBoundingBox& bbox = wxNonValidBbox );
00980
00981 ~a2dCommand_SetFlags(void);
00982
00983 bool Do();
00984 bool Undo();
00985
00986 inline a2dCanvasCommandProcessor *GetCanvasCmp() { return wxStaticCast( m_cmp, a2dCanvasCommandProcessor); }
00987
00988 protected:
00989
00990 a2dBoundingBox m_bbox;
00991
00992 a2dCanvasObjectFlagsMask m_mask;
00993
00994 a2dCanvasObjectList* m_objects;
00995 a2dlist< a2dCanvasObjectFlagsMask > m_objectOldMask;
00996
00997 a2dCanvasObjectPtr m_parent;
00998
00999 bool m_bool;
01000 };
01001
01002
01003
01004
01005
01006 class A2DCANVASDLLEXP a2dCommand_SetFlag: public a2dCommand
01007 {
01008 DECLARE_DYNAMIC_CLASS(a2dCommand_SetFlag)
01009
01010 public:
01011
01012
01013
01014 static const a2dCommandId Id;
01015
01016 a2dCommand_SetFlag() { m_canvasobject = NULL; }
01017
01018
01019 a2dCommand_SetFlag( a2dCanvasObject* object, a2dCanvasObjectFlagsMask which, bool value );
01020
01021 ~a2dCommand_SetFlag(void);
01022
01023 virtual a2dCommand* CloneAndBind( a2dPropObject *object );
01024
01025 bool Do();
01026 bool Undo();
01027
01028 inline a2dCanvasCommandProcessor *GetCanvasCmp() { return wxStaticCast( m_cmp, a2dCanvasCommandProcessor); }
01029
01030 protected:
01031
01032 a2dCanvasObjectPtr m_canvasobject;
01033
01034 a2dCanvasObjectFlagsMask m_which;
01035
01036 bool m_bool;
01037 };
01038
01039
01040
01041
01042
01043
01044
01045
01046 class A2DCANVASDLLEXP a2dCommand_SetSelectFlag: public a2dCommand
01047 {
01048 DECLARE_DYNAMIC_CLASS(a2dCommand_SetSelectFlag)
01049
01050 public:
01051
01052
01053
01054 static const a2dCommandId Id;
01055
01056 a2dCommand_SetSelectFlag() { m_canvasobject = NULL; }
01057
01058
01059 a2dCommand_SetSelectFlag( a2dCanvasObject* object, bool value );
01060
01061 ~a2dCommand_SetSelectFlag(void);
01062
01063 virtual a2dCommand* CloneAndBind( a2dPropObject *object );
01064
01065 bool Do();
01066 bool Undo();
01067
01068 inline a2dCanvasCommandProcessor *GetCanvasCmp() { return wxStaticCast( m_cmp, a2dCanvasCommandProcessor); }
01069
01070 protected:
01071
01072 a2dCanvasObjectPtr m_canvasobject;
01073
01074 bool m_bool;
01075 };
01076
01077 #include <wx/listimpl.cpp>
01078
01079
01080
01081 class A2DCANVASDLLEXP a2dCommandMatrixData
01082 {
01083
01084 public:
01085
01086
01087
01088 static const a2dCommandId Id;
01089
01090 a2dCommandMatrixData( a2dCanvasObject* WXUNUSED(parent), a2dCanvasObject* object, const a2dAffineMatrix& transform )
01091 {
01092 m_object = (a2dCanvasObject*) object;
01093 m_transform = transform;
01094 }
01095
01096 ~a2dCommandMatrixData()
01097 {
01098 }
01099
01100 a2dCanvasObjectPtr m_parent;
01101
01102 a2dCanvasObjectPtr m_object;
01103 a2dAffineMatrix m_transform;
01104 };
01105
01106 typedef a2dlist< a2dCommandMatrixData > a2dObjectMatrixList;
01107
01108
01109
01110
01111
01112 class A2DCANVASDLLEXP a2dCommand_TransformMask: public a2dCommand
01113 {
01114 DECLARE_DYNAMIC_CLASS(a2dCommand_TransformMask)
01115
01116 public:
01117
01118
01119
01120 static const a2dCommandId Id;
01121
01122 a2dCommand_TransformMask() { m_parent = NULL; }
01123
01124 a2dCommand_TransformMask( const a2dAffineMatrix& newtransform, a2dCanvasObjectFlagsMask mask = a2dCanvasOFlags::SELECTED, a2dCanvasObject* parent = NULL );
01125
01126 ~a2dCommand_TransformMask(void);
01127
01128 virtual a2dObject* Clone( CloneOptions options = clone_deep ) const
01129 {
01130 return new a2dCommand_TransformMask( m_transform, m_which, m_parent );
01131 }
01132
01133 bool Do();
01134 bool Undo();
01135
01136 inline a2dCanvasCommandProcessor *GetCanvasCmp() { return wxStaticCast( m_cmp, a2dCanvasCommandProcessor); }
01137
01138 protected:
01139
01140 a2dCanvasObjectPtr m_parent;
01141
01142 a2dObjectMatrixList m_objectsMatrix;
01143
01144 a2dCanvasObjectFlagsMask m_which;
01145
01146 a2dAffineMatrix m_transform;
01147 };
01148
01149
01150
01151
01152
01153 class A2DCANVASDLLEXP a2dCommand_AddPoint: public a2dCommand
01154 {
01155 DECLARE_DYNAMIC_CLASS(a2dCommand_AddPoint)
01156
01157 public:
01158
01159
01160
01161 static const a2dCommandId Id;
01162
01163 a2dCommand_AddPoint() { m_canvasobject = NULL; }
01164
01165 a2dCommand_AddPoint( a2dCanvasObject* object, double x, double y, int index, bool afterinversion = true );
01166 a2dCommand_AddPoint( a2dCanvasObject* object, double x, double y, a2dLineSegmentPtr seg, bool afterinversion = true );
01167 ~a2dCommand_AddPoint(void);
01168
01169 bool Do();
01170 bool Undo();
01171
01172 inline a2dCanvasCommandProcessor *GetCanvasCmp() { return wxStaticCast( m_cmp, a2dCanvasCommandProcessor); }
01173
01174
01175 double m_x;
01176
01177
01178 double m_y;
01179
01180 a2dLineSegmentPtr m_seg;
01181
01182 bool m_afterinversion;
01183
01184 a2dCanvasObjectPtr m_canvasobject;
01185
01186 };
01187
01188
01189
01190
01191 class A2DCANVASDLLEXP a2dCommand_MoveSegment: public a2dCommand
01192 {
01193 DECLARE_DYNAMIC_CLASS(a2dCommand_MoveSegment)
01194
01195 public:
01196
01197
01198
01199 static const a2dCommandId Id;
01200
01201 a2dCommand_MoveSegment() { m_canvasobject = NULL; }
01202
01203 a2dCommand_MoveSegment( a2dCanvasObject* object, double x, double y, int index, bool afterinversion = true );
01204 a2dCommand_MoveSegment( a2dCanvasObject* object, double x, double y, a2dLineSegmentPtr seg, bool afterinversion = true );
01205 ~a2dCommand_MoveSegment(void);
01206
01207 bool Do();
01208 bool Undo();
01209
01210 inline a2dCanvasCommandProcessor *GetCanvasCmp() { return wxStaticCast( m_cmp, a2dCanvasCommandProcessor); }
01211
01212
01213 double m_x;
01214
01215
01216 double m_y;
01217
01218 a2dLineSegmentPtr m_seg;
01219
01220 bool m_afterinversion;
01221
01222 a2dCanvasObjectPtr m_canvasobject;
01223
01224 };
01225
01226
01227
01228
01229 class A2DCANVASDLLEXP a2dCommand_MoveMidSegment: public a2dCommand
01230 {
01231 DECLARE_DYNAMIC_CLASS(a2dCommand_MoveMidSegment)
01232
01233 public:
01234
01235
01236
01237 static const a2dCommandId Id;
01238
01239 a2dCommand_MoveMidSegment() { m_canvasobject = NULL; }
01240
01241 a2dCommand_MoveMidSegment( a2dCanvasObject* object, double x, double y, int index, bool afterinversion = true );
01242 a2dCommand_MoveMidSegment( a2dCanvasObject* object, double x, double y, a2dLineSegmentPtr seg, bool afterinversion = true );
01243 ~a2dCommand_MoveMidSegment(void);
01244
01245 bool Do();
01246 bool Undo();
01247
01248 inline a2dCanvasCommandProcessor *GetCanvasCmp() { return wxStaticCast( m_cmp, a2dCanvasCommandProcessor); }
01249
01250
01251 double m_x;
01252
01253
01254 double m_y;
01255
01256 bool m_afterinversion;
01257
01258 a2dLineSegmentPtr m_seg;
01259
01260 a2dCanvasObjectPtr m_canvasobject;
01261
01262 };
01263
01264
01265
01266
01267
01268 class A2DCANVASDLLEXP a2dCommand_RemoveSegment: public a2dCommand
01269 {
01270 DECLARE_DYNAMIC_CLASS(a2dCommand_RemoveSegment)
01271
01272 public:
01273
01274
01275
01276 static const a2dCommandId Id;
01277
01278 a2dCommand_RemoveSegment() { m_canvasobject = NULL; }
01279
01280 a2dCommand_RemoveSegment( a2dCanvasObject* object, int index );
01281 a2dCommand_RemoveSegment( a2dCanvasObject* object, a2dLineSegmentPtr seg );
01282 ~a2dCommand_RemoveSegment(void);
01283
01284 bool Do();
01285 bool Undo();
01286
01287 inline a2dCanvasCommandProcessor *GetCanvasCmp() { return wxStaticCast( m_cmp, a2dCanvasCommandProcessor); }
01288
01289
01290 unsigned int m_index;
01291
01292
01293 a2dLineSegmentPtr m_seg;
01294
01295 a2dCanvasObjectPtr m_canvasobject;
01296 };
01297
01298
01299
01300
01301
01302 class A2DCANVASDLLEXP a2dCommand_SetSegments: public a2dCommand
01303 {
01304 DECLARE_DYNAMIC_CLASS(a2dCommand_SetSegments)
01305
01306 public:
01307
01308
01309
01310 static const a2dCommandId Id;
01311
01312 a2dCommand_SetSegments() { m_canvasobject = NULL; }
01313
01314 a2dCommand_SetSegments( a2dCanvasObject* object, a2dVertexList *segments, bool afterinversion );
01315 ~a2dCommand_SetSegments(void);
01316
01317 bool Do();
01318 bool Undo();
01319
01320 inline a2dCanvasCommandProcessor *GetCanvasCmp() { return wxStaticCast( m_cmp, a2dCanvasCommandProcessor); }
01321
01322
01323 a2dSmrtPtr<a2dVertexList> m_segments;
01324
01325 a2dCanvasObjectPtr m_canvasobject;
01326 };
01327
01328
01329
01330
01331
01332 class A2DCANVASDLLEXP a2dCommand_ChangeText: public a2dCommand
01333 {
01334 DECLARE_DYNAMIC_CLASS(a2dCommand_ChangeText)
01335
01336 public:
01337
01338
01339
01340 static const a2dCommandId Id;
01341
01342 a2dCommand_ChangeText() { m_canvasobject = NULL; }
01343
01344 a2dCommand_ChangeText( a2dText* object, wxString text,
01345 int caret, const a2dFont& font, double linespace, unsigned int textflags );
01346 ~a2dCommand_ChangeText(void);
01347
01348 bool Do();
01349 bool Undo();
01350
01351 inline a2dCanvasCommandProcessor *GetCanvasCmp() { return wxStaticCast( m_cmp, a2dCanvasCommandProcessor); }
01352
01353 protected:
01354
01355 wxString m_text;
01356 int m_caret;
01357 a2dFont m_font;
01358 double m_linespace;
01359 unsigned int m_textflags;
01360 a2dSmrtPtr<a2dText> m_canvasobject;
01361 };
01362
01363
01364
01365
01366 class A2DCANVASDLLEXP a2dCommand_ChangeCanvasObjectStyle: public a2dCommand
01367 {
01368 DECLARE_DYNAMIC_CLASS(a2dCommand_ChangeCanvasObjectStyle)
01369
01370 public:
01371
01372
01373
01374 static const a2dCommandId Id;
01375
01376
01377 static const a2dCommandId sm_SetFillStyleCommand;
01378 static const a2dCommandId sm_SetStrokeStyleCommand;
01379 static const a2dCommandId sm_SetStyleCommand;
01380
01381 a2dCommand_ChangeCanvasObjectStyle() { m_propObject = NULL; }
01382
01383 a2dCommand_ChangeCanvasObjectStyle( a2dPropObject* object, const a2dFill& fill );
01384 a2dCommand_ChangeCanvasObjectStyle( a2dPropObject* object, const a2dStroke& stroke );
01385 a2dCommand_ChangeCanvasObjectStyle( a2dPropObject* object, const a2dFill& fill, const a2dStroke& stroke );
01386
01387 ~a2dCommand_ChangeCanvasObjectStyle(void);
01388
01389 bool Do();
01390 bool Undo();
01391
01392 inline a2dCanvasCommandProcessor *GetCanvasCmp() { return wxStaticCast( m_cmp, a2dCanvasCommandProcessor); }
01393
01394 protected:
01395
01396 a2dSmrtPtr< a2dPropObject > m_propObject;
01397
01398 a2dFill m_fill;
01399
01400 a2dStroke m_stroke;
01401
01402 };
01403
01404
01405
01406
01407 class A2DCANVASDLLEXP a2dCommand_ChangeCentralStyle: public a2dCommand
01408 {
01409 DECLARE_DYNAMIC_CLASS(a2dCommand_ChangeCentralStyle)
01410
01411 public:
01412
01413
01414
01415 static const a2dCommandId Id;
01416
01417
01418 static const a2dCommandId sm_SetFillStyleCommand;
01419 static const a2dCommandId sm_SetStrokeStyleCommand;
01420 static const a2dCommandId sm_SetStyleCommand;
01421
01422 a2dCommand_ChangeCentralStyle() { m_propObject = NULL; }
01423
01424 a2dCommand_ChangeCentralStyle( a2dPropObject* object, const a2dFill& fill );
01425 a2dCommand_ChangeCentralStyle( a2dPropObject* object, const a2dStroke& stroke );
01426 a2dCommand_ChangeCentralStyle( a2dPropObject* object, const a2dFill& fill, const a2dStroke& stroke );
01427
01428 ~a2dCommand_ChangeCentralStyle(void);
01429
01430 bool Do();
01431 bool Undo();
01432
01433 inline a2dCanvasCommandProcessor *GetCanvasCmp() { return wxStaticCast( m_cmp, a2dCanvasCommandProcessor); }
01434
01435 protected:
01436
01437 a2dSmrtPtr< a2dPropObject > m_propObject;
01438
01439 a2dFill m_fill;
01440
01441 a2dStroke m_stroke;
01442 };
01443
01444
01445
01446
01447
01448
01449
01450
01451 class A2DCANVASDLLEXP a2dCommand_SetCanvasProperty: public a2dCommand_SetProperty
01452 {
01453 DECLARE_DYNAMIC_CLASS(a2dCommand_SetCanvasProperty)
01454
01455 public:
01456
01457
01458
01459 static const a2dCommandId Id;
01460
01461 a2dCommand_SetCanvasProperty(){}
01462
01463
01464
01465
01466
01467
01468
01469
01470 a2dCommand_SetCanvasProperty( a2dPropObject* object, a2dNamedProperty* property )
01471 :a2dCommand_SetProperty( object, property ) {}
01472
01473
01474
01475
01476
01477
01478
01479
01480
01481 a2dCommand_SetCanvasProperty( a2dPropObject* object, const a2dPropertyIdRefObject* id, a2dObject *value )
01482 :a2dCommand_SetProperty( object, id, value ) {}
01483
01484
01485
01486
01487
01488
01489
01490
01491
01492
01493 a2dCommand_SetCanvasProperty( a2dPropObject* object, const a2dPropertyIdString* id, const wxString& value )
01494 :a2dCommand_SetProperty( object, id, value ) {}
01495
01496
01497
01498
01499
01500
01501
01502
01503
01504
01505 a2dCommand_SetCanvasProperty( a2dPropObject* object, const a2dPropertyIdBool* id, bool value )
01506 :a2dCommand_SetProperty( object, id, value ) {}
01507
01508
01509
01510
01511
01512
01513
01514
01515
01516
01517 a2dCommand_SetCanvasProperty( a2dPropObject* object, const a2dPropertyIdInt16* id, wxInt16 value )
01518 :a2dCommand_SetProperty( object, id, value ) {}
01519
01520
01521
01522
01523
01524
01525
01526
01527
01528
01529 a2dCommand_SetCanvasProperty( a2dPropObject* object, const a2dPropertyIdUint16* id, wxUint16 value )
01530 :a2dCommand_SetProperty( object, id, value ) {}
01531
01532
01533
01534
01535
01536
01537
01538
01539
01540
01541 a2dCommand_SetCanvasProperty( a2dPropObject* object, const a2dPropertyIdInt32* id, wxInt32 value )
01542 :a2dCommand_SetProperty( object, id, value ) {}
01543
01544
01545
01546
01547
01548
01549
01550
01551
01552
01553 a2dCommand_SetCanvasProperty( a2dPropObject* object, const a2dPropertyIdUint32* id, wxUint32 value )
01554 :a2dCommand_SetProperty( object, id, value ) {}
01555
01556
01557
01558
01559
01560
01561
01562
01563
01564
01565 a2dCommand_SetCanvasProperty( a2dPropObject* object, const a2dPropertyIdDouble* id, double value )
01566 :a2dCommand_SetProperty( object, id, value ) {}
01567
01568
01569
01570
01571
01572
01573
01574
01575
01576 a2dCommand_SetCanvasProperty( a2dPropObject* object, const a2dPropertyIdCanvasObject* id, a2dCanvasObject* value );
01577
01578
01579
01580
01581
01582
01583
01584
01585
01586 a2dCommand_SetCanvasProperty( a2dPropObject* object, const a2dPropertyIdMatrix* id, const a2dAffineMatrix& value );
01587
01588
01589
01590
01591
01592
01593
01594
01595
01596
01597
01598 a2dCommand_SetCanvasProperty( a2dPropObject* object, const a2dPropertyIdPoint2D* id, const a2dPoint2D& point, int index = -1, bool afterinversion = true );
01599
01600 a2dCommand_SetCanvasProperty( a2dPropObject* object, const a2dPropertyIdFill* id, const a2dFill& fill = *a2dNullFILL );
01601
01602 a2dCommand_SetCanvasProperty( a2dPropObject* object, const a2dPropertyIdStroke* id, const a2dStroke& stroke = *a2dNullSTROKE );
01603
01604 ~a2dCommand_SetCanvasProperty(void);
01605
01606 virtual a2dCommand* CloneAndBind( a2dPropObject *object );
01607
01608 bool Do();
01609 bool Undo();
01610
01611 inline a2dCanvasCommandProcessor *GetCanvasCmp() { return wxStaticCast( m_cmp, a2dCanvasCommandProcessor); }
01612 };
01613
01614
01615
01616
01617
01618
01619
01620 class A2DCANVASDLLEXP a2dCommand_ConnectPins: public a2dCommand
01621 {
01622
01623 DECLARE_DYNAMIC_CLASS(a2dCommand_ConnectPins)
01624
01625 public:
01626
01627
01628
01629 static const a2dCommandId Id;
01630
01631 a2dCommand_ConnectPins() {}
01632
01633 a2dCommand_ConnectPins( a2dPin* pin1, a2dPin* pin2 );
01634
01635 ~a2dCommand_ConnectPins(void);
01636
01637 bool Do();
01638 bool Undo();
01639
01640 inline a2dCanvasCommandProcessor *GetCanvasCmp() { return wxStaticCast( m_cmp, a2dCanvasCommandProcessor); }
01641
01642 a2dCanvasObjectPtr m_pin1;
01643 a2dCanvasObjectPtr m_pin2;
01644 a2dCanvasObjectPtr m_pin1oldtarget;
01645 a2dCanvasObjectPtr m_pin2oldtarget;
01646 };
01647
01648
01649
01650
01651
01652
01653
01654
01655
01656
01657 class A2DCANVASDLLEXP a2dCommand_Select: public a2dCommand
01658 {
01659 DECLARE_DYNAMIC_CLASS(a2dCommand_Select)
01660
01661 public:
01662
01663
01664
01665
01666
01667 static const a2dCommandId Id;
01668
01669
01670
01671
01672 enum a2dDoWhat
01673 {
01674 SelectAll,
01675 DeSelectAll,
01676 SelectRect,
01677 DeSelectRect
01678 };
01679
01680 class A2DCANVASDLLEXP Args
01681 {
01682 public:
01683 Args()
01684 {
01685 argSet.what = false;
01686 argSet.layer = false;
01687 argSet.x1 = false;
01688 argSet.y1 = false;
01689 argSet.x2 = false;
01690 argSet.y2 = false;
01691 argValue.layer = 0;
01692 argValue.x1 = 0;
01693 argValue.y1 = 0;
01694 argValue.x2 = 0;
01695 argValue.y2 = 0;
01696 argValue.layervisible = true;
01697 argValue.layerselectable = true;
01698 }
01699
01700 A2D_ARGUMENT_SETTER( a2dDoWhat, what )
01701 A2D_ARGUMENT_SETTER( wxUint16, layer )
01702 A2D_ARGUMENT_SETTER( double, x1 )
01703 A2D_ARGUMENT_SETTER( double, y1 )
01704 A2D_ARGUMENT_SETTER( double, x2 )
01705 A2D_ARGUMENT_SETTER( double, y2 )
01706 A2D_ARGUMENT_SETTER( bool, layervisible )
01707 A2D_ARGUMENT_SETTER( bool, layerselectable )
01708
01709 struct argValue
01710 {
01711 a2dDoWhat what;
01712 wxUint16 layer;
01713 double x1;
01714 double y1;
01715 double x2;
01716 double y2;
01717 bool layervisible;
01718 bool layerselectable;
01719 } argValue;
01720
01721 struct argSet
01722 {
01723 bool what;
01724 bool layer;
01725 bool x1;
01726 bool y1;
01727 bool x2;
01728 bool y2;
01729 bool layervisible;
01730 bool layerselectable;
01731 } argSet;
01732 };
01733
01734 a2dCommand_Select() {}
01735
01736 a2dCommand_Select( const Args& args, a2dCanvasObject* parent = NULL ): a2dCommand( true, Id )
01737 {
01738 m_args = args;
01739 m_parent = parent;
01740 m_oldobjects = wxNullCanvasObjectList;
01741 }
01742
01743 ~a2dCommand_Select()
01744 {
01745 if ( m_oldobjects != wxNullCanvasObjectList )
01746 delete m_oldobjects;
01747 }
01748
01749 virtual a2dObject* Clone( CloneOptions options = clone_deep ) const
01750 {
01751 return new a2dCommand_Select( m_args, m_parent );
01752 }
01753
01754 inline a2dCanvasCommandProcessor *GetCanvasCmp() { return wxStaticCast( m_cmp, a2dCanvasCommandProcessor); }
01755
01756 private:
01757
01758 Args m_args;
01759 a2dCanvasObjectList* m_oldobjects;
01760 a2dlist< bool > m_oldobjectsSelected;
01761
01762 a2dCanvasObjectPtr m_parent;
01763
01764 virtual bool Do();
01765
01766 virtual bool Undo();
01767
01768 };
01769
01770
01771
01772
01773
01774
01775 class A2DCANVASDLLEXP a2dCommand_Zoom: public a2dCommand
01776 {
01777 DECLARE_DYNAMIC_CLASS(a2dCommand_Zoom)
01778 public:
01779
01780
01781
01782
01783 static const a2dCommandId Id;
01784
01785
01786
01787
01788 enum a2dDoWhat
01789 {
01790 ZoomOut,
01791 Zoom,
01792 };
01793
01794 class A2DCANVASDLLEXP Args
01795 {
01796 public:
01797 Args()
01798 {
01799 argSet.what = false;
01800 argSet.x1 = false;
01801 argSet.y1 = false;
01802 argSet.x2 = false;
01803 argSet.y2 = false;
01804 argSet.upp = false;
01805 argValue.x1 = 0;
01806 argValue.y1 = 0;
01807 argValue.x2 = 0;
01808 argValue.y2 = 0;
01809 argValue.upp = true;
01810 }
01811
01812 A2D_ARGUMENT_SETTER( a2dDoWhat, what )
01813 A2D_ARGUMENT_SETTER( double, x1 )
01814 A2D_ARGUMENT_SETTER( double, y1 )
01815 A2D_ARGUMENT_SETTER( double, x2 )
01816 A2D_ARGUMENT_SETTER( double, y2 )
01817 A2D_ARGUMENT_SETTER( bool, upp )
01818
01819 struct argValue
01820 {
01821 a2dDoWhat what;
01822 double x1;
01823 double y1;
01824 double x2;
01825 double y2;
01826 bool upp;
01827 } argValue;
01828
01829 struct argSet
01830 {
01831 bool what;
01832 bool x1;
01833 bool y1;
01834 bool x2;
01835 bool y2;
01836 bool upp;
01837 } argSet;
01838 };
01839
01840 a2dCommand_Zoom( a2dDoWhat what = ZoomOut ): a2dCommand( false, Id )
01841 {
01842 m_args.what( what );
01843 }
01844
01845 a2dCommand_Zoom( const Args& args ): a2dCommand( false, Id )
01846 {
01847 m_args = args;
01848 }
01849
01850 virtual a2dObject* Clone( CloneOptions options = clone_deep ) const
01851 {
01852 return new a2dCommand_Zoom( m_args );
01853 }
01854
01855 inline a2dCentralCanvasCommandProcessor *GetCanvasCmp() { return wxStaticCast( m_cmp, a2dCentralCanvasCommandProcessor); }
01856
01857 private:
01858
01859 Args m_args;
01860
01861 virtual bool Do()
01862 {
01863 a2dCanvasDocument* doc = GetCanvasCmp()->CheckCanvasDocument();
01864 if ( !doc )
01865 return false;
01866
01867 a2dCanvasView* drawer = GetCanvasCmp()->CheckDrawer();
01868 if ( !drawer )
01869 return false;
01870
01871 if ( m_args.argValue.what == Zoom )
01872 {
01873 return GetCanvasCmp()->Zoom( m_args.argValue.x1, m_args.argValue.y1, m_args.argValue.x2, m_args.argValue.y2, m_args.argValue.upp );
01874 }
01875 else if ( m_args.argValue.what == ZoomOut )
01876 {
01877 if ( drawer->GetCanvas() )
01878 drawer->GetCanvas()->SetMappingShowAll();
01879 else
01880 drawer->SetMappingShowAll();
01881 }
01882 else
01883 return false;
01884 return true;
01885 }
01886
01887 virtual bool Undo()
01888 {
01889 return false;
01890 }
01891 };
01892
01893
01894
01895
01896
01897
01898 class A2DCANVASDLLEXP a2dCommand_GroupAB: public a2dCommand
01899 {
01900 DECLARE_DYNAMIC_CLASS(a2dCommand_GroupAB)
01901 public:
01902
01903
01904
01905
01906 static const a2dCommandId Id;
01907
01908
01909
01910
01911 enum a2dDoWhat
01912 {
01913 DeleteGroupA,
01914 MoveGroupA,
01915 CopyGroupA,
01916 ConvertToArcs,
01917 ConvertToPolygonPolylinesWithArcs,
01918 ConvertToPolygonPolylinesWithoutArcs,
01919 ConvertPolygonToArcs,
01920 ConvertPolylineToArcs,
01921 ConvertToVPaths,
01922 ConvertLinesArcs,
01923 ConvertToPolylines,
01924 DetectSmall,
01925 RemoveRedundant,
01926 Boolean_OR,
01927 Boolean_AND,
01928 Boolean_EXOR,
01929 Boolean_A_SUB_B,
01930 Boolean_B_SUB_A,
01931 Boolean_CORRECTION,
01932 Boolean_SMOOTHEN,
01933 Boolean_MAKERING,
01934 Boolean_Polygon2Surface,
01935 Boolean_Surface2Polygon
01936 };
01937
01938 class A2DCANVASDLLEXP Args
01939 {
01940 public:
01941 Args()
01942 {
01943 argSet.what = false;
01944 argSet.target = false;
01945 argSet.clearTarget = false;
01946 argSet.selectedA = false;
01947 argSet.selectedB = false;
01948 argSet.fileNameOut = false;
01949 argSet.detectCircle = false;
01950 argValue.target = 0;
01951 argValue.clearTarget = false;
01952 argValue.selectedA = false;
01953 argValue.selectedB = false;
01954 argValue.detectCircle = false;
01955 }
01956
01957 A2D_ARGUMENT_SETTER( a2dDoWhat, what )
01958 A2D_ARGUMENT_SETTER( wxUint16, target )
01959 A2D_ARGUMENT_SETTER( bool, clearTarget )
01960 A2D_ARGUMENT_SETTER( bool, selectedA )
01961 A2D_ARGUMENT_SETTER( bool, selectedB )
01962 A2D_ARGUMENT_SETTER( wxString, fileNameOut )
01963 A2D_ARGUMENT_SETTER( bool, detectCircle )
01964
01965 struct argValue
01966 {
01967 a2dDoWhat what;
01968 wxUint16 target;
01969 bool clearTarget;
01970 bool selectedA;
01971 bool selectedB;
01972 bool detectCircle;
01973 wxString fileNameOut;
01974 } argValue;
01975
01976 struct argSet
01977 {
01978 bool what;
01979 bool target;
01980 bool clearTarget;
01981 bool selectedA;
01982 bool selectedB;
01983 bool detectCircle;
01984 bool fileNameOut;
01985 } argSet;
01986 };
01987
01988 a2dCommand_GroupAB( const Args& args = Args() ): a2dCommand( false, Id )
01989 {
01990 m_args = args;
01991 }
01992
01993 virtual a2dObject* Clone( CloneOptions options = clone_deep ) const
01994 {
01995 return new a2dCommand_GroupAB( m_args );
01996 }
01997
01998 inline a2dCanvasCommandProcessor *GetCanvasCmp() { return wxStaticCast( m_cmp, a2dCanvasCommandProcessor); }
01999
02000 private:
02001
02002 virtual bool Do();
02003
02004 virtual bool Undo();
02005
02006 Args m_args;
02007
02008 };
02009
02010
02011
02012
02013
02014 class A2DCANVASDLLEXP a2dCommand_SetLayerGroup: public a2dCommand
02015 {
02016 DECLARE_DYNAMIC_CLASS(a2dCommand_SetLayerGroup)
02017 public:
02018
02019
02020
02021
02022 static const a2dCommandId Id;
02023
02024
02025
02026
02027 enum a2dDoWhat
02028 {
02029 SetGroupA,
02030 SetGroupB,
02031 AddGroupA,
02032 AddGroupB,
02033 ClearGroupA,
02034 ClearGroupB,
02035 };
02036
02037 class A2DCANVASDLLEXP Args
02038 {
02039 public:
02040 Args()
02041 {
02042 argSet.what = false;
02043 argSet.layer = false;
02044 argSet.group = false;
02045 argValue.layer = 0;
02046 }
02047
02048 A2D_ARGUMENT_SETTER( a2dDoWhat, what )
02049 A2D_ARGUMENT_SETTER( wxUint16, layer )
02050 A2D_ARGUMENT_SETTER( a2dLayerGroup, group )
02051
02052 struct argValue
02053 {
02054 a2dDoWhat what;
02055 wxUint16 layer;
02056 a2dLayerGroup group;
02057 } argValue;
02058
02059 struct argSet
02060 {
02061 bool what;
02062 bool layer;
02063 bool group;
02064 } argSet;
02065 };
02066
02067 a2dCommand_SetLayerGroup( const Args& args = Args() ): a2dCommand( false, Id )
02068 {
02069 m_args = args;
02070 }
02071
02072 virtual a2dObject* Clone( CloneOptions options = clone_deep ) const
02073 {
02074 return new a2dCommand_SetLayerGroup( m_args );
02075 }
02076
02077 inline a2dCentralCanvasCommandProcessor *GetCanvasCmp() { return wxStaticCast( m_cmp, a2dCentralCanvasCommandProcessor); }
02078
02079 Args m_args;
02080
02081 protected:
02082
02083 virtual bool Do()
02084 {
02085 a2dCanvasDocument* doc = GetCanvasCmp()->CheckCanvasDocument();
02086 if ( !doc )
02087 return false;
02088
02089 a2dCanvasView* drawer = GetCanvasCmp()->CheckDrawer();
02090 if ( !drawer )
02091 return false;
02092
02093 if ( m_args.argValue.what == SetGroupA )
02094 {
02095 GetCanvasCmp()->GetGroupA() = m_args.argValue.group;
02096 }
02097 else if ( m_args.argValue.what == SetGroupB )
02098 {
02099 GetCanvasCmp()->GetGroupB() = m_args.argValue.group;
02100 }
02101 else if ( m_args.argValue.what == AddGroupA )
02102 {
02103 GetCanvasCmp()->GetGroupA().push_back( m_args.argValue.layer );
02104 }
02105 else if ( m_args.argValue.what == AddGroupB )
02106 {
02107 GetCanvasCmp()->GetGroupB().push_back( m_args.argValue.layer );
02108 }
02109 else if ( m_args.argValue.what == ClearGroupA )
02110 {
02111 GetCanvasCmp()->GetGroupA().clear();
02112 }
02113 else if ( m_args.argValue.what == ClearGroupB )
02114 {
02115 GetCanvasCmp()->GetGroupB().clear();
02116 }
02117 return false;
02118 }
02119
02120 virtual bool Undo()
02121 {
02122 return false;
02123 }
02124 };
02125
02126
02127
02128
02129
02130 class A2DCANVASDLLEXP a2dCommand_SetLayer: public a2dCommand
02131 {
02132 DECLARE_DYNAMIC_CLASS(a2dCommand_SetLayer)
02133 public:
02134 static const a2dCommandId Id;
02135
02136 a2dCommand_SetLayer( wxUint16 set = 0, bool setStyleOfLayer = false ): a2dCommand( true, Id )
02137 {
02138 m_value = set;
02139 m_setStyleOfLayer = setStyleOfLayer;
02140 }
02141
02142 virtual a2dObject* Clone( CloneOptions options = clone_deep ) const
02143 {
02144 return new a2dCommand_SetLayer( m_value, m_setStyleOfLayer );
02145 }
02146
02147 bool Do(void)
02148 {
02149 wxUint16 val = GetCanvasCmp()->GetLayer();
02150 GetCanvasCmp()->SetLayer( m_value, m_setStyleOfLayer ); m_value = val;
02151 return true;
02152 }
02153 bool Undo(void)
02154 {
02155 return Do();
02156 }
02157 inline a2dCentralCanvasCommandProcessor *GetCanvasCmp() { return wxStaticCast( m_cmp, a2dCentralCanvasCommandProcessor); }
02158
02159 wxUint16 m_value;
02160 bool m_setStyleOfLayer;
02161 };
02162
02163
02164
02165
02166
02167 class A2DCANVASDLLEXP a2dCommand_SetTarget: public a2dCommand
02168 {
02169 DECLARE_DYNAMIC_CLASS(a2dCommand_SetTarget)
02170
02171 public:
02172 static const a2dCommandId Id;
02173
02174 a2dCommand_SetTarget( wxUint16 set = 0 ): a2dCommand( true, Id )
02175 { m_value = set; }
02176
02177 virtual a2dObject* Clone( CloneOptions options = clone_deep ) const
02178 {
02179 return new a2dCommand_SetTarget( m_value );
02180 }
02181
02182 bool Do(void)
02183 {
02184 wxUint16 val = GetCanvasCmp()->GetTarget();
02185 GetCanvasCmp()->SetTarget( m_value ); m_value = val;
02186 return true;
02187 }
02188 bool Undo(void)
02189 {
02190 return Do();
02191 }
02192 inline a2dCentralCanvasCommandProcessor *GetCanvasCmp() { return wxStaticCast( m_cmp, a2dCentralCanvasCommandProcessor); }
02193
02194 wxUint16 m_value;
02195 };
02196
02197
02198
02199
02200
02201 class A2DCANVASDLLEXP a2dCommand_SetDrawWireFrame: public a2dCommand
02202 {
02203 DECLARE_DYNAMIC_CLASS(a2dCommand_SetDrawWireFrame)
02204 public:
02205 static const a2dCommandId Id;
02206
02207 a2dCommand_SetDrawWireFrame( wxUint16 set = 0 ): a2dCommand( true, Id )
02208 { m_value = set; }
02209
02210 virtual a2dObject* Clone( CloneOptions options = clone_deep ) const
02211 {
02212 return new a2dCommand_SetDrawWireFrame( m_value );
02213 }
02214
02215 protected:
02216
02217 bool Do(void)
02218 {
02219 a2dCanvasView* drawer = GetCanvasCmp()->CheckDrawer();
02220 if ( !drawer )
02221 return false;
02222
02223 wxUint16 val = drawer->GetDocumentDrawStyle();
02224 if ( !val )
02225 val = RenderLAYERED | RenderWIREFRAME_SELECT;
02226 drawer->SetDocumentDrawStyle( m_value );
02227 m_value = val;
02228
02229 drawer->Update();
02230
02231 return true;
02232
02233 }
02234 bool Undo(void)
02235 {
02236 return Do();
02237 }
02238
02239 inline a2dCentralCanvasCommandProcessor *GetCanvasCmp() { return wxStaticCast( m_cmp, a2dCentralCanvasCommandProcessor); }
02240
02241 protected:
02242
02243 wxUint16 m_value;
02244 };
02245
02246
02247
02248
02249
02250 class A2DCANVASDLLEXP a2dCommand_DrawGridLines: public a2dCommand
02251 {
02252 DECLARE_DYNAMIC_CLASS(a2dCommand_DrawGridLines)
02253 public:
02254 static const a2dCommandId Id;
02255
02256 a2dCommand_DrawGridLines( bool set = true ): a2dCommand( true, Id )
02257 { m_value = set; }
02258
02259 virtual a2dObject* Clone( CloneOptions options = clone_deep ) const
02260 {
02261 return new a2dCommand_DrawGridLines( m_value );
02262 }
02263
02264 bool m_value;
02265
02266 protected:
02267
02268 bool Do(void)
02269 {
02270 a2dCanvasView* drawer = GetCanvasCmp()->CheckDrawer();
02271 if ( !drawer )
02272 return false;
02273
02274 bool val = drawer->GetGridLines();
02275 drawer->SetGridLines( m_value );
02276 m_value = val;
02277 return true;
02278
02279 }
02280 bool Undo(void)
02281 {
02282 return Do();
02283 }
02284
02285 inline a2dCentralCanvasCommandProcessor *GetCanvasCmp() { return wxStaticCast( m_cmp, a2dCentralCanvasCommandProcessor); }
02286
02287 };
02288
02289
02290
02291
02292
02293 class A2DCANVASDLLEXP a2dCommand_DrawGridAtFront: public a2dCommand
02294 {
02295 DECLARE_DYNAMIC_CLASS(a2dCommand_DrawGridAtFront)
02296 public:
02297 static const a2dCommandId Id;
02298
02299 a2dCommand_DrawGridAtFront( bool set = true ): a2dCommand( true, Id )
02300 { m_value = set; }
02301
02302 virtual a2dObject* Clone( CloneOptions options = clone_deep ) const
02303 {
02304 return new a2dCommand_DrawGridAtFront( m_value );
02305 }
02306
02307 bool m_value;
02308
02309 protected:
02310
02311 bool Do(void)
02312 {
02313 a2dCanvasView* drawer = GetCanvasCmp()->CheckDrawer();
02314 if ( !drawer )
02315 return false;
02316
02317 bool val = drawer->GetGridAtFront();
02318 drawer->SetGridAtFront( m_value );
02319 m_value = val;
02320 return true;
02321
02322 }
02323 bool Undo(void)
02324 {
02325 return Do();
02326 }
02327
02328 inline a2dCentralCanvasCommandProcessor *GetCanvasCmp() { return wxStaticCast( m_cmp, a2dCentralCanvasCommandProcessor); }
02329
02330 };
02331
02332
02333
02334
02335
02336 class A2DCANVASDLLEXP a2dCommand_DrawGrid: public a2dCommand
02337 {
02338 DECLARE_DYNAMIC_CLASS(a2dCommand_DrawGrid)
02339
02340 public:
02341 static const a2dCommandId Id;
02342
02343 a2dCommand_DrawGrid( bool set = true ): a2dCommand( true, Id )
02344 { m_value = set; }
02345
02346 virtual a2dObject* Clone( CloneOptions options = clone_deep ) const
02347 {
02348 return new a2dCommand_DrawGrid( m_value );
02349 }
02350
02351 bool m_value;
02352
02353 protected:
02354
02355 bool Do(void)
02356 {
02357 a2dCanvasView* drawer = GetCanvasCmp()->CheckDrawer();
02358 if ( !drawer )
02359 return false;
02360
02361 bool val = drawer->GetGrid();
02362 drawer->SetGrid( m_value );
02363 m_value = val;
02364 return true;
02365
02366 }
02367 bool Undo(void)
02368 {
02369 return Do();
02370 }
02371
02372 inline a2dCentralCanvasCommandProcessor *GetCanvasCmp() { return wxStaticCast( m_cmp, a2dCentralCanvasCommandProcessor); }
02373
02374 };
02375
02376
02377
02378
02379
02380
02381
02382
02383
02384 class A2DCANVASDLLEXP a2dCommand_SetSnapFeatures: public a2dCommand
02385 {
02386 DECLARE_DYNAMIC_CLASS(a2dCommand_SetSnapFeatures)
02387 public:
02388 static const a2dCommandId Id;
02389
02390 class A2DCANVASDLLEXP Args
02391 {
02392 public:
02393 Args()
02394 {
02395 argSet.snapTo = a2dRestrictionEngine::snapToNone;
02396 }
02397
02398 A2D_ARGUMENT_SETTER( wxUint32, snapTo )
02399
02400 struct argValue
02401 {
02402 wxUint32 snapTo;
02403 } argValue;
02404
02405 struct argSet
02406 {
02407 bool snapTo;
02408 } argSet;
02409 };
02410
02411 a2dCommand_SetSnapFeatures( wxUint32 snapTo ): a2dCommand( true, Id )
02412 {
02413 m_args.snapTo( snapTo );
02414 }
02415
02416 a2dCommand_SetSnapFeatures( const Args& args = Args() ): a2dCommand( false, Id )
02417 {
02418 m_args = args;
02419 }
02420
02421 virtual a2dObject* Clone( CloneOptions options = clone_deep ) const
02422 {
02423 return new a2dCommand_SetSnapFeatures( m_args );
02424 }
02425
02426 Args m_args;
02427
02428 protected:
02429
02430 bool Do(void)
02431 {
02432 wxUint32 oldSnapToFeatures = a2dCanvasGlobals->GetRestrictionEngine()->GetSnapToFeatures();
02433 a2dCanvasGlobals->GetRestrictionEngine()->SetSnapToFeatures( m_args.argValue.snapTo );
02434 m_args.snapTo( oldSnapToFeatures );
02435 return true;
02436 }
02437 bool Undo(void)
02438 {
02439 return Do();
02440 }
02441 };
02442
02443
02444
02445
02446
02447
02448
02449
02450
02451 class A2DCANVASDLLEXP a2dCommand_SetSnapFeature: public a2dCommand
02452 {
02453 DECLARE_DYNAMIC_CLASS(a2dCommand_SetSnapFeature)
02454 public:
02455 static const a2dCommandId Id;
02456
02457 class A2DCANVASDLLEXP Args
02458 {
02459 public:
02460 Args()
02461 {
02462 argSet.snapTo = a2dRestrictionEngine::snapToNone;
02463 argSet.value = true;
02464 }
02465
02466 A2D_ARGUMENT_SETTER( a2dRestrictionEngine::a2dSnapToWhat, snapTo )
02467 A2D_ARGUMENT_SETTER( bool, value )
02468
02469 struct argValue
02470 {
02471 a2dRestrictionEngine::a2dSnapToWhat snapTo;
02472 bool value;
02473 } argValue;
02474
02475 struct argSet
02476 {
02477 bool snapTo;
02478 bool value;
02479 } argSet;
02480 };
02481
02482 a2dCommand_SetSnapFeature( a2dRestrictionEngine::a2dSnapToWhat snapTo, bool val = true ): a2dCommand( true, Id )
02483 {
02484 m_args.snapTo( snapTo );
02485 m_args.value( val );
02486 }
02487
02488 a2dCommand_SetSnapFeature( const Args& args = Args() ): a2dCommand( false, Id )
02489 {
02490 m_args = args;
02491 }
02492
02493 virtual a2dObject* Clone( CloneOptions options = clone_deep ) const
02494 {
02495 return new a2dCommand_SetSnapFeature( m_args );
02496 }
02497
02498 Args m_args;
02499
02500 protected:
02501
02502 bool Do(void)
02503 {
02504 bool oldSnapToFeature = a2dCanvasGlobals->GetRestrictionEngine()->GetSnapToFeature( m_args.argValue.snapTo );
02505 a2dCanvasGlobals->GetRestrictionEngine()->SetSnapToFeature( m_args.argValue.snapTo, m_args.argValue.value );
02506 m_args.argValue.value = oldSnapToFeature;
02507 return true;
02508 }
02509 bool Undo(void)
02510 {
02511 return Do();
02512 }
02513 };
02514
02515
02516
02517
02518
02519
02520
02521
02522 class A2DCANVASDLLEXP a2dCommand_SetSnap: public a2dCommand
02523 {
02524 DECLARE_DYNAMIC_CLASS(a2dCommand_SetSnap)
02525 public:
02526 static const a2dCommandId Id;
02527
02528 a2dCommand_SetSnap( bool set = true ): a2dCommand( true, Id )
02529 { m_value = set; }
02530
02531 virtual a2dObject* Clone( CloneOptions options = clone_deep ) const
02532 {
02533 return new a2dCommand_SetSnap( m_value );
02534 }
02535
02536 bool m_value;
02537
02538 protected:
02539
02540 bool Do(void)
02541 {
02542 a2dCanvasView* drawer = GetCanvasCmp()->CheckDrawer();
02543 if ( drawer && drawer->GetCanvasToolContr() )
02544 {
02545 bool val = drawer->GetCanvasToolContr()->GetSnap();
02546 drawer->GetCanvasToolContr()->SetSnap( m_value );
02547 m_value = val;
02548 }
02549 return true;
02550 }
02551 bool Undo(void)
02552 {
02553 return Do();
02554 }
02555
02556 inline a2dCentralCanvasCommandProcessor *GetCanvasCmp() { return wxStaticCast( m_cmp, a2dCentralCanvasCommandProcessor); }
02557 };
02558
02559
02560
02561
02562
02563 class A2DCANVASDLLEXP a2dCommand_SetFont: public a2dCommand
02564 {
02565 DECLARE_DYNAMIC_CLASS(a2dCommand_SetFont)
02566
02567 public:
02568 static const a2dCommandId Id;
02569
02570 a2dCommand_SetFont( const wxString& fontString ): a2dCommand( true, Id )
02571 {
02572 a2dFontInfo fontinfo;
02573 fontinfo.ParseString( fontString );
02574 a2dFont font = a2dFont::CreateFont( fontinfo );
02575
02576 m_font = font;
02577 }
02578 a2dCommand_SetFont( a2dFontInfo fontinfo ): a2dCommand( true, Id )
02579 {
02580 a2dFont font = a2dFont::CreateFont( fontinfo );
02581
02582 m_font = font;
02583 }
02584 a2dCommand_SetFont( const a2dFont& font = *a2dNullFONT ): a2dCommand( true, Id )
02585 {
02586 m_font = font;
02587 }
02588
02589 virtual a2dObject* Clone( CloneOptions options = clone_deep ) const
02590 {
02591 return new a2dCommand_SetFont( m_font );
02592 }
02593 a2dFont m_font;
02594
02595 protected:
02596
02597 bool Do(void)
02598 {
02599 a2dFont val = GetCanvasCmp()->GetFont();
02600 GetCanvasCmp()->SetFont( m_font );
02601 m_font = val;
02602 return true;
02603
02604 }
02605 bool Undo(void)
02606 {
02607 return Do();
02608 }
02609
02610 inline a2dCentralCanvasCommandProcessor *GetCanvasCmp() { return wxStaticCast( m_cmp, a2dCentralCanvasCommandProcessor); }
02611 };
02612
02613
02614
02615
02616
02617 class A2DCANVASDLLEXP a2dCommand_SetStroke: public a2dCommand
02618 {
02619 DECLARE_DYNAMIC_CLASS(a2dCommand_SetStroke)
02620 public:
02621 static const a2dCommandId Id;
02622
02623 a2dCommand_SetStroke( const a2dStroke& stroke = *a2dNullSTROKE ): a2dCommand( true, Id )
02624 {
02625 m_value = stroke;
02626 }
02627
02628 virtual a2dObject* Clone( CloneOptions options = clone_deep ) const
02629 {
02630 return new a2dCommand_SetStroke( m_value );
02631 }
02632
02633 a2dStroke m_value;
02634
02635 protected:
02636
02637 bool Do(void)
02638 {
02639 m_value = GetCanvasCmp()->GetStroke();
02640
02641 a2dStroke val = GetCanvasCmp()->GetStroke();
02642 GetCanvasCmp()->SetStroke( m_value );
02643 m_value = val;
02644 return true;
02645
02646 }
02647 bool Undo(void)
02648 {
02649 return Do();
02650 }
02651
02652 inline a2dCentralCanvasCommandProcessor *GetCanvasCmp() { return wxStaticCast( m_cmp, a2dCentralCanvasCommandProcessor); }
02653
02654 };
02655
02656
02657
02658
02659
02660 class A2DCANVASDLLEXP a2dCommand_SetFill: public a2dCommand
02661 {
02662 DECLARE_DYNAMIC_CLASS(a2dCommand_SetFill)
02663 public:
02664 static const a2dCommandId Id;
02665
02666 a2dCommand_SetFill( const a2dFill& fill = *a2dNullFILL ): a2dCommand( true, Id )
02667 {
02668 m_value = fill;
02669 }
02670
02671 virtual a2dObject* Clone( CloneOptions options = clone_deep ) const
02672 {
02673 return new a2dCommand_SetFill( m_value );
02674 }
02675
02676 bool Do(void)
02677 {
02678 a2dFill val = GetCanvasCmp()->GetFill();
02679 GetCanvasCmp()->SetFill( m_value );
02680 m_value = val;
02681 return true;
02682
02683 }
02684 bool Undo(void)
02685 {
02686 return Do();
02687 }
02688
02689 inline a2dCentralCanvasCommandProcessor *GetCanvasCmp() { return wxStaticCast( m_cmp, a2dCentralCanvasCommandProcessor); }
02690
02691 protected:
02692
02693 a2dFill m_value;
02694 };
02695
02696 class A2DCANVASDLLEXP a2dCommand_SetStrokeColour: public a2dCommand
02697 {
02698 DECLARE_DYNAMIC_CLASS(a2dCommand_SetStrokeColour)
02699 public:
02700 static const a2dCommandId Id;
02701
02702 a2dCommand_SetStrokeColour( const wxColour& colour = *wxBLACK ): a2dCommand( true, Id )
02703 {
02704 m_value = colour;
02705 }
02706
02707 virtual a2dObject* Clone( CloneOptions options = clone_deep ) const
02708 {
02709 return new a2dCommand_SetStrokeColour( m_value );
02710 }
02711
02712 wxColour m_value;
02713
02714 protected:
02715
02716 bool Do(void)
02717 {
02718 a2dStroke stroke = GetCanvasCmp()->GetStroke();
02719 wxColour old = stroke.GetColour();
02720 stroke.SetColour( m_value );
02721 m_value = old;
02722 return true;
02723
02724 }
02725 bool Undo(void)
02726 {
02727 return Do();
02728 }
02729
02730 inline a2dCentralCanvasCommandProcessor *GetCanvasCmp() { return wxStaticCast( m_cmp, a2dCentralCanvasCommandProcessor); }
02731 };
02732
02733 class A2DCANVASDLLEXP a2dCommand_SetFillColour: public a2dCommand
02734 {
02735 DECLARE_DYNAMIC_CLASS(a2dCommand_SetFillColour)
02736 public:
02737 static const a2dCommandId Id;
02738
02739 a2dCommand_SetFillColour( const wxColour& colour = *wxBLACK ): a2dCommand( true, Id )
02740 {
02741 m_value = colour;
02742 }
02743
02744 virtual a2dObject* Clone( CloneOptions options = clone_deep ) const
02745 {
02746 return new a2dCommand_SetFillColour( m_value );
02747 }
02748
02749 wxColour m_value;
02750
02751 protected:
02752
02753 bool Do(void)
02754 {
02755 a2dFill fill = GetCanvasCmp()->GetFill();
02756 wxColour old = fill.GetColour();
02757 fill.SetColour( m_value );
02758 m_value = old;
02759 return true;
02760
02761 }
02762 bool Undo(void)
02763 {
02764 return Do();
02765 }
02766
02767 inline a2dCentralCanvasCommandProcessor *GetCanvasCmp() { return wxStaticCast( m_cmp, a2dCentralCanvasCommandProcessor); }
02768
02769 };
02770
02771
02772
02773
02774
02775 class A2DCANVASDLLEXP a2dCommand_SetContourWidth: public a2dCommand
02776 {
02777 public:
02778 static const a2dCommandId Id;
02779
02780 a2dCommand_SetContourWidth( double width ): a2dCommand( true, Id )
02781 {
02782 m_value = width;
02783 }
02784
02785 virtual a2dObject* Clone( CloneOptions options = clone_deep ) const
02786 {
02787 return new a2dCommand_SetContourWidth( m_value );
02788 }
02789
02790 double m_value;
02791
02792 protected:
02793
02794 bool Do(void)
02795 {
02796 double old = GetCanvasCmp()->GetContourWidth();
02797 GetCanvasCmp()->SetContourWidth( m_value );
02798 m_value = old;
02799 return true;
02800
02801 }
02802 bool Undo(void)
02803 {
02804 return Do();
02805 }
02806
02807 inline a2dCentralCanvasCommandProcessor *GetCanvasCmp() { return wxStaticCast( m_cmp, a2dCentralCanvasCommandProcessor); }
02808
02809 };
02810
02811
02812
02813
02814
02815 class A2DCANVASDLLEXP a2dCommand_SetPathType: public a2dCommand
02816 {
02817 public:
02818 static const a2dCommandId Id;
02819
02820 a2dCommand_SetPathType( a2dPATH_END_TYPE type ): a2dCommand( true, Id )
02821 {
02822 m_pathtype = type;
02823 }
02824
02825 virtual a2dObject* Clone( CloneOptions options = clone_deep ) const
02826 {
02827 return new a2dCommand_SetPathType( m_pathtype );
02828 }
02829
02830 a2dPATH_END_TYPE m_pathtype;
02831
02832 protected:
02833
02834 bool Do(void)
02835 {
02836 a2dPATH_END_TYPE pathtype = GetCanvasCmp()->GetPathType();
02837 GetCanvasCmp()->SetPathType( m_pathtype );
02838 m_pathtype = pathtype;
02839 return true;
02840
02841 }
02842 bool Undo(void)
02843 {
02844 return Do();
02845 }
02846
02847 inline a2dCentralCanvasCommandProcessor *GetCanvasCmp() { return wxStaticCast( m_cmp, a2dCentralCanvasCommandProcessor); }
02848
02849 };
02850
02851
02852
02853
02854
02855 class A2DCANVASDLLEXP a2dCommand_Refresh: public a2dCommand
02856 {
02857 DECLARE_DYNAMIC_CLASS(a2dCommand_Refresh)
02858 public:
02859 static const a2dCommandId Id;
02860
02861 a2dCommand_Refresh(): a2dCommand( false, Id )
02862 {}
02863
02864 virtual a2dObject* Clone( CloneOptions options = clone_deep ) const
02865 {
02866 return new a2dCommand_Refresh();
02867 }
02868
02869 bool m_value;
02870
02871 protected:
02872
02873 bool Do(void)
02874 {
02875 a2dCanvasDocument* doc = GetCanvasCmp()->CheckCanvasDocument();
02876 if ( !doc )
02877 return false;
02878 doc->GetRootObject()->Update( a2dCanvasObject::updatemask_force );
02879 a2dCanvasView* drawer = GetCanvasCmp()->CheckDrawer();
02880 if ( !drawer )
02881 return false;
02882
02883 drawer->Update( a2dCANVIEW_UPDATE_OLDNEW | a2dCANVIEW_UPDATE_ALL );
02884
02885 return true;
02886
02887 }
02888 bool Undo(void)
02889 {
02890 return false;
02891 }
02892
02893 inline a2dCentralCanvasCommandProcessor *GetCanvasCmp() { return wxStaticCast( m_cmp, a2dCentralCanvasCommandProcessor); }
02894
02895 };
02896
02897
02898
02899
02900
02901 class A2DCANVASDLLEXP a2dCommand_GdsIoSaveTextAsPolygon: public a2dCommand
02902 {
02903 DECLARE_DYNAMIC_CLASS(a2dCommand_GdsIoSaveTextAsPolygon)
02904 public:
02905 static const a2dCommandId Id;
02906
02907 a2dCommand_GdsIoSaveTextAsPolygon( bool set = true ): a2dCommand( false, Id )
02908 { m_value = set; }
02909
02910 virtual a2dObject* Clone( CloneOptions options = clone_deep ) const
02911 {
02912 return new a2dCommand_GdsIoSaveTextAsPolygon( m_value );
02913 }
02914
02915 bool m_value;
02916
02917 protected:
02918
02919 bool Do(void)
02920 {
02921 const_forEachIn( a2dDocumentTemplateList, &GetCanvasCmp()->GetDocTemplates() )
02922 {
02923 a2dDocumentTemplateList::value_type temp = *iter;
02924 if (temp->IsVisible() && wxT("GDS-II") == temp->GetDescription() )
02925 {
02926 #if wxART2D_USE_GDSIO
02927 wxStaticCast( temp->GetDocumentIOHandlerStrOut(), a2dIOHandlerGDSOut )->SetSaveTextAsVpath( m_value );
02928 #endif //wxART2D_USE_GDSIO
02929 }
02930 }
02931 return true;
02932 }
02933 bool Undo(void)
02934 {
02935 return false;
02936 }
02937
02938 inline a2dCentralCanvasCommandProcessor *GetCanvasCmp() { return wxStaticCast( m_cmp, a2dCentralCanvasCommandProcessor); }
02939
02940 };
02941
02942
02943
02944
02945
02946 class A2DCANVASDLLEXP a2dCommand_KeyIoSaveTextAsPolygon: public a2dCommand
02947 {
02948 DECLARE_DYNAMIC_CLASS(a2dCommand_KeyIoSaveTextAsPolygon)
02949 public:
02950 static const a2dCommandId Id;
02951
02952 a2dCommand_KeyIoSaveTextAsPolygon( bool set = true ): a2dCommand( false, Id )
02953 { m_value = set; }
02954
02955 virtual a2dObject* Clone( CloneOptions options = clone_deep ) const
02956 {
02957 return new a2dCommand_KeyIoSaveTextAsPolygon( m_value );
02958 }
02959
02960 bool m_value;
02961
02962 protected:
02963
02964 bool Do(void)
02965 {
02966 const_forEachIn( a2dDocumentTemplateList, &GetCanvasCmp()->GetDocTemplates() )
02967 {
02968 a2dDocumentTemplateList::value_type temp = *iter;
02969 if (temp->IsVisible() && wxT("KEY") == temp->GetDescription() )
02970 {
02971 #if wxART2D_USE_KEYIO
02972 wxStaticCast( temp->GetDocumentIOHandlerStrOut(), a2dIOHandlerKeyOut )->SetSaveTextAsVpath( m_value );
02973 #endif //wxART2D_USE_KEYIO
02974 }
02975 }
02976 return true;
02977 }
02978 bool Undo(void)
02979 {
02980 return false;
02981 }
02982
02983 inline a2dCentralCanvasCommandProcessor *GetCanvasCmp() { return wxStaticCast( m_cmp, a2dCentralCanvasCommandProcessor); }
02984
02985 };
02986
02987
02988
02989
02990
02991 class A2DCANVASDLLEXP a2dCommand_ViewAsImage: public a2dCommand
02992 {
02993 DECLARE_DYNAMIC_CLASS(a2dCommand_ViewImage)
02994 public:
02995
02996
02997
02998
02999 static const a2dCommandId Id;
03000
03001 class A2DCANVASDLLEXP Args
03002 {
03003 public:
03004 Args()
03005 {
03006 argSet.file = false;
03007 argSet.btype = false;
03008 argValue.btype = wxBITMAP_TYPE_PNG;
03009 }
03010
03011 A2D_ARGUMENT_SETTER( wxFileName, file )
03012 A2D_ARGUMENT_SETTER( wxBitmapType, btype )
03013
03014 struct argValue
03015 {
03016 wxFileName file;
03017 wxBitmapType btype;
03018 } argValue;
03019
03020 struct argSet
03021 {
03022 bool file;
03023 bool btype;
03024 } argSet;
03025 };
03026
03027 a2dCommand_ViewAsImage( const Args& args = Args() ): a2dCommand( false, Id )
03028 {
03029 m_args = args;
03030 if ( args.argSet.file )
03031 m_args.file( args.argValue.file );
03032 else
03033 throw a2dCommandException( _( "file argument must be set" ) );
03034 }
03035
03036 virtual a2dObject* Clone( CloneOptions options = clone_deep ) const
03037 {
03038 return new a2dCommand_ViewAsImage( m_args );
03039 }
03040
03041 inline a2dCentralCanvasCommandProcessor *GetCanvasCmp() { return wxStaticCast( m_cmp, a2dCentralCanvasCommandProcessor); }
03042
03043 Args m_args;
03044
03045 protected:
03046
03047 virtual bool Do()
03048 {
03049 a2dCanvasDocument* doc = GetCanvasCmp()->CheckCanvasDocument();
03050 if ( !doc )
03051 return false;
03052 a2dCanvasView* drawer = GetCanvasCmp()->CheckDrawer();
03053 if ( !drawer )
03054 return false;
03055
03056 a2dPathList path;
03057 path.Add( wxT(".") );
03058 wxString foundfile = m_args.argValue.file.GetFullPath();
03059 if ( !path.ExpandPath( foundfile ) )
03060 {
03061 a2dDocviewGlobals->ReportErrorF( a2dError_CouldNotEvaluatePath, _("Could not expand %s resulted in %s"), m_args.argValue.file.GetFullPath().c_str(),foundfile.c_str() );
03062 return false;
03063 }
03064 if ( foundfile.IsEmpty() )
03065 {
03066 a2dDocviewGlobals->ReportErrorF( a2dError_NotSpecified, _("Filename %s not in %s"), foundfile.c_str(), path.GetAsString().c_str() );
03067 return false;
03068 }
03069
03070 drawer->GetDrawer2D()->GetBuffer().SaveFile( foundfile, m_args.argValue.btype, (wxPalette*)NULL );
03071
03072 return true;
03073 }
03074
03075 virtual bool Undo()
03076 {
03077 return false;
03078 }
03079 };
03080
03081
03082
03083
03084
03085 class A2DCANVASDLLEXP a2dCommand_ViewAsSvg: public a2dCommand
03086 {
03087 DECLARE_DYNAMIC_CLASS(a2dCommand_ViewAsSvg)
03088 public:
03089
03090
03091
03092
03093 static const a2dCommandId Id;
03094
03095 class A2DCANVASDLLEXP Args
03096 {
03097 public:
03098 Args()
03099 {
03100 argSet.file = false;
03101 }
03102
03103 A2D_ARGUMENT_SETTER( wxFileName, file )
03104
03105 struct argValue
03106 {
03107 wxFileName file;
03108 } argValue;
03109
03110 struct argSet
03111 {
03112 bool file;
03113 } argSet;
03114 };
03115
03116 a2dCommand_ViewAsSvg( const Args& args = Args() ): a2dCommand( false, Id )
03117 {
03118 m_args = args;
03119
03120 if ( args.argSet.file )
03121 m_args.file( args.argValue.file );
03122 else
03123 throw a2dCommandException( _( "file argument must be set" ) );
03124 }
03125
03126 virtual a2dObject* Clone( CloneOptions options = clone_deep ) const
03127 {
03128 return new a2dCommand_ViewAsSvg( m_args );
03129 }
03130
03131 inline a2dCentralCanvasCommandProcessor *GetCanvasCmp() { return wxStaticCast( m_cmp, a2dCentralCanvasCommandProcessor); }
03132
03133 Args m_args;
03134
03135 private:
03136
03137 virtual bool Do()
03138 {
03139 a2dCanvasDocument* doc = GetCanvasCmp()->CheckCanvasDocument();
03140 if ( !doc )
03141 return false;
03142 a2dCanvasView* drawer = GetCanvasCmp()->CheckDrawer();
03143 if ( !drawer )
03144 return false;
03145
03146 a2dPathList path;
03147 path.Add( wxT(".") );
03148 wxString foundfile = m_args.argValue.file.GetFullPath();
03149 if ( !path.ExpandPath( foundfile ) )
03150 {
03151 a2dDocviewGlobals->ReportErrorF( a2dError_CouldNotEvaluatePath, _("Could not expand %s resulted in %s"), m_args.argValue.file.GetFullPath().c_str(),foundfile.c_str() );
03152 return false;
03153 }
03154 if ( foundfile.IsEmpty() )
03155 {
03156 a2dDocviewGlobals->ReportErrorF( a2dError_NotSpecified, _("Filename %s not in %s"), foundfile.c_str(), path.GetAsString().c_str() );
03157 return false;
03158 }
03159
03160 doc->WriteSVG( drawer, foundfile, drawer->GetShowObject(), 10, 10, _T("cm") );
03161
03162 return true;
03163 }
03164
03165 virtual bool Undo()
03166 {
03167 return false;
03168 }
03169 };
03170
03171
03172
03173
03174
03175 class A2DCANVASDLLEXP a2dCommand_NewGroup: public a2dCommand
03176 {
03177 DECLARE_DYNAMIC_CLASS(a2dCommand_NewGroup)
03178 public:
03179
03180
03181
03182
03183 static const a2dCommandId Id;
03184
03185 class A2DCANVASDLLEXP Args
03186 {
03187 public:
03188 Args()
03189 {
03190 argSet.x = false;
03191 argSet.y = false;
03192 argSet.name = false;
03193 argSet.layer = false;
03194 argValue.x = 0;
03195 argValue.y = 0;
03196 argValue.layer = 0;
03197 }
03198
03199 A2D_ARGUMENT_SETTER( wxString, name )
03200 A2D_ARGUMENT_SETTER( wxUint16, layer )
03201 A2D_ARGUMENT_SETTER( double, x )
03202 A2D_ARGUMENT_SETTER( double, y )
03203
03204 struct argValue
03205 {
03206 wxString name;
03207 wxUint16 layer;
03208 double x;
03209 double y;
03210 } argValue;
03211
03212 struct argSet
03213 {
03214 bool name;
03215 bool layer;
03216 bool x;
03217 bool y;
03218 } argSet;
03219 };
03220
03221 a2dCommand_NewGroup( const Args& args = Args() ): a2dCommand( false, Id )
03222 {
03223 m_args = args;
03224 }
03225
03226 virtual a2dObject* Clone( CloneOptions options = clone_deep ) const
03227 {
03228 return new a2dCommand_NewGroup( m_args );
03229 }
03230
03231 inline a2dCanvasCommandProcessor *GetCanvasCmp() { return wxStaticCast( m_cmp, a2dCanvasCommandProcessor); }
03232
03233 Args m_args;
03234
03235 private:
03236
03237 virtual bool Do()
03238 {
03239 a2dCanvasDocument* doc = GetCanvasCmp()->GetCanvasDocument();
03240 if ( !doc )
03241 return false;
03242
03243 a2dCanvasView* drawer = a2dGetCmdh()->CheckDrawer();
03244 if ( !drawer )
03245 return false;
03246
03247 a2dCanvasObject* group = new a2dCanvasObject();
03248 group->CreateChildObjectList();
03249
03250 wxString groupname = m_args.argValue.name;
03251 if ( groupname.IsEmpty() )
03252 {
03253 wxTextEntryDialog getname( NULL, wxT("Give group name:"), wxT("Group name"));
03254 if ( wxID_OK == getname.ShowModal() )
03255 groupname = getname.GetValue();
03256 else
03257 groupname = wxT("Not Specified");
03258 }
03259
03260 group->SetName( groupname );
03261 group->SetLayer( m_args.argValue.layer );
03262 group->CreateChildObjectList();
03263 group->SetIgnoreLayer( true );
03264 a2dCanvasObjectReference* groupref = new a2dCanvasObjectReference( m_args.argValue.x, m_args.argValue.y, group );
03265 drawer->GetShowObject()->Prepend( groupref );
03266
03267 return true;
03268 }
03269
03270 virtual bool Undo()
03271 {
03272 return false;
03273 }
03274 };
03275
03276
03277
03278
03279
03280 class A2DCANVASDLLEXP a2dCommand_NewPin: public a2dCommand
03281 {
03282 DECLARE_DYNAMIC_CLASS(a2dCommand_NewPin)
03283 public:
03284
03285
03286
03287
03288 static const a2dCommandId Id;
03289
03290 class A2DCANVASDLLEXP Args
03291 {
03292 public:
03293 Args()
03294 {
03295 argSet.x = false;
03296 argSet.y = false;
03297 argSet.name = false;
03298 argValue.x = 0;
03299 argValue.y = 0;
03300 }
03301
03302 A2D_ARGUMENT_SETTER( wxString, name )
03303 A2D_ARGUMENT_SETTER( double, x )
03304 A2D_ARGUMENT_SETTER( double, y )
03305
03306 struct argValue
03307 {
03308 wxString name;
03309 double x;
03310 double y;
03311 } argValue;
03312
03313 struct argSet
03314 {
03315 bool name;
03316 bool x;
03317 bool y;
03318 } argSet;
03319 };
03320
03321 a2dCommand_NewPin( const Args& args = Args() ): a2dCommand( false, Id )
03322 {
03323 m_args = args;
03324 }
03325
03326 virtual a2dObject* Clone( CloneOptions options = clone_deep ) const
03327 {
03328 return new a2dCommand_NewPin( m_args );
03329 }
03330
03331 inline a2dCanvasCommandProcessor *GetCanvasCmp() { return wxStaticCast( m_cmp, a2dCanvasCommandProcessor); }
03332
03333 Args m_args;
03334
03335 private:
03336
03337 virtual bool Do()
03338 {
03339 a2dCanvasDocument* doc = GetCanvasCmp()->GetCanvasDocument();
03340 if ( !doc )
03341 return false;
03342
03343 a2dCanvasView* drawer = a2dGetCmdh()->CheckDrawer();
03344 if ( !drawer )
03345 return false;
03346
03347 if ( !m_args.argSet.name )
03348 m_args.argValue.name = wxGetTextFromUser(_("give name of new pin:"));
03349 long ang = wxGetNumberFromUser(_("Give pin angle:"), _("angle:"), _("pin angle"),0,-360,360);
03350
03351 a2dPin* pin = new a2dPin(drawer->GetShowObject(), m_args.argValue.name, a2dPinClass::Standard, m_args.argValue.x, m_args.argValue.y, ang );
03352 drawer->GetShowObject()->Prepend( pin );
03353 return true;
03354 }
03355
03356 virtual bool Undo()
03357 {
03358 return false;
03359 }
03360 };
03361
03362
03363
03364
03365
03366 class A2DCANVASDLLEXP a2dCommand_SetShowObject: public a2dCommand
03367 {
03368 DECLARE_DYNAMIC_CLASS(a2dCommand_SetShowObject)
03369
03370 public:
03371
03372
03373
03374
03375 static const a2dCommandId Id;
03376
03377 class A2DCANVASDLLEXP Args
03378 {
03379 public:
03380 Args()
03381 {
03382 argSet.canvasobject = false;
03383 argSet.index = false;
03384 argSet.selected = false;
03385 argSet.name = false;
03386 argValue.canvasobject = NULL;
03387 argValue.index = 0;
03388 argValue.selected = false;
03389 }
03390
03391 A2D_ARGUMENT_SETTER( a2dCanvasObjectPtr, canvasobject )
03392 A2D_ARGUMENT_SETTER( wxInt32, index )
03393 A2D_ARGUMENT_SETTER( wxString, name )
03394 A2D_ARGUMENT_SETTER( bool, selected )
03395
03396 struct argValue
03397 {
03398 a2dCanvasObjectPtr canvasobject;
03399 wxInt32 index;
03400 wxString name;
03401 bool selected;
03402 } argValue;
03403
03404 struct argSet
03405 {
03406 bool canvasobject;
03407 bool name;
03408 bool index;
03409 bool selected;
03410 } argSet;
03411 };
03412
03413 a2dCommand_SetShowObject( const Args& args = Args() ): a2dCommand( false, Id )
03414 {
03415 m_args = args;
03416 }
03417
03418 virtual a2dObject* Clone( CloneOptions options = clone_deep ) const
03419 {
03420 return new a2dCommand_SetShowObject( m_args );
03421 }
03422
03423 inline a2dCentralCanvasCommandProcessor *GetCanvasCmp() { return wxStaticCast( m_cmp, a2dCentralCanvasCommandProcessor); }
03424
03425 Args m_args;
03426
03427 protected:
03428
03429 virtual bool Do()
03430 {
03431 a2dCanvasDocument* doc = GetCanvasCmp()->CheckCanvasDocument();
03432 if ( !doc )
03433 return false;
03434 a2dCanvasView* drawer = GetCanvasCmp()->CheckDrawer();
03435 if ( !drawer )
03436 return false;
03437
03438 a2dCanvasObject* g = NULL;
03439 if ( m_args.argSet.index )
03440 {
03441 g = drawer->GetCanvasDocument()->Find( _T(""), _T(""), m_args.argValue.index );
03442 if ( !g )
03443 {
03444 a2dDocviewGlobals->ReportErrorF( a2dError_NotSpecified, _T("No Object with id %d in a2dCentralCanvasCommandProcessor::SetShowObject()"), m_args.argValue.index );
03445 return false;
03446 }
03447 }
03448 else if ( m_args.argSet.name )
03449 {
03450 g = drawer->GetCanvasDocument()->Find( m_args.argValue.name, _T(""), -1 );
03451 if ( !g )
03452 {
03453 a2dDocviewGlobals->ReportErrorF( a2dError_NotSpecified, _T("No Object with id %d in a2dCentralCanvasCommandProcessor::SetShowObject()"), m_args.argValue.index );
03454 return false;
03455 }
03456 }
03457 else if ( m_args.argSet.selected )
03458 g = drawer->GetShowObject()->Find( wxT(""), wxT(""), a2dCanvasOFlags::SELECTED );
03459 else if ( m_args.argSet.canvasobject )
03460 g = m_args.argValue.canvasobject;
03461
03462 if ( g )
03463 {
03464 g->SetSelected( false );
03465 g->GetChildObjectList()->SetSpecificFlags( false, a2dCanvasOFlags::SELECTED );
03466 drawer->SetShowObject( g );
03467 }
03468 GetCanvasCmp()->SetLastXyEntry( 0, 0 );
03469 return true;
03470 }
03471
03472 virtual bool Undo()
03473 {
03474 return false;
03475 }
03476 };
03477
03478
03479
03480
03481
03482 class A2DCANVASDLLEXP a2dCommand_SaveLayers: public a2dCommand
03483 {
03484 public:
03485
03486
03487
03488
03489 static const a2dCommandId Id;
03490
03491 a2dCommand_SaveLayers( const wxFileName& file ): a2dCommand( false, Id )
03492 {
03493 m_fileName = file;
03494 }
03495
03496 virtual a2dObject* Clone( CloneOptions options = clone_deep ) const
03497 {
03498 return new a2dCommand_SaveLayers( m_fileName );
03499 }
03500
03501 inline a2dCentralCanvasCommandProcessor *GetCanvasCmp() { return wxStaticCast( m_cmp, a2dCentralCanvasCommandProcessor); }
03502
03503 protected:
03504
03505 wxFileName m_fileName;
03506
03507 virtual bool Do()
03508 {
03509 a2dCanvasDocument* doc = GetCanvasCmp()->CheckCanvasDocument();
03510 if ( !doc )
03511 return false;
03512
03513 a2dPathList path;
03514 path.Add( wxT(".") );
03515 wxString foundfile = m_fileName.GetFullPath();
03516 if ( !path.ExpandPath( foundfile ) )
03517 {
03518 a2dDocviewGlobals->ReportErrorF( a2dError_CouldNotEvaluatePath, _("Could not expand %s resulted in %s"), m_fileName.GetFullPath().c_str(),foundfile.c_str() );
03519 return false;
03520 }
03521 if ( foundfile.IsEmpty() )
03522 {
03523 a2dDocviewGlobals->ReportErrorF( a2dError_NotSpecified, _("Filename %s not in %s"), foundfile.c_str(), path.GetAsString().c_str() );
03524 return false;
03525 }
03526
03527 if ( doc->GetLayerSetup() )
03528 doc->GetLayerSetup()->SaveLayers( foundfile );
03529 else
03530 a2dDocviewGlobals->ReportErrorF( a2dError_NotSpecified, _("Document does not have layer setup") );
03531
03532 return true;
03533 }
03534
03535 virtual bool Undo()
03536 {
03537 return false;
03538 }
03539 };
03540
03541
03542
03543
03544
03545 class A2DCANVASDLLEXP a2dCommand_LoadLayers: public a2dCommand
03546 {
03547 public:
03548
03549
03550
03551
03552 static const a2dCommandId Id;
03553
03554 a2dCommand_LoadLayers( const wxFileName& file ): a2dCommand( false, Id )
03555 {
03556 m_fileName = file;
03557 }
03558
03559 virtual a2dObject* Clone( CloneOptions options = clone_deep ) const
03560 {
03561 return new a2dCommand_LoadLayers( m_fileName );
03562 }
03563
03564 inline a2dCentralCanvasCommandProcessor *GetCanvasCmp() { return wxStaticCast( m_cmp, a2dCentralCanvasCommandProcessor); }
03565
03566 protected:
03567
03568 wxFileName m_fileName;
03569
03570 virtual bool Do()
03571 {
03572 a2dCanvasDocument* doc = GetCanvasCmp()->CheckCanvasDocument();
03573 if ( !doc )
03574 return false;
03575
03576 a2dPathList path;
03577 path.Add( wxT(".") );
03578 wxString foundfile = m_fileName.GetFullPath();
03579 if ( !path.ExpandPath( foundfile ) )
03580 {
03581 a2dDocviewGlobals->ReportErrorF( a2dError_CouldNotEvaluatePath, _("Could not expand %s resulted in %s"), m_fileName.GetFullPath().c_str(),foundfile.c_str() );
03582 return false;
03583 }
03584 if ( foundfile.IsEmpty() )
03585 {
03586 a2dDocviewGlobals->ReportErrorF( a2dError_NotSpecified, _("Filename %s not in %s"), foundfile.c_str(), path.GetAsString().c_str() );
03587 return false;
03588 }
03589
03590 #if wxUSE_STD_IOSTREAM
03591 a2dDocumentFileInputStream store( foundfile.mb_str() );
03592 if (store.fail() || store.bad())
03593 {
03594 a2dDocviewGlobals->ReportErrorF( a2dError_FileCouldNotOpen, _("Sorry, could not open file %s for import"), foundfile.c_str() );
03595 return false;
03596 }
03597 #else
03598 wxFileInputStream storeUnbuf( foundfile );
03599 if ( !storeUnbuf.Ok() )
03600 {
03601 a2dDocviewGlobals->ReportErrorF( a2dError_FileCouldNotOpen, _("Sorry, could not open file %s for import"), foundfile.c_str() );
03602 return false;
03603 }
03604 wxBufferedInputStream store( storeUnbuf );
03605 #endif
03606
03607 #if wxART2D_USE_CVGIO
03608
03609 a2dIOHandlerCVGIn* handler = new a2dIOHandlerCVGIn();
03610 a2dLayers* layersetup = new a2dLayers();
03611 handler->LoadLayers( store, layersetup );
03612
03613 delete handler;
03614 #else
03615 wxFAIL_MSG( wxT("wxART2D_USE_CVGIO is needed to load object from a file CVG file") );
03616 #endif //wxART2D_USE_CVGIO
03617
03618 doc->SetLayerSetup( layersetup );
03619 return true;
03620 }
03621
03622 virtual bool Undo()
03623 {
03624 return false;
03625 }
03626 };
03627
03628
03629
03630
03631
03632 class A2DCANVASDLLEXP a2dCommand_SetCursor: public a2dCommand
03633 {
03634 DECLARE_DYNAMIC_CLASS(a2dCommand_SetCursor)
03635
03636 public:
03637 static const a2dCommandId Id;
03638
03639
03640 class A2DCANVASDLLEXP Args
03641 {
03642 public:
03643 Args()
03644 {
03645 argValue.x = 0;
03646 argValue.y = 0;
03647 argValue.polar = false;
03648 argValue.relative = false;
03649 argValue.snapped = false;
03650
03651 argSet.x = false;
03652 argSet.y = false;
03653 argSet.polar = false;
03654 argSet.relative = false;
03655 argSet.snapped = false;
03656 }
03657
03658 A2D_ARGUMENT_SETTER( double, x )
03659 A2D_ARGUMENT_SETTER( double, y )
03660 A2D_ARGUMENT_SETTER( bool, polar )
03661 A2D_ARGUMENT_SETTER( bool, relative )
03662 A2D_ARGUMENT_SETTER( bool, snapped )
03663
03664 struct argValue
03665 {
03666 double x;
03667 double y;
03668 bool polar;
03669 bool relative;
03670 bool snapped;
03671 } argValue;
03672
03673 struct argSet
03674 {
03675 bool x;
03676 bool y;
03677 bool polar;
03678 bool relative;
03679 bool snapped;
03680 } argSet;
03681 };
03682
03683 a2dCommand_SetCursor( const Args& args = Args() ): a2dCommand( false, Id )
03684 {
03685 m_args = args;
03686 }
03687
03688 a2dCommand_SetCursor( double x, double y ): a2dCommand( true, Id )
03689 {
03690 m_args.x( x );
03691 m_args.y( y );
03692 }
03693
03694 virtual a2dObject* Clone( CloneOptions options = clone_deep ) const
03695 {
03696 return new a2dCommand_SetCursor( m_args );
03697 }
03698
03699 bool Do(void)
03700 {
03701 a2dCanvasDocument* doc = GetCanvasCmp()->CheckCanvasDocument();
03702 if ( !doc )
03703 return false;
03704 a2dCanvasView* drawer = GetCanvasCmp()->CheckDrawer();
03705 if ( !drawer )
03706 return false;
03707
03708 double x = m_args.argValue.x;
03709 double y = m_args.argValue.y;
03710
03711
03712 m_xold = GetCanvasCmp()->GetLastXEntry();
03713 m_yold = GetCanvasCmp()->GetLastYEntry();
03714
03715
03716 if ( m_args.argValue.relative )
03717 {
03718 if ( m_args.argValue.polar )
03719 {
03720 double radius = y;
03721 double ang = x;
03722
03723 x = m_xold + radius * cos( wxDegToRad(ang) );
03724 y = m_yold + radius * sin( wxDegToRad(ang) );
03725 }
03726 else
03727 {
03728 x += m_xold;
03729 y += m_yold;
03730 }
03731 }
03732 else
03733 {
03734 if ( m_args.argValue.polar )
03735 {
03736 double radius = y;
03737 double ang = x;
03738
03739 x = radius * cos( wxDegToRad(ang) );
03740 y = radius * sin( wxDegToRad(ang) );
03741 }
03742 }
03743
03744
03745 int dx = drawer->GetDrawer2D()->WorldToDeviceX(x);
03746 int dy = drawer->GetDrawer2D()->WorldToDeviceY(y);
03747 drawer->GetDisplayWindow()->WarpPointer( dx, dy );
03748 GetCanvasCmp()->SetLastXyEntry( x, y );
03749
03750 return true;
03751 }
03752 bool Undo(void)
03753 {
03754 a2dCanvasDocument* doc = GetCanvasCmp()->CheckCanvasDocument();
03755 if ( !doc )
03756 return false;
03757 a2dCanvasView* drawer = GetCanvasCmp()->CheckDrawer();
03758 if ( !drawer )
03759 return false;
03760
03761 int dx = drawer->GetDrawer2D()->WorldToDeviceX( m_xold );
03762 int dy = drawer->GetDrawer2D()->WorldToDeviceY( m_yold );
03763 drawer->GetDisplayWindow()->WarpPointer( dx, dy );
03764 return true;
03765 }
03766 inline a2dCentralCanvasCommandProcessor *GetCanvasCmp() { return wxStaticCast( m_cmp, a2dCentralCanvasCommandProcessor); }
03767
03768 Args m_args;
03769 double m_xold,m_yold;
03770 };
03771
03772
03773
03774
03775
03776
03777
03778 class A2DCANVASDLLEXP a2dCommand_SetRelativeStart: public a2dCommand
03779 {
03780 DECLARE_DYNAMIC_CLASS(a2dCommand_SetRelativeStart)
03781 public:
03782 static const a2dCommandId Id;
03783
03784 a2dCommand_SetRelativeStart( double x = 0, double y = 0 ): a2dCommand( true, Id )
03785 { m_x = x; m_y = y; }
03786
03787 double m_x;
03788 double m_y;
03789
03790 protected:
03791
03792 bool Do(void)
03793 {
03794 double x = GetCanvasCmp()->GetRelativeStartX();
03795 double y = GetCanvasCmp()->GetRelativeStartY();
03796
03797 GetCanvasCmp()->SetRelativeStart( m_x, m_y );
03798 m_x = x;
03799 m_y = y;
03800 return true;
03801 }
03802 bool Undo(void)
03803 {
03804 return Do();
03805 }
03806
03807 inline a2dCentralCanvasCommandProcessor *GetCanvasCmp() { return wxStaticCast( m_cmp, a2dCentralCanvasCommandProcessor); }
03808 };
03809
03810
03811
03812
03813
03814
03815
03816 class A2DCANVASDLLEXP a2dCommand_AddMeasurement: public a2dCommand
03817 {
03818 DECLARE_DYNAMIC_CLASS(a2dCommand_AddMeasurement)
03819 public:
03820 static const a2dCommandId Id;
03821
03822 a2dCommand_AddMeasurement( double x = 0, double y = 0 ): a2dCommand( true, Id )
03823 { m_x = x; m_y = y; }
03824
03825 double m_x;
03826 double m_y;
03827
03828 protected:
03829
03830 bool Do(void)
03831 {
03832
03833 return true;
03834 }
03835 bool Undo(void)
03836 {
03837 return Do();
03838 }
03839 };
03840
03841
03842
03843
03844
03845
03846
03847 class A2DCANVASDLLEXP a2dCommand_ClearMeasurements: public a2dCommand
03848 {
03849 DECLARE_DYNAMIC_CLASS(a2dCommand_ClearMeasurements)
03850 public:
03851 static const a2dCommandId Id;
03852
03853 a2dCommand_ClearMeasurements(): a2dCommand( true, Id )
03854 {}
03855
03856 protected:
03857
03858 bool Do(void)
03859 {
03860
03861 return true;
03862 }
03863 bool Undo(void)
03864 {
03865 return Do();
03866 }
03867 };
03868
03869
03870
03871
03872
03873 class A2DCANVASDLLEXP a2dCommand_PushInto: public a2dCommand
03874 {
03875 DECLARE_DYNAMIC_CLASS(a2dCommand_PushInto)
03876 public:
03877
03878
03879
03880
03881 static const a2dCommandId Id;
03882
03883 class A2DCANVASDLLEXP Args
03884 {
03885 public:
03886 Args()
03887 {
03888 argSet.canvasobject = false;
03889 argSet.name = false;
03890 argSet.selected = false;
03891 argValue.selected = false;
03892 argValue.canvasobject = NULL;
03893 }
03894
03895 A2D_ARGUMENT_SETTER( a2dCanvasObjectPtr, canvasobject )
03896 A2D_ARGUMENT_SETTER( wxString, name )
03897 A2D_ARGUMENT_SETTER( bool, selected )
03898
03899 struct argValue
03900 {
03901 a2dCanvasObjectPtr canvasobject;
03902 wxString name;
03903 bool selected;
03904 } argValue;
03905
03906 struct argSet
03907 {
03908 bool canvasobject;
03909 bool name;
03910 bool selected;
03911 } argSet;
03912 };
03913
03914 a2dCommand_PushInto( const Args& args = Args() ): a2dCommand( true, Id )
03915 {
03916 m_args = args;
03917 }
03918
03919 virtual a2dObject* Clone( CloneOptions options = clone_deep ) const
03920 {
03921 return new a2dCommand_PushInto( m_args );
03922 }
03923
03924 inline a2dCanvasCommandProcessor *GetCanvasCmp() { return wxStaticCast( m_cmp, a2dCanvasCommandProcessor); }
03925
03926 Args m_args;
03927
03928 private:
03929
03930 virtual bool Do()
03931 {
03932 a2dCanvasDocument* doc = GetCanvasCmp()->GetCanvasDocument();
03933 if ( !doc )
03934 return false;
03935 a2dCanvasView* drawer = a2dGetCmdh()->CheckDrawer();
03936 if ( !drawer )
03937 return false;
03938
03939 if ( m_args.argSet.name )
03940 m_pushIn = drawer->GetShowObject()->Find( m_args.argValue.name );
03941 else if ( m_args.argSet.selected )
03942 m_pushIn = drawer->GetShowObject()->Find( wxT(""), wxT(""), a2dCanvasOFlags::SELECTED );
03943 else if ( m_args.argSet.canvasobject )
03944 m_pushIn = m_args.argValue.canvasobject;
03945
03946 a2dCanvasObjectReference* obj = wxDynamicCast( m_pushIn.Get(), a2dCanvasObjectReference );
03947 if ( obj )
03948 m_pushIn = obj->GetCanvasObject();
03949
03950 if (m_pushIn)
03951 {
03952 m_previous = drawer->GetShowObject();
03953
03954 if ( doc->GetRootObject() != m_pushIn->GetCanvasDocument()->GetRootObject() )
03955 drawer->SetDocument(m_pushIn->GetCanvasDocument());
03956 m_pushIn->SetSelected( false );
03957 m_pushIn->GetChildObjectList()->SetSpecificFlags( false, a2dCanvasOFlags::SELECTED );
03958 drawer->SetShowObject( m_pushIn );
03959 }
03960 else
03961 (void)wxMessageBox( _("Does not contain a group, unable to push into"), _("push into"), wxICON_INFORMATION | wxOK );
03962
03963 return true;
03964 }
03965
03966 virtual bool Undo()
03967 {
03968 a2dCanvasDocument* doc = GetCanvasCmp()->GetCanvasDocument();
03969 if ( !doc )
03970 return false;
03971 a2dCanvasView* drawer = a2dGetCmdh()->CheckDrawer();
03972 if ( !drawer )
03973 return false;
03974
03975 if (m_pushIn)
03976 {
03977
03978 if ( doc->GetRootObject() != m_previous->GetCanvasDocument()->GetRootObject() )
03979 drawer->SetDocument( m_previous->GetCanvasDocument() );
03980 m_previous->SetSelected( false );
03981 m_previous->GetChildObjectList()->SetSpecificFlags( false, a2dCanvasOFlags::SELECTED );
03982 drawer->SetShowObject( m_previous );
03983 m_pushIn = m_previous;
03984 m_previous = 0;
03985 return true;
03986 }
03987 return false;
03988 }
03989
03990 a2dCanvasObjectPtr m_previous;
03991 a2dCanvasObjectPtr m_pushIn;
03992 };
03993
03994
03995
03996
03997
03998 class A2DCANVASDLLEXP a2dCommand_KeyIoSaveFromView: public a2dCommand
03999 {
04000 DECLARE_DYNAMIC_CLASS(a2dCommand_KeyIoSaveTextAsPolygon)
04001 public:
04002 static const a2dCommandId Id;
04003
04004 a2dCommand_KeyIoSaveFromView( bool set = true ): a2dCommand( false, Id )
04005 { m_value = set; }
04006
04007 virtual a2dObject* Clone( CloneOptions options = clone_deep ) const
04008 {
04009 return new a2dCommand_KeyIoSaveFromView( m_value );
04010 }
04011
04012 bool m_value;
04013
04014 protected:
04015
04016 bool Do(void)
04017 {
04018 const_forEachIn( a2dDocumentTemplateList, &GetCanvasCmp()->GetDocTemplates() )
04019 {
04020 a2dDocumentTemplateList::value_type temp = *iter;
04021 if (temp->IsVisible() && wxT("KEY") == temp->GetDescription() )
04022 {
04023 #if wxART2D_USE_KEYIO
04024 a2dIOHandlerKeyOut* handler = wxStaticCast( temp->GetDocumentIOHandlerStrOut(), a2dIOHandlerKeyOut );
04025 bool currentSetting = handler->GetFromViewAsTop();
04026 handler->SetFromViewAsTop( m_value );
04027 m_value = currentSetting;
04028 #endif //wxART2D_USE_KEYIO
04029 }
04030 }
04031 return true;
04032 }
04033 bool Undo(void)
04034 {
04035 return Do();
04036 }
04037
04038 inline a2dCentralCanvasCommandProcessor *GetCanvasCmp() { return wxStaticCast( m_cmp, a2dCentralCanvasCommandProcessor); }
04039
04040 };
04041
04042
04043
04044
04045
04046 class A2DCANVASDLLEXP a2dCommand_GdsIoSaveFromView: public a2dCommand
04047 {
04048 DECLARE_DYNAMIC_CLASS(a2dCommand_GdsIoSaveFromView)
04049 public:
04050 static const a2dCommandId Id;
04051
04052 a2dCommand_GdsIoSaveFromView( bool set = true ): a2dCommand( false, Id )
04053 { m_value = set; }
04054
04055 virtual a2dObject* Clone( CloneOptions options = clone_deep ) const
04056 {
04057 return new a2dCommand_GdsIoSaveFromView( m_value );
04058 }
04059
04060 bool m_value;
04061
04062 protected:
04063
04064 bool Do(void)
04065 {
04066 const_forEachIn( a2dDocumentTemplateList, &GetCanvasCmp()->GetDocTemplates() )
04067 {
04068 a2dDocumentTemplateList::value_type temp = *iter;
04069 if (temp->IsVisible() && wxT("GDS-II") == temp->GetDescription() )
04070 {
04071 #if wxART2D_USE_GDSIO
04072 a2dIOHandlerGDSOut* handler = wxStaticCast( temp->GetDocumentIOHandlerStrOut(), a2dIOHandlerGDSOut );
04073 bool currentSetting = handler->GetFromViewAsTop();
04074 handler->SetFromViewAsTop( m_value );
04075 m_value = currentSetting;
04076 #endif //wxART2D_USE_GDSIO
04077 }
04078 }
04079 return true;
04080 }
04081 bool Undo(void)
04082 {
04083 return Do();
04084 }
04085
04086 inline a2dCentralCanvasCommandProcessor *GetCanvasCmp() { return wxStaticCast( m_cmp, a2dCentralCanvasCommandProcessor); }
04087
04088 };
04089
04090
04091
04092
04093
04094 class A2DCANVASDLLEXP a2dCommand_SetLayerMask: public a2dCommand
04095 {
04096 DECLARE_DYNAMIC_CLASS(a2dCommand_SetLayerMask)
04097 public:
04098 static const a2dCommandId Id;
04099
04100 a2dCommand_SetLayerMask( long set = -1, a2dCanvasObjectFlagsMask mask = a2dCanvasOFlags::SELECTED, a2dCanvasObject* parent = NULL ): a2dCommand( true, Id )
04101 {
04102 m_parent = parent;
04103 m_layer = set;
04104 m_mask = mask;
04105 m_objects = wxNullCanvasObjectList;
04106 }
04107
04108 ~a2dCommand_SetLayerMask()
04109 {
04110 if ( m_objects != wxNullCanvasObjectList )
04111 delete m_objects;
04112 }
04113
04114 virtual a2dObject* Clone( CloneOptions options = clone_deep ) const
04115 {
04116 return new a2dCommand_SetLayerMask( m_layer, m_mask, m_parent );
04117 }
04118
04119 bool Do(void);
04120
04121 bool Undo(void);
04122
04123 inline a2dCanvasCommandProcessor *GetCanvasCmp() { return wxStaticCast( m_cmp, a2dCanvasCommandProcessor); }
04124
04125 long m_layer;
04126 a2dCanvasObjectFlagsMask m_mask;
04127 a2dCanvasObjectPtr m_parent;
04128 a2dCanvasObjectList* m_objects;
04129 a2dLayerGroup m_objectOldLayers;
04130
04131 };
04132
04133
04134
04135
04136
04137 class A2DCANVASDLLEXP a2dCommand_DeleteMask: public a2dCommand
04138 {
04139 DECLARE_DYNAMIC_CLASS(a2dCommand_DeleteMask)
04140 public:
04141 static const a2dCommandId Id;
04142
04143 a2dCommand_DeleteMask( a2dCanvasObjectFlagsMask mask = a2dCanvasOFlags::SELECTED, a2dCanvasObject* parent = NULL): a2dCommand( true, Id )
04144 {
04145 m_parent = parent;
04146 m_mask = mask;
04147 m_objects = wxNullCanvasObjectList;
04148 }
04149
04150 virtual a2dObject* Clone( CloneOptions options = clone_deep ) const
04151 {
04152 return new a2dCommand_DeleteMask( m_mask, m_parent );
04153 }
04154
04155 ~a2dCommand_DeleteMask()
04156 {
04157 if ( m_objects != wxNullCanvasObjectList )
04158 delete m_objects;
04159 }
04160
04161 bool Do(void);
04162
04163 bool Undo(void);
04164
04165 inline a2dCanvasCommandProcessor *GetCanvasCmp() { return wxStaticCast( m_cmp, a2dCanvasCommandProcessor); }
04166
04167 a2dCanvasObjectFlagsMask m_mask;
04168 a2dCanvasObjectPtr m_parent;
04169 a2dCanvasObjectList* m_objects;
04170 a2dlist< long > m_objectsIndex;
04171 };
04172
04173
04174
04175
04176
04177 class A2DCANVASDLLEXP a2dCommand_ToTopMask: public a2dCommand
04178 {
04179 DECLARE_DYNAMIC_CLASS(a2dCommand_ToTopMask)
04180 public:
04181 static const a2dCommandId Id;
04182
04183 a2dCommand_ToTopMask( a2dCanvasObjectFlagsMask mask = a2dCanvasOFlags::SELECTED, a2dCanvasObject* parent = NULL ): a2dCommand( true, Id )
04184 {
04185 m_parent = parent;
04186 m_mask = mask;
04187 m_objects = wxNullCanvasObjectList;
04188 }
04189
04190 virtual a2dObject* Clone( CloneOptions options = clone_deep ) const
04191 {
04192 return new a2dCommand_ToTopMask( m_mask, m_parent );
04193 }
04194
04195 ~a2dCommand_ToTopMask()
04196 {
04197 if ( m_objects != wxNullCanvasObjectList )
04198 delete m_objects;
04199 }
04200
04201 bool Do(void);
04202
04203 bool Undo(void);
04204
04205 inline a2dCanvasCommandProcessor *GetCanvasCmp() { return wxStaticCast( m_cmp, a2dCanvasCommandProcessor); }
04206
04207 a2dCanvasObjectFlagsMask m_mask;
04208 a2dCanvasObjectPtr m_parent;
04209 a2dCanvasObjectList* m_objects;
04210 a2dlist< long > m_objectsIndex;
04211 };
04212
04213
04214
04215
04216
04217 class A2DCANVASDLLEXP a2dCommand_ToBackMask: public a2dCommand
04218 {
04219 DECLARE_DYNAMIC_CLASS(a2dCommand_ToBackMask)
04220 public:
04221 static const a2dCommandId Id;
04222
04223 a2dCommand_ToBackMask( a2dCanvasObjectFlagsMask mask = a2dCanvasOFlags::SELECTED, a2dCanvasObject* parent = NULL ): a2dCommand( true, Id )
04224 {
04225 m_parent = parent;
04226 m_mask = mask;
04227 m_objects = wxNullCanvasObjectList;
04228 }
04229
04230 virtual a2dObject* Clone( CloneOptions options = clone_deep ) const
04231 {
04232 return new a2dCommand_ToBackMask( m_mask, m_parent );
04233 }
04234
04235 ~a2dCommand_ToBackMask()
04236 {
04237 if ( m_objects != wxNullCanvasObjectList )
04238 delete m_objects;
04239 }
04240
04241 bool Do(void);
04242
04243 bool Undo(void);
04244
04245 inline a2dCanvasCommandProcessor *GetCanvasCmp() { return wxStaticCast( m_cmp, a2dCanvasCommandProcessor); }
04246
04247 a2dCanvasObjectFlagsMask m_mask;
04248 a2dCanvasObjectPtr m_parent;
04249 a2dCanvasObjectList* m_objects;
04250 a2dlist< long > m_objectsIndex;
04251 };
04252
04253
04254
04255
04256
04257 class A2DCANVASDLLEXP a2dCommand_CopyMask: public a2dCommand
04258 {
04259 DECLARE_DYNAMIC_CLASS(a2dCommand_CopyMask)
04260 public:
04261 static const a2dCommandId Id;
04262
04263 a2dCommand_CopyMask( double x = 0, double y = 0, long target = -1, bool toTarget = false, a2dCanvasObjectFlagsMask mask = a2dCanvasOFlags::SELECTED, a2dCanvasObject* parent = NULL ): a2dCommand( true, Id )
04264 {
04265 m_parent = parent;
04266 m_mask = mask;
04267 m_x = x;
04268 m_y = y;
04269 m_target = target;
04270 m_toTarget = toTarget;
04271 m_objects = wxNullCanvasObjectList;
04272 }
04273
04274 virtual a2dObject* Clone( CloneOptions options = clone_deep ) const
04275 {
04276 return new a2dCommand_CopyMask( m_x, m_y, m_target, m_toTarget, m_mask, m_parent );
04277 }
04278
04279 ~a2dCommand_CopyMask()
04280 {
04281 if ( m_objects != wxNullCanvasObjectList )
04282 delete m_objects;
04283 }
04284
04285 bool Do(void);
04286
04287 bool Undo(void);
04288
04289 inline a2dCanvasCommandProcessor *GetCanvasCmp() { return wxStaticCast( m_cmp, a2dCanvasCommandProcessor); }
04290
04291 double m_x, m_y;
04292 long m_target;
04293 bool m_toTarget;
04294 a2dCanvasObjectFlagsMask m_mask;
04295 a2dCanvasObjectPtr m_parent;
04296 a2dCanvasObjectList* m_objects;
04297 };
04298
04299
04300
04301
04302
04303 class A2DCANVASDLLEXP a2dCommand_MoveMask: public a2dCommand
04304 {
04305 DECLARE_DYNAMIC_CLASS(a2dCommand_MoveMask)
04306 public:
04307 static const a2dCommandId Id;
04308
04309 a2dCommand_MoveMask( double x = 0, double y = 0, long target = -1, bool toTarget = false, a2dCanvasObjectFlagsMask mask = a2dCanvasOFlags::SELECTED, a2dCanvasObject* parent = NULL ): a2dCommand( true, Id )
04310 {
04311 m_parent = parent;
04312 m_mask = mask;
04313 m_x = x;
04314 m_y = y;
04315 m_target = target;
04316 m_toTarget = toTarget;
04317 m_objects = wxNullCanvasObjectList;
04318 }
04319
04320 virtual a2dObject* Clone( CloneOptions options = clone_deep ) const
04321 {
04322 return new a2dCommand_MoveMask( m_x, m_y, m_target, m_toTarget, m_mask, m_parent );
04323 }
04324
04325 ~a2dCommand_MoveMask()
04326 {
04327 if ( m_objects != wxNullCanvasObjectList )
04328 delete m_objects;
04329 }
04330
04331 bool Do(void);
04332
04333 bool Undo(void);
04334
04335 inline a2dCanvasCommandProcessor *GetCanvasCmp() { return wxStaticCast( m_cmp, a2dCanvasCommandProcessor); }
04336
04337 double m_x, m_y;
04338 long m_target;
04339 bool m_toTarget;
04340 a2dCanvasObjectFlagsMask m_mask;
04341 a2dCanvasObjectPtr m_parent;
04342 a2dCanvasObjectList* m_objects;
04343 a2dLayerGroup m_objectOldLayers;
04344 };
04345
04346
04347
04348
04349
04350 class A2DCANVASDLLEXP a2dCommand_GroupMask: public a2dCommand
04351 {
04352 DECLARE_DYNAMIC_CLASS(a2dCommand_GroupMask)
04353 public:
04354 static const a2dCommandId Id;
04355
04356 a2dCommand_GroupMask( const wxString& name = wxEmptyString, a2dCanvasObjectFlagsMask mask = a2dCanvasOFlags::SELECTED, a2dCanvasObject* parent = NULL ): a2dCommand( true, Id )
04357 {
04358 m_name = name;
04359 m_parent = parent;
04360 m_mask = mask;
04361 m_objects = wxNullCanvasObjectList;
04362 }
04363
04364 virtual a2dObject* Clone( CloneOptions options = clone_deep ) const
04365 {
04366 return new a2dCommand_GroupMask( m_name, m_mask, m_parent );
04367 }
04368
04369 ~a2dCommand_GroupMask()
04370 {
04371 if ( m_objects != wxNullCanvasObjectList )
04372 delete m_objects;
04373 }
04374
04375 bool Do(void);
04376
04377 bool Undo(void);
04378
04379 inline a2dCanvasCommandProcessor *GetCanvasCmp() { return wxStaticCast( m_cmp, a2dCanvasCommandProcessor); }
04380
04381 wxString m_name;
04382 a2dCanvasObjectFlagsMask m_mask;
04383 a2dCanvasObjectPtr m_parent;
04384 a2dCanvasObjectList* m_objects;
04385 a2dCanvasObjectPtr m_groupobject;
04386 a2dlist< long > m_objectsIndex;
04387 };
04388
04389
04390
04391
04392
04393 class A2DCANVASDLLEXP a2dCommand_UnGroupMask: public a2dCommand
04394 {
04395 DECLARE_DYNAMIC_CLASS(a2dCommand_UnGroupMask)
04396 public:
04397 static const a2dCommandId Id;
04398
04399 a2dCommand_UnGroupMask( bool deep = false, a2dCanvasObjectFlagsMask mask = a2dCanvasOFlags::SELECTED, a2dCanvasObject* parent = NULL ): a2dCommand( true, Id )
04400 {
04401 m_parent = parent;
04402 m_mask = mask;
04403 m_deep = deep;
04404 m_objects = wxNullCanvasObjectList;
04405 }
04406
04407 virtual a2dObject* Clone( CloneOptions options = clone_deep ) const
04408 {
04409 return new a2dCommand_UnGroupMask( m_deep, m_mask, m_parent );
04410 }
04411
04412 ~a2dCommand_UnGroupMask()
04413 {
04414 if ( m_objects != wxNullCanvasObjectList )
04415 delete m_objects;
04416 }
04417
04418 bool Do(void);
04419
04420 bool Undo(void);
04421
04422 inline a2dCanvasCommandProcessor *GetCanvasCmp() { return wxStaticCast( m_cmp, a2dCanvasCommandProcessor); }
04423
04424 a2dCanvasObjectFlagsMask m_mask;
04425 bool m_deep;
04426 a2dCanvasObjectPtr m_parent;
04427 a2dCanvasObjectList* m_objects;
04428 a2dlist< long > m_objectsIndex;
04429 };
04430
04431
04432
04433
04434
04435 class A2DCANVASDLLEXP a2dCommand_MergeMask: public a2dCommand
04436 {
04437 DECLARE_DYNAMIC_CLASS(a2dCommand_MergeMask)
04438 public:
04439 static const a2dCommandId Id;
04440
04441 a2dCommand_MergeMask( a2dCanvasObjectFlagsMask mask = a2dCanvasOFlags::SELECTED,
04442 long target = -1, bool layerFirstObject = false, bool clearorg = true,
04443 int depth = 20, a2dCanvasObject* parent = NULL ): a2dCommand( true, Id )
04444 {
04445 m_parent = parent;
04446 m_mask = mask;
04447 m_takeLayerFirstObject = layerFirstObject;
04448 m_target = target;
04449 m_clearorg = clearorg;
04450 m_depth = depth;
04451 m_objects = wxNullCanvasObjectList;
04452 m_mergedObjects = wxNullCanvasObjectList;
04453 }
04454
04455 virtual a2dObject* Clone( CloneOptions options = clone_deep ) const
04456 {
04457 return new a2dCommand_MergeMask( m_mask, m_target, m_takeLayerFirstObject, m_clearorg, m_depth, m_parent );
04458 }
04459
04460 ~a2dCommand_MergeMask()
04461 {
04462 if ( m_objects != wxNullCanvasObjectList )
04463 delete m_objects;
04464 if ( m_mergedObjects != wxNullCanvasObjectList )
04465 delete m_mergedObjects;
04466 }
04467
04468 bool Do(void);
04469
04470 bool Undo(void);
04471
04472 inline a2dCanvasCommandProcessor *GetCanvasCmp() { return wxStaticCast( m_cmp, a2dCanvasCommandProcessor); }
04473
04474 long m_target;
04475 bool m_takeLayerFirstObject;
04476 bool m_clearorg;
04477 int m_depth;
04478 a2dCanvasObjectFlagsMask m_mask;
04479 a2dCanvasObjectPtr m_parent;
04480 a2dCanvasObjectList* m_objects;
04481 a2dCanvasObjectList* m_mergedObjects;
04482 a2dlist< long > m_objectsIndex;
04483 };
04484
04485
04486
04487
04488
04489 class A2DCANVASDLLEXP a2dCommand_OffsetMask: public a2dCommand
04490 {
04491 DECLARE_DYNAMIC_CLASS(a2dCommand_OffsetMask)
04492 public:
04493 static const a2dCommandId Id;
04494
04495 a2dCommand_OffsetMask( a2dCanvasObjectFlagsMask mask = a2dCanvasOFlags::SELECTED,
04496 long target = -1, bool layerFirstObject = false, bool clearorg = true,
04497 int depth = 20, a2dCanvasObject* parent = NULL ): a2dCommand( true, Id )
04498 {
04499 m_parent = parent;
04500 m_mask = mask;
04501 m_takeLayerFirstObject = layerFirstObject;
04502 m_target = target;
04503 m_clearorg = clearorg;
04504 m_depth = depth;
04505 m_objects = wxNullCanvasObjectList;
04506 m_offsetObjects = wxNullCanvasObjectList;
04507 }
04508
04509 virtual a2dObject* Clone( CloneOptions options = clone_deep ) const
04510 {
04511 return new a2dCommand_OffsetMask( m_mask, m_target, m_takeLayerFirstObject, m_clearorg, m_depth, m_parent );
04512 }
04513
04514 ~a2dCommand_OffsetMask()
04515 {
04516 if ( m_objects != wxNullCanvasObjectList )
04517 delete m_objects;
04518 if ( m_offsetObjects != wxNullCanvasObjectList )
04519 delete m_offsetObjects;
04520 }
04521
04522 bool Do(void);
04523
04524 bool Undo(void);
04525
04526 inline a2dCanvasCommandProcessor *GetCanvasCmp() { return wxStaticCast( m_cmp, a2dCanvasCommandProcessor); }
04527
04528 long m_target;
04529 bool m_takeLayerFirstObject;
04530 bool m_clearorg;
04531 int m_depth;
04532 a2dCanvasObjectFlagsMask m_mask;
04533 a2dCanvasObjectPtr m_parent;
04534 a2dCanvasObjectList* m_objects;
04535 a2dCanvasObjectList* m_offsetObjects;
04536 a2dlist< long > m_objectsIndex;
04537 };
04538
04539
04540
04541
04542
04543 class A2DCANVASDLLEXP a2dCommand_PolygonToSurfaceMask: public a2dCommand
04544 {
04545 DECLARE_DYNAMIC_CLASS(a2dCommand_PolygonToSurfaceMask)
04546 public:
04547 static const a2dCommandId Id;
04548
04549 a2dCommand_PolygonToSurfaceMask( a2dCanvasObjectFlagsMask mask = a2dCanvasOFlags::SELECTED,
04550 long target = -1, bool layerFirstObject = false, bool clearorg = true,
04551 int depth = 20, a2dCanvasObject* parent = NULL ): a2dCommand( true, Id )
04552 {
04553 m_parent = parent;
04554 m_mask = mask;
04555 m_takeLayerFirstObject = layerFirstObject;
04556 m_target = target;
04557 m_clearorg = clearorg;
04558 m_depth = depth;
04559 m_objects = wxNullCanvasObjectList;
04560 m_offsetObjects = wxNullCanvasObjectList;
04561 }
04562
04563 virtual a2dObject* Clone( CloneOptions options = clone_deep ) const
04564 {
04565 return new a2dCommand_PolygonToSurfaceMask( m_mask, m_target, m_takeLayerFirstObject, m_clearorg, m_depth, m_parent );
04566 }
04567
04568 ~a2dCommand_PolygonToSurfaceMask()
04569 {
04570 if ( m_objects != wxNullCanvasObjectList )
04571 delete m_objects;
04572 if ( m_offsetObjects != wxNullCanvasObjectList )
04573 delete m_offsetObjects;
04574 }
04575
04576 bool Do(void);
04577
04578 bool Undo(void);
04579
04580 inline a2dCanvasCommandProcessor *GetCanvasCmp() { return wxStaticCast( m_cmp, a2dCanvasCommandProcessor); }
04581
04582 long m_target;
04583 bool m_takeLayerFirstObject;
04584 bool m_clearorg;
04585 int m_depth;
04586 a2dCanvasObjectFlagsMask m_mask;
04587 a2dCanvasObjectPtr m_parent;
04588 a2dCanvasObjectList* m_objects;
04589 a2dCanvasObjectList* m_offsetObjects;
04590 a2dlist< long > m_objectsIndex;
04591 };
04592
04593
04594
04595
04596
04597 class A2DCANVASDLLEXP a2dCommand_SurfaceToPolygonMask: public a2dCommand
04598 {
04599 DECLARE_DYNAMIC_CLASS(a2dCommand_SurfaceToPolygonMask)
04600 public:
04601 static const a2dCommandId Id;
04602
04603 a2dCommand_SurfaceToPolygonMask( a2dCanvasObjectFlagsMask mask = a2dCanvasOFlags::SELECTED,
04604 long target = -1, bool layerFirstObject = false, bool clearorg = true,
04605 int depth = 20, a2dCanvasObject* parent = NULL ): a2dCommand( true, Id )
04606 {
04607 m_parent = parent;
04608 m_mask = mask;
04609 m_takeLayerFirstObject = layerFirstObject;
04610 m_target = target;
04611 m_clearorg = clearorg;
04612 m_depth = depth;
04613 m_objects = wxNullCanvasObjectList;
04614 m_offsetObjects = wxNullCanvasObjectList;
04615 }
04616
04617 virtual a2dObject* Clone( CloneOptions options = clone_deep ) const
04618 {
04619 return new a2dCommand_SurfaceToPolygonMask( m_mask, m_target, m_takeLayerFirstObject, m_clearorg, m_depth, m_parent );
04620 }
04621
04622 ~a2dCommand_SurfaceToPolygonMask()
04623 {
04624 if ( m_objects != wxNullCanvasObjectList )
04625 delete m_objects;
04626 if ( m_offsetObjects != wxNullCanvasObjectList )
04627 delete m_offsetObjects;
04628 }
04629
04630 bool Do(void);
04631
04632 bool Undo(void);
04633
04634 inline a2dCanvasCommandProcessor *GetCanvasCmp() { return wxStaticCast( m_cmp, a2dCanvasCommandProcessor); }
04635
04636 long m_target;
04637 bool m_takeLayerFirstObject;
04638 bool m_clearorg;
04639 int m_depth;
04640 a2dCanvasObjectFlagsMask m_mask;
04641 a2dCanvasObjectPtr m_parent;
04642 a2dCanvasObjectList* m_objects;
04643 a2dCanvasObjectList* m_offsetObjects;
04644 a2dlist< long > m_objectsIndex;
04645 };
04646
04647
04648
04649
04650
04651 class A2DCANVASDLLEXP a2dCommand_UrlOnMask: public a2dCommand
04652 {
04653 DECLARE_DYNAMIC_CLASS(a2dCommand_UrlOnMask)
04654 public:
04655 static const a2dCommandId Id;
04656
04657 a2dCommand_UrlOnMask( wxURI uri = wxURI(), a2dCanvasObjectFlagsMask mask = a2dCanvasOFlags::SELECTED, a2dCanvasObject* parent = NULL ): a2dCommand( true, Id )
04658 {
04659 m_parent = parent;
04660 m_mask = mask;
04661 m_uri = uri;
04662 m_objects = wxNullCanvasObjectList;
04663 m_oldobjects = wxNullCanvasObjectList;
04664 }
04665
04666 virtual a2dObject* Clone( CloneOptions options = clone_deep ) const
04667 {
04668 return new a2dCommand_UrlOnMask( m_uri, m_mask, m_parent );
04669 }
04670
04671 ~a2dCommand_UrlOnMask()
04672 {
04673 if ( m_objects != wxNullCanvasObjectList )
04674 delete m_objects;
04675 if ( m_oldobjects != wxNullCanvasObjectList )
04676 delete m_oldobjects;
04677 }
04678
04679 bool Do(void);
04680
04681 bool Undo(void);
04682
04683 inline a2dCanvasCommandProcessor *GetCanvasCmp() { return wxStaticCast( m_cmp, a2dCanvasCommandProcessor); }
04684
04685 a2dCanvasObjectFlagsMask m_mask;
04686 a2dCanvasObjectPtr m_parent;
04687 a2dCanvasObjectList* m_oldobjects;
04688 a2dCanvasObjectList* m_objects;
04689 a2dlist< long > m_objectsIndex;
04690 wxURI m_uri;
04691 };
04692
04693
04694
04695
04696
04697 class A2DCANVASDLLEXP a2dCommand_SetFillStrokeMask: public a2dCommand
04698 {
04699 DECLARE_DYNAMIC_CLASS(a2dCommand_SetFillStrokeMask)
04700 public:
04701 static const a2dCommandId Id;
04702
04703 a2dCommand_SetFillStrokeMask( a2dCanvasObjectFlagsMask mask = a2dCanvasOFlags::SELECTED, a2dCanvasObject* parent = NULL ): a2dCommand( true, Id )
04704 {
04705 m_parent = parent;
04706 m_mask = mask;
04707 m_objects = wxNullCanvasObjectList;
04708 m_oldobjects = wxNullCanvasObjectList;
04709 }
04710
04711 virtual a2dObject* Clone( CloneOptions options = clone_deep ) const
04712 {
04713 return new a2dCommand_SetFillStrokeMask( m_mask, m_parent );
04714 }
04715
04716 ~a2dCommand_SetFillStrokeMask()
04717 {
04718 if ( m_objects != wxNullCanvasObjectList )
04719 delete m_objects;
04720 if ( m_oldobjects != wxNullCanvasObjectList )
04721 delete m_oldobjects;
04722 }
04723
04724 bool Do(void);
04725
04726 bool Undo(void);
04727
04728 inline a2dCanvasCommandProcessor *GetCanvasCmp() { return wxStaticCast( m_cmp, a2dCanvasCommandProcessor); }
04729
04730 a2dCanvasObjectFlagsMask m_mask;
04731 a2dCanvasObjectPtr m_parent;
04732 a2dCanvasObjectList* m_oldobjects;
04733 a2dCanvasObjectList* m_objects;
04734 a2dlist< long > m_objectsIndex;
04735 };
04736
04737
04738
04739
04740
04741 class A2DCANVASDLLEXP a2dCommand_ImagesToRectMask: public a2dCommand
04742 {
04743 DECLARE_DYNAMIC_CLASS(a2dCommand_ImagesToRectMask)
04744 public:
04745 static const a2dCommandId Id;
04746
04747 a2dCommand_ImagesToRectMask( a2dCanvasObjectFlagsMask mask = a2dCanvasOFlags::SELECTED, a2dCanvasObject* parent = NULL ): a2dCommand( true, Id )
04748 {
04749 m_parent = parent;
04750 m_mask = mask;
04751 m_objects = wxNullCanvasObjectList;
04752 m_oldobjects = wxNullCanvasObjectList;
04753 }
04754
04755 virtual a2dObject* Clone( CloneOptions options = clone_deep ) const
04756 {
04757 return new a2dCommand_ImagesToRectMask( m_mask, m_parent );
04758 }
04759
04760 ~a2dCommand_ImagesToRectMask()
04761 {
04762 if ( m_objects != wxNullCanvasObjectList )
04763 delete m_objects;
04764 if ( m_oldobjects != wxNullCanvasObjectList )
04765 delete m_oldobjects;
04766 }
04767
04768 bool Do(void);
04769
04770 bool Undo(void);
04771
04772 inline a2dCanvasCommandProcessor *GetCanvasCmp() { return wxStaticCast( m_cmp, a2dCanvasCommandProcessor); }
04773
04774 a2dCanvasObjectFlagsMask m_mask;
04775 a2dCanvasObjectPtr m_parent;
04776 a2dCanvasObjectList* m_oldobjects;
04777 a2dCanvasObjectList* m_objects;
04778 a2dlist< long > m_objectsIndex;
04779 };
04780
04781
04782
04783
04784
04785 class A2DCANVASDLLEXP a2dCommand_SetLayersProperty: public a2dCommand
04786 {
04787 DECLARE_DYNAMIC_CLASS(a2dCommand_SetLayerMask)
04788 public:
04789 static const a2dCommandId Id;
04790
04791 enum SetWhat{ visible, selectable, readable, filling };
04792
04793 void DistributeEvent( wxEventType eventType );
04794
04795 a2dCommand_SetLayersProperty( bool value = true, SetWhat what = visible ): a2dCommand( true, Id )
04796 {
04797 m_value = value;
04798 m_setWhat = what;
04799 }
04800
04801 ~a2dCommand_SetLayersProperty()
04802 {
04803 }
04804
04805 virtual a2dObject* Clone( CloneOptions options = clone_deep ) const
04806 {
04807 return new a2dCommand_SetLayersProperty( m_value );
04808 }
04809
04810 bool Do(void);
04811
04812 bool Undo(void);
04813
04814 inline a2dCanvasCommandProcessor *GetCanvasCmp() { return wxStaticCast( m_cmp, a2dCanvasCommandProcessor); }
04815
04816 bool m_value;
04817 a2dlist< bool > m_oldLayersVisible;
04818
04819 SetWhat m_setWhat;
04820
04821 };
04822
04823
04824
04825
04826
04827 class A2DCANVASDLLEXP a2dCommand_ConvertMask: public a2dCommand
04828 {
04829 DECLARE_DYNAMIC_CLASS(a2dCommand_ConvertMask)
04830 public:
04831 static const a2dCommandId Id;
04832
04833
04834
04835
04836 enum a2dDoWhat
04837 {
04838 ConvertToPolygonPolylinesWithArcs,
04839 ConvertToPolygonPolylinesWithoutArcs,
04840 ConvertPolygonToArcs,
04841 ConvertPolylineToArcs,
04842 ConvertToVPaths,
04843 ConvertLinesArcs,
04844 ConvertToPolylines,
04845 };
04846
04847 class A2DCANVASDLLEXP Args
04848 {
04849 public:
04850 Args()
04851 {
04852 argSet.what = false;
04853 argSet.target = false;
04854 argSet.clearTarget = false;
04855 argSet.mask = false;
04856 argSet.deleteOriginal = false;
04857 argSet.keepLayer = false;
04858 argSet.clearTarget = false;
04859 argSet.detectCircle = false;
04860 argSet.detectCircle = false;
04861 argSet.parent = false;
04862 argValue.what = ConvertToVPaths;
04863 argValue.target = -1;
04864 argValue.clearTarget = false;
04865 argValue.mask = a2dCanvasOFlags::SELECTED;
04866 argValue.deleteOriginal = true;
04867 argValue.keepLayer = true;
04868 argValue.clearTarget = false;
04869 argValue.detectCircle = false;
04870 argValue.parent = NULL;
04871 }
04872
04873 A2D_ARGUMENT_SETTER( a2dDoWhat, what )
04874 A2D_ARGUMENT_SETTER( long, target )
04875 A2D_ARGUMENT_SETTER( a2dCanvasObjectFlagsMask, mask )
04876 A2D_ARGUMENT_SETTER( bool, deleteOriginal )
04877 A2D_ARGUMENT_SETTER( bool, keepLayer )
04878 A2D_ARGUMENT_SETTER( bool, clearTarget )
04879 A2D_ARGUMENT_SETTER( bool, detectCircle )
04880 A2D_ARGUMENT_SETTER( a2dCanvasObjectPtr, parent )
04881
04882 struct argValue
04883 {
04884 a2dDoWhat what;
04885 long target;
04886 a2dCanvasObjectFlagsMask mask;
04887 bool deleteOriginal;
04888 bool keepLayer;
04889 bool clearTarget;
04890 bool detectCircle;
04891 a2dCanvasObjectPtr parent;
04892 } argValue;
04893
04894 struct argSet
04895 {
04896 bool what, target, mask, deleteOriginal, keepLayer, clearTarget, detectCircle, parent;
04897 } argSet;
04898 };
04899
04900 a2dCommand_ConvertMask( const Args& args = Args() ): a2dCommand( true, Id )
04901 {
04902 m_args = args;
04903 m_newobjects = wxNullCanvasObjectList;
04904 m_maskobjects = wxNullCanvasObjectList;
04905 }
04906
04907 virtual a2dObject* Clone( CloneOptions options = clone_deep ) const
04908 {
04909 return new a2dCommand_ConvertMask( m_args );
04910 }
04911
04912 a2dCommand_ConvertMask( a2dDoWhat what,
04913 long target = -1, a2dCanvasObjectFlagsMask mask = a2dCanvasOFlags::SELECTED,
04914 bool deleteOriginal = true, bool keepLayer = true )
04915 : a2dCommand( true, Id )
04916 {
04917 m_args.what( what ).target( target ).mask( mask ).deleteOriginal( deleteOriginal ).keepLayer( keepLayer);
04918 m_newobjects = wxNullCanvasObjectList;
04919 m_maskobjects = wxNullCanvasObjectList;
04920 }
04921
04922 ~a2dCommand_ConvertMask()
04923 {
04924 if ( m_newobjects != wxNullCanvasObjectList )
04925 delete m_newobjects;
04926 if ( m_maskobjects != wxNullCanvasObjectList )
04927 delete m_maskobjects;
04928 }
04929
04930 bool Do(void);
04931
04932 bool Undo(void);
04933
04934 inline a2dCanvasCommandProcessor *GetCanvasCmp() { return wxStaticCast( m_cmp, a2dCanvasCommandProcessor); }
04935
04936 Args m_args;
04937
04938 a2dCanvasObjectList* m_newobjects;
04939 a2dCanvasObjectList* m_maskobjects;
04940 a2dlist< long > m_objectsIndex;
04941 };
04942
04943
04944
04945
04946
04947
04948 class A2DCANVASDLLEXP wxDoubleNumberEntryDialog : public wxDialog
04949 {
04950 public:
04951 wxDoubleNumberEntryDialog(wxWindow *parent,
04952 const wxString& message,
04953 const wxString& prompt,
04954 const wxString& caption,
04955 double value, double min, double max,
04956 const wxPoint& pos = wxDefaultPosition);
04957
04958
04959 double GetValue() const { return m_value; }
04960
04961
04962 void OnOK(wxCommandEvent& event);
04963
04964 void OnCancel(wxCommandEvent& event);
04965
04966 protected:
04967
04968
04969 wxTextCtrl *m_textctrl;
04970
04971 double m_value;
04972
04973 double m_min;
04974
04975 double m_max;
04976
04977 private:
04978 DECLARE_EVENT_TABLE()
04979 DECLARE_DYNAMIC_CLASS(wxDoubleNumberEntryDialog)
04980 DECLARE_NO_COPY_CLASS(wxDoubleNumberEntryDialog)
04981 };
04982
04983
04984
04985
04986
04987
04988 double A2DCANVASDLLEXP
04989 wxGetDoubleNumberFromUser(const wxString& message,
04990 const wxString& prompt,
04991 const wxString& caption,
04992 double value = 0,
04993 double min = 0,
04994 double max = 100,
04995 wxWindow *parent = (wxWindow *)NULL,
04996 const wxPoint& pos = wxDefaultPosition);
04997
04998
04999 #endif
05000