wxArt2D
drawing.h
Go to the documentation of this file.
1 /*! \file wx/canvas/drawing.h
2  \brief Contains a2dDrawing Class to hold a drawing.
3 
4  a2dDrawing is the class where a hierarchy of a2dCanvasObject's is stored.
5  Updating pending/changed objects and drawing a2dDrawing and a2dCanvasView is all from this class.
6 
7  \author Klaas Holwerda
8 
9  Copyright: 2000-2004 (c) Klaas Holwerda
10 
11  Licence: wxWidgets Licence
12 
13  RCS-ID: $Id: drawing.h,v 1.31 2009/07/10 19:23:13 titato Exp $
14 */
15 
16 #ifndef __WXDRAWING_H__
17 #define __WXDRAWING_H__
18 
19 #ifndef WX_PRECOMP
20 #include "wx/wx.h"
21 #endif
22 
23 #include "wx/image.h"
24 #include <wx/numdlg.h>
25 #include "a2dprivate.h"
26 #include "wx/canvas/canobj.h"
27 #include "wx/canvas/vpath.h"
28 #include "wx/canvas/canprim.h"
29 #include "wx/canvas/polygon.h"
30 #include "wx/canvas/objlist.h"
31 #include "wx/canvas/recur.h"
32 #include "wx/canvas/canglob.h"
33 #include "wx/canvas/canprop.h"
34 #include "wx/canvas/sttool.h"
35 
37 class a2dIOHandlerCVGIn;
38 class a2dIOHandlerCVGOut;
39 class a2dDrawingPart;
40 class a2dCameleonEvent;
41 
42 //----------------------------------------------------------------------------
43 // decls
44 //----------------------------------------------------------------------------
45 
46 DECLARE_MENU_ITEMID( CmdMenu_ChangeCanvasObjectStyle )
47 DECLARE_MENU_ITEMID( CmdMenu_ChangeCentralStyle )
48 DECLARE_MENU_ITEMID( CmdMenu_SetLayer )
49 DECLARE_MENU_ITEMID( CmdMenu_SetTarget )
50 DECLARE_MENU_ITEMID( CmdMenu_SetDrawWireFrame )
51 DECLARE_MENU_ITEMID( CmdMenu_DrawGridLines )
52 DECLARE_MENU_ITEMID( CmdMenu_DrawGridAtFront )
53 DECLARE_MENU_ITEMID( CmdMenu_SetYAxis )
54 DECLARE_MENU_ITEMID( CmdMenu_Option_SplinePoly )
55 DECLARE_MENU_ITEMID( CmdMenu_Option_CursorCrosshair )
56 DECLARE_MENU_ITEMID( CmdMenu_Option_RescaleAtReSize )
57 DECLARE_MENU_ITEMID( CmdMenu_Option_ReverseLayers )
58 
59 DECLARE_MENU_ITEMID( CmdMenu_RouteMethod_StraightEndSegment )
60 DECLARE_MENU_ITEMID( CmdMenu_RouteMethod_StraightEndSegmentUnlessPins )
61 DECLARE_MENU_ITEMID( CmdMenu_RouteMethod_StraightSegment )
62 DECLARE_MENU_ITEMID( CmdMenu_RouteMethod_StraightSegmentUnlessPins )
63 DECLARE_MENU_ITEMID( CmdMenu_RouteMethod_GridRouting )
64 DECLARE_MENU_ITEMID( CmdMenu_RouteMethod_ManhattanSegments )
65 DECLARE_MENU_ITEMID( CmdMenu_RouteMethod_ManhattanEndSegments )
66 DECLARE_MENU_ITEMID( CmdMenu_RouteMethod_ManhattanEndSegmentsStay )
67 DECLARE_MENU_ITEMID( CmdMenu_RouteMethod_ManhattanEndSegmentsConvertAndStay )
68 
69 DECLARE_MENU_ITEMID( CmdMenu_RotateObject90Left )
70 DECLARE_MENU_ITEMID( CmdMenu_RotateObject90Right )
71 
72 DECLARE_MENU_ITEMID( CmdMenu_Refresh )
73 DECLARE_MENU_ITEMID( CmdMenu_ZoomOut )
74 DECLARE_MENU_ITEMID( CmdMenu_ZoomOut2 )
75 DECLARE_MENU_ITEMID( CmdMenu_ZoomIn2 )
76 DECLARE_MENU_ITEMID( CmdMenu_ZoomOut2CondSelected )
77 DECLARE_MENU_ITEMID( CmdMenu_ZoomIn2CondSelected )
78 DECLARE_MENU_ITEMID( CmdMenu_EmptyShownObject )
79 DECLARE_MENU_ITEMID( CmdMenu_DrawGrid )
80 DECLARE_MENU_ITEMID( CmdMenu_SetSnap )
81 DECLARE_MENU_ITEMID( CmdMenu_SetSnapFeatures )
82 DECLARE_MENU_ITEMID( CmdMenu_SetSnapFeature )
83 DECLARE_MENU_ITEMID( CmdMenu_SetStroke )
84 DECLARE_MENU_ITEMID( CmdMenu_SetFill )
85 DECLARE_MENU_ITEMID( CmdMenu_SetStrokeColour )
86 DECLARE_MENU_ITEMID( CmdMenu_SetFillColour )
87 DECLARE_MENU_ITEMID( CmdMenu_SetContourWidth )
88 DECLARE_MENU_ITEMID( CmdMenu_SetPathType )
89 DECLARE_MENU_ITEMID( CmdMenu_SetNormalizeFactor )
90 
91 DECLARE_MENU_ITEMID( CmdMenu_ShowDiagram )
92 DECLARE_MENU_ITEMID( CmdMenu_ShowSymbol )
93 DECLARE_MENU_ITEMID( CmdMenu_ShowGui )
94 
95 
96 DECLARE_MENU_ITEMID( CmdMenu_PushInto )
97 DECLARE_MENU_ITEMID( CmdMenu_PopOut )
98 DECLARE_MENU_ITEMID( CmdMenu_NewGroup )
99 DECLARE_MENU_ITEMID( CmdMenu_NewPin )
100 DECLARE_MENU_ITEMID( CmdMenu_SaveLayersDrawing )
101 DECLARE_MENU_ITEMID( CmdMenu_SaveLayersDrawingHome )
102 DECLARE_MENU_ITEMID( CmdMenu_SaveLayersDrawingLastDir )
103 DECLARE_MENU_ITEMID( CmdMenu_SaveLayersDrawingCurrentDir )
104 DECLARE_MENU_ITEMID( CmdMenu_LoadLayersDrawing )
105 DECLARE_MENU_ITEMID( CmdMenu_LoadLayersDrawingHome )
106 DECLARE_MENU_ITEMID( CmdMenu_LoadLayersDrawingLastDir )
107 DECLARE_MENU_ITEMID( CmdMenu_LoadLayersDrawingCurrentDir )
108 
109 DECLARE_MENU_ITEMID( CmdMenu_SetCursor )
110 DECLARE_MENU_ITEMID( CmdMenu_SetRelativeStart )
111 DECLARE_MENU_ITEMID( CmdMenu_AddMeasurement )
112 DECLARE_MENU_ITEMID( CmdMenu_ClearMeasurements )
113 
114 DECLARE_MENU_ITEMID( CmdMenu_Selected_SelectAll )
115 DECLARE_MENU_ITEMID( CmdMenu_Selected_DeSelectAll )
116 DECLARE_MENU_ITEMID( CmdMenu_Selected_SelectAll_NoUndo )
117 DECLARE_MENU_ITEMID( CmdMenu_Selected_DeSelectAll_NoUndo )
118 DECLARE_MENU_ITEMID( CmdMenu_Selected_Delete )
119 DECLARE_MENU_ITEMID( CmdMenu_Selected_Group )
120 DECLARE_MENU_ITEMID( CmdMenu_Selected_ImageToRectangles )
121 DECLARE_MENU_ITEMID( CmdMenu_Selected_ToTop )
122 DECLARE_MENU_ITEMID( CmdMenu_Selected_ToBack )
123 DECLARE_MENU_ITEMID( CmdMenu_Selected_SetStyle )
124 DECLARE_MENU_ITEMID( CmdMenu_Selected_SetExtStyle )
125 DECLARE_MENU_ITEMID( CmdMenu_Selected_SetTextChanges )
126 DECLARE_MENU_ITEMID( CmdMenu_Selected_SetTextChanges2 )
127 DECLARE_MENU_ITEMID( CmdMenu_Selected_ConvertToPolygonPolylinesWithArcs )
128 DECLARE_MENU_ITEMID( CmdMenu_Selected_ConvertToPolygonPolylinesWithoutArcs )
129 DECLARE_MENU_ITEMID( CmdMenu_Selected_ConvertToPolylines )
130 DECLARE_MENU_ITEMID( CmdMenu_Selected_ConvertLinesArcs )
131 DECLARE_MENU_ITEMID( CmdMenu_Selected_ConvertToVPaths )
132 DECLARE_MENU_ITEMID( CmdMenu_Selected_ConvertPolygonToArcs )
133 DECLARE_MENU_ITEMID( CmdMenu_Selected_ConvertPolylineToArcs )
134 DECLARE_MENU_ITEMID( CmdMenu_Selected_ConvertPolygonToSurface )
135 DECLARE_MENU_ITEMID( CmdMenu_Selected_ConvertSurfaceToPolygon )
136 DECLARE_MENU_ITEMID( CmdMenu_Selected_ConvertPathToPolygon )
137 DECLARE_MENU_ITEMID( CmdMenu_Selected_UnGroup )
138 DECLARE_MENU_ITEMID( CmdMenu_Selected_UnGroupDeep )
139 DECLARE_MENU_ITEMID( CmdMenu_Selected_Merge )
140 DECLARE_MENU_ITEMID( CmdMenu_Selected_Offset )
141 DECLARE_MENU_ITEMID( CmdMenu_Selected_CreateRing )
142 DECLARE_MENU_ITEMID( CmdMenu_Selected_CameleonDiagram )
143 DECLARE_MENU_ITEMID( CmdMenu_Selected_CameleonSymbol )
144 DECLARE_MENU_ITEMID( CmdMenu_Selected_FlattenCameleon )
145 DECLARE_MENU_ITEMID( CmdMenu_Selected_CloneCameleonFromInst )
146 DECLARE_MENU_ITEMID( CmdMenu_Selected_MoveXY )
147 DECLARE_MENU_ITEMID( CmdMenu_Selected_MoveLayer )
148 DECLARE_MENU_ITEMID( CmdMenu_Selected_CopyXY )
149 DECLARE_MENU_ITEMID( CmdMenu_Selected_CopyLayer )
150 DECLARE_MENU_ITEMID( CmdMenu_Selected_Transform )
151 DECLARE_MENU_ITEMID( CmdMenu_Selected_Rotate )
152 
153 DECLARE_MENU_ITEMID( CmdMenu_Selected_Align_MinX )
154 DECLARE_MENU_ITEMID( CmdMenu_Selected_Align_MaxX )
155 DECLARE_MENU_ITEMID( CmdMenu_Selected_Align_MinY )
156 DECLARE_MENU_ITEMID( CmdMenu_Selected_Align_MaxY )
157 DECLARE_MENU_ITEMID( CmdMenu_Selected_Align_MidX )
158 DECLARE_MENU_ITEMID( CmdMenu_Selected_Align_MidY )
159 DECLARE_MENU_ITEMID( CmdMenu_Selected_Align_MirrorVert )
160 DECLARE_MENU_ITEMID( CmdMenu_Selected_Align_MirrorHorz )
161 DECLARE_MENU_ITEMID( CmdMenu_Selected_Align_MirrorVertBbox )
162 DECLARE_MENU_ITEMID( CmdMenu_Selected_Align_MirrorHorzBbox )
163 DECLARE_MENU_ITEMID( CmdMenu_Selected_Align_DistributeVert )
164 DECLARE_MENU_ITEMID( CmdMenu_Selected_Align_DistributeHorz )
165 DECLARE_MENU_ITEMID( CmdMenu_Selected_RotateObject90Left )
166 DECLARE_MENU_ITEMID( CmdMenu_Selected_RotateObject90Right )
167 DECLARE_MENU_ITEMID( CmdMenu_Selected_Align_MinX_Dest )
168 DECLARE_MENU_ITEMID( CmdMenu_Selected_Align_MaxX_Dest )
169 DECLARE_MENU_ITEMID( CmdMenu_Selected_Align_MinY_Dest )
170 DECLARE_MENU_ITEMID( CmdMenu_Selected_Align_MaxY_Dest )
171 DECLARE_MENU_ITEMID( CmdMenu_Selected_Align_MidX_Dest )
172 DECLARE_MENU_ITEMID( CmdMenu_Selected_Align_MidY_Dest )
173 DECLARE_MENU_ITEMID( CmdMenu_Selected_Align_MirrorVert_Dest )
174 DECLARE_MENU_ITEMID( CmdMenu_Selected_Align_MirrorHorz_Dest )
175 DECLARE_MENU_ITEMID( CmdMenu_Selected_Align_MirrorVertBbox_Dest )
176 DECLARE_MENU_ITEMID( CmdMenu_Selected_Align_MirrorHorzBbox_Dest )
177 
178 
179 DECLARE_MENU_ITEMID( CmdMenu_GroupAB_Offset )
180 DECLARE_MENU_ITEMID( CmdMenu_GroupAB_Smooth )
181 DECLARE_MENU_ITEMID( CmdMenu_GroupAB_CreateRing )
182 DECLARE_MENU_ITEMID( CmdMenu_GroupAB_Delete )
183 DECLARE_MENU_ITEMID( CmdMenu_GroupAB_Move )
184 DECLARE_MENU_ITEMID( CmdMenu_GroupAB_Copy )
185 DECLARE_MENU_ITEMID( CmdMenu_GroupAB_ToArcs )
186 DECLARE_MENU_ITEMID( CmdMenu_GroupAB_Or )
187 DECLARE_MENU_ITEMID( CmdMenu_GroupAB_And )
188 DECLARE_MENU_ITEMID( CmdMenu_GroupAB_Exor )
189 DECLARE_MENU_ITEMID( CmdMenu_GroupAB_AsubB )
190 DECLARE_MENU_ITEMID( CmdMenu_GroupAB_BsubA )
191 DECLARE_MENU_ITEMID( CmdMenu_GroupAB_ConvertPolygonToSurface )
192 DECLARE_MENU_ITEMID( CmdMenu_GroupAB_ConvertSurfaceToPolygon )
193 
194 
195 
196 DECLARE_MENU_ITEMID( CmdMenu_PopTool )
197 
198 
199 DECLARE_MENU_ITEMID( CmdMenu_PushTool_Zoom_OneShot )
200 DECLARE_MENU_ITEMID( CmdMenu_PushTool_FastZoom_OneShot )
201 DECLARE_MENU_ITEMID( CmdMenu_PushTool_Select_OneShot )
202 DECLARE_MENU_ITEMID( CmdMenu_PushTool_Select2_OneShot )
203 DECLARE_MENU_ITEMID( CmdMenu_PushTool_FastSelect_OneShot )
204 DECLARE_MENU_ITEMID( CmdMenu_PushTool_FastSelect2_OneShot )
205 DECLARE_MENU_ITEMID( CmdMenu_PushTool_RecursiveEdit_OneShot )
206 DECLARE_MENU_ITEMID( CmdMenu_PushTool_MultiEdit_OneShot )
207 DECLARE_MENU_ITEMID( CmdMenu_PushTool_Drag_OneShot )
208 DECLARE_MENU_ITEMID( CmdMenu_PushTool_DragOriginal_OneShot )
209 DECLARE_MENU_ITEMID( CmdMenu_PushTool_RenderImageZoom_OneShot )
210 DECLARE_MENU_ITEMID( CmdMenu_PushTool_Copy_OneShot )
211 DECLARE_MENU_ITEMID( CmdMenu_PushTool_Rotate_OneShot )
212 DECLARE_MENU_ITEMID( CmdMenu_PushTool_Delete_OneShot )
213 DECLARE_MENU_ITEMID( CmdMenu_PushTool_DrawText_OneShot )
214 DECLARE_MENU_ITEMID( CmdMenu_PushTool_Image_OneShot )
215 DECLARE_MENU_ITEMID( CmdMenu_PushTool_DrawRectangleFast_OneShot )
216 DECLARE_MENU_ITEMID( CmdMenu_PushTool_DrawRectangle_OneShot )
217 DECLARE_MENU_ITEMID( CmdMenu_PushTool_DrawCircle_OneShot )
218 DECLARE_MENU_ITEMID( CmdMenu_PushTool_DrawCircleFast_OneShot )
219 DECLARE_MENU_ITEMID( CmdMenu_PushTool_DrawLine_OneShot )
220 DECLARE_MENU_ITEMID( CmdMenu_PushTool_DrawLineScaledArrow_OneShot )
221 DECLARE_MENU_ITEMID( CmdMenu_PushTool_DrawEllipse_OneShot )
222 DECLARE_MENU_ITEMID( CmdMenu_PushTool_DrawEllipticArc_OneShot )
223 DECLARE_MENU_ITEMID( CmdMenu_PushTool_DrawEllipticArc_Chord_OneShot )
224 DECLARE_MENU_ITEMID( CmdMenu_PushTool_DrawArc_OneShot )
225 DECLARE_MENU_ITEMID( CmdMenu_PushTool_DrawArc_Chord_OneShot )
226 DECLARE_MENU_ITEMID( CmdMenu_PushTool_DrawPolylineL_OneShot )
227 DECLARE_MENU_ITEMID( CmdMenu_PushTool_DrawPolylineL_Splined_OneShot )
228 DECLARE_MENU_ITEMID( CmdMenu_PushTool_DrawPolylineLFast_OneShot )
229 DECLARE_MENU_ITEMID( CmdMenu_PushTool_DrawPolygonL_OneShot )
230 DECLARE_MENU_ITEMID( CmdMenu_PushTool_DrawPolygonL_Splined_OneShot )
231 DECLARE_MENU_ITEMID( CmdMenu_PushTool_DrawPolygonLFast_OneShot )
232 DECLARE_MENU_ITEMID( CmdMenu_PushTool_Property_OneShot )
233 DECLARE_MENU_ITEMID( CmdMenu_PushTool_DragMulti_OneShot )
234 DECLARE_MENU_ITEMID( CmdMenu_PushTool_FastDragMulti_OneShot )
235 DECLARE_MENU_ITEMID( CmdMenu_PushTool_CopyMulti_OneShot )
236 DECLARE_MENU_ITEMID( CmdMenu_PushTool_FastCopyMulti_OneShot )
237 DECLARE_MENU_ITEMID( CmdMenu_PushTool_Measure_OneShot )
238 DECLARE_MENU_ITEMID( CmdMenu_PushTool_DrawWirePolylineL_OneShot )
239 DECLARE_MENU_ITEMID( CmdMenu_PushTool_DrawVPath_OneShot )
240 
241 DECLARE_MENU_ITEMID( CmdMenu_PushTool_Zoom )
242 DECLARE_MENU_ITEMID( CmdMenu_PushTool_FastZoom )
243 DECLARE_MENU_ITEMID( CmdMenu_PushTool_Select )
244 DECLARE_MENU_ITEMID( CmdMenu_PushTool_Select2 )
245 DECLARE_MENU_ITEMID( CmdMenu_PushTool_FastSelect )
246 DECLARE_MENU_ITEMID( CmdMenu_PushTool_FastSelect2 )
247 DECLARE_MENU_ITEMID( CmdMenu_PushTool_RecursiveEdit )
248 DECLARE_MENU_ITEMID( CmdMenu_PushTool_MultiEdit )
249 DECLARE_MENU_ITEMID( CmdMenu_PushTool_Drag )
250 DECLARE_MENU_ITEMID( CmdMenu_PushTool_DragOriginal )
251 DECLARE_MENU_ITEMID( CmdMenu_PushTool_RenderImageZoom )
252 DECLARE_MENU_ITEMID( CmdMenu_PushTool_Copy )
253 DECLARE_MENU_ITEMID( CmdMenu_PushTool_Rotate )
254 DECLARE_MENU_ITEMID( CmdMenu_PushTool_Delete )
255 DECLARE_MENU_ITEMID( CmdMenu_PushTool_DrawText )
256 DECLARE_MENU_ITEMID( CmdMenu_PushTool_Image )
257 DECLARE_MENU_ITEMID( CmdMenu_PushTool_DrawRectangleFast )
258 DECLARE_MENU_ITEMID( CmdMenu_PushTool_DrawRectangle )
259 DECLARE_MENU_ITEMID( CmdMenu_PushTool_DrawCircle )
260 DECLARE_MENU_ITEMID( CmdMenu_PushTool_DrawCircleFast )
261 DECLARE_MENU_ITEMID( CmdMenu_PushTool_DrawLine )
262 DECLARE_MENU_ITEMID( CmdMenu_PushTool_DrawLineScaledArrow )
263 DECLARE_MENU_ITEMID( CmdMenu_PushTool_DrawEllipse )
264 DECLARE_MENU_ITEMID( CmdMenu_PushTool_DrawEllipticArc )
265 DECLARE_MENU_ITEMID( CmdMenu_PushTool_DrawEllipticArc_Chord )
266 DECLARE_MENU_ITEMID( CmdMenu_PushTool_DrawArc )
267 DECLARE_MENU_ITEMID( CmdMenu_PushTool_DrawArc_Chord )
268 DECLARE_MENU_ITEMID( CmdMenu_PushTool_DrawPolylineL )
269 DECLARE_MENU_ITEMID( CmdMenu_PushTool_DrawPolylineL_Splined )
270 DECLARE_MENU_ITEMID( CmdMenu_PushTool_DrawPolylineLFast )
271 DECLARE_MENU_ITEMID( CmdMenu_PushTool_DrawPolygonL )
272 DECLARE_MENU_ITEMID( CmdMenu_PushTool_DrawPolygonL_Splined )
273 DECLARE_MENU_ITEMID( CmdMenu_PushTool_DrawPolygonLFast )
274 DECLARE_MENU_ITEMID( CmdMenu_PushTool_Property )
275 DECLARE_MENU_ITEMID( CmdMenu_PushTool_DragMulti )
276 DECLARE_MENU_ITEMID( CmdMenu_PushTool_FastDragMulti )
277 DECLARE_MENU_ITEMID( CmdMenu_PushTool_CopyMulti )
278 DECLARE_MENU_ITEMID( CmdMenu_PushTool_FastCopyMulti )
279 DECLARE_MENU_ITEMID( CmdMenu_PushTool_Measure )
280 DECLARE_MENU_ITEMID( CmdMenu_PushTool_DrawWirePolylineL )
281 DECLARE_MENU_ITEMID( CmdMenu_PushTool_DrawVPath )
282 DECLARE_MENU_ITEMID( CmdMenu_PushTool_Port )
283 DECLARE_MENU_ITEMID( CmdMenu_PushTool_Cameleon )
284 DECLARE_MENU_ITEMID( CmdMenu_PushTool_Cameleon_BuildIn )
285 DECLARE_MENU_ITEMID( CmdMenu_PushTool_CameleonInst )
286 DECLARE_MENU_ITEMID( CmdMenu_PushTool_CameleonInstDlg )
287 DECLARE_MENU_ITEMID( CmdMenu_PushTool_CameleonRefDlg )
288 DECLARE_MENU_ITEMID( CmdMenu_PushTool_CameleonRefDlg_Diagram )
289 DECLARE_MENU_ITEMID( CmdMenu_PushTool_CameleonRefDlg_Symbol )
290 DECLARE_MENU_ITEMID( CmdMenu_PushTool_TagGroups )
291 DECLARE_MENU_ITEMID( CmdMenu_PushTool_TagGroups_WireMode )
292 DECLARE_MENU_ITEMID( CmdMenu_PushTool_TagGroups_DlgMode )
293 DECLARE_MENU_ITEMID( CmdMenu_PushTool_TagGroups_WireMode_DlgMode )
294 DECLARE_MENU_ITEMID( CmdMenu_PushTool_SingleClick )
295 
296 DECLARE_MENU_ITEMID( CmdMenu_InsertGroupRef )
297 
298 DECLARE_MENU_ITEMID( CmdMenu_ShowDlgLayersDrawing )
299 DECLARE_MENU_ITEMID( CmdMenu_ShowDlgLayersGlobal )
300 DECLARE_MENU_ITEMID( CmdMenu_ShowDlgLayerOrderDrawing )
301 DECLARE_MENU_ITEMID( CmdMenu_ShowDlgLayerOrderGlobal )
302 DECLARE_MENU_ITEMID( CmdMenu_ShowDlgTools )
303 DECLARE_MENU_ITEMID( CmdMenu_ShowDlgStyle )
304 DECLARE_MENU_ITEMID( CmdMenu_ShowDlgSnap )
305 DECLARE_MENU_ITEMID( CmdMenu_ShowDlgGroups )
306 DECLARE_MENU_ITEMID( CmdMenu_ShowDlgIdentify )
307 DECLARE_MENU_ITEMID( CmdMenu_ShowDlgCoordEntry )
308 DECLARE_MENU_ITEMID( CmdMenu_ShowDlgMeasure )
309 DECLARE_MENU_ITEMID( CmdMenu_ShowDlgStructure )
310 DECLARE_MENU_ITEMID( CmdMenu_ShowDlgStructureModal )
311 DECLARE_MENU_ITEMID( CmdMenu_ShowDlgCameleonModal )
312 DECLARE_MENU_ITEMID( CmdMenu_ShowDlgPathSettings )
313 DECLARE_MENU_ITEMID( CmdMenu_ShowDlgSettings )
314 DECLARE_MENU_ITEMID( CmdMenu_ShowDlgTrans )
315 DECLARE_MENU_ITEMID( CmdMenu_ShowDlgPropEdit )
316 
317 DECLARE_MENU_ITEMID( CmdMenu_SetFont )
318 
319 DECLARE_MENU_ITEMID( CmdMenu_SetMasterTool_SelectFirst )
320 DECLARE_MENU_ITEMID( CmdMenu_SetMasterTool_ZoomFirst )
321 DECLARE_MENU_ITEMID( CmdMenu_SetMasterTool_TagGroups )
322 DECLARE_MENU_ITEMID( CmdMenu_SetMasterTool_TagGroups_WireMode )
323 DECLARE_MENU_ITEMID( CmdMenu_SetMasterTool_TagGroups_WireMode_DlgMode )
324 DECLARE_MENU_ITEMID( CmdMenu_SetMasterTool_TagGroups_DlgMode )
325 DECLARE_MENU_ITEMID( CmdMenu_SetMasterTool_SingleClick )
326 DECLARE_MENU_ITEMID( CmdMenu_LineBegin )
327 DECLARE_MENU_ITEMID( CmdMenu_LineEnd )
328 DECLARE_MENU_ITEMID( CmdMenu_LineScale )
329 
330 DECLARE_MENU_ITEMID( CmdMenu_SetLayerDlg )
331 DECLARE_MENU_ITEMID( CmdMenu_SetTargetDlg )
332 DECLARE_MENU_ITEMID( CmdMenu_SetLayerDlgModeless )
333 DECLARE_MENU_ITEMID( CmdMenu_SetBackgroundStyle )
334 
335 DECLARE_MENU_ITEMID( CmdMenu_PrintDrawing )
336 DECLARE_MENU_ITEMID( CmdMenu_PreviewDrawing )
337 DECLARE_MENU_ITEMID( CmdMenu_PrintDrawingPart )
338 DECLARE_MENU_ITEMID( CmdMenu_PreviewDrawingPart )
339 
340 extern const a2dPrintWhat a2dPRINT_PrintDrawing; //!< print a2dDrawing
341 extern const a2dPrintWhat a2dPRINT_PreviewDrawing; //!< preview print a2dDrawing
342 extern const a2dPrintWhat a2dPRINT_PrintDrawingPart; //!< print a2dDrawing Part
343 extern const a2dPrintWhat a2dPRINT_PreviewDrawingPart; //!< preview print a2dDrawing Part
344 
345 
346 // ----------------------------------------------------------------------------
347 // wxDoubleNumberEntryDialog
348 // ----------------------------------------------------------------------------
349 
350 //! wxDoubleNumberEntryDialog: a dialog with spin control, [ok] and [cancel] buttons
351 class A2DCANVASDLLEXP wxDoubleNumberEntryDialog : public wxDialog
352 {
353 public:
354  wxDoubleNumberEntryDialog( wxWindow* parent,
355  const wxString& message,
356  const wxString& prompt,
357  const wxString& caption,
358  double value, double min, double max,
359  const wxPoint& pos = wxDefaultPosition );
360 
361  //! get the double
362  double GetValue() const { return m_value; }
363 
364  //! implementation only
365  void OnOK( wxCommandEvent& event );
366  //! implementation only
367  void OnCancel( wxCommandEvent& event );
368 
369 protected:
370 
371  //! the text control top get the double entry
372  wxTextCtrl* m_textctrl;
373  //! teh value of the double
374  double m_value;
375  //! min required
376  double m_min;
377  //! max required
378  double m_max;
379 
380 private:
381  DECLARE_EVENT_TABLE()
382  DECLARE_DYNAMIC_CLASS( wxDoubleNumberEntryDialog )
383  DECLARE_NO_COPY_CLASS( wxDoubleNumberEntryDialog )
384 };
385 
386 // ----------------------------------------------------------------------------
387 // function to get a number from user
388 // ----------------------------------------------------------------------------
389 
390 //! get Double from user
391 double A2DCANVASDLLEXP
392 wxGetDoubleNumberFromUser( const wxString& message,
393  const wxString& prompt,
394  const wxString& caption,
395  double value = 0,
396  double min = 0,
397  double max = 100,
398  wxWindow* parent = ( wxWindow* )NULL,
399  const wxPoint& pos = wxDefaultPosition );
400 
401 
402 typedef wxUint16 a2dDrawingId;
403 
404 class A2DCANVASDLLEXP a2dDrawingEvent;
405 
406 //! Contain one drawing as hierarchical tree of a2dCanvasObject's
407 /*!
408 A a2dDrawing contains a drawing and related data, such as units.
409 A drawing start at the m_rootObject, and its children is what is seen as the top level of the drawing.
410 The m_rootObject and its children are a2dCanvasObject's. But a a2dCanvasObject itslef can have children,
411 therefore the drawing can be hierarchy, where children are drawn releative to their parent canvasobject.
412 
413 The drawing can be displayed on a a2dDrawingPart. And any level in the drawing hierarchy can set as the
414 start object to a2dDrawingPart. More then one a2dDrawingPart can be used at the same time, each displaying
415 different parts and/or different levels of the a2dDrawing.
416 Changes in the canvasobjects within the a2dDrawing are reported to the top level, and from there reported
417 to the a2dDrawingPart's set on the drawing. The a2dDrawingPart is used on its turn by a a2dCanvas to display
418 part of the drawing in a window. The same way a2dDrawingPart can be used to print or to draw into bitmap's.
419 
420 The drawing in a2dDrawing can be on layers, the m_layersetup is used to store the colours and othere features
421 of the layers in use. Each canvas object rendered, refers to the layer setup by an id. Layers are rendered
422 from top to bottom, as defined by the layer order.
423 For each layer to be rendered on a a2dDrawingPart's, the drawing is traversed, and only objects with that layer
424 id are rendered.
425 
426 A a2dDrawing does have its own a2dCommandProcessor, changes to the drawing are (can be) recorded using
427 commands submitted to the command processor. The changes can be Undone by reverse applying the commands.
428 
429 When used in combination with the wxArt2d document view framework, one a2dCanvasDocument can contain
430 many a2dDrawing objects. One can even place drawings inside other drawings.
431 The classes a2dCameleonInst and a2dCameleon together with related classes, are used to do this.
432 
433 */
434 class a2dDrawing : public a2dObject
435 {
436  DECLARE_EVENT_TABLE()
437 
438 public:
439 
440  static const a2dDrawingId sm_cameleonrefs;
441  static const a2dDrawingId sm_normal;
442  static const a2dDrawingId sm_physical;
443  static const a2dDrawingId sm_programming;
444  static const a2dDrawingId sm_appearances;
445 
446  //! Constructor.
447  a2dDrawing( const wxString& name = wxT(""), a2dHabitat* habitat = NULL );
448 
449  //! Copy constructor
450  a2dDrawing( const a2dDrawing& other, CloneOptions options, a2dRefMap* refs );
451 
452  ~a2dDrawing();
453 
454  a2dHabitat* GetHabitat() const { return m_habitat; }
455 
456  void SetHabitat( a2dHabitat* habitat ) { m_habitat = habitat; }
457 
458  inline a2dDrawing* TClone( CloneOptions options, a2dRefMap* refs = NULL ) { return ( a2dDrawing* ) Clone( options, refs ); }
459 
460  //! set parent object of the drawing ( in case there is always only one )
461  void SetParent( a2dObject* parent ) { m_parent = parent; }
462 
463  //! get parent object of the drawing ( in case there is always only one )
464  //! return pointer of the current parent object
465  //!\return: pointer to the current object that is used to Get to for instance a2dCameleon.
466  a2dObject* GetParent() const { return m_parent; }
467 
468  void SetAvailable();
469 
470  //!set a2dDrawing to its nested a2dCanvasObject's recursive for whole tree
471  void SetRootRecursive();
472 
473  //!set the layersettings for the canvas.
474  /*!
475  A default Layer Setting is created in the constructor a2dCanvasDocument::a2dCanvasDocument
476 
477  An example how to set another layer setup
478  \code
479  // Clone the current layer setup
480  a2dLayers* docLayers = doc->GetLayerSetup()->Clone( bool deep = true );
481 
482  // Create a new layer with an index above the predefined layers
483  a2dLayerInfo* lr = new a2dLayerInfo(wxLAYER_USER_FIRST, "MyLayer");
484 
485  // Set layer available
486  lr->Set_Available(true);
487 
488  // Add layer to to the a2dLayers
489  docLayers->Append(lr);
490 
491  doc->SetLayerSetup(docLayers);
492  \endcode
493 
494  \remark
495  You don't have to call Set_UpdateAvailableLayers it will be done automatically
496 
497  \param layersetup the new layersetup
498  */
499  void SetLayerSetup( a2dLayers* layersetup );
500 
501  //!Get the layersettings for the canvas.
502  /*!
503  A default Layer Setting is taken from a2dCanvasGlobal.
504  \sa a2dCanvasGlobal for central layers settings, used for initializing a a2dCanvasDocument
505  */
506  a2dLayers* GetLayerSetup() { return m_layersetup; }
507 
508  /*! Set if layers will be save to CVG or not.
509  If layers are shared with other drawing or not, savcing of layers in drawing can de disabled here.
510  */
511  void SetSaveLayers( bool saveLayers ) { m_saveLayers = saveLayers; }
512 
513  static void SetSaveLayersInit( bool saveLayers ) { m_saveLayersInit = saveLayers; }
514 
515  void SetInitLayersGlobal( bool initLayersGlobal ) { m_initLayersGlobal = initLayersGlobal; }
516 
517  static void SetInitLayersGlobalInit( bool initLayersGlobal ) { m_initLayersGlobalInit = initLayersGlobal; }
518 
519 
520  //! get the root object, which holds the objects in the document
521  inline a2dCanvasObject* GetRootObject() const { return m_rootObject; }
522 
523  //! set new root object ( may not be NULL )
524  void SetRootObject( a2dCanvasObject* newRoot );
525 
526  void Append( a2dCanvasObject* obj ) { m_rootObject->Append( obj ); }
527  void Prepend( a2dCanvasObject* obj ) { m_rootObject->Prepend( obj ); }
528 
529  //! set size for view in userunits, when still empty
530  void SetInitialSize( double sizeX, double sizeY )
531  { m_initialSizeX = sizeX; m_initialSizeY = sizeY; }
532 
533  //! get size for view in userunits, when still empty
534  double GetInitialSizeX() { return m_initialSizeX; }
535 
536  //! get size for view in userunits, when still empty
537  double GetInitialSizeY() { return m_initialSizeY; }
538 
539  //! create a command processor and set it for the document.
540  /*!
541  If available the existing commandprocessor will be deleted.
542  A new CommandProcessor will be created and set for the document.
543 
544  Override if you need a more application specific commandhandler.
545  */
546  virtual void CreateCommandProcessor();
547 
548  //!Returns a pointer to the command processor associated with this document
549  a2dCommandProcessor* GetCommandProcessor() const { return m_commandProcessor; }
550 
551  //! get a pointer to the command processor
552  a2dCanvasCommandProcessor* GetCanvasCommandProcessor();
553 
554  //! Sets the command processor to be used for this document.
555  /*!
556  Use in case you need one a2dCommandProcessor to be used for several
557  a2dDocument's,
558  Make sure you set it to NULL before deleting the document itself,
559  else the a2dDocument destructor will delete it ( leaving the others
560  with dangling pointers ).
561  */
562  void SetCommandProcessor( a2dCommandProcessor* proc ) { m_commandProcessor = proc; }
563 
564  //!set all bit flags in object that or true in mask to true or false
565  /*!
566  set specific flags to true or false, also recursive for children objects
567 
568  \remark the object is not setpending when soemthing changed ( actually the pending flag can be set here also )
569 
570  \param setOrClear if true sets the flag to true else to false
571  \param which set only those flags in object to true or false
572  \param classname if not empty, object must have this classname
573  \param whichobjects set flags only for object having this flags set already
574  */
575  void SetSpecificFlags( bool setOrClear, a2dCanvasObjectFlagsMask which, const wxString& classname = wxT( "" ), a2dCanvasObjectFlagsMask whichobjects = a2dCanvasOFlags::ALL );
576 
577  //! Tells the document that an object has changed.
578  /*!
579  If an object has changed and and needs an update, this method
580  informes the document about this.
581  The update of pending objects will be proceed in Idle time.
582  */
583  void SetUpdatesPending( bool onoff );
584 
585  //! call DependencyPending on root object and recursive on childs.
586  /*!
587  This call is repeated until no more a2dCanvasObject were set pending.
588  \sa a2dCanvasObject::DependencyPending
589  */
590  void DependencyPending();
591 
592  //!returns true if some objects have changed recently within this document
593  bool GetUpdatesPending();
594 
595  //! Switches ignorance of pending objects on and off.
596  /*!
597  If set to <code>true</code> pending objects won't be updated.
598  This method is used by several tools (i.e. a2dDragTool) to avoid updates
599  while the tool is working.
600 
601  \see GetUpdatesPending()
602 
603  \param onoff <code>true</code> to ignore pending objects, else <code>false</code>
604  */
605  void SetIgnorePendingObjects( bool onoff );
606 
607  //!get setting of ignore pending objects /sa GetUpdatesPending()
608  bool GetIgnorePendingObjects() { return m_ignorePendingObjects; }
609 
610  //! also walks m_layersetup and m_rootobject.
611  virtual void DoWalker( wxObject* parent, a2dWalkerIOHandler& handler );
612 
613  //bool Update( a2dCanvasObject::UpdateMode mode );
614 
615  void UpdateAllViews( unsigned int hint, wxObject* objecthint = NULL );
616 
617  //!adds current and future boundingbox of the objects with pending flag set, to the pendinglist of all a2dCanvasView's
618  /*!
619  which are using this document.
620  The areas will only be updated from the a2dCanvasView's, which are using this document in idle time.
621  It first check's for pending object's stored in this a2dCanvasDocument.
622  If true, it searches those object starting from the displayed showgroup in each drawer, and adds
623  the boundingbox of the current state the object is in, to the update area list of the those a2dCanvasView's
624  If the boundingbox of an object is not available, it will be calcualted at that moment.
625  In Next step the new boundingboxes are calculated for the pending objects and those are also
626  added to the pending arae list's of all a2dCanvasView's.
627  This functions adds areas of all places where this object is rendered also when referenced.
628  In the end, the pending flag in all objects is reset.
629 
630  AddPendingUpdatesOldNew() makes sure all objects
631  that where pending are processed.
632 
633  In idle time a2dCanvasView's will only redraw the areas that are damaged because of changes to canvas objects.
634 
635 
636 
637  \return if there were pendingobjects it return true
638  */
639  bool AddPendingUpdatesOldNew();
640 
641  //! Has the document been modified
642  bool IsModified() const { return m_documentModified != 0; }
643 
644  //! set the drawing as modified or not
645  /*!
646  If the modified status changes an ::wxEVT_CHANGEDMODIFY_DRAWING event will
647  be send.
648 
649  \param increment to decrement or increment document modified counter.
650  */
651  void Modify( bool increment );
652 
653  //!this is the number that defines the number of decimal places in the fraction
654  /*!when writing numbers to a file.
655  When reading a file, this number is set to the accuracy information available in the file.
656  1/GetUnitsAccuracy() == 100 means 2 decimal places will be written, or the data just
657  read is accurate to this number of decimal places.
658 
659  \remark GetUnitsAccuracy() can also be > 1
660  */
661  double GetUnitsAccuracy() { return m_units_accuracy; }
662 
663  //!this is the number that defines the number of decimal places in the fraction
664  /*!when writing numbers to a file.
665  When reading a file, this number is set to the accuracy information available in the file.
666  1/GetAccuracyUserUnits() == 100 means 2 decimal places will be written, or the data just
667  read is accurate to this number of decimal places.
668  \remark SetUnitsAccuracy() can also be > 1
669  */
670  void SetUnitsAccuracy( double accuracy ) { m_units_accuracy = accuracy; }
671 
672  //!this is the number that defines the physical dimension in meters / inch/ etc.
673  /*! numbers used for storing length or position or always stored as doubles.
674  The real dimension is: (anynumber) * GetUnitsScale() * GetUnits()
675  */
676  double GetUnitsScale() { return m_units_scale; }
677 
678 
679  //!this is the number that defines the physical dimension in meters / inch/ etc.
680  /*! numbers used for storing length or position or always stored as doubles.
681  The real dimension is: (anynumber) * GetUnitsScale() * GetUnits()
682  */
683  void SetUnitsScale( double scale ) { m_units_scale = scale; }
684 
685  //! Normalize objects ( defined in coordinates -1 to 1 ranges ) will be multiplied by this factor.
686  /*!
687  Libraries containing object which are defined in normalized coordinates,
688  need to be multiplied by a certain factor before they can be added to a document.
689  This factor defines by how much that should be done.
690  As an example a libary containing arrow objects for placing at the end of a2dEndsLine
691  objects, will use this factor.
692  */
693  double GetNormalizeScale() { return m_normalize_scale; }
694 
695  //! see GetNormalizeScale()
696  void SetNormalizeScale( double scale ) { m_normalize_scale = scale; }
697 
698  //!this string defines the unit e.g. meters / inch/ etc.
699  /*! numbers used for storing length or position or always stored as doubles.
700  The real dimension is: (anynumber) * GetUnitsScale() * GetUnits()
701 
702  \remark the value may also be "trees" "pixels" or "people" etc.
703 
704  \remark conversion to other units is not just simply changing this string.
705  You must Change the SetUnitsScale(double) or really scale the data itself.
706  */
707  wxString GetUnits() { return m_units; }
708 
709  //!this string defines the unit e.g. meters / inch/ etc.
710  /*! numbers used for storing length or position or always stored as doubles.
711  The real dimension is: (anynumber) * GetUnitsScale() * GetUnits()
712 
713  \remark the value may also be "trees" "pixels" or "people" etc.
714 
715  \remark conversion to other units is not just simply changing this string.
716  You must Change the SetUnitsScale(double) or really scale the data itself.
717  */
718  void SetUnits( const wxString& unitString ) { m_units = unitString; }
719 
720  //! set special id to differentiate drawings
721  a2dDrawingId GetDrawingId() { return m_drawingId; }
722  //! get special id to differentiate drawings
723  void SetDrawingId( a2dDrawingId id ) { m_drawingId = id; }
724 
725  //! if true, editing drawing is allowed
726  void SetMayEdit( bool mayEdit ) { m_mayEdit = mayEdit; }
727 
728  //! if true, editing drawing is allowed
729  bool GetMayEdit() const { return m_mayEdit; }
730 
731  //!Sets the title for this drawing.
732  /*!
733  \param title The title of the drawing.
734  */
735  void SetTitle( const wxString& title );
736 
737  //! Returns the title for this document.
738  wxString GetTitle() const { return m_title; }
739 
740  //! Sets a description of the drawing
741  /*!
742  A description may describe the content of this drawing or contain keywords etc.
743  The default value is "".
744 
745  \param desc description of the drawing
746  */
747  void SetDescription( const wxString& desc ) { m_description = desc; }
748 
749  //! Returns the description of the document
750  /*!
751  \see SetDescription
752 
753  \return the description
754  */
755  wxString& GetDescription() { return m_description; }
756 
757  //! load document from a file with the given filename and given parser type
758  bool LoadFromFile( const wxString& filename, a2dIOHandlerStrIn* handler = new a2dIOHandlerCVGIn() );
759 
760  //! save document to a file with the given name and given output writer type
761  bool SaveToFile( const wxString& filename, a2dIOHandlerStrOut* handler = new a2dIOHandlerCVGOut() ) const;
762 
763 #if wxART2D_USE_CVGIO
764  virtual void Load( wxObject* parent, a2dIOHandlerXmlSerIn& parser );
765  virtual void Save( wxObject* parent, a2dIOHandlerXmlSerOut& out, a2dObjectList* towrite, a2dCanvasObject* start );
766 #endif //wxART2D_USE_CVGIO
767 
768  bool LinkReference( a2dObject* other );
769 
770  //! layer info changed id sent around when m_layersetup is changed.
771  static const a2dSignal sig_layersetupChanged;
772 
773  //! when an object is removed from a layer,
774  static const a2dSignal sig_changedLayer;
775 
776  a2dCanvasObject* PushInto( a2dCanvasObject* parent );
777 
778  //! gives time when a change was made to the drawing
779  /*!
780  Comparing this time in a different object its own update time, one can easily keep them up to date.
781 
782  e.g. set in SetUpdatesPending()
783  */
784  wxDateTime& GetInternalChangedTime() { return m_changedTime; }
785 
786  //! make the changed time Now
787  void TriggerChangedTime() { m_changedTime = wxDateTime::Now(); }
788 
789  bool ProcessEvent( wxEvent& event );
790 
791 protected:
792 
793  virtual a2dObject* DoClone( CloneOptions options, a2dRefMap* refs ) const;
794 
795  //! track modification of document
796  void OnDoEvent( a2dCommandProcessorEvent& event );
797 
798  //! track modification of document
799  void OnRedoEvent( a2dCommandProcessorEvent& event );
800 
801  //! track modification of document
802  void OnUndoEvent( a2dCommandProcessorEvent& event );
803 
804  void OnChangeDrawings( a2dDrawingEvent& event );
805 
806  void OnAddCameleon( a2dCameleonEvent& event );
807 
808  void DoAddPending( a2dIterC& ic );
809 
810  //! Called by ProcessEvent(wxEvent& event) of document
811  /*!
812  Event processing is called by wxView and therefore a2dCanvasView.
813  In a a2dDocumentCommandProcessor controller application wxDocChildFrame and wxDocParentFrame
814  redirect events to wxView and a2dDocumentCommandProcessor.
815  In a non a2dDocumentCommandProcessor the a2dCanvas is calling ProcessEvent(wxEvent& event) of document.
816  Onidle updates all drawers if pending updates are available
817  */
818  void OnIdle( wxIdleEvent& event );
819 
820  void OnComEvent( a2dComEvent& event );
821 
822 #if wxART2D_USE_CVGIO
823  // Documented in base class
824  virtual void DoLoad( wxObject* parent, a2dIOHandlerXmlSerIn& parser, a2dXmlSer_flag xmlparts );
825  // Documented in base class
826  virtual void DoSave( wxObject* parent, a2dIOHandlerXmlSerOut& out, a2dXmlSer_flag xmlparts , a2dObjectList* towrite );
827 #endif //wxART2D_USE_CVGIO
828 
829  a2dDrawingId m_drawingId;
830 
831  //!setup for layers in this document
832  /*!
833  \remark will contain if a layer is available/visible for rendering
834  \remark object without style will take the layer style to draw itself.
835  */
837 
838  //!A pointer to the command processor associated with this document.
840 
841  a2dCanvasObjectPtr m_rootObject;
842 
843  a2dCanvasObjectPtr m_saveStartObject;
844 
845  //! in case of a single parent, this can be set.
846  a2dObject* m_parent;
847 
848  //!set by object in this a2dCanvasDocument, to tell they have changed and therefore it needs to be rerendered
850 
851  //!if set ignore all setting for pendingobjects
853 
854  long m_documentModified;
855 
856  //! for new document views what will be the size in userunits in X
858 
859  //! for new document views what will be the size in userunits in Y
861 
862  //! how many decimal places in fraction are valid
864 
865  //! scaling factor (how many "m_units_measure" is one unit)
867 
868  //! normalization factor to scale normalized objects.
870 
871  //! unit (e.g. Meters Inch Microns etc.)
872  wxString m_units;
873 
874  //! measuring unit (e.g. Meters Inch Microns etc.)
875  wxString m_units_measure;
876 
877  //! gives time when a change was made to the drawing
878  /*!
879  */
880  wxDateTime m_changedTime;
881 
882  wxDateTime m_lastCheck;
883 
884  //! if true, editing drawing is allowed
885  bool m_mayEdit;
886 
887  //! save layers or not
889 
890  static bool m_saveLayersInit;
891 
892  bool m_initLayersGlobal;
893 
894  static bool m_initLayersGlobalInit;
895 
896  wxString m_title;
897 
898  wxString m_description;
899 
900  a2dHabitat* m_habitat;
901 
902 private:
903 
904  virtual a2dObject* SmrtPtrOwn();
905  //!To release the object, it is not longer owned by the calling object.
906  /*! the object itself will be deleted when not Owned (the reference count becomes zero)
907 
908  \remark AskSaveWhenOwned was false, and this document is not Owned by anyone,
909  the user will now be asked to save the document (when it was modified).
910  */
911  virtual bool SmrtPtrRelease();
912  friend class a2dSmrtPtrBase;
913 
914  DECLARE_DYNAMIC_CLASS( a2dDrawing )
915 };
916 
918 
919 BEGIN_DECLARE_EVENT_TYPES()
920  //!see a2dDrawingEvent \ingroup eventid
921  DECLARE_EXPORTED_EVENT_TYPE( A2DCANVASDLLEXP, wxEVT_UPDATE_DRAWING, 1 )
922  DECLARE_EXPORTED_EVENT_TYPE( A2DCANVASDLLEXP, wxEVT_CHANGEDMODIFY_DRAWING, 1 )
923  //DECLARE_EXPORTED_EVTIDFUNC( A2DCANVASDLLEXP, wxEVT_CHANGEDMODIFY_DRAWING )
924 END_DECLARE_EVENT_TYPES()
925 
926 //! used to report a2dDrawing events
927 /*!
928  The event Object is a a2dDrawing.
929 
930  \ingroup events
931 
932 */
933 class A2DCANVASDLLEXP a2dDrawingEvent : public a2dEvent
934 {
935 public:
936 
937  //! for event types
938  /*!
939  ::wxEVT_REPORT_VIEWS
940  Sent from a2dDocument to a2dView's. a2dView will add itself to the reportlist of the event, but only
941  when this document is indeed used by the a2dView.
942  Register your wxEvtHandler to recieve it.
943  */
944  a2dDrawingEvent( unsigned int updateHint, a2dDrawing* drawing )
945  : a2dEvent( 0, wxEVT_UPDATE_DRAWING )
946  {
947  m_updateHint = updateHint;
948  SetEventObject( drawing );
949  }
950 
951  a2dDrawingEvent( int theId, wxEventType commandType, a2dDrawing* drawing )
952  : a2dEvent( theId, commandType )
953  {
954  m_updateHint = 0;
955  SetEventObject( drawing );
956  }
957 
958  //! constructor
959  a2dDrawingEvent( const a2dDrawingEvent& event )
960  : a2dEvent( event )
961  {
962  m_updateHint = event.m_updateHint;
963  }
964 
965  virtual wxEvent* Clone() const { return new a2dDrawingEvent( *this ); }
966 
967  unsigned int GetUpdateHint() { return m_updateHint; }
968 
969  a2dDrawing* GetDrawing() { return (a2dDrawing*) GetEventObject(); }
970 
971  int GetModified() { return m_modified; }
972 
973  void SetModified( int modifications ) { m_modified = modifications; }
974 
975  private:
976 
977  int m_modified;
978 
979  unsigned int m_updateHint;
980 };
981 
982 
983 typedef void ( wxEvtHandler::*a2dDrawingEventFunction )( a2dDrawingEvent& );
984 #define a2dDrawingEventHandler(func) \
985  (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(a2dDrawingEventFunction, &func)
986 
987 //! event from a drawing when updated
988 #define EVT_UPDATE_DRAWING(func) wx__DECLARE_EVT0( wxEVT_UPDATE_DRAWING, a2dDrawingEventHandler( func ))
989 
990 //! event from a drawing when changed by commands
991 #define EVT_CHANGEDMODIFY_DRAWING(func) wx__DECLARE_EVT0( wxEVT_CHANGEDMODIFY_DRAWING, a2dDrawingEventHandler( func ))
992 //#define EVT_CHANGEDMODIFY_DRAWING( func ) wx__DECLARE_EVT0( GETID_wxEVT_CHANGEDMODIFY_DRAWING(), a2dDrawingEventHandler( func ))
993 
994 class A2DCANVASDLLEXP ToolDlg;
995 
996 class A2DCANVASDLLEXP a2dStyleDialog;
997 
998 class A2DCANVASDLLEXP LayerPropertiesDialog;
999 
1000 class A2DCANVASDLLEXP a2dLayerOrderDlg;
1001 
1002 class A2DCANVASDLLEXP a2dLayerDlg;
1003 
1004 class A2DCANVASDLLEXP IdentifyDialog;
1005 
1006 class A2DCANVASDLLEXP ExecDlg;
1007 
1008 class A2DCANVASDLLEXP a2dCentralCanvasCommandProcessor;
1009 
1010 class A2DCANVASDLLEXP a2dPathSettings;
1011 
1012 class A2DCANVASDLLEXP a2dSnapSettings;
1013 
1014 class A2DCANVASDLLEXP a2dSettings;
1015 
1016 class A2DCANVASDLLEXP a2dTransDlg;
1017 
1018 class A2DCANVASDLLEXP a2dPropertyEditorDlg;
1019 
1020 class A2DCANVASDLLEXP a2dCanvasObjectsDialog;
1021 
1022 class A2DCANVASDLLEXP a2dCoordinateEntry;
1023 
1024 class A2DCANVASDLLEXP a2dMeasureDlg;
1025 
1026 
1027 #define DECLARE_CMH_HABITAT() \
1028  \
1029  inline a2dCanvasCommandProcessor* GetCanvasCmp() { return wxStaticCast( m_cmp, a2dCanvasCommandProcessor ); } \
1030  a2dHabitat* GetDrawHabitat() \
1031  { \
1032  assert( GetCanvasCmp() ); \
1033  assert( GetCanvasCmp()->m_drawing ); \
1034  return GetCanvasCmp()->m_drawing->GetHabitat(); \
1035  } \
1036 
1037 
1038 
1039 //! a command processor specially designed to work with a a2dCanvasDocument
1040 /*!
1041  This command processor allows you to add object to the document and
1042  takes care of undo redo.
1043 
1044  \ingroup tools commands
1045 */
1046 class A2DCANVASDLLEXP a2dCanvasCommandProcessor : public a2dCommandProcessor
1047 {
1048  DECLARE_EVENT_TABLE()
1049  DECLARE_CLASS( a2dCanvasCommandProcessor )
1050 
1051 public:
1052 
1053  static const a2dCommandId COMID_InsertGroupRef;
1054  static const a2dCommandId COMID_ShowDlgLayers;
1055  static const a2dCommandId COMID_ShowDlgLayersDocument;
1056  static const a2dCommandId COMID_ShowDlgLayersGlobal;
1057  static const a2dCommandId COMID_ShowDlgLayerOrderDocument;
1058  static const a2dCommandId COMID_ShowDlgLayerOrderGlobal;
1059  static const a2dCommandId COMID_ShowDlgTools;
1060  static const a2dCommandId COMID_ShowDlgStyle;
1061  static const a2dCommandId COMID_ShowDlgSnap;
1062  static const a2dCommandId COMID_ShowDlgGroups;
1063  static const a2dCommandId COMID_ShowDlgIdentify;
1064  static const a2dCommandId COMID_ShowDlgCoordEntry;
1065  static const a2dCommandId COMID_ShowDlgMeasure;
1066  static const a2dCommandId COMID_ShowDlgStructure;
1067  static const a2dCommandId COMID_ShowDlgPathSettings;
1068  static const a2dCommandId COMID_ShowDlgSettings;
1069  static const a2dCommandId COMID_ShowDlgTrans;
1070  static const a2dCommandId COMID_ShowDlgPropEdit;
1071  static const a2dCommandId COMID_PopTool;
1072 
1073  a2dCanvasCommandProcessor( a2dDrawing* drawing, int maxCommands = -1 );
1075 
1076  static bool StaticProcessEvent( wxUpdateUIEvent& event );
1077 
1078  void OnUpdateMenu( wxUpdateUIEvent& event );
1079 
1080  static void DefaultOnUpdateMenu( wxUpdateUIEvent& event );
1081 
1082  void OnPushToolUpdateMenu( wxUpdateUIEvent& event );
1083 
1084  //! do this at command start
1085  void OnBusyBegin( a2dCommandProcessorEvent& WXUNUSED( event ) );
1086 
1087  //! do this at command end
1088  void OnBusyEnd( a2dCommandProcessorEvent& WXUNUSED( event ) );
1089 
1090  //! All menu's a2dMenuIdItem used can be intercepted here
1091  void OnMenu( wxCommandEvent& event );
1092 
1093  //! All menu's a2dMenuIdItem used can be intercepted here
1094  void OnPushToolMenu( wxCommandEvent& event );
1095 
1096  bool Print( wxUint16 printWhat );
1097  bool Preview( wxUint16 printWhat );
1098 
1099  //! ask for a file using a file selector.
1100  /*!
1101  If your path contains internal variables, they will be expanded.
1102  */
1103  wxString AskFile( const wxString& message, const wxString& default_path = "",
1104  const wxString& default_filename = "", const wxString& default_extension = "",
1105  const wxString& wildcard = "*.*", int flags = 0,
1106  int x = -1, int y = -1 );
1107 
1108  //! set undo storage or not
1109  void SetUndo( bool withUndo ) { m_withUndo = withUndo; }
1110 
1111  //! get undo storage setting
1112  bool GetUndo() { return m_withUndo; }
1113 
1114  //* next to the base class submit, it sets the document and commandprocessor for
1115  /*!
1116  a2dDocumentCommand
1117  */
1118  virtual bool Submit( a2dCommand* command, bool storeIt = true );
1119 
1120  //! Undo one command or command group
1121  virtual bool Undo();
1122  //! Redo one command or command group
1123  virtual bool Redo();
1124 
1125  //! submit a command template with multiple objects
1126  virtual bool SubmitMultiple( a2dCommand* command, a2dCanvasObjectList* objects, bool storeIt = true );
1127 
1128 #if wxUSE_PRINTING_ARCHITECTURE
1129  wxPageSetupDialogData* GetPageSetupData( void ) const { return m_pageSetupData; }
1130  void SetPageSetupData( const wxPageSetupDialogData& pageSetupData ) { *m_pageSetupData = pageSetupData; }
1131  void SetPageSetupData( wxPageSetupDialogData* pageSetupData );
1132 #endif
1133 
1134  //! full update of drawing
1135  void Refresh();
1136 
1137  void DeselectAll();
1138 
1139  a2dDrawingPart* GetActiveDrawingPart() { return a2dCanvasGlobals->GetActiveDrawingPart(); }
1140 
1141  bool IsShownToolDlg();
1142 
1143  bool IsShowna2dStyleDialog();
1144 
1145  bool IsShownLayerPropertiesDialog();
1146 
1147  bool IsShownLayerOrderDialog();
1148 
1149  bool IsShownIdentifyDialog();
1150 
1151  bool IsShowna2dSnapSettings();
1152 
1153  bool IsShowna2dCoordinateEntry();
1154 
1155  bool IsShowna2dMeasureDlg();
1156 
1157  bool IsShowna2dPathSettings();
1158 
1159  bool IsShowna2dSettings();
1160 
1161  bool IsShowna2dTransDlg();
1162 
1163  //bool IsShownPropEditDlg();
1164 
1165  bool IsShownStructureDlg();
1166 
1167  //! show style dialog or not, return true of changed from previous state
1168  bool ShowDlgStyle( bool onOff );
1169 
1170  bool SaveLayers( const wxFileName& fileName );
1171 
1172  bool LoadLayers( const wxFileName& fileName );
1173 
1174  virtual bool PushToolDragNew( a2dCanvasObject* newObject, const a2dMenuIdItem& initiatingMenuId, bool dragCenter = true );
1175 
1176  virtual bool PushTool( const a2dCommandId& whichTool, bool shiftadd = false, bool oneshot = false );
1177 
1178  a2dBaseTool* PopTool();
1179 
1180  //!set top object available in the a2dCanvasDocument to be used for adding other objects
1181  /*!
1182  \param obj: pointer to object to set as new parent a2dCanvasObject
1183 
1184  \remark the document will be searched to check if the object does exist,
1185  if not found, the rootobject of the document will be set as parent.
1186 
1187  \remark if obj is set to NULL, the rootobject of the document will be set.
1188 
1189  \return if the object is found and set return is true
1190  */
1191  bool SetParentObject( a2dCanvasObject* obj = 0 );
1192 
1193  //!return pointer of then current parent object
1194  //!\return: pointer to the current object that is used for adding other objects to.
1195  a2dCanvasObject* GetParentObject() { return m_parent; }
1196 
1197  //! get the current canvas object to add to parent as child
1198  a2dCanvasObject* GetCurrentCanvasObject() { return m_currentobject; }
1199 
1200  //! set the current canvas object, which gets the change in style etc
1201  /*!
1202  The current object is the object that gets the settings made on the commandprocessor
1203  and that do influence a a2dCanvasObject.
1204  Normally this is already set when a new object is added via commands.
1205  You must use NULL to reset the current object to not in use.
1206 
1207  When setting the current object, normally the object its properties are checked and the commandprocessor
1208  its internal chached properties or updated to that.
1209 
1210  \param currentcanvasobject the object to set current.
1211  \param takeOverProperties when true the internal chached properties are updated from the object.
1212  */
1213  void SetCurrentCanvasObject( a2dCanvasObject* currentcanvasobject, bool takeOverProperties = true );
1214 
1215  //! add the current canvas object to parent as child
1216  /*! First the current style is to the currentobject, and then it is added to the document.
1217 
1218  \param objectToAdd this is the object to add to the current parentobject
1219  \param withUndo if true a a2dCommand_AddObject will be used to have undo information
1220  \param setStyles the object added will get these styles that are currently set in the command processor
1221  \param parentObject when not NULL, this will become the current parent object.
1222  */
1223  a2dCanvasObject* AddCurrent( a2dCanvasObject* objectToAdd, bool withUndo = false, a2dPropertyIdList* setStyles = NULL, a2dCanvasObject* parentObject = NULL );
1224 
1225  //! add specific object
1226  a2dCanvasObject* Add_a2dCanvasObject( double x = 0, double y = 0 );
1227 
1228  //! add specific object
1229  a2dCanvasObjectReference* Add_a2dCanvasObjectReference( double x, double y, a2dCanvasObject* obj );
1230 
1231  //a2dNameReference* Add_a2dNameReference( double x, double y, a2dCanvasObject* obj, const wxString &text, double size, double angle );
1232 
1233  //! add specific object
1234  a2dOrigin* Add_a2dOrigin( double w, double h );
1235 
1236  //! add specific object
1237  a2dHandle* Add_a2dHandle( double xc, double yc, int w, int h, double angle = 0 , int radius = 0 );
1238 
1239  //! add specific object
1240  a2dRectC* Add_a2dRectC( double xc, double yc, double w, double h, double angle = 0 , double radius = 0 );
1241 
1242  //! add specific object
1243  a2dArrow* Add_a2dArrow( double xt, double yt, double l1, double l2, double b, bool spline = false );
1244 
1245  //! add specific object
1246  a2dRect* Add_a2dRect( double x, double y, double w, double h , double radius = 0 );
1247 
1248  //! add specific object
1249  a2dCircle* Add_a2dCircle( double x, double y, double radius );
1250 
1251  //! add specific object
1252  a2dEllipse* Add_a2dEllipse( double xc, double yc, double width, double height );
1253 
1254  //! add specific object
1255  a2dEllipticArc* Add_a2dEllipticArc( double xc, double yc, double width, double height, double start, double end );
1256 
1257  //! add specific object
1258  a2dArc* Add_a2dArc( double xc, double yc, double radius, double start, double end );
1259 
1260  //! add specific object
1261  a2dSLine* Add_a2dSLine( double x1, double y1, double x2, double y2 );
1262 
1263  //! add specific object
1264  a2dEndsLine* Add_a2dEndsLine( double x1, double y1, double x2, double y2 );
1265 
1266  //! add specific object
1267  a2dImage* Add_a2dImage( const wxImage& image, double xc, double yc, double w, double h );
1268 
1269  //! add specific object
1270  a2dImage* Add_a2dImage( const wxString& imagefile, wxBitmapType type, double xc, double yc, double w, double h );
1271 
1272  //! add specific object
1273  a2dText* Add_a2dText( const wxString& text, double x, double y, double angle, const a2dFont& font );
1274 
1275  //! add specific object
1276  a2dPolygonL* Add_a2dPolygonL( a2dVertexList* points, bool spline = false );
1277 
1278  //! add specific object
1279  a2dPolylineL* Add_a2dPolylineL( a2dVertexList* points, bool spline = false );
1280 
1281  //! add a point to the current a2dCanvasObject
1282  bool Add_Point( double x, double y );
1283 
1284  //! add a point to the current a2dCanvasObject
1285  bool Move_Point( int index , double x, double y );
1286 
1287  void SetZoomFactor( double zoomfactor ) { m_zoomfactor = zoomfactor; }
1288  double GetZoomFactor() { return m_zoomfactor; }
1289 
1290  //! Zoom to this rectangle, or Upp at x1, y1.
1291  bool Zoom( double x1, double y1, double x2, double y2, bool upp );
1292 
1293  //! Zoom to a real size or a factor of it.
1294  /*! Center of window is the fix point unless the slected flag is set, and there are selected objects, in which case it
1295  is the centre of the boundingbox of the selected objects.
1296 
1297  \param scaleFromRealSize Factor from the real size the zoom will be.
1298  \param selected if set also look at selcted objects.
1299  */
1300  bool ZoomRealSize( double scaleFromRealSize, bool selected );
1301 
1302  bool ZoomOut();
1303 
1304  //! select this area
1305  bool Select( double x1, double y1, double x2, double y2 );
1306 
1307  //! de select this area
1308  bool DeSelect( double x1, double y1, double x2, double y2 );
1309 
1310  void DeleteDlgs();
1311 
1312  void OnEditProperties( a2dPropertyEditEvent& event );
1313 
1314  //! convert canvasobject to a list of polygons.
1315  //! But only for simple primitive objects.
1316  //! first a2dCanvasObject::GetAsCanvasVpaths() is used to convert to vector paths,
1317  //! and next the vector path is translated into polygons.
1318  a2dCanvasObjectList* ConvertToPolygons( a2dCanvasObject* canvasobject, bool transform );
1319 
1320  //! convert canvasobject to a list of Vpath.
1321  //! But only for simple primitive objects.
1322  //! first a2dCanvasObject::GetAsCanvasVpaths() is used to convert to vector paths,
1323  a2dCanvasObjectList* ConvertToVpath( a2dCanvasObject* canvasobject, bool transform );
1324 
1325  void ClearMeasurements();
1326  void AddMeasurement( double x, double y );
1327  void SetRelativeStart( double x, double y );
1328 
1329  static const a2dSignal sig_ClearMeasurements;
1330  static const a2dSignal sig_AddMeasurement;
1331  static const a2dSignal sig_SetRelativeStart;
1332 
1333  //! sets current style object to current canvas object
1334  /*!
1335  For the property id's in the list, copy the current settings in the command processor
1336  to the current object.
1337 
1338  \param setStyles lit of property id which will be set if available in the command processor.
1339  */
1340  //void SetStyle( a2dPropertyIdList* setStyles );
1341 
1342  //! current parent object to which new objects will be added as childs
1343  //! this is also the ShowObject of the Active a2dCanvasView when apropriate.
1345 
1346  //! last added object
1348 
1349  //! add in front of parent childs or add end
1351 
1352  a2dDrawing* m_drawing;
1353 
1354  //! if set, for commands which can undo, will be submitted like that.
1356 
1357  double m_meas_x, m_meas_y;
1358 
1359  double m_zoomfactor;
1360 
1361  bool InsertGroupRef();
1362 
1363  static ToolDlg* m_tooldlg;
1364 
1365  static a2dStyleDialog* m_styledlg;
1366 
1367  static LayerPropertiesDialog* m_layersdlg;
1368 
1369  static a2dLayerOrderDlg* m_layerOrderDlg;
1370 
1371  static IdentifyDialog* m_identifyDlg;
1372 
1373  static a2dSnapSettings* m_snapSettings;
1374 
1375  static a2dCoordinateEntry* m_coordEntry;
1376 
1377  static a2dMeasureDlg* m_measure;
1378 
1379  static a2dPathSettings* m_pathsettings;
1380 
1381  static a2dSettings* m_settings;
1382 
1383  static a2dTransDlg* m_transset;
1384 
1385  static a2dPropertyEditorDlg* m_propEdit;
1386 
1387  static a2dCanvasObjectsDialog* m_structDlg;
1388 
1389  static a2dLayerDlg* m_layerChooseDlg;
1390 
1391 #if wxUSE_PRINTING_ARCHITECTURE
1392  //! this is the global printer page setup data for printer
1393  wxPageSetupDialogData* m_pageSetupData;
1394 #endif
1395 
1396 };
1397 
1398 //! used to add object to a a2dCanvasDocument in the current parent
1399 /*!
1400 
1401  \ingroup commands
1402 */
1403 class A2DCANVASDLLEXP a2dCommand_AddObject: public a2dCommand
1404 {
1405 
1406 public:
1407  //! used to add object to a a2dCanvasDocument in the current parent
1408  /*! \ingroup commandid
1409  */
1410  static const a2dCommandId Id;
1411 
1412  a2dCommand_AddObject() { m_canvasobject = NULL; m_parent = NULL; }
1413 
1415 
1416  ~a2dCommand_AddObject( void );
1417 
1418  bool Do();
1419  bool Undo();
1420  bool Redo();
1421 
1422  DECLARE_CMH_HABITAT()
1423 
1424  a2dCanvasObject* GetCanvasObject() { return m_canvasobject; }
1425  a2dCanvasObject* GetParent() const { return m_parent; }
1426 
1427 protected:
1428  a2dCanvasObjectPtr m_canvasobject;
1429  a2dCanvasObjectPtr m_parent;
1430 };
1431 
1432 //! used to release object from a a2dCanvasDocument in the current parent
1433 /*!
1434 
1435  \ingroup commands
1436 */
1437 class A2DCANVASDLLEXP a2dCommand_ReleaseObject: public a2dCommand
1438 {
1439 
1440 public:
1441 
1442  //! used to release object from a a2dCanvasDocument in the current parent
1443  /*! \ingroup commandid
1444  */
1445  static const a2dCommandId Id;
1446 
1447  a2dCommand_ReleaseObject() { m_canvasobject = NULL; m_parent = NULL; m_index = 0; m_now = true; }
1448 
1449  a2dCommand_ReleaseObject( a2dCanvasObject* parent, a2dCanvasObject* object, bool now = true );
1450 
1451  ~a2dCommand_ReleaseObject( void );
1452 
1453  bool Do();
1454  bool Undo();
1455  bool PreDo();
1456 
1457 
1458  a2dCanvasObject* GetCanvasObject() { return m_canvasobject; }
1459  a2dCanvasObject* GetParent() { return m_parent; }
1460 
1461  DECLARE_CMH_HABITAT()
1462 
1463 protected:
1464 
1465  a2dCanvasObjectPtr m_canvasobject;
1466  a2dCanvasObjectPtr m_parent;
1467  int m_index;
1468  bool m_now;
1469 };
1470 
1471 //! move object within a a2dDrawing
1472 /*!
1473 
1474  \ingroup commands
1475 */
1476 class A2DCANVASDLLEXP a2dCommand_MoveObject: public a2dCommand
1477 {
1478 
1479 public:
1480 
1481  //! used to release object from a a2dCanvasDocument in the current parent
1482  /*! \ingroup commandid
1483  */
1484  static const a2dCommandId Id;
1485 
1486  a2dCommand_MoveObject( a2dCanvasObject* parentFrom = NULL, a2dCanvasObject* parentTo = NULL, a2dCanvasObject* object = NULL );
1487 
1488  ~a2dCommand_MoveObject( void );
1489 
1490  bool Do();
1491  bool Undo();
1492 
1493  a2dCanvasObject* GetCanvasObject() { return m_canvasobject; }
1494  a2dCanvasObject* GetParentFrom() { return m_parentFrom; }
1495  a2dCanvasObject* GetParentTo() { return m_parentTo; }
1496 
1497  DECLARE_CMH_HABITAT()
1498 
1499 protected:
1500 
1501  a2dCanvasObjectPtr m_canvasobject;
1502  a2dCanvasObjectPtr m_parentFrom;
1503  a2dCanvasObjectPtr m_parentTo;
1504  int m_index;
1505 };
1506 
1507 //! used to replace an object in a a2dCanvasDocument in the current parent
1508 /*!
1509 
1510  \ingroup commands
1511 */
1512 class A2DCANVASDLLEXP a2dCommand_ReplaceObject: public a2dCommand
1513 {
1514 
1515 public:
1516  //! used to replace an object in a a2dCanvasDocument in the current parent
1517  /*! \ingroup commandid
1518  */
1519  static const a2dCommandId Id;
1520 
1521  a2dCommand_ReplaceObject() { m_canvasobject = NULL; m_canvasobject2 = NULL; m_parent = NULL; }
1522 
1523  a2dCommand_ReplaceObject( a2dCanvasObject* parent, a2dCanvasObject* oldobject, a2dCanvasObject* newobject );
1524 
1525  ~a2dCommand_ReplaceObject( void );
1526 
1527  bool Do();
1528  bool Undo();
1529 
1530  DECLARE_CMH_HABITAT()
1531 
1532 protected:
1533 
1534  a2dCanvasObjectPtr m_canvasobject;
1535  a2dCanvasObjectPtr m_canvasobject2;
1536  a2dCanvasObjectPtr m_parent;
1537 };
1538 
1539 //! for changing boolean values inside a rectangle of the current parent object.
1540 /*!
1541 */
1542 class A2DCANVASDLLEXP a2dCommand_SetFlags: public a2dCommand
1543 {
1544 public:
1545 
1546  //!
1547  /*! \ingroup commandid
1548  */
1549  static const a2dCommandId Id;
1550 
1551  a2dCommand_SetFlags() { m_parentObject = NULL; }
1552 
1553  //! given flags of objects within the rectangle are set to value
1554  a2dCommand_SetFlags( a2dCanvasObject* parentObject, a2dCanvasObjectFlagsMask which, bool value, bool preserve = false, a2dCanvasObjectFlagsMask whichobjects = a2dCanvasOFlags::ALL, const a2dBoundingBox& bbox = wxNonValidBbox );
1555 
1556  ~a2dCommand_SetFlags( void );
1557 
1558  bool Do();
1559  bool Undo();
1560  bool Redo();
1561 
1562  DECLARE_CMH_HABITAT()
1563 
1564 protected:
1565 
1566  a2dBoundingBox m_bbox;
1567 
1568  a2dCanvasObjectFlagsMask m_which;
1569  a2dCanvasObjectFlagsMask m_whichObjects;
1570 
1571  //! objects found with required mask
1573  a2dlist< a2dCanvasObjectFlagsMask > m_objectOldMask;
1574 
1575  //! parent of found objects
1577  bool m_preserve;
1578  bool m_bool;
1579 };
1580 
1581 //! for changing boolean values inside canvas objects
1582 /*!
1583  \ingroup commands
1584 */
1585 class A2DCANVASDLLEXP a2dCommand_SetFlag: public a2dCommand
1586 {
1587 public:
1588  //!
1589  /*! \ingroup commandid
1590  */
1591  static const a2dCommandId Id;
1592 
1593  a2dCommand_SetFlag() { m_canvasobject = NULL; }
1594 
1595  //! given flag of object set to value
1596  a2dCommand_SetFlag( a2dCanvasObject* object, a2dCanvasObjectFlagsMask which, bool value );
1597 
1598  ~a2dCommand_SetFlag( void );
1599 
1600  virtual a2dCommand* CloneAndBind( a2dObject* object );
1601 
1602  bool Do();
1603  bool Undo();
1604 
1605  DECLARE_CMH_HABITAT()
1606 
1607 protected:
1608 
1609  a2dCanvasObjectPtr m_canvasobject;
1610 
1611  a2dCanvasObjectFlagsMask m_which;
1612 
1613  bool m_bool;
1614 };
1615 
1616 //! for changing boolean flag values inside pins
1617 /*!
1618  \ingroup commands
1619 */
1620 class A2DCANVASDLLEXP a2dCommand_SetPinFlags: public a2dCommand
1621 {
1622 public:
1623  //!
1624  /*! \ingroup commandid
1625  */
1626  static const a2dCommandId Id;
1627 
1628  a2dCommand_SetPinFlags() { m_pin = NULL; }
1629 
1630  //! given flags of object set to value
1631  a2dCommand_SetPinFlags( a2dPin* pin, a2dPin::a2dPinFlagsMask which, bool value );
1632 
1633  ~a2dCommand_SetPinFlags( void );
1634 
1635  virtual a2dCommand* CloneAndBind( a2dObject* object );
1636 
1637  bool Do();
1638  bool Undo();
1639 
1640  DECLARE_CMH_HABITAT()
1641 
1642 protected:
1643 
1644  a2dPinPtr m_pin;
1645 
1646  a2dPin::a2dPinFlagsMask m_which;
1647 
1648  a2dPin::a2dPinFlagsMask m_oldmask;
1649 
1650  bool m_value;
1651 };
1652 
1653 // used as base commands for commands on a group of selected objects.
1654 class A2DCANVASDLLEXP a2dCommandMasked: public a2dCommandGroup
1655 {
1656 public:
1657 
1659  a2dCanvasObject* parentObject,
1660  a2dCommandGroup* parent,
1663  bool index = false, bool rewire = false,
1664  const a2dCommandId& commandId = sm_noCommandId,
1665  const a2dCommandId& commandTypeId = sm_noCommandTypeId,
1666  const wxString& menuString = wxEmptyString
1667  );
1668 
1669  //! destructor
1670  ~a2dCommandMasked( void );
1671 
1672  inline a2dCommand* TClone( CloneOptions options = clone_deep, a2dRefMap* refs = NULL ) { return ( a2dCommand* ) Clone( options, refs ); }
1673 
1674  bool Do();
1675  bool PostDo();
1676 
1677  bool Undo();
1678  bool Redo();
1679 
1680  DECLARE_CMH_HABITAT()
1681 
1682 protected:
1683  virtual a2dObject* DoClone( CloneOptions options, a2dRefMap* refs ) const;
1684 
1685  //! the mask required for the objects to search
1687  //! target mask for m_target
1689 
1690  //! produce index of where masked object are found.
1691  bool m_index;
1692 
1693  //! objects connected with pins rewiring is optional
1694  bool m_rewire;
1695 
1696  //! objects found with required mask
1698  //! indexes of found objects
1700  //! target object
1702  //! parent of found objects
1704 
1705  a2dCanvasObjectList m_copies;
1706 };
1707 
1708 //! for changing boolean select flag values inside canvas objects
1709 /*!
1710  This command takes into account the layer settings of the a2dCanvasDocument,
1711  if there the layer is set non selectable, nothing will be done.
1712 
1713  \ingroup commands
1714 */
1715 class A2DCANVASDLLEXP a2dCommand_SetSelectFlag: public a2dCommand
1716 {
1717 public:
1718  //!
1719  /*! \ingroup commandid
1720  */
1721  static const a2dCommandId Id;
1722 
1723  a2dCommand_SetSelectFlag() { m_canvasobject = NULL; }
1724 
1725  //! given select flag of object set to value
1726  a2dCommand_SetSelectFlag( a2dCanvasObject* object, bool value, bool preserve = false );
1727 
1728  ~a2dCommand_SetSelectFlag( void );
1729 
1730  virtual a2dCommand* CloneAndBind( a2dObject* object );
1731 
1732  bool Do();
1733  bool Undo();
1734  bool Redo();
1735 
1736  DECLARE_CMH_HABITAT()
1737 
1738 protected:
1739 
1740  a2dCanvasObjectPtr m_canvasobject;
1741 
1742  bool m_bool; //value to set select flag to
1743  bool m_preserve; //do undo redo sets the flag (used as subcommand in groups)
1744  bool m_oldvalue; //what it was
1745 };
1746 
1747 //! for changing boolean select2 flag values inside canvas objects
1748 /*!
1749  This command takes into account the layer settings of the a2dCanvasDocument,
1750  if there the layer is set non selectable, nothing will be done.
1751 
1752  \ingroup commands
1753 */
1754 class A2DCANVASDLLEXP a2dCommand_SetSelect2Flag: public a2dCommand
1755 {
1756 public:
1757  //!
1758  /*! \ingroup commandid
1759  */
1760  static const a2dCommandId Id;
1761 
1762  a2dCommand_SetSelect2Flag() { m_canvasobject = NULL; }
1763 
1764  //! given select flag of object set to value
1765  a2dCommand_SetSelect2Flag( a2dCanvasObject* object, bool value, bool preserve = false );
1766 
1767  ~a2dCommand_SetSelect2Flag( void );
1768 
1769  virtual a2dCommand* CloneAndBind( a2dObject* object );
1770 
1771  bool Do();
1772  bool Undo();
1773  bool Redo();
1774 
1775  DECLARE_CMH_HABITAT()
1776 
1777 protected:
1778 
1779  a2dCanvasObjectPtr m_canvasobject;
1780 
1781  bool m_bool;
1782  bool m_preserve; //do undo redo sets the flag (used as subcommand in groups)
1783  bool m_oldvalue; //what it was
1784 };
1785 
1786 
1787 #include <wx/listimpl.cpp>
1788 
1789 //! used as part of a a2dCommand_TransformMask to store the matrix
1790 //! of a a2dCanvasObject, in order to Undo/Redo the command
1791 class A2DCANVASDLLEXP a2dCommandMatrixData
1792 {
1793 
1794 public:
1795  //!
1796  /*! \ingroup commandid
1797  */
1798  static const a2dCommandId Id;
1799 
1800  a2dCommandMatrixData( a2dCanvasObject* WXUNUSED( parent ), a2dCanvasObject* object, const a2dAffineMatrix& transform )
1801  {
1802  m_object = ( a2dCanvasObject* ) object;
1803  m_transform = transform;
1804  }
1805 
1807  {
1808  }
1809 
1810  a2dCanvasObjectPtr m_parent;
1811 
1812  a2dCanvasObjectPtr m_object;
1813  a2dAffineMatrix m_transform;
1814 };
1815 
1817 
1818 //! for changing only the matrix of objects for which a certain mask was set
1819 /*!
1820  \ingroup commands
1821 */
1822 class A2DCANVASDLLEXP a2dCommand_TransformMask: public a2dCommandMasked
1823 {
1824 public:
1825  //!
1826  /*! \ingroup commandid
1827  */
1828  static const a2dCommandId Id;
1829 
1831 
1832  ~a2dCommand_TransformMask( void );
1833 
1834  bool Do();
1835  bool PostDo( void );
1836  bool Undo();
1837  bool Redo( void );
1838 
1839  DECLARE_CMH_HABITAT()
1840 
1841 protected:
1842 
1843  virtual a2dObject* DoClone( CloneOptions options, a2dRefMap* refs ) const
1844  {
1845  return new a2dCommand_TransformMask( m_parentObject, m_transform, m_which );
1846  }
1847 
1848  a2dObjectMatrixList m_objectsMatrix;
1849 
1850  a2dAffineMatrix m_transform;
1851 };
1852 
1853 //! for changing only the matrix of objects for which a certain mask was set
1854 /*!
1855  \ingroup commands
1856 */
1857 class A2DCANVASDLLEXP a2dCommand_RotateMask: public a2dCommandMasked
1858 {
1859 public:
1860  //!
1861  /*! \ingroup commandid
1862  */
1863  static const a2dCommandId Id;
1864 
1866 
1867  ~a2dCommand_RotateMask( void );
1868 
1869  bool Do();
1870  bool PostDo();
1871  bool Undo();
1872  bool Redo( void );
1873 
1874  DECLARE_CMH_HABITAT()
1875 
1876 protected:
1877 
1878  virtual a2dObject* DoClone( CloneOptions options, a2dRefMap* refs ) const
1879  {
1880  return new a2dCommand_RotateMask( m_parentObject, m_angle, m_which );
1881  }
1882 
1883  a2dObjectMatrixList m_objectsMatrix;
1884 
1885  double m_angle;
1886 };
1887 
1888 
1889 //! for changing only the alignment of objects for which a certain mask was set
1890 /*!
1891  \ingroup commands
1892 */
1893 class A2DCANVASDLLEXP a2dCommand_AlignMask: public a2dCommandMasked
1894 {
1895 public:
1896 
1897  enum Alignment
1898  {
1899  MIDY = 0x00000000,
1900  MIDX = 0x00000001,
1901  MINX = 0x00000002,
1902  MAXX = 0x00000004,
1903  MINY = 0x00000008,
1904  MAXY = 0x00000010,
1905  MirrorVert = 0x00000020,
1906  MirrorHorz = 0x00000040,
1907  MirrorVertBbox = 0x00000080,
1908  MirrorHorzBbox = 0x00000100,
1909  DistributeVert = 0x00000200,
1910  DistributeHorz = 0x00000400,
1911  MIDY_Dest = 0x00010000,
1912  MIDX_Dest = 0x00020000,
1913  MINX_Dest = 0x00040000,
1914  MAXX_Dest = 0x00080000,
1915  MINY_Dest = 0x00100000,
1916  MAXY_Dest = 0x00200000,
1917  MirrorVert_Dest = 0x00400000,
1918  MirrorHorz_Dest = 0x00800000,
1919  MirrorVertBbox_Dest = 0x01000000,
1920  MirrorHorzBbox_Dest = 0x02000000,
1921  DistributeVert_Dest = 0x04000000,
1922  DistributeHorz_Dest = 0x08000000
1923  };
1924 
1925 
1926  //!
1927  /*! \ingroup commandid
1928  */
1929  static const a2dCommandId Id;
1930 
1932 
1933  ~a2dCommand_AlignMask( void );
1934 
1935  bool Do();
1936  bool PostDo( void );
1937  bool Undo();
1938  bool Redo();
1939 
1940  DECLARE_CMH_HABITAT()
1941 
1942 protected:
1943 
1944  virtual a2dObject* DoClone( CloneOptions options, a2dRefMap* refs ) const
1945  {
1946  return new a2dCommand_AlignMask( m_parentObject, m_align, m_which );
1947  }
1948 
1949  a2dObjectMatrixList m_objectsMatrix;
1950 
1951  Alignment m_align;
1952 };
1953 
1954 
1955 //! used to add points to polygon objects
1956 /*!
1957  \ingroup commands
1958 */
1959 class A2DCANVASDLLEXP a2dCommand_AddPoint: public a2dCommand
1960 {
1961 public:
1962  //!
1963  /*! \ingroup commandid
1964  */
1965  static const a2dCommandId Id;
1966 
1967  a2dCommand_AddPoint() { m_canvasobject = NULL; }
1968 
1969  a2dCommand_AddPoint( a2dCanvasObject* object, double x, double y, int index, bool afterinversion = true );
1970  a2dCommand_AddPoint( a2dCanvasObject* object, double x, double y, a2dLineSegmentPtr seg, bool afterinversion = true );
1971  ~a2dCommand_AddPoint( void );
1972 
1973  bool Do();
1974  bool Undo();
1975  bool Redo();
1976 
1977  DECLARE_CMH_HABITAT()
1978 
1979  // x of point
1980  double m_x;
1981 
1982  // y of point
1983  double m_y;
1984 
1985  a2dLineSegmentPtr m_seg;
1986  a2dLineSegmentPtr m_segAdded;
1987 
1988  bool m_afterinversion;
1989 
1990  a2dCanvasObjectPtr m_canvasobject;
1991 
1992 };
1993 
1994 //! used to move points in polygon objects
1995 /*!
1996 */
1997 class A2DCANVASDLLEXP a2dCommand_MoveSegment: public a2dCommand
1998 {
1999 public:
2000  //!
2001  /*! \ingroup commandid
2002  */
2003  static const a2dCommandId Id;
2004 
2005  a2dCommand_MoveSegment() { m_canvasobject = NULL; }
2006 
2007  a2dCommand_MoveSegment( a2dCanvasObject* object, double x, double y, int index, bool afterinversion = true );
2008  a2dCommand_MoveSegment( a2dCanvasObject* object, double x, double y, a2dLineSegmentPtr seg, bool afterinversion = true );
2009  ~a2dCommand_MoveSegment( void );
2010 
2011  bool Do();
2012  bool Undo();
2013 
2014  DECLARE_CMH_HABITAT()
2015 
2016  // x of point
2017  double m_x;
2018 
2019  // y of point
2020  double m_y;
2021 
2022  a2dLineSegmentPtr m_seg;
2023 
2024  bool m_afterinversion;
2025 
2026  a2dCanvasObjectPtr m_canvasobject;
2027 
2028 };
2029 
2030 //! used to move points in polygon objects
2031 /*!
2032 */
2033 class A2DCANVASDLLEXP a2dCommand_MoveMidSegment: public a2dCommand
2034 {
2035 public:
2036  //!
2037  /*! \ingroup commandid
2038  */
2039  static const a2dCommandId Id;
2040 
2041  a2dCommand_MoveMidSegment() { m_canvasobject = NULL; }
2042 
2043  a2dCommand_MoveMidSegment( a2dCanvasObject* object, double x, double y, int index, bool afterinversion = true );
2044  a2dCommand_MoveMidSegment( a2dCanvasObject* object, double x, double y, a2dLineSegmentPtr seg, bool afterinversion = true );
2045  ~a2dCommand_MoveMidSegment( void );
2046 
2047  bool Do();
2048  bool Undo();
2049 
2050  DECLARE_CMH_HABITAT()
2051 
2052  // x of point
2053  double m_x;
2054 
2055  // y of point
2056  double m_y;
2057 
2058  bool m_afterinversion;
2059 
2060  a2dLineSegmentPtr m_seg;
2061 
2062  a2dCanvasObjectPtr m_canvasobject;
2063 
2064 };
2065 
2066 //! used to remove points from polygon objects
2067 /*!
2068  \ingroup commands
2069 */
2070 class A2DCANVASDLLEXP a2dCommand_RemoveSegment: public a2dCommand
2071 {
2072 public:
2073  //!
2074  /*! \ingroup commandid
2075  */
2076  static const a2dCommandId Id;
2077 
2078  a2dCommand_RemoveSegment() { m_canvasobject = NULL; }
2079 
2080  a2dCommand_RemoveSegment( a2dCanvasObject* object, int index );
2082  ~a2dCommand_RemoveSegment( void );
2083 
2084  bool Do();
2085  bool Undo();
2086 
2087  DECLARE_CMH_HABITAT()
2088 
2089  //! where did we remove it, in order to insert there in case of undo
2090  unsigned int m_index;
2091 
2092  //! segment removed
2094 
2095  a2dCanvasObjectPtr m_canvasobject;
2096 };
2097 
2098 //! used to set the complete Segment list/array of polygons
2099 /*!
2100  \ingroup commands
2101 */
2102 class A2DCANVASDLLEXP a2dCommand_SetSegments: public a2dCommand
2103 {
2104 public:
2105  //!
2106  /*! \ingroup commandid
2107  */
2108  static const a2dCommandId Id;
2109 
2110  a2dCommand_SetSegments() { m_canvasobject = NULL; }
2111 
2112  a2dCommand_SetSegments( a2dCanvasObject* object, a2dVertexList* segments, bool afterinversion );
2113  ~a2dCommand_SetSegments( void );
2114 
2115  bool Do();
2116  bool Undo();
2117 
2118  DECLARE_CMH_HABITAT()
2119 
2120  // Segment list
2121  a2dSmrtPtr<a2dVertexList> m_segments;
2122 
2123  a2dCanvasObjectPtr m_canvasobject;
2124 };
2125 
2126 //! used to move start or end point in line objects
2127 /*!
2128  Move begin or end point of a2dSLine or derived.
2129 */
2130 class A2DCANVASDLLEXP a2dCommand_MovePoint: public a2dCommand
2131 {
2132 public:
2133  //!
2134  /*! \ingroup commandid
2135  */
2136  static const a2dCommandId Id;
2137 
2138  a2dCommand_MovePoint() { m_line = NULL; }
2139 
2140  a2dCommand_MovePoint( a2dSLine* object, double x, double y, bool start, bool afterinversion = true );
2141  ~a2dCommand_MovePoint( void );
2142 
2143  bool Do();
2144  bool Undo();
2145 
2146  DECLARE_CMH_HABITAT()
2147 
2148  // x of point
2149  double m_x;
2150 
2151  // y of point
2152  double m_y;
2153 
2154  // true of start point is moved
2155  bool m_start;
2156 
2157  bool m_afterinversion;
2158 
2159  a2dSmrtPtr<a2dSLine> m_line;
2160 
2161 };
2162 
2163 //! used to change text and caret of canvas text objects in a a2dCanvasDocument
2164 /*!
2165  \ingroup commands
2166 */
2167 class A2DCANVASDLLEXP a2dCommand_ChangeText: public a2dCommand
2168 {
2169 public:
2170  //!
2171  /*! \ingroup commandid
2172  */
2173  static const a2dCommandId Id;
2174 
2175  a2dCommand_ChangeText() { m_canvasobject = NULL; }
2176 
2177  a2dCommand_ChangeText( a2dText* object, wxString text,
2178  int caret, const a2dFont& font, double linespace, unsigned int textflags );
2179  ~a2dCommand_ChangeText( void );
2180 
2181  bool Do();
2182  bool Undo();
2183 
2184  a2dText* GetTextObject() { return m_canvasobject; }
2185 
2186  DECLARE_CMH_HABITAT()
2187 
2188 protected:
2189 
2190  wxString m_text;
2191  int m_caret;
2192  a2dFont m_font;
2193  double m_linespace;
2194  unsigned int m_textflags;
2195  a2dSmrtPtr<a2dText> m_canvasobject;
2196 };
2197 
2198 //! used to change style of canvas objects in a a2dCanvasDocument
2199 /*!
2200 */
2201 class A2DCANVASDLLEXP a2dCommand_ChangeCanvasObjectStyle: public a2dCommand
2202 {
2203 public:
2204  //!
2205  /*! \ingroup commandid
2206  */
2207  static const a2dCommandId Id;
2208 
2209  //! non info.
2211  static const a2dCommandId sm_SetStrokeStyleCommand;
2212  static const a2dCommandId sm_SetStyleCommand;
2213 
2214  a2dCommand_ChangeCanvasObjectStyle() { m_propObject = NULL; }
2215 
2216  a2dCommand_ChangeCanvasObjectStyle( a2dObject* object, const a2dFill& fill );
2217  a2dCommand_ChangeCanvasObjectStyle( a2dObject* object, const a2dStroke& stroke );
2218  a2dCommand_ChangeCanvasObjectStyle( a2dObject* object, const a2dFill& fill, const a2dStroke& stroke );
2219 
2221 
2222  bool Do();
2223  bool Undo();
2224 
2225  DECLARE_CMH_HABITAT()
2226 
2227 protected:
2228 
2229  a2dSmrtPtr< a2dObject > m_propObject;
2230 
2231  a2dFill m_fill;
2232 
2233  a2dStroke m_stroke;
2234 
2235 };
2236 
2237 //! used to change a property on objects
2238 /*!
2239  A a2dObject property is set on the a2dObject, and the first property
2240  on the a2dObject with the same name is used for undo.
2241  If the property was not yet set for the object, in Undo the new property is just removed, else
2242  the old value is restored.
2243 */
2245 {
2246 public:
2247  //!
2248  /*! \ingroup commandid
2249  */
2250  static const a2dCommandId Id;
2251 
2253 
2254  //! Set property on object
2255  /*!
2256  The property its name is used for undo, and restore the old value if available.
2257 
2258  \param object the canvas object to set the property on.
2259  \param property the property to set
2260  */
2261  a2dCommand_SetCanvasProperty( a2dObject* object, a2dNamedProperty* property )
2262  : a2dCommand_SetProperty( object, property ) {}
2263 
2264  //! Set property on object
2265  /*!
2266  The property its name is used for undo, and restore the old value if available.
2267 
2268  \param object the canvas object to set the property on.
2269  \param id the name of the property to set.
2270  \param value the value to set the property to.
2271  */
2272  a2dCommand_SetCanvasProperty( a2dObject* object, const a2dPropertyIdRefObject* id, a2dObject* value )
2273  : a2dCommand_SetProperty( object, id, value ) {}
2274 
2275  //! Set property on object
2276  /*!
2277  The property its name is used for undo, and restore the old value if available.
2278 
2279  \param object the canvas object to set the property on.
2280  \param id the name of the property to set.
2281  \param value the value to set the property to.
2282 
2283  */
2284  a2dCommand_SetCanvasProperty( a2dObject* object, const a2dPropertyIdString* id, const wxString& value )
2285  : a2dCommand_SetProperty( object, id, value ) {}
2286 
2287  //! Set property on object
2288  /*!
2289  The property its name is used for undo, and restore the old value if available.
2290 
2291  \param object the canvas object to set the property on.
2292  \param id the name of the property to set.
2293  \param value the value to set the property to.
2294 
2295  */
2296  a2dCommand_SetCanvasProperty( a2dObject* object, const a2dPropertyIdBool* id, bool value )
2297  : a2dCommand_SetProperty( object, id, value ) {}
2298 
2299  //! Set property on object
2300  /*!
2301  The property its name is used for undo, and restore the old value if available.
2302 
2303  \param object the canvas object to set the property on.
2304  \param id the name of the property to set.
2305  \param value the value to set the property to.
2306 
2307  */
2308  a2dCommand_SetCanvasProperty( a2dObject* object, const a2dPropertyIdInt16* id, wxInt16 value )
2309  : a2dCommand_SetProperty( object, id, value ) {}
2310 
2311  //! Set property on object
2312  /*!
2313  The property its name is used for undo, and restore the old value if available.
2314 
2315  \param object the canvas object to set the property on.
2316  \param id the name of the property to set.
2317  \param value the value to set the property to.
2318 
2319  */
2320  a2dCommand_SetCanvasProperty( a2dObject* object, const a2dPropertyIdUint16* id, wxUint16 value )
2321  : a2dCommand_SetProperty( object, id, value ) {}
2322 
2323  //! Set property on object
2324  /*!
2325  The property its name is used for undo, and restore the old value if available.
2326 
2327  \param object the canvas object to set the property on.
2328  \param id the name of the property to set.
2329  \param value the value to set the property to.
2330 
2331  */
2332  a2dCommand_SetCanvasProperty( a2dObject* object, const a2dPropertyIdInt32* id, wxInt32 value )
2333  : a2dCommand_SetProperty( object, id, value ) {}
2334 
2335  //! Set property on object
2336  /*!
2337  The property its name is used for undo, and restore the old value if available.
2338 
2339  \param object the canvas object to set the property on.
2340  \param id the name of the property to set.
2341  \param value the value to set the property to.
2342 
2343  */
2344  a2dCommand_SetCanvasProperty( a2dObject* object, const a2dPropertyIdUint32* id, wxUint32 value )
2345  : a2dCommand_SetProperty( object, id, value ) {}
2346 
2347  //! Set property on object
2348  /*!
2349  The property its name is used for undo, and restore the old value if available.
2350 
2351  \param object the canvas object to set the property on.
2352  \param id the name of the property to set.
2353  \param value the value to set the property to.
2354 
2355  */
2356  a2dCommand_SetCanvasProperty( a2dObject* object, const a2dPropertyIdDouble* id, double value )
2357  : a2dCommand_SetProperty( object, id, value ) {}
2358 
2359  //! Set property on object
2360  /*!
2361  The property its name is used for undo, and restore the old value if available.
2362 
2363  \param id the name of the property to set.
2364  \param value the value to set the property to.
2365  \param object the canvas object to set the property on.
2366  */
2367  a2dCommand_SetCanvasProperty( a2dObject* object, const a2dPropertyIdCanvasObject* id, a2dCanvasObject* value );
2368 
2369  //! Set property on object
2370  /*!
2371  The property its name is used for undo, and restore the old value if available.
2372 
2373  \param id the name of the property to set.
2374  \param value the value to set the property to.
2375  \param object the canvas object to set the property on.
2376  */
2377  a2dCommand_SetCanvasProperty( a2dObject* object, const a2dPropertyIdMatrix* id, const a2dAffineMatrix& value );
2378 
2379  //! Set property on object
2380  /*!
2381  The property its name is used for undo, and restore the old value if available.
2382 
2383  \param id the name of the property to set.
2384  \param point the point for the internal a2dPoint2DProperty
2385  \param index the index for the internal a2dPoint2DProperty
2386  \param afterinversion the afterinversion for the internal a2dPoint2DProperty
2387  \param object the canvas object to set the property on.
2388  */
2389  a2dCommand_SetCanvasProperty( a2dObject* object, const a2dPropertyIdPoint2D* id, const a2dPoint2D& point, int index = -1, bool afterinversion = true );
2390 
2391  a2dCommand_SetCanvasProperty( a2dObject* object, const a2dPropertyIdFill* id, const a2dFill& fill = *a2dNullFILL );
2392 
2393  a2dCommand_SetCanvasProperty( a2dObject* object, const a2dPropertyIdStroke* id, const a2dStroke& stroke = *a2dNullSTROKE );
2394 
2396 
2397  virtual a2dCommand* CloneAndBind( a2dObject* object );
2398 
2399  bool Do();
2400  bool Undo();
2401 
2402  DECLARE_CMH_HABITAT()
2403 };
2404 
2405 
2406 //! used to connect two pins
2407 /*!
2408 
2409  \ingroup commands
2410 */
2411 class A2DCANVASDLLEXP a2dCommand_ConnectPins: public a2dCommand
2412 {
2413 public:
2414  //!
2415  /*! \ingroup commandid
2416  */
2417  static const a2dCommandId Id;
2418 
2420 
2421  a2dCommand_ConnectPins( a2dPin* pin1, a2dPin* pin2 );
2422 
2423  ~a2dCommand_ConnectPins( void );
2424 
2425  bool Do();
2426  bool Undo();
2427 
2428  DECLARE_CMH_HABITAT()
2429 
2430  a2dPinPtr m_pin1;
2431  a2dPinPtr m_pin2;
2432 };
2433 
2434 //! used to disconnect two pins
2435 /*!
2436 
2437  \ingroup commands
2438 */
2439 class A2DCANVASDLLEXP a2dCommand_DisConnectPins: public a2dCommand
2440 {
2441 public:
2442  //!
2443  /*! \ingroup commandid
2444  */
2445  static const a2dCommandId Id;
2446 
2448 
2449  a2dCommand_DisConnectPins( a2dPin* pin1, a2dPin* pin2 );
2450 
2451  ~a2dCommand_DisConnectPins( void );
2452 
2453  bool Do();
2454  bool Undo();
2455 
2456  DECLARE_CMH_HABITAT()
2457 
2458  a2dPinPtr m_pin1;
2459  a2dPinPtr m_pin2;
2460 };
2461 
2462 //===========================================================================================
2463 // commands
2464 //===========================================================================================
2465 
2466 
2467 //! command on selected objects
2468 /*!
2469  \ingroup commands
2470 */
2471 class A2DCANVASDLLEXP a2dCommand_Select: public a2dCommand
2472 {
2473 public:
2474 
2475 
2476  //! Print the current document or view
2477  /*! \ingroup commandid
2478  */
2479  static const a2dCommandId Id;
2480 
2481  //! defines what to do
2482  /*!
2483  */
2485  {
2486  SelectAll, //!< select all objects
2487  DeSelectAll, //!< de-select all objects
2488  SelectRect, //!< select objects in a rectangle area
2489  DeSelectRect //!< de-select objects in a rectangle area
2490  };
2491 
2492  class A2DCANVASDLLEXP Args
2493  {
2494  public:
2495  Args()
2496  {
2497  argSet.what = false;
2498  argSet.layer = false;
2499  argSet.x1 = false;
2500  argSet.y1 = false;
2501  argSet.x2 = false;
2502  argSet.y2 = false;
2503  argValue.layer = 0;
2504  argValue.x1 = 0;
2505  argValue.y1 = 0;
2506  argValue.x2 = 0;
2507  argValue.y2 = 0;
2508  argValue.layervisible = true;
2509  argValue.layerselectable = true;
2510  }
2511 
2512  A2D_ARGUMENT_SETTER( a2dDoWhat, what )
2513  A2D_ARGUMENT_SETTER( wxUint16, layer )
2514  A2D_ARGUMENT_SETTER( double, x1 )
2515  A2D_ARGUMENT_SETTER( double, y1 )
2516  A2D_ARGUMENT_SETTER( double, x2 )
2517  A2D_ARGUMENT_SETTER( double, y2 )
2518  A2D_ARGUMENT_SETTER( bool, layervisible )
2519  A2D_ARGUMENT_SETTER( bool, layerselectable )
2520 
2521  struct argValue
2522  {
2523  a2dDoWhat what;
2524  wxUint16 layer;
2525  double x1;
2526  double y1;
2527  double x2;
2528  double y2;
2529  bool layervisible;
2530  bool layerselectable;
2531  } argValue;
2532 
2533  struct argSet
2534  {
2535  bool what;
2536  bool layer;
2537  bool x1;
2538  bool y1;
2539  bool x2;
2540  bool y2;
2541  bool layervisible;
2542  bool layerselectable;
2543  } argSet;
2544  };
2545 
2546  a2dCommand_Select() {}
2547 
2548  a2dCommand_Select( a2dCanvasObject* parent, const Args& args ): a2dCommand( true, Id )
2549  {
2550  m_args = args;
2551  m_parent = parent;
2552  m_oldobjects = wxNullCanvasObjectList;
2553  }
2554 
2556  {
2557  if ( m_oldobjects != wxNullCanvasObjectList )
2558  delete m_oldobjects;
2559  }
2560 
2561  DECLARE_CMH_HABITAT()
2562 
2563 protected:
2564 
2565  virtual a2dObject* DoClone( CloneOptions options, a2dRefMap* refs ) const
2566  {
2567  return new a2dCommand_Select( m_parent, m_args );
2568  }
2569 
2570 
2571 private:
2572 
2573  Args m_args;
2574  a2dCanvasObjectList* m_oldobjects;
2575  a2dlist< bool > m_oldobjectsSelected;
2576 
2577  a2dCanvasObjectPtr m_parent;
2578 
2579  virtual bool Do();
2580 
2581  virtual bool Undo();
2582 
2583 };
2584 
2585 //! command on selected objects
2586 /*!
2587  \ingroup commands
2588 */
2589 class A2DCANVASDLLEXP a2dCommand_GroupAB: public a2dCommand
2590 {
2591 public:
2592 
2593  //! Print the current document or view
2594  /*! \ingroup commandid
2595  */
2596  static const a2dCommandId Id;
2597 
2598  //! defines what to do
2599  /*!
2600  */
2602  {
2603  DeleteGroupA, //!< delete group A objects
2604  MoveGroupA, //!< move group A objects
2605  CopyGroupA, //!< copy group A objects
2606  ConvertToArcs, //!< convert segments in polygon/polyline objects in group A to Arcs where possible
2607  ConvertToPolygonPolylinesWithArcs, //!< convert to simple polygons and polylines
2608  ConvertToPolygonPolylinesWithoutArcs, //!< convert to simple polygons and polylines
2609  ConvertPolygonToArcs, //!< convert segments in polygon/polyline with width objects in group A to Arcs where possible
2610  ConvertPolylineToArcs, //!< convert segments in polyline objects in group A to Arcs where possible
2611  ConvertToVPaths, //!< convert shapes to vector paths
2612  ConvertLinesArcs, //!< convert shapes to seperate lines and arcs
2613  ConvertToPolylines, //!< convert shapes to polylines even if polygons
2614  DetectSmall, //! < generate a report of small objects
2615  RemoveRedundant, //! remove redundant segment
2616  Boolean_OR, /*!< boolean OR operation */
2617  Boolean_AND, /*!< boolean AND operation */
2618  Boolean_EXOR, /*!< boolean EX_OR operation */
2619  Boolean_A_SUB_B, /*!< boolean Group A - Group B operation */
2620  Boolean_B_SUB_A, /*!< boolean Group B - Group A operation */
2621  Boolean_CORRECTION, /*!< polygon correction/offset operation */
2622  Boolean_SMOOTHEN, /*!< smooth operation */
2623  Boolean_MAKERING, /*!< create a ring on all polygons */
2624  Boolean_Polygon2Surface, /*!< convert polygon shapes to surfaces */
2625  Boolean_Surface2Polygon /*!< convert surfaces shapes to polygons */
2626  };
2627 
2628  class A2DCANVASDLLEXP Args
2629  {
2630  public:
2631  Args()
2632  {
2633  argSet.what = false;
2634  argSet.target = false;
2635  argSet.clearTarget = false;
2636  argSet.selectedA = false;
2637  argSet.selectedB = false;
2638  argSet.fileNameOut = false;
2639  argSet.detectCircle = false;
2640  argValue.target = 0;
2641  argValue.clearTarget = false;
2642  argValue.selectedA = false;
2643  argValue.selectedB = false;
2644  argValue.detectCircle = false;
2645  }
2646 
2647  A2D_ARGUMENT_SETTER( a2dDoWhat, what )
2648  A2D_ARGUMENT_SETTER( wxUint16, target )
2649  A2D_ARGUMENT_SETTER( bool, clearTarget )
2650  A2D_ARGUMENT_SETTER( bool, selectedA )
2651  A2D_ARGUMENT_SETTER( bool, selectedB )
2652  A2D_ARGUMENT_SETTER( wxString, fileNameOut )
2653  A2D_ARGUMENT_SETTER( bool, detectCircle )
2654 
2655  struct argValue
2656  {
2657  a2dDoWhat what;
2658  wxUint16 target;
2659  bool clearTarget;
2660  bool selectedA;
2661  bool selectedB;
2662  bool detectCircle;
2663  wxString fileNameOut;
2664  } argValue;
2665 
2666  struct argSet
2667  {
2668  bool what;
2669  bool target;
2670  bool clearTarget;
2671  bool selectedA;
2672  bool selectedB;
2673  bool detectCircle;
2674  bool fileNameOut;
2675  } argSet;
2676  };
2677 
2678  a2dCommand_GroupAB( a2dCanvasObject* parent, const Args& args = Args() ): a2dCommand( false, Id )
2679  {
2680  m_args = args;
2681  m_parent = parent;
2682  }
2683 
2684  DECLARE_CMH_HABITAT()
2685 
2686 protected:
2687 
2688  virtual a2dObject* DoClone( CloneOptions options, a2dRefMap* refs ) const
2689  {
2690  return new a2dCommand_GroupAB( m_parent, m_args );
2691  }
2692 
2693 private:
2694 
2695  virtual bool Do();
2696 
2697  virtual bool Undo();
2698 
2699  Args m_args;
2700  a2dCanvasObjectPtr m_parent;
2701 
2702 };
2703 
2704 //! create new group at x,y
2705 /*!
2706  \ingroup commands
2707 */
2708 class A2DCANVASDLLEXP a2dCommand_NewGroup: public a2dCommand
2709 {
2710 public:
2711 
2712  //! Print the current document or view
2713  /*! \ingroup commandid
2714  */
2715  static const a2dCommandId Id;
2716 
2717  class A2DCANVASDLLEXP Args
2718  {
2719  public:
2720  Args()
2721  {
2722  argSet.x = false;
2723  argSet.y = false;
2724  argSet.name = false;
2725  argSet.layer = false;
2726  argValue.x = 0;
2727  argValue.y = 0;
2728  argValue.layer = 0;
2729  }
2730 
2731  A2D_ARGUMENT_SETTER( wxString, name )
2732  A2D_ARGUMENT_SETTER( wxUint16, layer )
2733  A2D_ARGUMENT_SETTER( double, x )
2734  A2D_ARGUMENT_SETTER( double, y )
2735 
2736  struct argValue
2737  {
2738  wxString name;
2739  wxUint16 layer;
2740  double x;
2741  double y;
2742  } argValue;
2743 
2744  struct argSet
2745  {
2746  bool name;
2747  bool layer;
2748  bool x;
2749  bool y;
2750  } argSet;
2751  };
2752 
2753  a2dCommand_NewGroup( a2dCanvasObject* parent, const Args& args = Args() ): a2dCommand( false, Id )
2754  {
2755  m_args = args;
2756  m_parent = parent;
2757  }
2758 
2759  DECLARE_CMH_HABITAT()
2760 
2761  Args m_args;
2762  a2dCanvasObjectPtr m_parent;
2763 
2764 protected:
2765 
2766  virtual a2dObject* DoClone( CloneOptions options, a2dRefMap* refs ) const
2767  {
2768  return new a2dCommand_NewGroup( m_parent, m_args );
2769  }
2770 
2771 private:
2772 
2773  virtual bool Do()
2774  {
2775  a2dCanvasObject* group = new a2dCanvasObject();
2776  group->CreateChildObjectList();
2777 
2778  wxString groupname = m_args.argValue.name;
2779  if ( groupname.IsEmpty() )
2780  {
2781  wxTextEntryDialog getname( NULL, wxT( "Give group name:" ), wxT( "Group name" ) );
2782  if ( wxID_OK == getname.ShowModal() )
2783  groupname = getname.GetValue();
2784  else
2785  groupname = wxT( "Not Specified" );
2786  }
2787 
2788  group->SetName( groupname );
2789  group->SetLayer( m_args.argValue.layer );
2790  group->CreateChildObjectList();
2791  group->SetIgnoreLayer( true );
2792  a2dCanvasObjectReference* groupref = new a2dCanvasObjectReference( m_args.argValue.x, m_args.argValue.y, group );
2793  m_parent->Prepend( groupref );
2794 
2795  return true;
2796  }
2797 
2798  virtual bool Undo()
2799  {
2800  return false;
2801  }
2802 };
2803 
2804 //! create new group at x,y
2805 /*!
2806  \ingroup commands
2807 */
2808 class A2DCANVASDLLEXP a2dCommand_NewPin: public a2dCommand
2809 {
2810 public:
2811 
2812  //! Print the current document or view
2813  /*! \ingroup commandid
2814  */
2815  static const a2dCommandId Id;
2816 
2817  class A2DCANVASDLLEXP Args
2818  {
2819  public:
2820  Args()
2821  {
2822  argSet.x = false;
2823  argSet.y = false;
2824  argSet.name = false;
2825  argValue.x = 0;
2826  argValue.y = 0;
2827  }
2828 
2829  A2D_ARGUMENT_SETTER( wxString, name )
2830  A2D_ARGUMENT_SETTER( double, x )
2831  A2D_ARGUMENT_SETTER( double, y )
2832 
2833  struct argValue
2834  {
2835  wxString name;
2836  double x;
2837  double y;
2838  } argValue;
2839 
2840  struct argSet
2841  {
2842  bool name;
2843  bool x;
2844  bool y;
2845  } argSet;
2846  };
2847 
2848  a2dCommand_NewPin( a2dCanvasObject* parent, const Args& args = Args() ): a2dCommand( false, Id )
2849  {
2850  m_args = args;
2851  m_parent = parent;
2852  }
2853 
2854  DECLARE_CMH_HABITAT()
2855 
2856  Args m_args;
2857  a2dCanvasObjectPtr m_parent;
2858 
2859 protected:
2860 
2861  virtual a2dObject* DoClone( CloneOptions options, a2dRefMap* refs ) const
2862  {
2863  return new a2dCommand_NewPin( m_parent, m_args );
2864  }
2865 
2866 private:
2867 
2868  virtual bool Do()
2869  {
2870  if ( !m_args.argSet.name )
2871  m_args.argValue.name = wxGetTextFromUser( _( "give name of new pin:" ) );
2872  long ang = wxGetNumberFromUser( _( "Give pin angle:" ), _( "angle:" ), _( "pin angle" ), 0, -360, 360 );
2873 
2874  a2dPin* pin = new a2dPin( m_parent, m_args.argValue.name, a2dPinClass::Standard, m_args.argValue.x, m_args.argValue.y, ang );
2875  m_parent->Prepend( pin );
2876  return true;
2877  }
2878 
2879  virtual bool Undo()
2880  {
2881  return false;
2882  }
2883 };
2884 
2885 
2886 
2887 //! set layer of objects which fit the mask
2888 /*!
2889  \ingroup commands
2890 */
2891 class A2DCANVASDLLEXP a2dCommand_SetLayerMask: public a2dCommand
2892 {
2893 public:
2894  static const a2dCommandId Id;
2895 
2896  a2dCommand_SetLayerMask( a2dCanvasObject* parent, long set = -1, a2dCanvasObjectFlagsMask mask = a2dCanvasOFlags::SELECTED ): a2dCommand( true, Id )
2897  {
2898  m_parent = parent;
2899  m_layer = set;
2900  m_mask = mask;
2901  m_objects = wxNullCanvasObjectList;
2902  }
2903 
2905  {
2906  if ( m_objects != wxNullCanvasObjectList )
2907  delete m_objects;
2908  }
2909 
2910  bool Do( void );
2911 
2912  bool Undo( void );
2913 
2914  DECLARE_CMH_HABITAT()
2915 
2916  long m_layer;
2917  a2dCanvasObjectFlagsMask m_mask;
2918  a2dCanvasObjectPtr m_parent;
2919  a2dCanvasObjectList* m_objects;
2920  a2dLayerGroup m_objectOldLayers;
2921 
2922 protected:
2923 
2924  virtual a2dObject* DoClone( CloneOptions options, a2dRefMap* refs ) const
2925  {
2926  return new a2dCommand_SetLayerMask( m_parent, m_layer, m_mask );
2927  }
2928 };
2929 
2930 //! delete objects which fit the mask
2931 /*!
2932  The bin flag is temporarily used to skip connected wire optimization, for objects fitting the mask.
2933  \see a2dCommand_ReleaseObject::PreDo()
2934 
2935  \ingroup commands
2936 */
2937 class A2DCANVASDLLEXP a2dCommand_DeleteMask: public a2dCommandMasked
2938 {
2939 public:
2940  static const a2dCommandId Id;
2941 
2943 
2945  {
2946  }
2947 
2948  bool Do( void );
2949 
2950  bool Undo( void );
2951 
2952  bool Redo( void );
2953 
2954  DECLARE_CMH_HABITAT()
2955 
2956 protected:
2957 
2958  virtual a2dObject* DoClone( CloneOptions options, a2dRefMap* refs ) const
2959  {
2960  return new a2dCommand_DeleteMask( m_parentObject, m_which );
2961  }
2962 };
2963 
2964 //! objects which fit the mask to top in parent (rendered last)
2965 /*!
2966  \ingroup commands
2967 */
2968 class A2DCANVASDLLEXP a2dCommand_ToTopMask: public a2dCommandMasked
2969 {
2970 public:
2971  static const a2dCommandId Id;
2972 
2974 
2976  {
2977  }
2978 
2979  bool Do( void );
2980 
2981  bool Undo( void );
2982 
2983  bool Redo( void );
2984 
2985  DECLARE_CMH_HABITAT()
2986 
2987 protected:
2988 
2989  virtual a2dObject* DoClone( CloneOptions options, a2dRefMap* refs ) const
2990  {
2991  return new a2dCommand_ToTopMask( m_parentObject, m_which );
2992  }
2993 };
2994 
2995 //! objects which fit the mask to bottom in parent (rendered first)
2996 /*!
2997  \ingroup commands
2998 */
2999 class A2DCANVASDLLEXP a2dCommand_ToBackMask: public a2dCommandMasked
3000 {
3001 public:
3002  static const a2dCommandId Id;
3003 
3005 
3007  {
3008  }
3009 
3010  bool Do( void );
3011 
3012  bool Undo( void );
3013 
3014  bool Redo( void );
3015 
3016  DECLARE_CMH_HABITAT()
3017 
3018 protected:
3019 
3020  virtual a2dObject* DoClone( CloneOptions options, a2dRefMap* refs ) const
3021  {
3022  return new a2dCommand_ToBackMask( m_parentObject, m_which );
3023  }
3024 };
3025 
3026 
3027 //! objects which fit the mask are copied to target and translated
3028 /*!
3029  \ingroup commands
3030 */
3031 class A2DCANVASDLLEXP a2dCommand_CopyMask: public a2dCommand
3032 {
3033 public:
3034  static const a2dCommandId Id;
3035 
3036  a2dCommand_CopyMask( a2dCanvasObject* parent, double x = 0, double y = 0, long target = -1, bool toTarget = false, a2dCanvasObjectFlagsMask mask = a2dCanvasOFlags::SELECTED ): a2dCommand( true, Id )
3037  {
3038  m_parent = parent;
3039  m_mask = mask;
3040  m_x = x;
3041  m_y = y;
3042  m_target = target;
3043  m_toTarget = toTarget;
3044  m_objects = wxNullCanvasObjectList;
3045  }
3046 
3048  {
3049  if ( m_objects != wxNullCanvasObjectList )
3050  delete m_objects;
3051  }
3052 
3053  bool Do( void );
3054 
3055  bool Undo( void );
3056 
3057  DECLARE_CMH_HABITAT()
3058 
3059  double m_x, m_y;
3060  long m_target;
3061  bool m_toTarget;
3062  a2dCanvasObjectFlagsMask m_mask;
3063  a2dCanvasObjectPtr m_parent;
3064  a2dCanvasObjectList* m_objects;
3065 
3066 protected:
3067 
3068  virtual a2dObject* DoClone( CloneOptions options, a2dRefMap* refs ) const
3069  {
3070  return new a2dCommand_CopyMask( m_parent, m_x, m_y, m_target, m_toTarget, m_mask );
3071  }
3072 };
3073 
3074 //! objects which fit the mask are moved to target and translated
3075 /*!
3076  \ingroup commands
3077 */
3078 class A2DCANVASDLLEXP a2dCommand_MoveMask: public a2dCommand
3079 {
3080 public:
3081  static const a2dCommandId Id;
3082 
3083  a2dCommand_MoveMask( a2dCanvasObject* parent, double x = 0, double y = 0, long target = -1, bool toTarget = false, a2dCanvasObjectFlagsMask mask = a2dCanvasOFlags::SELECTED ): a2dCommand( true, Id )
3084  {
3085  m_parent = parent;
3086  m_mask = mask;
3087  m_x = x;
3088  m_y = y;
3089  m_target = target;
3090  m_toTarget = toTarget;
3091  m_objects = wxNullCanvasObjectList;
3092  }
3093 
3095  {
3096  if ( m_objects != wxNullCanvasObjectList )
3097  delete m_objects;
3098  }
3099 
3100  bool Do( void );
3101 
3102  bool Undo( void );
3103 
3104  DECLARE_CMH_HABITAT()
3105 
3106  double m_x, m_y;
3107  long m_target;
3108  bool m_toTarget;
3109  a2dCanvasObjectFlagsMask m_mask;
3110  a2dCanvasObjectPtr m_parent;
3111  a2dCanvasObjectList* m_objects;
3112  a2dLayerGroup m_objectOldLayers;
3113 
3114 protected:
3115 
3116  virtual a2dObject* DoClone( CloneOptions options, a2dRefMap* refs ) const
3117  {
3118  return new a2dCommand_MoveMask( m_parent, m_x, m_y, m_target, m_toTarget, m_mask );
3119  }
3120 };
3121 
3122 //! objects which fit the mask are grouped into a new object
3123 /*!
3124  \ingroup commands
3125 */
3126 class A2DCANVASDLLEXP a2dCommand_GroupMask: public a2dCommand
3127 {
3128 public:
3129  static const a2dCommandId Id;
3130 
3131  a2dCommand_GroupMask( a2dCanvasObject* parent, const wxString& name = wxEmptyString, a2dCanvasObjectFlagsMask mask = a2dCanvasOFlags::SELECTED ): a2dCommand( true, Id )
3132  {
3133  m_name = name;
3134  m_parent = parent;
3135  m_mask = mask;
3136  m_objects = wxNullCanvasObjectList;
3137  }
3138 
3140  {
3141  if ( m_objects != wxNullCanvasObjectList )
3142  delete m_objects;
3143  }
3144 
3145  bool Do( void );
3146 
3147  bool Undo( void );
3148 
3149  DECLARE_CMH_HABITAT()
3150 
3151  wxString m_name;
3152  a2dCanvasObjectFlagsMask m_mask;
3153  a2dCanvasObjectPtr m_parent;
3154  a2dCanvasObjectList* m_objects;
3155  a2dCanvasObjectPtr m_groupobject;
3156  a2dlist< long > m_objectsIndex;
3157 
3158 protected:
3159 
3160  virtual a2dObject* DoClone( CloneOptions options, a2dRefMap* refs ) const
3161  {
3162  return new a2dCommand_GroupMask( m_parent, m_name, m_mask );
3163  }
3164 };
3165 
3166 //! objects which fit the mask are grouped into a new object
3167 /*!
3168  \ingroup commands
3169 */
3170 class A2DCANVASDLLEXP a2dCommand_UnGroupMask: public a2dCommand
3171 {
3172 public:
3173  static const a2dCommandId Id;
3174 
3175  a2dCommand_UnGroupMask( a2dCanvasObject* parent, bool deep = false, a2dCanvasObjectFlagsMask mask = a2dCanvasOFlags::SELECTED ): a2dCommand( true, Id )
3176  {
3177  m_parent = parent;
3178  m_mask = mask;
3179  m_deep = deep;
3180  m_objects = wxNullCanvasObjectList;
3181  }
3182 
3184  {
3185  if ( m_objects != wxNullCanvasObjectList )
3186  delete m_objects;
3187  }
3188 
3189  bool Do( void );
3190 
3191  bool Undo( void );
3192 
3193  DECLARE_CMH_HABITAT()
3194 
3195  a2dCanvasObjectFlagsMask m_mask;
3196  bool m_deep;
3197  a2dCanvasObjectPtr m_parent;
3198  a2dCanvasObjectList* m_objects;
3199  a2dlist< long > m_objectsIndex;
3200 
3201 protected:
3202 
3203  virtual a2dObject* DoClone( CloneOptions options, a2dRefMap* refs ) const
3204  {
3205  return new a2dCommand_UnGroupMask( m_parent, m_deep, m_mask );
3206  }
3207 };
3208 
3209 //! objects which fit the mask are merge into one new object
3210 /*!
3211  \ingroup commands
3212 */
3213 class A2DCANVASDLLEXP a2dCommand_MergeMask: public a2dCommand
3214 {
3215 public:
3216  static const a2dCommandId Id;
3217 
3219  long target = -1, bool layerFirstObject = false, bool clearorg = true,
3220  int depth = 20 ): a2dCommand( true, Id )
3221  {
3222  m_parent = parent;
3223  m_mask = mask;
3224  m_takeLayerFirstObject = layerFirstObject;
3225  m_target = target;
3226  m_clearorg = clearorg;
3227  m_depth = depth;
3228  m_objects = wxNullCanvasObjectList;
3229  m_mergedObjects = wxNullCanvasObjectList;
3230  }
3231 
3233  {
3234  if ( m_objects != wxNullCanvasObjectList )
3235  delete m_objects;
3236  if ( m_mergedObjects != wxNullCanvasObjectList )
3237  delete m_mergedObjects;
3238  }
3239 
3240  bool Do( void );
3241 
3242  bool Undo( void );
3243 
3244  DECLARE_CMH_HABITAT()
3245 
3246  long m_target;
3247  bool m_takeLayerFirstObject;
3248  bool m_clearorg;
3249  int m_depth;
3250  a2dCanvasObjectFlagsMask m_mask;
3251  a2dCanvasObjectPtr m_parent;
3252  a2dCanvasObjectList* m_objects;
3253  a2dCanvasObjectList* m_mergedObjects;
3254  a2dlist< long > m_objectsIndex;
3255 
3256 protected:
3257 
3258  virtual a2dObject* DoClone( CloneOptions options, a2dRefMap* refs ) const
3259  {
3260  return new a2dCommand_MergeMask( m_parent, m_mask, m_target, m_takeLayerFirstObject, m_clearorg, m_depth );
3261  }
3262 };
3263 
3264 //! objects which fit the mask are offset corrected
3265 /*!
3266  \ingroup commands
3267 */
3268 class A2DCANVASDLLEXP a2dCommand_OffsetMask: public a2dCommand
3269 {
3270 public:
3271  static const a2dCommandId Id;
3272 
3274  long target = -1, bool layerFirstObject = false, bool clearorg = true,
3275  int depth = 20 ): a2dCommand( true, Id )
3276  {
3277  m_parent = parent;
3278  m_mask = mask;
3279  m_takeLayerFirstObject = layerFirstObject;
3280  m_target = target;
3281  m_clearorg = clearorg;
3282  m_depth = depth;
3283  m_objects = wxNullCanvasObjectList;
3284  m_offsetObjects = wxNullCanvasObjectList;
3285  }
3286 
3288  {
3289  if ( m_objects != wxNullCanvasObjectList )
3290  delete m_objects;
3291  if ( m_offsetObjects != wxNullCanvasObjectList )
3292  delete m_offsetObjects;
3293  }
3294 
3295  bool Do( void );
3296 
3297  bool Undo( void );
3298 
3299  DECLARE_CMH_HABITAT()
3300 
3301  long m_target;
3302  bool m_takeLayerFirstObject;
3303  bool m_clearorg;
3304  int m_depth;
3305  a2dCanvasObjectFlagsMask m_mask;
3306  a2dCanvasObjectPtr m_parent;
3307  a2dCanvasObjectList* m_objects;
3308  a2dCanvasObjectList* m_offsetObjects;
3309  a2dlist< long > m_objectsIndex;
3310 
3311 protected:
3312 
3313  virtual a2dObject* DoClone( CloneOptions options, a2dRefMap* refs ) const
3314  {
3315  return new a2dCommand_OffsetMask( m_parent, m_mask, m_target, m_takeLayerFirstObject, m_clearorg, m_depth );
3316  }
3317 };
3318 
3319 //! objects which fit the mask are offset corrected
3320 /*!
3321  \ingroup commands
3322 */
3323 class A2DCANVASDLLEXP a2dCommand_PolygonToSurfaceMask: public a2dCommand
3324 {
3325 public:
3326  static const a2dCommandId Id;
3327 
3329  long target = -1, bool layerFirstObject = false, bool clearorg = true,
3330  int depth = 20 ): a2dCommand( true, Id )
3331  {
3332  m_parent = parent;
3333  m_mask = mask;
3334  m_takeLayerFirstObject = layerFirstObject;
3335  m_target = target;
3336  m_clearorg = clearorg;
3337  m_depth = depth;
3338  m_objects = wxNullCanvasObjectList;
3339  m_offsetObjects = wxNullCanvasObjectList;
3340  }
3341 
3343  {
3344  if ( m_objects != wxNullCanvasObjectList )
3345  delete m_objects;
3346  if ( m_offsetObjects != wxNullCanvasObjectList )
3347  delete m_offsetObjects;
3348  }
3349 
3350  bool Do( void );
3351 
3352  bool Undo( void );
3353 
3354  DECLARE_CMH_HABITAT()
3355 
3356  long m_target;
3357  bool m_takeLayerFirstObject;
3358  bool m_clearorg;
3359  int m_depth;
3360  a2dCanvasObjectFlagsMask m_mask;
3361  a2dCanvasObjectPtr m_parent;
3362  a2dCanvasObjectList* m_objects;
3363  a2dCanvasObjectList* m_offsetObjects;
3364  a2dlist< long > m_objectsIndex;
3365 
3366 protected:
3367 
3368  virtual a2dObject* DoClone( CloneOptions options, a2dRefMap* refs ) const
3369  {
3370  return new a2dCommand_PolygonToSurfaceMask( m_parent, m_mask, m_target, m_takeLayerFirstObject, m_clearorg, m_depth );
3371  }
3372 };
3373 
3374 //! objects which fit the mask are offset corrected
3375 /*!
3376  \ingroup commands
3377 */
3378 class A2DCANVASDLLEXP a2dCommand_SurfaceToPolygonMask: public a2dCommand
3379 {
3380 public:
3381  static const a2dCommandId Id;
3382 
3384  long target = -1, bool layerFirstObject = false, bool clearorg = true,
3385  int depth = 20 ): a2dCommand( true, Id )
3386  {
3387  m_parent = parent;
3388  m_mask = mask;
3389  m_takeLayerFirstObject = layerFirstObject;
3390  m_target = target;
3391  m_clearorg = clearorg;
3392  m_depth = depth;
3393  m_objects = wxNullCanvasObjectList;
3394  m_offsetObjects = wxNullCanvasObjectList;
3395  }
3396 
3398  {
3399  if ( m_objects != wxNullCanvasObjectList )
3400  delete m_objects;
3401  if ( m_offsetObjects != wxNullCanvasObjectList )
3402  delete m_offsetObjects;
3403  }
3404 
3405  bool Do( void );
3406 
3407  bool Undo( void );
3408 
3409  DECLARE_CMH_HABITAT()
3410 
3411  long m_target;
3412  bool m_takeLayerFirstObject;
3413  bool m_clearorg;
3414  int m_depth;
3415  a2dCanvasObjectFlagsMask m_mask;
3416  a2dCanvasObjectPtr m_parent;
3417  a2dCanvasObjectList* m_objects;
3418  a2dCanvasObjectList* m_offsetObjects;
3419  a2dlist< long > m_objectsIndex;
3420 
3421 protected:
3422 
3423  virtual a2dObject* DoClone( CloneOptions options, a2dRefMap* refs ) const
3424  {
3425  return new a2dCommand_SurfaceToPolygonMask( m_parent, m_mask, m_target, m_takeLayerFirstObject, m_clearorg, m_depth );
3426  }
3427 };
3428 
3429 //! objects which fit the mask are given an Url property
3430 /*!
3431  \ingroup commands
3432 */
3433 class A2DCANVASDLLEXP a2dCommand_UrlOnMask: public a2dCommand
3434 {
3435 public:
3436  static const a2dCommandId Id;
3437 
3438  a2dCommand_UrlOnMask( a2dCanvasObject* parent, wxURI uri = wxURI(), a2dCanvasObjectFlagsMask mask = a2dCanvasOFlags::SELECTED ): a2dCommand( true, Id )
3439  {
3440  m_parent = parent;
3441  m_mask = mask;
3442  m_uri = uri;
3443  m_objects = wxNullCanvasObjectList;
3444  m_oldobjects = wxNullCanvasObjectList;
3445  }
3446 
3448  {
3449  if ( m_objects != wxNullCanvasObjectList )
3450  delete m_objects;
3451  if ( m_oldobjects != wxNullCanvasObjectList )
3452  delete m_oldobjects;
3453  }
3454 
3455  bool Do( void );
3456 
3457  bool Undo( void );
3458 
3459  DECLARE_CMH_HABITAT()
3460 
3461  a2dCanvasObjectFlagsMask m_mask;
3462  a2dCanvasObjectPtr m_parent;
3463  a2dCanvasObjectList* m_oldobjects;
3464  a2dCanvasObjectList* m_objects;
3465  a2dlist< long > m_objectsIndex;
3466  wxURI m_uri;
3467 
3468 protected:
3469 
3470  virtual a2dObject* DoClone( CloneOptions options, a2dRefMap* refs ) const
3471  {
3472  return new a2dCommand_UrlOnMask( m_parent, m_uri, m_mask );
3473  }
3474 };
3475 
3476 //! objects which fit the mask are given a new fill and stroke style
3477 /*!
3478  \ingroup commands
3479 */
3480 class A2DCANVASDLLEXP a2dCommand_SetFillStrokeMask: public a2dCommand
3481 {
3482 public:
3483  static const a2dCommandId Id;
3484 
3486  {
3487  m_parent = parent;
3488  m_mask = mask;
3489  m_objects = wxNullCanvasObjectList;
3490  m_oldobjects = wxNullCanvasObjectList;
3491  }
3492 
3494  {
3495  if ( m_objects != wxNullCanvasObjectList )
3496  delete m_objects;
3497  if ( m_oldobjects != wxNullCanvasObjectList )
3498  delete m_oldobjects;
3499  }
3500 
3501  bool Do( void );
3502 
3503  bool Undo( void );
3504 
3505  DECLARE_CMH_HABITAT()
3506 
3507  a2dCanvasObjectFlagsMask m_mask;
3508  a2dCanvasObjectPtr m_parent;
3509  a2dCanvasObjectList* m_oldobjects;
3510  a2dCanvasObjectList* m_objects;
3511  a2dlist< long > m_objectsIndex;
3512 
3513 protected:
3514 
3515  virtual a2dObject* DoClone( CloneOptions options, a2dRefMap* refs ) const
3516  {
3517  return new a2dCommand_SetFillStrokeMask( m_parent, m_mask );
3518  }
3519 };
3520 
3521 //! objects which fit the mask are given a new fill and stroke style
3522 /*!
3523  \ingroup commands
3524 */
3526 {
3527 public:
3528  static const a2dCommandId Id;
3529 
3531 
3533  {
3534  }
3535 
3536  bool Do( void );
3537 
3538  bool Undo( void );
3539 
3540  bool Redo( void );
3541 
3542  DECLARE_CMH_HABITAT()
3543 
3544  a2dlist< a2dStroke > m_strokes;
3545  a2dlist< a2dFill > m_fills;
3546 
3547  a2dExtStroke m_extStroke;
3548  a2dExtFill m_extFill;
3549 
3550 protected:
3551 
3552  virtual a2dObject* DoClone( CloneOptions options, a2dRefMap* refs ) const
3553  {
3554  return NULL;//new a2dCommand_SetFillStrokeExtMask( m_parent, m_mask );
3555  }
3556 
3557 };
3558 
3559 //! objects which fit the mask are given a new font and other text properties
3560 /*!
3561  \ingroup commands
3562 */
3564 {
3565 public:
3566  static const a2dCommandId Id;
3567 
3569 
3571  {
3572  }
3573 
3574  bool Do( void );
3575 
3576  bool Undo( void );
3577 
3578  bool Redo( void );
3579 
3580  DECLARE_CMH_HABITAT()
3581 
3582  a2dlist< a2dFont > m_fonts;
3583  a2dlist< int > m_alignmentslist;
3584  a2dlist< unsigned int > m_textflagslist;
3585 
3586  a2dTextChanges m_extFont;
3587  int m_alignment;
3588 
3589 protected:
3590 
3591  virtual a2dObject* DoClone( CloneOptions options, a2dRefMap* refs ) const
3592  {
3593  return NULL;
3594  }
3595 
3596 };
3597 
3598 //! objects which fit the mask are converted to rectangles
3599 /*!
3600  \ingroup commands
3601 */
3602 class A2DCANVASDLLEXP a2dCommand_ImagesToRectMask: public a2dCommand
3603 {
3604 public:
3605  static const a2dCommandId Id;
3606 
3608  {
3609  m_parent = parent;
3610  m_mask = mask;
3611  m_objects = wxNullCanvasObjectList;
3612  m_oldobjects = wxNullCanvasObjectList;
3613  }
3614 
3616  {
3617  if ( m_objects != wxNullCanvasObjectList )
3618  delete m_objects;
3619  if ( m_oldobjects != wxNullCanvasObjectList )
3620  delete m_oldobjects;
3621  }
3622 
3623  bool Do( void );
3624 
3625  bool Undo( void );
3626 
3627  DECLARE_CMH_HABITAT()
3628 
3629  a2dCanvasObjectFlagsMask m_mask;
3630  a2dCanvasObjectPtr m_parent;
3631  a2dCanvasObjectList* m_oldobjects;
3632  a2dCanvasObjectList* m_objects;
3633  a2dlist< long > m_objectsIndex;
3634 
3635 protected:
3636 
3637  virtual a2dObject* DoClone( CloneOptions options, a2dRefMap* refs ) const
3638  {
3639  return new a2dCommand_ImagesToRectMask( m_parent, m_mask );
3640  }
3641 };
3642 
3643 //! set all layers visible or not
3644 /*!
3645  \ingroup commands
3646 */
3647 class A2DCANVASDLLEXP a2dCommand_SetLayersProperty: public a2dCommand
3648 {
3649 public:
3650  static const a2dCommandId Id;
3651 
3652  enum SetWhat { visible, selectable, readable, filling };
3653 
3654  a2dCommand_SetLayersProperty( a2dLayers* layerSetup, bool value = true, SetWhat what = visible ): a2dCommand( true, Id )
3655  {
3656  m_layerSetup = layerSetup;
3657  m_value = value;
3658  m_setWhat = what;
3659  }
3660 
3662  {
3663  }
3664 
3665  bool Do( void );
3666 
3667  bool Undo( void );
3668 
3669  DECLARE_CMH_HABITAT()
3670 
3671  bool m_value;
3672  a2dlist< bool > m_oldLayersVisible;
3673 
3674  SetWhat m_setWhat;
3675 
3676  a2dSmrtPtr<a2dLayers> m_layerSetup;
3677 
3678 protected:
3679 
3680  virtual a2dObject* DoClone( CloneOptions options, a2dRefMap* refs ) const
3681  {
3682  return new a2dCommand_SetLayersProperty( m_layerSetup, m_value );
3683  }
3684 
3685 };
3686 
3687 //! objects which fit the mask are converted to polygons or vector paths
3688 /*!
3689  \ingroup commands
3690 */
3691 class A2DCANVASDLLEXP a2dCommand_ConvertMask: public a2dCommand
3692 {
3693 public:
3694  static const a2dCommandId Id;
3695 
3696  //! defines what to do
3697  /*!
3698  */
3700  {
3701  ConvertToPolygonPolylinesWithArcs, //!< convert to simple polygons and polylines
3702  ConvertToPolygonPolylinesWithoutArcs, //!< convert to simple polygons and polylines
3703  ConvertPolygonToArcs, //!< convert segments in polygon/polyline with width objects in group A to Arcs where possible
3704  ConvertPolylineToArcs, //!< convert segments in polyline objects in group A to Arcs where possible
3705  ConvertToVPaths, //!< convert shapes to vector paths
3706  ConvertLinesArcs, //!< convert shapes to seperate lines and arcs
3707  ConvertToPolylines, //!< convert shapes to polylines even if polygons
3708  };
3709 
3710  class A2DCANVASDLLEXP Args
3711  {
3712  public:
3713  Args()
3714  {
3715  argSet.what = false;
3716  argSet.target = false;
3717  argSet.clearTarget = false;
3718  argSet.mask = false;
3719  argSet.deleteOriginal = false;
3720  argSet.keepLayer = false;
3721  argSet.clearTarget = false;
3722  argSet.detectCircle = false;
3723  argSet.detectCircle = false;
3724  argSet.parent = false;
3725  argValue.what = ConvertToVPaths;
3726  argValue.target = -1;
3727  argValue.clearTarget = false;
3729  argValue.deleteOriginal = true;
3730  argValue.keepLayer = true;
3731  argValue.clearTarget = false;
3732  argValue.detectCircle = false;
3733  argValue.parent = NULL;
3734  }
3735 
3736  A2D_ARGUMENT_SETTER( a2dDoWhat, what )
3737  A2D_ARGUMENT_SETTER( long, target )
3738  A2D_ARGUMENT_SETTER( a2dCanvasObjectFlagsMask, mask )
3739  A2D_ARGUMENT_SETTER( bool, deleteOriginal )
3740  A2D_ARGUMENT_SETTER( bool, keepLayer )
3741  A2D_ARGUMENT_SETTER( bool, clearTarget )
3742  A2D_ARGUMENT_SETTER( bool, detectCircle )
3743  A2D_ARGUMENT_SETTER( a2dCanvasObjectPtr, parent )
3744 
3745  struct argValue
3746  {
3747  a2dDoWhat what;
3748  long target;
3750  bool deleteOriginal;
3751  bool keepLayer;
3752  bool clearTarget;
3753  bool detectCircle;
3754  a2dCanvasObjectPtr parent;
3755  } argValue;
3756 
3757  struct argSet
3758  {
3759  bool what, target, mask, deleteOriginal, keepLayer, clearTarget, detectCircle, parent;
3760  } argSet;
3761  };
3762 
3763  a2dCommand_ConvertMask( const Args& args = Args() ): a2dCommand( true, Id )
3764  {
3765  m_args = args;
3766  m_newobjects = wxNullCanvasObjectList;
3767  m_maskobjects = wxNullCanvasObjectList;
3768  }
3769 
3770  a2dCommand_ConvertMask( a2dCanvasObject* parent, a2dDoWhat what,
3771  long target = -1, a2dCanvasObjectFlagsMask mask = a2dCanvasOFlags::SELECTED,
3772  bool deleteOriginal = true, bool keepLayer = true )
3773  : a2dCommand( true, Id )
3774  {
3775  m_args.what( what ).target( target ).mask( mask ).deleteOriginal( deleteOriginal ).keepLayer( keepLayer ).parent( parent );
3776  m_newobjects = wxNullCanvasObjectList;
3777  m_maskobjects = wxNullCanvasObjectList;
3778  }
3779 
3781  {
3782  if ( m_newobjects != wxNullCanvasObjectList )
3783  delete m_newobjects;
3784  if ( m_maskobjects != wxNullCanvasObjectList )
3785  delete m_maskobjects;
3786  }
3787 
3788  bool Do( void );
3789 
3790  bool Undo( void );
3791 
3792  bool PreDo();
3793 
3794  DECLARE_CMH_HABITAT()
3795 
3796  Args m_args;
3797 
3798  a2dCanvasObjectList* m_newobjects;
3799  a2dCanvasObjectList* m_maskobjects;
3800  a2dlist< long > m_objectsIndex;
3801 
3802 protected:
3803 
3804  virtual a2dObject* DoClone( CloneOptions options, a2dRefMap* refs ) const
3805  {
3806  return new a2dCommand_ConvertMask( m_args );
3807  }
3808 };
3809 
3810 //!
3811 /*!
3812  \ingroup commands
3813 */
3814 class A2DCANVASDLLEXP a2dCommand_SetShowObject: public a2dCommand
3815 {
3816 public:
3817 
3818  //!
3819  /*! \ingroup commandid
3820  */
3821  static const a2dCommandId Id;
3822 
3823  class A2DCANVASDLLEXP Args
3824  {
3825  public:
3826  Args()
3827  {
3828  argSet.canvasobject = false;
3829  argSet.index = false;
3830  argSet.selected = false;
3831  argSet.name = false;
3832  argValue.canvasobject = NULL;
3833  argValue.index = 0;
3834  argValue.selected = false;
3835  }
3836 
3837  A2D_ARGUMENT_SETTER( a2dCanvasObjectPtr, canvasobject )
3838  A2D_ARGUMENT_SETTER( wxInt32, index )
3839  A2D_ARGUMENT_SETTER( wxString, name )
3840  A2D_ARGUMENT_SETTER( bool, selected )
3841 
3842  struct argValue
3843  {
3844  a2dCanvasObjectPtr canvasobject;
3845  wxInt32 index;
3846  wxString name;
3847  bool selected;
3848  } argValue;
3849 
3850  struct argSet
3851  {
3852  bool canvasobject;
3853  bool name;
3854  bool index;
3855  bool selected;
3856  } argSet;
3857  };
3858 
3859  a2dCommand_SetShowObject( a2dDrawingPart* drawingPart, const Args& args = Args() ): a2dCommand( false, Id )
3860  {
3861  m_args = args;
3862  m_drawingPart = drawingPart;
3863  }
3864 
3865  virtual bool Do();
3866 
3867  virtual bool Undo();
3868 
3869  DECLARE_CMH_HABITAT()
3870 
3871  Args m_args;
3872  a2dDrawingPart* m_drawingPart;
3873 
3874  a2dCanvasObjectPtr m_previous;
3875  a2dCanvasObjectPtr m_showobject;
3876 
3877 protected:
3878 
3879  virtual a2dObject* DoClone( CloneOptions options, a2dRefMap* refs ) const
3880  {
3881  return new a2dCommand_SetShowObject( m_drawingPart, m_args );
3882  }
3883 };
3884 
3885 //!
3886 /*!
3887  \ingroup commands
3888 */
3889 class A2DCANVASDLLEXP a2dCommand_PushInto: public a2dCommand
3890 {
3891 public:
3892 
3893  //!
3894  /*! \ingroup commandid
3895  */
3896  static const a2dCommandId Id;
3897 
3898  class A2DCANVASDLLEXP Args
3899  {
3900  public:
3901  Args()
3902  {
3903  argSet.canvasobject = false;
3904  argSet.name = false;
3905  argSet.selected = false;
3906  argValue.selected = false;
3907  argValue.canvasobject = NULL;
3908  }
3909 
3910  A2D_ARGUMENT_SETTER( a2dCanvasObjectPtr, canvasobject )
3911  A2D_ARGUMENT_SETTER( wxString, name )
3912  A2D_ARGUMENT_SETTER( bool, selected )
3913 
3914  struct argValue
3915  {
3916  a2dCanvasObjectPtr canvasobject;
3917  wxString name;
3918  bool selected;
3919  } argValue;
3920 
3921  struct argSet
3922  {
3923  bool canvasobject;
3924  bool name;
3925  bool selected;
3926  } argSet;
3927  };
3928 
3929  a2dCommand_PushInto( a2dDrawingPart* drawingPart, const Args& args = Args() ): a2dCommand( true, Id )
3930  {
3931  m_args = args;
3932  m_drawingPart = drawingPart;
3933  }
3934 
3935  virtual bool Do();
3936 
3937  virtual bool Undo();
3938 
3939  DECLARE_CMH_HABITAT()
3940 
3941  Args m_args;
3942  a2dDrawingPart* m_drawingPart;
3943 
3944 private:
3945 
3946  a2dCanvasObjectPtr m_previous;
3947  a2dCanvasObjectPtr m_pushIn;
3948 
3949 protected:
3950 
3951  virtual a2dObject* DoClone( CloneOptions options, a2dRefMap* refs ) const
3952  {
3953  return new a2dCommand_PushInto( m_drawingPart, m_args );
3954  }
3955 };
3956 
3957 //! layer group A and B commands
3958 /*!
3959  \ingroup commands
3960 */
3961 class A2DCANVASDLLEXP a2dCommand_SetLayerGroup: public a2dCommand
3962 {
3963  DECLARE_DYNAMIC_CLASS( a2dCommand_SetLayerGroup )
3964 public:
3965 
3966  //! layer group A and B command
3967  /*! \ingroup commandid
3968  */
3969  static const a2dCommandId Id;
3970 
3971  //! defines what to do
3972  /*!
3973  */
3975  {
3976  SetGroupA, //!< add a layer to a operation group A
3977  SetGroupB, //!< add a layer to a operation group B
3978  AddGroupA, //!< add a layer to a operation group A
3979  AddGroupB, //!< add a layer to a operation group B
3980  ClearGroupA, //!< clear all layers in operation group A
3981  ClearGroupB, //!< clear all layers in operation group B
3982  };
3983 
3984  class A2DCANVASDLLEXP Args
3985  {
3986  public:
3987  Args()
3988  {
3989  argSet.what = false;
3990  argSet.layer = false;
3991  argSet.group = false;
3992  argValue.layer = 0;
3993  }
3994 
3995  A2D_ARGUMENT_SETTER( a2dDoWhat, what )
3996  A2D_ARGUMENT_SETTER( wxUint16, layer )
3997  A2D_ARGUMENT_SETTER( a2dLayerGroup, group )
3998 
3999  struct argValue
4000  {
4001  a2dDoWhat what;
4002  wxUint16 layer;
4003  a2dLayerGroup group;
4004  } argValue;
4005 
4006  struct argSet
4007  {
4008  bool what;
4009  bool layer;
4010  bool group;
4011  } argSet;
4012  };
4013 
4014  a2dCommand_SetLayerGroup( const Args& args = Args() ): a2dCommand( false, Id )
4015  {
4016  m_args = args;
4017  }
4018 
4019  DECLARE_CMH_HABITAT()
4020 
4021  Args m_args;
4022 
4023 protected:
4024 
4025  virtual a2dObject* DoClone( CloneOptions options, a2dRefMap* refs ) const
4026  {
4027  return new a2dCommand_SetLayerGroup( m_args );
4028  }
4029 
4030  virtual bool Do()
4031  {
4032  if ( m_args.argValue.what == SetGroupA )
4033  {
4034  GetDrawHabitat()->GetGroupA() = m_args.argValue.group;
4035  }
4036  else if ( m_args.argValue.what == SetGroupB )
4037  {
4038  GetDrawHabitat()->GetGroupB() = m_args.argValue.group;
4039  }
4040  else if ( m_args.argValue.what == AddGroupA )
4041  {
4042  GetDrawHabitat()->GetGroupA().push_back( m_args.argValue.layer );
4043  }
4044  else if ( m_args.argValue.what == AddGroupB )
4045  {
4046  GetDrawHabitat()->GetGroupB().push_back( m_args.argValue.layer );
4047  }
4048  else if ( m_args.argValue.what == ClearGroupA )
4049  {
4050  GetDrawHabitat()->GetGroupA().clear();
4051  }
4052  else if ( m_args.argValue.what == ClearGroupB )
4053  {
4054  GetDrawHabitat()->GetGroupB().clear();
4055  }
4056  return false;
4057  }
4058 
4059  virtual bool Undo()
4060  {
4061  return false;
4062  }
4063 };
4064 
4065 //! set
4066 /*!
4067  \ingroup commands
4068 */
4069 class A2DCANVASDLLEXP a2dCommand_SetStroke: public a2dCommand
4070 {
4071  DECLARE_DYNAMIC_CLASS( a2dCommand_SetStroke )
4072 public:
4073  static const a2dCommandId Id;
4074 
4075  a2dCommand_SetStroke( const a2dStroke& stroke = *a2dNullSTROKE ): a2dCommand( true, Id )
4076  {
4077  m_value = stroke;
4078  }
4079 
4080  a2dStroke m_value;
4081 
4082 protected:
4083 
4084  virtual a2dObject* DoClone( CloneOptions options, a2dRefMap* refs ) const
4085  {
4086  return new a2dCommand_SetStroke( m_value );
4087  }
4088 
4089  bool Do( void )
4090  {
4091  m_value = GetDrawHabitat()->GetStroke();
4092 
4093  a2dStroke val = GetDrawHabitat()->GetStroke();
4094  GetDrawHabitat()->SetStroke( m_value );
4095  m_value = val;
4096  return true;
4097 
4098  }
4099  bool Undo( void )
4100  {
4101  return Do();
4102  }
4103 
4104  DECLARE_CMH_HABITAT()
4105 
4106 };
4107 
4108 //! set
4109 /*!
4110  \ingroup commands
4111 */
4112 class A2DCANVASDLLEXP a2dCommand_SetFill: public a2dCommand
4113 {
4114  DECLARE_DYNAMIC_CLASS( a2dCommand_SetFill )
4115 public:
4116  static const a2dCommandId Id;
4117 
4118  a2dCommand_SetFill( const a2dFill& fill = *a2dNullFILL ): a2dCommand( true, Id )
4119  {
4120  m_value = fill;
4121  }
4122 
4123  bool Do( void )
4124  {
4125  a2dFill val = GetDrawHabitat()->GetFill();
4126  GetDrawHabitat()->SetFill( m_value );
4127  m_value = val;
4128  return true;
4129 
4130  }
4131  bool Undo( void )
4132  {
4133  return Do();
4134  }
4135 
4136  DECLARE_CMH_HABITAT()
4137 
4138 protected:
4139 
4140  virtual a2dObject* DoClone( CloneOptions options, a2dRefMap* refs ) const
4141  {
4142  return new a2dCommand_SetFill( m_value );
4143  }
4144 
4145  a2dFill m_value;
4146 };
4147 
4148 class A2DCANVASDLLEXP a2dCommand_SetStrokeColour: public a2dCommand
4149 {
4150  DECLARE_DYNAMIC_CLASS( a2dCommand_SetStrokeColour )
4151 public:
4152  static const a2dCommandId Id;
4153 
4154  a2dCommand_SetStrokeColour( const wxColour& colour = *wxBLACK ): a2dCommand( true, Id )
4155  {
4156  m_value = colour;
4157  }
4158 
4159  wxColour m_value;
4160 
4161 protected:
4162 
4163  virtual a2dObject* DoClone( CloneOptions options, a2dRefMap* refs ) const
4164  {
4165  return new a2dCommand_SetStrokeColour( m_value );
4166  }
4167 
4168  bool Do( void )
4169  {
4170  a2dStroke stroke = GetDrawHabitat()->GetStroke();
4171  wxColour old = stroke.GetColour();
4172  stroke.SetColour( m_value );
4173  m_value = old;
4174  return true;
4175 
4176  }
4177  bool Undo( void )
4178  {
4179  return Do();
4180  }
4181 
4182  DECLARE_CMH_HABITAT()
4183 };
4184 
4185 class A2DCANVASDLLEXP a2dCommand_SetFillColour: public a2dCommand
4186 {
4187  DECLARE_DYNAMIC_CLASS( a2dCommand_SetFillColour )
4188 public:
4189  static const a2dCommandId Id;
4190 
4191  a2dCommand_SetFillColour( const wxColour& colour = *wxBLACK ): a2dCommand( true, Id )
4192  {
4193  m_value = colour;
4194  }
4195 
4196  wxColour m_value;
4197 
4198 protected:
4199 
4200  virtual a2dObject* DoClone( CloneOptions options, a2dRefMap* refs ) const
4201  {
4202  return new a2dCommand_SetFillColour( m_value );
4203  }
4204 
4205  bool Do( void )
4206  {
4207  a2dFill fill = GetDrawHabitat()->GetFill();
4208  wxColour old = fill.GetColour();
4209  fill.SetColour( m_value );
4210  m_value = old;
4211  return true;
4212 
4213  }
4214  bool Undo( void )
4215  {
4216  return Do();
4217  }
4218 
4219  DECLARE_CMH_HABITAT()
4220 
4221 };
4222 
4223 //! set cursor
4224 /*!
4225  \ingroup commands
4226 */
4227 class A2DCANVASDLLEXP a2dCommand_SetCursor: public a2dCommand
4228 {
4229  DECLARE_DYNAMIC_CLASS( a2dCommand_SetCursor )
4230 
4231 public:
4232  static const a2dCommandId Id;
4233 
4234 
4235  class A2DCANVASDLLEXP Args
4236  {
4237  public:
4238  Args()
4239  {
4240  argValue.x = 0;
4241  argValue.y = 0;
4242  argValue.polar = false;
4243  argValue.relative = false;
4244  argValue.snapped = false;
4245 
4246  argSet.x = false;
4247  argSet.y = false;
4248  argSet.polar = false;
4249  argSet.relative = false;
4250  argSet.snapped = false;
4251  }
4252 
4253  A2D_ARGUMENT_SETTER( double, x )
4254  A2D_ARGUMENT_SETTER( double, y )
4255  A2D_ARGUMENT_SETTER( bool, polar )
4256  A2D_ARGUMENT_SETTER( bool, relative )
4257  A2D_ARGUMENT_SETTER( bool, snapped )
4258 
4259  struct argValue
4260  {
4261  double x;
4262  double y;
4263  bool polar;
4264  bool relative;
4265  bool snapped;
4266  } argValue;
4267 
4268  struct argSet
4269  {
4270  bool x;
4271  bool y;
4272  bool polar;
4273  bool relative;
4274  bool snapped;
4275  } argSet;
4276  };
4277 
4278  a2dCommand_SetCursor( const Args& args = Args() ): a2dCommand( false, Id )
4279  {
4280  m_args = args;
4281  }
4282 
4283  a2dCommand_SetCursor( double x, double y ): a2dCommand( true, Id )
4284  {
4285  m_args.x( x );
4286  m_args.y( y );
4287  }
4288 
4289  double GetX() const { return m_args.argValue.x; }
4290  double GetY() const { return m_args.argValue.y; }
4291 
4292  bool Do( void );
4293 
4294  bool Undo( void );
4295 
4296  DECLARE_CMH_HABITAT()
4297 
4298  Args m_args;
4299  double m_xold, m_yold;
4300 
4301 protected:
4302 
4303  virtual a2dObject* DoClone( CloneOptions options, a2dRefMap* refs ) const
4304  {
4305  return new a2dCommand_SetCursor( m_args );
4306  }
4307 };
4308 
4309 //! used to add objects to a a2dCanvasDocument in the current parent
4310 /*!
4311  The objects to add can be connected. Connections are preserved in undo and redo
4312 
4313  \ingroup commands
4314 */
4315 class A2DCANVASDLLEXP a2dCommand_AddObjects: public a2dCommand
4316 {
4317 
4318 public:
4319 
4320  //! used to release object from a a2dCanvasDocument in the current parent
4321  /*! \ingroup commandid
4322  */
4323  static const a2dCommandId Id;
4324 
4325  a2dCommand_AddObjects() { m_parent = NULL; }
4326 
4328 
4329  bool Do();
4330  bool Undo();
4331  bool Redo();
4332 
4333  a2dCanvasObject* GetParent() { return m_parent; }
4334 
4335  a2dCanvasObjectList& GetObjectList() { return m_objects; }
4336 
4337  DECLARE_CMH_HABITAT()
4338 
4339 protected:
4340 
4341  a2dCanvasObjectList m_objects;
4342  a2dCanvasObjectPtr m_parent;
4343 };
4344 
4345 #endif /* __WXDRAWING_H__ */
static const a2dCanvasObjectFlagsMask SELECTED2
Definition: candefs.h:181
Display Part of a a2dDrawing, in which a2dCanvasObjects are shown.
Definition: drawer.h:470
a2dCircle at x,y, and with radius
Definition: canprim.h:554
a2dCanvasObject * GetCurrentCanvasObject()
get the current canvas object to add to parent as child
Definition: drawing.h:1198
a2dCanvasObjectList m_maskedObjects
objects found with required mask
Definition: drawing.h:1697
wxPoint2DDouble a2dPoint2D
this to define if coordinate numbers are integer or doubles
Definition: artglob.h:47
used to move points in polygon objects
Definition: drawing.h:1997
see a2dCameleonEvent
Definition: cameleon.h:1098
virtual bool Undo()=0
Override this to undo a command.
bool Undo(void)
Override this to undo a command.
Definition: drawing.h:4177
used to move points in polygon objects
Definition: drawing.h:2033
(In) Visible property that can be added to Docview Objects.
Definition: gen.h:1785
a2dDoWhat
defines what to do
Definition: drawing.h:2484
all basic primitives derived from a2dCanvasObject
wxDateTime m_changedTime
gives time when a change was made to the drawing
Definition: drawing.h:880
Base class for all types of strokes, understood by a2dDrawer2D classes.
Definition: stylebase.h:378
for changing boolean select2 flag values inside canvas objects
Definition: drawing.h:1754
virtual bool Undo()
Undo one command or command group.
Definition: comevt.cpp:918
objects which fit the mask to bottom in parent (rendered first)
Definition: drawing.h:2999
a2dCanvasObjectList * CreateChildObjectList()
create and get the list where the child objects are stored in.
Definition: canobj.cpp:2561
a2dCanvasObjectReference is a reference to any a2dCanvasObject derived class.
Definition: recur.h:53
convert segments in polygon/polyline with width objects in group A to Arcs where possible ...
Definition: drawing.h:3703
virtual bool Redo()
Redo one command or command group.
Definition: comevt.cpp:933
used to move start or end point in line objects
Definition: drawing.h:2130
a2dDoWhat
defines what to do
Definition: drawing.h:3974
a2dCommand_SetCanvasProperty(a2dObject *object, const a2dPropertyIdInt16 *id, wxInt16 value)
Set property on object.
Definition: drawing.h:2308
double m_initialSizeY
for new document views what will be the size in userunits in Y
Definition: drawing.h:860
a2dHandle is used inside editing versions of a certain objects.
Definition: canpin.h:30
see a2dDrawingEvent
Definition: drawing.h:933
The a2dBaseTool is used to derive tools from that are controlled by.
Definition: tools.h:379
convert segments in polygon/polyline with width objects in group A to Arcs where possible ...
Definition: drawing.h:2609
a2dDoWhat
defines what to do
Definition: drawing.h:3699
const a2dPrintWhat a2dPRINT_PreviewDrawing
preview print a2dDrawing
Definition: drawing.cpp:76
objects which fit the mask are converted to rectangles
Definition: drawing.h:3602
a2dDrawingId GetDrawingId()
set special id to differentiate drawings
Definition: drawing.h:721
a2dCommand_SetCanvasProperty(a2dObject *object, const a2dPropertyIdInt32 *id, wxInt32 value)
Set property on object.
Definition: drawing.h:2332
a2dCanvasObjectFlagsMask m_which
the mask required for the objects to search
Definition: drawing.h:1686
class to map references to objects stored in XML, in order to make the connection later on...
Definition: gen.h:3462
a2dlist< long > m_objectsIndex
indexes of found objects
Definition: drawing.h:1699
double GetNormalizeScale()
Normalize objects ( defined in coordinates -1 to 1 ranges ) will be multiplied by this factor...
Definition: drawing.h:693
see a2dCommandProcessorEvent
Definition: comevt.h:649
a2dCanvasObjectPtr m_parentObject
parent of found objects
Definition: drawing.h:1576
virtual bool Do()=0
Override this to perform a command.
set cursor
Definition: drawing.h:4227
virtual a2dObject * DoClone(CloneOptions options, a2dRefMap *refs) const
Clone this object and return a pointer to the new object.
Definition: drawing.h:3313
wxPageSetupDialogData * m_pageSetupData
this is the global printer page setup data for printer
Definition: drawing.h:1393
a2dCanvasObject * GetRootObject() const
get the root object, which holds the objects in the document
Definition: drawing.h:521
a2dPin is used in a2dCanvasObject to add pins to it.
Definition: canpin.h:233
polygon defined with list of points.
Definition: polygon.h:45
used to add points to polygon objects
Definition: drawing.h:1959
Ref Counted base object.
Definition: gen.h:1045
a2dCommand_SetCanvasProperty(a2dObject *object, const a2dPropertyIdDouble *id, double value)
Set property on object.
Definition: drawing.h:2356
virtual bool Redo()
Definition: comevt.cpp:155
a2dCommand_SetCanvasProperty(a2dObject *object, const a2dPropertyIdString *id, const wxString &value)
Set property on object.
Definition: drawing.h:2284
double wxGetDoubleNumberFromUser(const wxString &message, const wxString &prompt, const wxString &caption, double value=0, double min=0, double max=100, wxWindow *parent=(wxWindow *) NULL, const wxPoint &pos=wxDefaultPosition)
get Double from user
Definition: drawing.cpp:11371
used to add objects to a a2dCanvasDocument in the current parent
Definition: drawing.h:4315
objects which fit the mask to top in parent (rendered last)
Definition: drawing.h:2968
objects which fit the mask are merge into one new object
Definition: drawing.h:3213
add a layer to a operation group B
Definition: drawing.h:3979
store a menu Id generated by XRCID( menuIdString ) plus a menustring and helpstring ...
Definition: comevt.h:1563
bool m_updatespending
set by object in this a2dCanvasDocument, to tell they have changed and therefore it needs to be reren...
Definition: drawing.h:849
used to connect two pins
Definition: drawing.h:2411
convert segments in polygon/polyline objects in group A to Arcs where possible
Definition: drawing.h:2606
a2dDrawingEvent(const a2dDrawingEvent &event)
constructor
Definition: drawing.h:959
Defines a font to be set to a2dDrawer2D or stored in a2dCanvsObject etc.
Definition: stylebase.h:779
Input and output handler for the XmlSer format.
Definition: genxmlpars.h:819
a command processor specially designed to work with a a2dCanvasDocument
Definition: drawing.h:1046
convert shapes to polylines even if polygons
Definition: drawing.h:2613
convert to simple polygons and polylines
Definition: drawing.h:2607
objects which fit the mask are offset corrected
Definition: drawing.h:3323
bool GetUndo()
get undo storage setting
Definition: drawing.h:1112
a2dCommand_SetCanvasProperty(a2dObject *object, const a2dPropertyIdUint32 *id, wxUint32 value)
Set property on object.
Definition: drawing.h:2344
a2dRectC is a centered rectangle
Definition: canprim.h:99
wxTextCtrl * m_textctrl
the text control top get the double entry
Definition: drawing.h:372
A trivial base class for a2dSmrtPtr. Non-template class, so that it can.
Definition: smrtptr.h:55
a2dCanvasObjectList * m_maskedObjects
objects found with required mask
Definition: drawing.h:1572
add a layer to a operation group A
Definition: drawing.h:3978
The base class for all drawable objects in a a2dCanvasDocument.
using a file stream for input, stream the file into a a2dDocument or other object ...
Definition: gen.h:3632
wxString & GetDescription()
Returns the description of the document.
Definition: drawing.h:755
virtual a2dObject * DoClone(CloneOptions options, a2dRefMap *refs) const
Clone this object and return a pointer to the new object.
Definition: drawing.h:3116
convert shapes to vector paths
Definition: drawing.h:2611
bool Undo(void)
Override this to undo a command.
Definition: drawing.h:4214
for changing only the alignment of objects for which a certain mask was set
Definition: drawing.h:1893
void SetDescription(const wxString &desc)
Sets a description of the drawing.
Definition: drawing.h:747
set layer of objects which fit the mask
Definition: drawing.h:2891
virtual a2dObject * DoClone(CloneOptions options, a2dRefMap *refs) const
Clone this object and return a pointer to the new object.
Definition: drawing.h:3020
void SetDrawingId(a2dDrawingId id)
get special id to differentiate drawings
Definition: drawing.h:723
a2dCanvasObject is the base class for Canvas Objects.
Definition: canobj.h:371
wxColour GetColour() const
return colour 1
Definition: stylebase.cpp:6131
a2dBoundingBox wxNonValidBbox
global non valid boundingbox to use as default argument etc.
Definition: bbox.cpp:23
objects which fit the mask are offset corrected
Definition: drawing.h:3378
void SetMayEdit(bool mayEdit)
if true, editing drawing is allowed
Definition: drawing.h:726
for changing boolean values inside canvas objects
Definition: drawing.h:1585
output handler for the CVG format.
Definition: xmlpars.h:103
bool m_index
produce index of where masked object are found.
Definition: drawing.h:1691
static const a2dCommandId Id
Print the current document or view.
Definition: drawing.h:2715
a2dLayers * GetLayerSetup()
Get the layersettings for the canvas.
Definition: drawing.h:506
Definition: gen.h:276
remove redundant segment
Definition: drawing.h:2616
vertex list of line and arc segments.
Definition: polyver.h:600
special a2dCanvasObject which are used to create hierarchy different from the standard a2dCanvasObjec...
bool m_mayEdit
if true, editing drawing is allowed
Definition: drawing.h:885
static const a2dSignal sig_layersetupChanged
layer info changed id sent around when m_layersetup is changed.
Definition: drawing.h:771
virtual void SetName(const wxString &name)
Creates the a2dStringProperty PROPID_Name.
Definition: gen.cpp:1305
bool IsModified() const
Has the document been modified.
Definition: drawing.h:642
base command processor
Definition: comevt.h:829
move object within a a2dDrawing
Definition: drawing.h:1476
a2dDrawingPart * GetActiveDrawingPart()
return the currently/last active drawing part.
Definition: canglob.h:1262
for changing boolean flag values inside pins
Definition: drawing.h:1620
a2dSmrtPtr< a2dCommandProcessor > m_commandProcessor
A pointer to the command processor associated with this document.
Definition: drawing.h:839
used to change style of canvas objects in a a2dCanvasDocument
Definition: drawing.h:2201
virtual a2dObject * DoClone(CloneOptions options, a2dRefMap *refs) const
Clone this object and return a pointer to the new object.
Definition: drawing.h:3203
wxDateTime & GetInternalChangedTime()
gives time when a change was made to the drawing
Definition: drawing.h:784
clear all layers in operation group B
Definition: drawing.h:3981
double GetValue() const
get the double
Definition: drawing.h:362
objects which fit the mask are grouped into a new object
Definition: drawing.h:3126
clear all layers in operation group A
Definition: drawing.h:3980
vector path a2dVectorPath derived from a2dCanvasObject
a group of commands, used to group commands together for undo/redo
Definition: comevt.h:360
wxString m_units_measure
measuring unit (e.g. Meters Inch Microns etc.)
Definition: drawing.h:875
wxUint64 a2dCanvasObjectFlagsMask
mask flags for a2dCanvasObject
Definition: candefs.h:152
a2dCommand_SetCanvasProperty(a2dObject *object, const a2dPropertyIdBool *id, bool value)
Set property on object.
Definition: drawing.h:2296
Io handler to iterate through a a2dDocument.
Definition: gen.h:3911
virtual a2dObject * DoClone(CloneOptions options, a2dRefMap *refs) const
Clone this object and return a pointer to the new object.
Definition: drawing.h:3068
static const a2dCommandId Id
Print the current document or view.
Definition: drawing.h:2479
general style dialog to edit a2dCanvasObject style
Definition: styledialg.h:60
add a layer to a operation group B
Definition: drawing.h:3977
static const a2dSignal sig_changedLayer
when an object is removed from a layer,
Definition: drawing.h:774
for changing only the matrix of objects for which a certain mask was set
Definition: drawing.h:1822
bool GetIgnorePendingObjects()
get setting of ignore pending objects /sa GetUpdatesPending()
Definition: drawing.h:608
bool Do(void)
Override this to perform a command.
Definition: drawing.h:4123
a2dText is an abstract base class.
Definition: cantext.h:93
a2dCanvasObjectList * wxNullCanvasObjectList
define a NON a2dCanvasObjectList
Definition: objlist.cpp:53
virtual a2dObject * DoClone(CloneOptions options, a2dRefMap *refs) const
Clone this object and return a pointer to the new object.
Definition: drawing.h:4163
used to change a property on objects
Definition: drawing.h:2244
a2dCanvasObject * m_parent
sets current style object to current canvas object
Definition: drawing.h:1344
command on selected objects
Definition: drawing.h:2471
void SetSaveLayers(bool saveLayers)
Definition: drawing.h:511
a2dOrigin stays at World Coordinate Zero (0,0) not matter what.
Definition: canprim.h:31
double m_initialSizeX
for new document views what will be the size in userunits in X
Definition: drawing.h:857
void SetColour(const wxColour &col)
set colour used for gradient and wxSTROKE_MASK_OPAQUE filling.
Definition: stylebase.cpp:6112
delete objects which fit the mask
Definition: drawing.h:2937
virtual a2dObject * DoClone(CloneOptions options, a2dRefMap *refs) const
Clone this object and return a pointer to the new object.
Definition: drawing.h:3591
a2dCommand_SetCanvasProperty(a2dObject *object, const a2dPropertyIdRefObject *id, a2dObject *value)
Set property on object.
Definition: drawing.h:2272
a2dEllipse centered at x,y.
Definition: canprim.h:635
delete group A objects
Definition: drawing.h:2603
polyline defined with list of points.
Definition: polygon.h:332
void SetParent(a2dObject *parent)
set parent object of the drawing ( in case there is always only one )
Definition: drawing.h:461
wxUint16 a2dPrintWhat
defines what to print
Definition: gen.h:4052
double m_units_accuracy
how many decimal places in fraction are valid
Definition: drawing.h:863
used to remove points from polygon objects
Definition: drawing.h:2070
wxString m_units
unit (e.g. Meters Inch Microns etc.)
Definition: drawing.h:872
bool Do(void)
Override this to perform a command.
Definition: drawing.h:4205
edit properties of a2dCanvasObject&#39;s
Definition: canpropedit.h:148
virtual a2dObject * DoClone(CloneOptions options, a2dRefMap *refs) const
Clone this object and return a pointer to the new object.
Definition: drawing.h:1843
virtual a2dObject * DoClone(CloneOptions options, a2dRefMap *refs) const
Clone this object and return a pointer to the new object.
Definition: drawing.h:3552
a2dImage (will scale/rotate image when needed)
Definition: canimage.h:33
void SetUnitsAccuracy(double accuracy)
this is the number that defines the number of decimal places in the fraction
Definition: drawing.h:670
double m_value
teh value of the double
Definition: drawing.h:374
double m_max
max required
Definition: drawing.h:378
bool Do(void)
Override this to perform a command.
Definition: drawing.h:4089
a2dCommand_SetCanvasProperty(a2dObject *object, const a2dPropertyIdUint16 *id, wxUint16 value)
Set property on object.
Definition: drawing.h:2320
a2dSLine
Definition: canprim.h:987
objects which fit the mask are given a new fill and stroke style
Definition: drawing.h:3480
objects which fit the mask are given a new fill and stroke style
Definition: drawing.h:3525
void SetCommandProcessor(a2dCommandProcessor *proc)
Sets the command processor to be used for this document.
Definition: drawing.h:562
bool m_withUndo
if set, for commands which can undo, will be submitted like that.
Definition: drawing.h:1355
a2dSmrtPtr< a2dLayers > m_layersetup
setup for layers in this document
Definition: drawing.h:836
virtual a2dObject * DoClone(CloneOptions options, a2dRefMap *refs) const
Clone this object and return a pointer to the new object.
Definition: drawing.h:2989
virtual a2dObject * DoClone(CloneOptions options, a2dRefMap *refs) const
Clone this object and return a pointer to the new object.
Definition: drawing.h:3258
GUI to choose a tool, and execute it via the command processor.
Definition: tooldlg.h:33
static const a2dCommandId Id
Print the current document or view.
Definition: drawing.h:2815
used to disconnect two pins
Definition: drawing.h:2439
for changing boolean values inside a rectangle of the current parent object.
Definition: drawing.h:1542
objects which fit the mask are copied to target and translated
Definition: drawing.h:3031
void SetColour(const wxColour &col)
set colour used for gradient and wxSTIPPLE_MASK_OPAQUE filling.
Definition: stylebase.cpp:4988
convert to simple polygons and polylines
Definition: drawing.h:2608
convert segments in polyline objects in group A to Arcs where possible
Definition: drawing.h:3704
void Prepend(a2dCanvasObject *obj)
prepend a a2dCanvasObject to the childobjects
Definition: canobj.cpp:6209
Input and output handler for the XmlSer format.
Definition: genxmlpars.h:862
static const a2dCanvasObjectFlagsMask SELECTED
Definition: candefs.h:180
virtual bool PreDo()
Override this to perform a dependency action before command is done.
Definition: comevt.h:200
used to replace an object in a a2dCanvasDocument in the current parent
Definition: drawing.h:1512
convert shapes to polylines even if polygons
Definition: drawing.h:3707
double m_units_scale
scaling factor (how many &quot;m_units_measure&quot; is one unit)
Definition: drawing.h:866
a2dCanvasObject * m_parentObject
parent of found objects
Definition: drawing.h:1703
const a2dFill * a2dNullFILL
global a2dFill stock object for defining NO filling
a2dCanvasObjectPtr m_target
target object
Definition: drawing.h:1701
used to set the complete Segment list/array of polygons
Definition: drawing.h:2102
a2dArrow is used for having line begin and ends on specific objects.
Definition: canprim.h:198
void SetNormalizeScale(double scale)
see GetNormalizeScale()
Definition: drawing.h:696
Each a2dCommand is given a command id at construction.
Definition: comevt.h:99
virtual bool Submit(a2dCommand *command, bool storeIt=true)
next to the base class submit, it sets a2DocumentCommandProcessor for a2dCommand
Definition: comevt.cpp:842
used to add object to a a2dCanvasDocument in the current parent
Definition: drawing.h:1403
properties specific for a2dCanvasOject
void SetInitialSize(double sizeX, double sizeY)
set size for view in userunits, when still empty
Definition: drawing.h:530
defines common settinsg for a habitat for a set of a2dCameleons.
Definition: canglob.h:439
bool Undo(void)
Override this to undo a command.
Definition: drawing.h:4131
using a file stream for output, stream a a2dDocument or other wxObject into a stream.
Definition: gen.h:3751
const a2dPrintWhat a2dPRINT_PreviewDrawingPart
preview print a2dDrawing Part
Definition: drawing.cpp:78
A 2x3 affine matrix class for 2D transformations.
Definition: afmatrix.h:53
a2dCommand_SetCanvasProperty(a2dObject *object, a2dNamedProperty *property)
Set property on object.
Definition: drawing.h:2261
static const a2dCommandId Id
used to release object from a a2dCanvasDocument in the current parent
Definition: drawing.h:1445
const a2dStroke * a2dNullSTROKE
global a2dStroke stock object for NO stroking
Dialog for displaying/editing layers and properties of layers.
Definition: layerdlg.h:30
objects which fit the mask are offset corrected
Definition: drawing.h:3268
convert segments in polyline objects in group A to Arcs where possible
Definition: drawing.h:2610
bool m_rewire
objects connected with pins rewiring is optional
Definition: drawing.h:1694
while iterating a a2dCanvasDocument, this holds the context.
Definition: canobj.h:3212
virtual a2dObject * DoClone(CloneOptions options, a2dRefMap *refs) const
Clone this object and return a pointer to the new object.
Definition: drawing.h:3160
a2dCanvasObject * m_currentobject
last added object
Definition: drawing.h:1347
virtual a2dObject * DoClone(CloneOptions options, a2dRefMap *refs) const
Clone this object and return a pointer to the new object.
Definition: drawing.h:1878
double m_normalize_scale
normalization factor to scale normalized objects.
Definition: drawing.h:869
static const a2dCommandId Id
Print the current document or view.
Definition: drawing.h:2596
convert to simple polygons and polylines
Definition: drawing.h:3702
a2dDrawingEvent(unsigned int updateHint, a2dDrawing *drawing)
for event types
Definition: drawing.h:944
a2dCommandProcessor * GetCommandProcessor() const
Returns a pointer to the command processor associated with this document.
Definition: drawing.h:549
a2dCanvasObject * GetParentObject()
Definition: drawing.h:1195
for changing only the matrix of objects for which a certain mask was set
Definition: drawing.h:1857
virtual bool Do()
Override this to perform a command.
Definition: drawing.h:4030
a2dDoWhat
defines what to do
Definition: drawing.h:2601
used to release object from a a2dCanvasDocument in the current parent
Definition: drawing.h:1437
double GetUnitsScale()
this is the number that defines the physical dimension in meters / inch/ etc.
Definition: drawing.h:676
create new group at x,y
Definition: drawing.h:2708
a2dObject * m_parent
in case of a single parent, this can be set.
Definition: drawing.h:846
a2dEndsLine with begin and/or end object.
Definition: canprim.h:1174
void SetUnitsScale(double scale)
this is the number that defines the physical dimension in meters / inch/ etc.
Definition: drawing.h:683
wxString GetTitle() const
Returns the title for this document.
Definition: drawing.h:738
static const a2dCommandId Id
used to release object from a a2dCanvasDocument in the current parent
Definition: drawing.h:4323
void TriggerChangedTime()
make the changed time Now
Definition: drawing.h:787
virtual a2dObject * DoClone(CloneOptions options, a2dRefMap *refs) const
Clone this object and return a pointer to the new object.
Definition: drawing.h:4084
list for a2dCanvasObject
static a2dPinClass * Standard
Pins of this class can only connect to pins of the same class.
Definition: canpin.h:766
select all objects
Definition: drawing.h:2486
select objects in a rectangle area
Definition: drawing.h:2488
wxColour GetColour() const
return colour
Definition: stylebase.cpp:5012
bool m_ignorePendingObjects
if set ignore all setting for pendingobjects
Definition: drawing.h:852
virtual a2dObject * DoClone(CloneOptions options, a2dRefMap *refs) const
Clone this object and return a pointer to the new object.
Definition: drawing.h:3680
bool m_AppendOrPrepend
add in front of parent childs or add end
Definition: drawing.h:1350
wxString GetUnits()
this string defines the unit e.g. meters / inch/ etc.
Definition: drawing.h:707
layer group A and B commands
Definition: drawing.h:3961
convert to simple polygons and polylines
Definition: drawing.h:3701
double m_min
min required
Definition: drawing.h:376
static const a2dCommandId Id
layer group A and B command
Definition: drawing.h:3969
virtual a2dObject * DoClone(CloneOptions options, a2dRefMap *refs) const
Clone this object and return a pointer to the new object.
Definition: drawing.h:2958
a2dObject * GetParent() const
Definition: drawing.h:466
bool m_saveLayers
save layers or not
Definition: drawing.h:888
Event sent to a2dCommandProcessor.
Definition: comevt.h:701
objects which fit the mask are given a new font and other text properties
Definition: drawing.h:3563
holds a list of layers numbers
Definition: canglob.h:60
see a2dComEvent
Definition: gen.h:371
void SetUndo(bool withUndo)
set undo storage or not
Definition: drawing.h:1109
a2dRect
Definition: canprim.h:440
double GetInitialSizeX()
get size for view in userunits, when still empty
Definition: drawing.h:534
The a2dBoundingBox class stores one a2dBoundingBox of a a2dCanvasObject.
Definition: bbox.h:39
de-select all objects
Definition: drawing.h:2487
void SetUnits(const wxString &unitString)
this string defines the unit e.g. meters / inch/ etc.
Definition: drawing.h:718
all polygon and polyline a2dCanvasObject are here.
a2dArc centered at x,y
Definition: canprim.h:823
a2dCanvasObjectFlagsMask m_targetMask
target mask for m_target
Definition: drawing.h:1688
Input handler for the CVG format.
Definition: xmlpars.h:59
static const a2dCommandId Id
used to replace an object in a a2dCanvasDocument in the current parent
Definition: drawing.h:1519
bool Undo(void)
Override this to undo a command.
Definition: drawing.h:4099
move group A objects
Definition: drawing.h:2604
double GetUnitsAccuracy()
this is the number that defines the number of decimal places in the fraction
Definition: drawing.h:661
copy group A objects
Definition: drawing.h:2605
a2dCanvasGlobal * a2dCanvasGlobals
global a2dCanvasGlobal to have easy access to global settings
Definition: canglob.cpp:1234
objects which fit the mask are grouped into a new object
Definition: drawing.h:3170
a command wrapper specially designed to work with wxArt2D docview classes and rest.
Definition: cancom.h:100
virtual a2dObject * DoClone(CloneOptions options, a2dRefMap *refs) const
Clone this object and return a pointer to the new object.
Definition: drawing.h:3515
const a2dPrintWhat a2dPRINT_PrintDrawingPart
print a2dDrawing Part
Definition: drawing.cpp:77
This template class is for property ids with a known data type.
Definition: id.h:477
static const a2dCommandId Id
used to add object to a a2dCanvasDocument in the current parent
Definition: drawing.h:1410
add a layer to a operation group A
Definition: drawing.h:3976
static const a2dCanvasObjectFlagsMask ALL
Definition: candefs.h:220
command on selected objects
Definition: drawing.h:2589
virtual bool Undo()
Override this to undo a command.
Definition: drawing.h:4059
objects which fit the mask are moved to target and translated
Definition: drawing.h:3078
virtual a2dObject * DoClone(CloneOptions options, a2dRefMap *refs) const
Clone this object and return a pointer to the new object.
Definition: drawing.h:3637
virtual a2dObject * DoClone(CloneOptions options, a2dRefMap *refs) const
Clone this object and return a pointer to the new object.
Definition: drawing.h:1944
bool Do(void)
Override this to perform a command.
Definition: drawing.h:4168
virtual a2dObject * DoClone(CloneOptions options, a2dRefMap *refs) const
Clone this object and return a pointer to the new object.
Definition: drawing.h:3368
set all layers visible or not
Definition: drawing.h:3647
objects which fit the mask are given an Url property
Definition: drawing.h:3433
virtual void SetLayer(wxUint16 layer)
set layer index where this object is drawn upon.
Definition: canobj.cpp:5920
used to change text and caret of canvas text objects in a a2dCanvasDocument
Definition: drawing.h:2167
stack based tools controller and tools for drawing and editing.
virtual a2dObject * DoClone(CloneOptions options, a2dRefMap *refs) const
Clone this object and return a pointer to the new object.
Definition: drawing.h:3470
objects which fit the mask are converted to polygons or vector paths
Definition: drawing.h:3691
virtual a2dObject * DoClone(CloneOptions options, a2dRefMap *refs) const
Clone this object and return a pointer to the new object.
Definition: drawing.h:3423
list of a2dObject&#39;s
Definition: gen.h:3157
const a2dPrintWhat a2dPRINT_PrintDrawing
print a2dDrawing
Definition: drawing.cpp:75
bool GetMayEdit() const
if true, editing drawing is allowed
Definition: drawing.h:729
for changing boolean select flag values inside canvas objects
Definition: drawing.h:1715
virtual a2dObject * DoClone(CloneOptions options, a2dRefMap *refs) const
Clone this object and return a pointer to the new object.
Definition: drawing.h:2924
create new group at x,y
Definition: drawing.h:2808
CloneOptions
options for cloning
Definition: gen.h:1200
static const a2dCommandId Id
used to release object from a a2dCanvasDocument in the current parent
Definition: drawing.h:1484
convert shapes to seperate lines and arcs
Definition: drawing.h:3706
convert shapes to vector paths
Definition: drawing.h:3705
double GetInitialSizeY()
get size for view in userunits, when still empty
Definition: drawing.h:537
convert shapes to seperate lines and arcs
Definition: drawing.h:2612
Contain one drawing as hierarchical tree of a2dCanvasObject&#39;s.
Definition: drawing.h:434
used to change a property on objects
Definition: comevt.h:460
wxDoubleNumberEntryDialog: a dialog with spin control, [ok] and [cancel] buttons
Definition: drawing.h:351
virtual a2dObject * DoClone(CloneOptions options, a2dRefMap *refs) const
Clone this object and return a pointer to the new object.
Definition: drawing.h:4200
a2dEllipticArc centered at x,y
Definition: canprim.h:697
&lt; generate a report of small objects
Definition: drawing.h:2615
general canvas module declarations and classes
static const a2dCommandId sm_SetFillStyleCommand
non info.
Definition: drawing.h:2210
a base command for the a2dCommandProcessor
Definition: comevt.h:140
drawing.h Source File -- Sun Oct 12 2014 17:04:19 -- Sun Oct 12 2014 -- 1.8.5 -- wxArt2D -- . -- Main Page Reference Documentation