wxArt2D
sttool.h
Go to the documentation of this file.
1 /*! \file wx/canvas/sttool.h
2  \brief stack based tools controller and tools for drawing and editing.
3 
4  This is a whole set of tools and controller which work closely together,
5  such that they can function well inside one application.
6  The controller uses a stack of tools, where the first one is always active.
7 
8  \author Klaas Holwerda
9 
10  Copyright: 2001-2004 (c) Klaas Holwerda
11 
12  Licence: wxWidgets Licence
13 
14  RCS-ID: $Id: sttool.h,v 1.48 2009/10/01 19:22:35 titato Exp $
15 */
16 
17 #ifndef __A2DCANVASSTTOOL_H__
18 #define __A2DCANVASSTTOOL_H__
19 
20 #ifndef WX_PRECOMP
21 #include "wx/wx.h"
22 #endif
23 
24 #include <wx/listimpl.cpp>
25 
26 #include "wx/canvas/canobj.h"
27 #include "wx/canvas/tools.h"
28 #include "wx/canvas/restrict.h"
29 
30 class a2dVectorPath;
31 
32 WX_DECLARE_LIST_WITH_DECL( a2dBoundingBox, wxZoomList, class A2DCANVASDLLEXP );
33 
34 
35 
36 //! zoom menu
37 /*!
38  \ingroup tools
39 */
40 A2DCANVASDLLEXP_DATA( extern const long ) TC_UNDO;
41 A2DCANVASDLLEXP_DATA( extern const long ) TC_REDO;
42 A2DCANVASDLLEXP_DATA( extern const long ) TC_ENDTOOL;
43 A2DCANVASDLLEXP_DATA( extern const long ) TC_ZOOMIN;
44 A2DCANVASDLLEXP_DATA( extern const long ) TC_ZOOMOUT;
45 A2DCANVASDLLEXP_DATA( extern const long ) TC_ZOOMBACK;
46 A2DCANVASDLLEXP_DATA( extern const long ) TC_ZOOMOUT2;
47 A2DCANVASDLLEXP_DATA( extern const long ) TC_ZOOMIN2;
48 A2DCANVASDLLEXP_DATA( extern const long ) TC_ZOOMPANXY;
49 A2DCANVASDLLEXP_DATA( extern const long ) TC_PROPERTY_XY;
50 
51 
52 
53 enum a2dSTAT_ID
54 {
55  STAT_Xd_Yd,
56  STAT_Xw_Yw,
57  STAT_ToolString,
58  STAT_toolHelp = 3,
59  STAT_Feedback = 10,
60  STAT_Feedback2
61 };
62 
63 /*!
64  \ingroup tools
65 */
67 {
68  // !!!! I think we need two versions of the RECTANGLE and COPY modes, one in which
69  // the original is shown in its original position, and one in which the editcopy is
70  // drawn twice, once in edit-mode and once in usual mode.
71 
72  // All these modes are now implemented in a2dStTool::Render
73  // Even the rectangle mode can be done there by drawing a rectangle with the
74  // size of the bounding box for every object.
75 
76  // Depending one the mode, some m_renderXXXX flags of the tool are set.
77 
78  //! draw a rectangle the size of the bounding box of the object draged.
80  //! seperate the object from the document, and layer, so it will be draged on top of all other objects.
82  //! object stay in document and it is redrawn while dragging, and so are all objects above and below it.
84  //! a clone is created which is draged in an outline mode, original stays at position until drag is finished.
86 };
87 
88 /*!
89  \ingroup tools
90 */
92 {
93  wxTC_DefaultBehavior = 0x00000000, /*!< enable all Default Behavior enabled (Default) */
94  wxTC_NoDefaultKeys = 0x00000001, /*!< skip the onchardown & up eventhandler */
95  wxTC_NoContextMenu = 0x00000002, /*!< skip the onmouse && rightdown event */
96  wxTC_NoDefaultMouseActions = 0x00000004, /*!< skip the onmouse && controlkeys {shift,control,alt} event*/
97  wxTC_NoAll = 0xFFFFFFFF /*!< Set All posible flags */
98 };
99 
100 class A2DCANVASDLLEXP a2dStToolContr;
101 #if defined(WXART2D_USINGDLL)
102 template class A2DCANVASDLLEXP a2dSmrtPtr<a2dStToolContr>;
103 #endif
104 
105 class A2DCANVASDLLEXP a2dObjectEditTool;
106 
107 //!The a2dStTool is used to derive tools from.
108 /*! Those are controlled by
109  a a2dStToolContr class.
110  Those type of tools understand zooming and stacked redraw.
111  \sa a2dStToolContr
112 
113  \ingroup tools
114 */
115 class A2DCANVASDLLEXP a2dStTool: public a2dBaseTool
116 {
117 public:
118 
119  //! send when tool was poped
120  //! \ingroup events
121  static const a2dSignal sig_toolComEventAddObject;
122  //! send when tool starts editing object
123  //! \ingroup events
124  static const a2dSignal sig_toolComEventSetEditObject;
125 
126  //!\param controller Pointer to a a2dStToolContr controller.
127  a2dStTool( a2dStToolContr* controller );
128 
129  //! constructor
130  a2dStTool( const a2dStTool& other, CloneOptions options, a2dRefMap* refs );
131 
132  //!destructor
133  virtual ~a2dStTool();
134 
135  //! halts the tool is busy
136  virtual bool OnPushNewTool( a2dBaseTool* newtool );
137 
138  virtual void SetActive( bool active = true );
139 
140  //! starts a new action (e.g drawing something ) in a tool that is already pushed.
141  /*!
142  Opens a new a2dCommandGroup, which will be closed at the end of an action.
143  This is normally in FinishBusyMode(), but might be delayed when other tools are pushed,
144  like the edit tool to further edit the drawn figure. This should become part
145  of the same command group.
146  */
147  virtual bool EnterBusyMode();
148 
149  virtual void FinishBusyMode( bool closeCommandGroup = true );
150  virtual void AbortBusyMode();
151 
152  //! add the current canvas object to parent as child
153  /*!
154  \param objectToAdd this is the object to add to the current parentobject
155  */
156  void AddCurrent( a2dCanvasObject* objectToAdd );
157 
158  //! implement rendering
159  /*!
160  in general is rendering for tools just to draw/render m_canvasobject when set.
161  */
162  virtual void Render();
163 
164  //! to render the tools its anotation text.
165  /*!
166  Tools can have a line of text displayed while in action, this is done in pixel size.
167  */
168  void RenderAnotation();
169 
170  //! return the staacked tool controller
171  /*! this cast is save, because a2dStTool takes a a2dStToolContr as
172  constructor argument
173  */
174  a2dStToolContr* GetStToolContr() { return ( a2dStToolContr* ) m_controller; }
175 
176  //! to start editing tool when wanted
177  a2dObjectEditTool* StartEditTool( a2dCanvasObject* objecttoedit );
178 
179  //! flag for setting editing tool after drawing a primitive.
180  /*!
181  \param editatend when true the drawing tool will start a editing tool after drawing a primitive.
182 
183  \remark it depends on the implementatian of the tool if this flag is used.
184  */
185  void SetEditAtEnd( bool editatend ) { m_editatend = editatend; }
186 
187  //! see SetEditAtEnd
188  bool GetEditAtEnd() { return m_editatend; }
189 
190  //! how editing transparency will be handled
192  {
193  a2dOpaqueMode_Off = 0x00000000, /*!< tool will not use apaque edit mode */
194  a2dOpaqueMode_Tool = 0x00000001, /*!< tool will apaque edit mode and setting are from the tool*/
195  a2dOpaqueMode_Tool_FixedStyle = 0x00000002, /*!< tool will apaque edit mode and setting are from the tool but style is fixed*/
196  a2dOpaqueMode_Controller = 0x00000004, /*!< tool will use apaque edit mode as set in Controller*/
197  };
198 
199  //! when enabling m_useEditOpaque, this is how transparent the editcopy will be made.
200  /*!
201  \param editOpacity Real opacity is set opacity * m_OpacityFactor/255
202  */
203  void SetOpacityFactorEditcopy( wxUint8 editOpacity ) { m_editOpacityFactor = editOpacity; }
204 
205  //! When set true, instead of using a special style for editcopies, a clone of the
206  /*!
207  fill and stroke of the original are made, and used for the editcopy, but its transparancy is
208  set using m_editOpacityFactor.
209  The effect is that when dragging such an object, that in the editcopy mode, a half transparent object is shown.
210  */
211  void SetUseOpaqueEditcopy( a2dOpaqueMode editOpaque ) { m_useEditOpaque = editOpaque; }
212 
213  //! Set class for generating new connection objects between object and pins
214  void SetConnectionGenerator( a2dConnectionGenerator* connectionGenerator ) { m_connectionGenerator = connectionGenerator; };
215 
216  //! Get class for generating new connection objects between object and pins
217  a2dConnectionGenerator* GetConnectionGenerator() const { return m_connectionGenerator; }
218 
219  //! object to draw or edit
220  a2dCanvasObject* GetOriginal() { return m_original; }
221 
222  //! defines the context, relative to which this tools works.
223  /*!
224  The more advanged usage of tools is in situation where the tools is used inside a2dCanvasObjects.
225  So the context a2dIterC is in such a situation relative to that object its position.
226  */
227  bool SetContext( a2dIterC& ic, a2dCanvasObject* startObject = NULL );
228 
229  void SetStateString( const wxString& message = wxEmptyString, size_t field = 0 );
230 
231  //! set what snapping features or enabled for the source to snap to.
232  //! see a2dSnapToWhat for snapping features.
233  void SetSnapSourceFeatures( wxUint32 snapSourceFeatures ) { m_snapSourceFeatures = snapSourceFeatures; }
234 
235  //! set one of the snapping features for the source to true or false, leaf others as is
236  void SetSnapSourceFeature( a2dRestrictionEngine::a2dSnapToWhat snapSourceFeature, bool value = true )
237  {
238  m_snapSourceFeatures = value ? m_snapSourceFeatures | snapSourceFeature :
239  m_snapSourceFeatures & ( a2dRestrictionEngine::snapToAll ^ snapSourceFeature );
240  }
241 
242  //! set what snapping features or enabled for the source to snap to.
243  //! see a2dSnapToWhat for snapping features.
244  a2dSnapToWhatMask GetSnapSourceFeatures() const { return m_snapSourceFeatures; }
245 
246  //! set what snapping features or enabled for the target to snap to.
247  //! see a2dSnapToWhat for snapping features.
248  void SetSnapTargetFeatures( wxUint32 snapTargetFeatures ) { m_snapTargetFeatures = snapTargetFeatures; }
249 
250  //! set one of the snapping features for targets to true or false, leaf others as is
251  void SetSnapTargetFeature( a2dRestrictionEngine::a2dSnapToWhat snapTargetFeature, bool value = true )
252  {
253  m_snapTargetFeatures = value ? m_snapTargetFeatures | snapTargetFeature :
254  m_snapTargetFeatures & ( a2dRestrictionEngine::snapToAll ^ snapTargetFeature );
255  }
256 
257  //! return the setting of a specific snapping feature
259  {
260  return ( m_snapTargetFeatures & snapTargetFeature ) > 0;
261  }
262 
263  //! set what snapping features or enabled for the target to snap to.
264  //! see a2dSnapToWhat for snapping features.
265  a2dSnapToWhatMask GetSnapTargetFeatures() const { return m_snapTargetFeatures; }
266 
267  a2dCanvasObject* GetCanvasObject() const { return m_canvasobject; }
268  a2dCanvasObject* GetOriginalObject() const { return m_original; }
269 
270 protected:
271 
272 
273  void PrepareForRewire( a2dCanvasObjectList& dragList, bool walkWires = true, bool selected = false, bool stopAtSelectedWire = false, bool CreateExtraWires = true, a2dRefMap* = NULL );
274 
275  void DeselectAll();
276 
277  //! calculate world coordinates from devide coordinates
278  void MouseToToolWorld( int x, int y, double& xWorldLocal, double& yWorldLocal );
279 
280  //! area occupied by this object
281  wxRect GetAbsoluteArea( a2dCanvasObject* object );
282 
283  //! return text extends of string
284  void GetTextExtent( const wxString& string, wxCoord* w, wxCoord* h, wxCoord* descent = NULL, wxCoord* externalLeading = NULL );
285 
286  //! handler for paint event
287  void OnPaint( wxPaintEvent& event );
288 
289  //! handler for idle events
290  void OnIdle( wxIdleEvent& event );
291 
292  //! handler for Undo event
293  void OnUndoEvent( a2dCommandProcessorEvent& event );
294 
295  //! handler for Do event
296  void OnDoEvent( a2dCommandProcessorEvent& event );
297 
298  //!called when a tool has changed (fill stroke layer spline )
299  void OnComEvent( a2dComEvent& event );
300 
301  //! to display a string along with a tool drawing.
302  virtual void GenerateAnotation();
303 
304  //! after calculating anotation position and string, extend the boundingbox of the tools with it.
305  void AddAnotationToPendingUpdateArea();
306 
307  //! get the increments used when moving is done with cursor keys
308  void GetKeyIncrement( double* xIncr, double* yIncr );
309 
310  //!called on key down events
311  void OnKeyDown( wxKeyEvent& event );
312  //!called on key up events
313  void OnKeyUp( wxKeyEvent& event );
314 
315  //!called on key events
316  void OnChar( wxKeyEvent& event );
317 
318  //!called on mouse events
319  void OnMouseEvent( wxMouseEvent& event );
320 
321  //!Adjust the rendering options to the needs of this tool
322  virtual void AdjustRenderOptions();
323 
324  //!Create the editcopy and other tool objects (e.g. decorations)
325  /*! m_original must be set before this function is called */
326  virtual bool CreateToolObjects();
327 
328  //!Cleanup the editcopy other tool objects (e.g. decorations)
329  virtual void CleanupToolObjects();
330 
331  a2dCanvasObject* FindTaggedObject();
332 
333  //! set to the a2dSnapToWhat features enabled by the engine for the source object
335 
336  //! set to the a2dSnapToWhat target features enabled by the engine and/or snap source object
338 
339  //! anotation string, which is in general modified by the tools to display position etc.
340  wxString m_anotation;
341 
342  //! x position of anotation text
344 
345  //! y position of anotation text
347 
348  int m_prevxanotation;
349  int m_prevyanotation;
350 
351  //! x of mouse in device
352  int m_x;
353  //! y of mouse in device
354  int m_y;
355 
356  //! previous x of mouse in device
357  int m_xprev;
358 
359  //! previous y of mouse in device
360  int m_yprev;
361 
362  //! x world coordinates old or new value of mouse
363  double m_xwprev;
364 
365  //! y world coordinates old or new value of mouse
366  double m_ywprev;
367 
368  //! x of mouse in device at start drag
370  //! y of mouse in device at start drag
372 
373  //! used to indicate that a first drag event has arrived.
375 
376  //! This is the object currently edited
377  /*! This is usually a clone of m_original, if m_original exists.
378  This object is directly (without commands) edited by the tool.
379  The m_original is in this case edited indirectly via commands.
380  */
382 
383  //! This is the original object selected for editing
384  /*! If there is an original and an editcopy, this is the original.
385  Tools creating objects do not always have an original and an editcopy.
386  This object only manipulated via commands
387  */
389 
390  //!controller for canvas
392 
393  //! Use this connection generator for wires and pins
395 
396  //! if yes, the original object is rendered in place
398  //! if yes, the editcopy is rendered in place
399  /*! this is not yet supported */
401  //! if yes, the editcopy is rendered on top in usual style
403  //! if yes, the editcopy is rendered on top in edit style
405  //! if yes, the editcopy is rendered on top as bounding box rectangle
407 
408  //! when drawing something editing must follow, using the a2dRecursiveEditTool
410 
411  //! when using cloned style for editcopy, use this opacity.
413 
414  //! when true editcopies are using a half transparent cloned style.
416 
417  friend class a2dStToolEvtHandler;
419 
420 public:
421 
422  DECLARE_CLASS( a2dStTool )
423  DECLARE_EVENT_TABLE()
424 };
425 
426 //! base for tools that draw and are stack based.
427 class A2DCANVASDLLEXP a2dStDrawTool: public a2dStTool
428 {
429 public:
430  //!\param controller Pointer to a a2dStToolContr controller.
431  a2dStDrawTool( a2dStToolContr* controller );
432 
433  //!destructor
434  virtual ~a2dStDrawTool();
435 
436  //! template adepts to style change from outside or not
437  void SetAllowModifyTemplate( bool allowModifyTemplate ) { m_AllowModifyTemplate = allowModifyTemplate; }
438 
439  //! template adepts to style change from outside or not
440  bool GetAllowModifyTemplate() { return m_AllowModifyTemplate; }
441 
442 
443 protected:
444  bool EnterBusyMode();
445  virtual void FinishBusyMode( bool closeCommandGroup = true );
446  void AbortBusyMode();
447 
448  //!called on key down events
449  void OnKeyDown( wxKeyEvent& event );
450  //!called on key up events
451  void OnKeyUp( wxKeyEvent& event );
452 
453  //!called on key events
454  void OnChar( wxKeyEvent& event );
455 
456  //!Create the editcopy and other tool objects (e.g. decorations)
457  /*! m_original must be set before this function is called */
458  virtual bool CreateToolObjects();
459 
460  void AdjustRenderOptions();
461 
462  bool m_AllowModifyTemplate;
463 
464 public:
465 
466  DECLARE_CLASS( a2dStDrawTool )
467  DECLARE_EVENT_TABLE()
468 };
469 
470 //!The a2dStToolContr is a Tool Controller specialized for working with a2dCanvasView.
471 /*!
472 It maintains tools that allows zooming while drawing is in progress.
473 It has a stack of tools, some tools remain on the stack, while other or pushed and poped from it.
474 A tool to show the cursor is a tool that is always on the stack and active, a tool to draw something
475 is only on the stack as long the user wants. Zooming while drawing something is done by temporarily pushing a zoomtool to the stack.
476 When the zoom as done, the tools is removed again.
477 You can develop new tools by deriving new tools from a2dStTool.
478 \sa a2dToolContr
479 \sa a2dStTool
480 \sa a2dCanvasView
481 \sa a2dCanvas
482 
483  \ingroup tools
484 */
485 class A2DCANVASDLLEXP a2dStToolContr: public a2dToolContr
486 {
487 public:
488 
489  //! Constructor
490  /*!
491  \param view a2dCanvasView where the controller takes events from
492  \param where wxFrame to display statusbar text in.
493  \param noStatusEvent if true use, m_where to set statusbar text in first field.
494  Else a a2dComEvent sm_showCursor is send to the m_where.
495 
496  */
497  a2dStToolContr( a2dDrawingPart* drawingPart, wxFrame* where, bool noStatusEvent = true );
498 
499  //!destructor
500  ~a2dStToolContr();
501 
502  //! sets the m_toptool (if set ) as first tool.
503  virtual void ReStart();
504 
505  //! to get the current mouse menu of the controller
506  /*!
507  /return NULL if no menu is set, else the menu.
508  */
509  wxMenu* GetMousePopupMenu() { return m_mousemenu; }
510 
511  //! to set the current mouse menu of the controller
512  /*!
513  NULL sets the menu to non.
514  */
515  void SetMousePopupMenu( wxMenu* mousemenu );
516 
517  //!specialize to keep first tool on the stack active
518  /*!
519  \param tool The tools to push, also checks if it is a a2dStTool derived tools, else an assert.
520  */
521  bool PushTool( a2dBaseTool* tool );
522 
523  //!specialize to keep m_topTool tool active
524  /*!
525  It the new first tool was already stopped for some reason, this tool will also be poped,
526  this continues recursive until a tool is found which does not want to be stopped.
527  */
528  virtual bool PopTool( a2dSmrtPtr<a2dBaseTool>& poped, bool force = true );
529 
530  //! if true a zoomout is centered to the view.
531  void SetZoomoutCentered( bool center ) { m_zoomoutCentered = center;}
532 
533  //! see SetZoomoutCentered()
534  bool GetZoomoutCentered() { return m_zoomoutCentered; }
535 
536  //!first tool on the tool stack is the zoom tool.
537  /*!
538  This is the same as SetTopTool( new a2dZoomTool( MyController ) )
539  */
540  void SetZoomFirst( bool zoomfirst );
541 
542  //! when all tools are poped, this tool will be pushed.
543  /*!
544  The effect is that this tool always stays on top of the stack.
545  This call also makes this the top tool right now.
546 
547  \param toolOnTop pointer to a tool you want to habve on top, NULL if non.
548  */
549  void SetTopTool( a2dBaseTool* toolOnTop );
550 
551  //! for zooming purposes this tool wil be used
552  /*!
553  This only sets for future use.
554 
555  \param toolForZoom pointer to a tool you want to use for zooming
556  */
557  void SetZoomTool( a2dBaseTool* toolForZoom );
558 
559  //!drag mode used in drag tool (if used)
560  /*!
561  Choose one of the three different drag methods see DRAGMODE
562  */
563  void SetDragMode( DRAGMODE mode ) { m_dragmode = mode; }
564 
565  //!Returns drag mode
566  /*! \see SetDragMode */
567  DRAGMODE GetDragMode() { return m_dragmode; }
568 
569  void SetDrawMode( a2dDrawStyle drawstyle ) { m_drawmode = drawstyle; }
570 
571  a2dDrawStyle GetDrawMode() { return m_drawmode; }
572 
573  //!Control the default behavior
574  /*! \see wxTC_BEHAVIOR */
575  void SetDefaultBehavior( unsigned int behavior ) { m_defaultBehavior = behavior; }
576 
577  unsigned int GetDefaultBehavior() { return m_defaultBehavior; }
578 
579  //! redirect to command processor of document
580  void Undo( wxCommandEvent& );
581 
582  //! redirect to command processor of document
583  void Redo( wxCommandEvent& );
584 
585  //!End the current active tool if not busy
586  void EndTool( wxCommandEvent& );
587 
588  //! default implementation for property editing
589  void EditProperties( wxCommandEvent& );
590 
591  //! how to set mouse menu undo/redo
592  void OnSetmenuStrings( a2dCommandProcessorEvent& event );
593 
594  //!start one shot zoomtool from popup menu (used while another tool is active)
595  void ZoomWindow();
596  //!zoompan from popup menu (used while another tool is active)
597  void ZoomPan();
598  //!go to previous zoom area (used while another tool is active)
599  void ZoomUndo();
600  //!show all on canvas
601  void Zoomout();
602  //!zoom out two times the current visible area
603  void Zoomout2();
604  //!zoom in two half the current visible area
605  void Zoomin2();
606 
607  void Zoom( double x, double y, double uppx, double uppy );
608 
609  //!zoom out two times the current visible area at mouse position
610  void ZoomOut2AtMouse();
611 
612  //!zoom in two half the current visible area at mouse position
613  void ZoomIn2AtMouse();
614 
615  //!Get zoom stack list, that is use to store zooming areas
616  wxZoomList& GetZoomList() {return m_zoomstack;};
617 
618  //! set the format for double to be this
619  void SetFormat( const wxString& format ) { m_format = format; }
620 
621  wxString GetFormat() { return m_format; }
622 
623  //! set all state string to empty.
624  void ClearStateStrings();
625 
626  //! function called at mouse events, the default displays cursor in statusbar.
627  /*! Override in a derived class to change behaviour. */
628  virtual void SetStateString( const wxString& message = wxEmptyString, size_t field = 3 );
629 
630  //! return mouse position in device coordinates
631  wxPoint GetMousePosition() { return wxPoint( m_mouse_x, m_mouse_y ); }
632 
633  //! what frame has the statusbar
634  wxFrame* GetFrame() { return m_where; }
635 
636  //! Get the array containing statusbar strings
637  std::vector<wxString>& GetStatusStrings() { return m_statusStrings; }
638 
639  //! start editing this object
640  virtual bool StartEditingObject( a2dCanvasObject* objectToEdit );
641 
642  //! start editing this object
643  virtual bool StartEditingObject( a2dCanvasObject* objectToEdit, a2dIterC& ic );
644 
645  //! when edit tool is firsttool, restart it.
646  bool TriggerReStartEdit( wxUint16 editmode );
647 
648  //! rotate object of first tool on the stack, when appropriate.
649  bool RotateObject90LeftRight( bool Right );
650 
651  //! when enabling m_useEditOpaque, this is how transparent the editcopy will be made.
652  /*!
653  \param editOpacity Real opacity is set opacity * m_OpacityFactor/255
654  */
655  void SetOpacityFactorEditcopy( wxUint8 editOpacity ) { m_editOpacityFactor = editOpacity; }
656 
657  //! see SetOpacityFactorEditcopy()
658  wxUint8 GetOpacityFactorEditcopy() { return m_editOpacityFactor; }
659 
660  //! When set true, instead of using a special style for editcopies, a clone of the
661  /*!
662  fill and stroke of the original are made, and used for the editcopy, but its transparancy is
663  set using m_editOpacityFactor.
664  The effect is that when dragging such an object, that in the editcopy mode, a half transparent object is shown.
665  */
666  void SetUseOpaqueEditcopy( bool editOpaque ) { m_useEditOpaque = editOpaque; }
667 
668  //! see SetUseOpaqueEditcopy()
669  bool GetUseOpaqueEditcopy() { return m_useEditOpaque; }
670 
671  void SetDraggingCanvasOption( bool draggingCanvasOption ) { m_draggingCanvasOption = draggingCanvasOption; }
672 
673  bool GetDraggingCanvasOption() { return m_draggingCanvasOption; }
674 
675  //! set key to disable snapping in tools
676  void SetNoSnapKey( int keyCode ) { m_noSnapkey = keyCode; }
677 
678  //! what is the key to disable snapping in tools
679  int GetNoSnapKey() { return m_noSnapkey; }
680 
681  //! set if selection state of tools object is set during undo.
682  bool GetSelectionStateUndo() const { return m_selectionStateUndo; }
683 
684  void SetSelectionStateUndo( bool selectionStateUndo ) { m_selectionStateUndo = selectionStateUndo; }
685 
686  //! set tool object as selected at end of action
687  bool GetSelectAtEnd() const { return m_selectedAtEnd; }
688 
689  void SetSelectAtEnd( bool selectedAtEnd ) { m_selectedAtEnd = selectedAtEnd; }
690 
691 protected:
692 
693  //!start one shot zoomtool from popup menu (used while another tool is active)
694  void ZoomWindowMenu( wxCommandEvent& );
695  //!zoompan from popup menu (used while another tool is active)
696  void ZoomPanMenu( wxCommandEvent& );
697  //!go to previous zoom area (used while another tool is active)
698  void ZoomUndoMenu( wxCommandEvent& );
699  //!show all on canvas
700  void ZoomoutMenu( wxCommandEvent& );
701  //!zoom out two times the current visible area
702  void Zoomout2Menu( wxCommandEvent& );
703  //!zoom in two half the current visible area
704  void Zoomin2Menu( wxCommandEvent& );
705 
706  //! handler for this event
707  void OnComEvent( a2dComEvent& event );
708 
709  //!called on mouse events
710  void OnMouseEvent( wxMouseEvent& event );
711  //!called on key events
712  void OnChar( wxKeyEvent& event );
713  //!called on keydown events
714  void OnKeyDown( wxKeyEvent& event );
715  //!called on keyup events
716  void OnKeyUp( wxKeyEvent& event );
717 
718  //! if set no event is send to m_where, instead a statusbar text is set directly
720 
721  //! statusbar frame
722  wxFrame* m_where;
723 
724  std::vector<wxString> m_statusStrings;
725 
726  wxString m_format;
727 
728  //! zoom stack containing previous zooms
729  wxZoomList m_zoomstack;
730 
731  //!popup menu
732  wxMenu* m_mousemenu;
733 
734  //! mouse position
736 
737  //! mouse position
739 
740  //! previous x of mouse in device
742 
743  //! previous y of mouse in device
745 
746  //! used to indicate that dragging canvas is in action.
748 
749  //! can canvas be dragged using RightMouse.
751 
752  //! x of mouse in device at start drag
754  //! y of mouse in device at start drag
756 
757  //! when true zoom out and center to middle of the view
759 
760  //! manner to drag
762 
763  //! manner to draw
765 
766  //! control the default behavior
767  unsigned int m_defaultBehavior;
768 
769  //! tool always on top of the stack, or non if NULL
771 
772  //! tool used for zooming
774 
775  //! when using cloned style for editcopy, use this opacity.
777 
778  //! when true editcopies are using a half transparent cloned style.
780 
781  int m_noSnapkey;
782 
783  bool m_selectionStateUndo;
784 
785  bool m_selectedAtEnd;
786 
787 public:
788  static const a2dPropertyIdBool PROPID_zoomfirst;
789  //! send when tool was poped
790  //! \ingroup events
791  static const wxEventType sm_showCursor;
792 
793  DECLARE_CLASS( a2dStToolContr )
794  DECLARE_EVENT_TABLE()
795 };
796 
797 //!Interactive drawing of a Rectangle.
798 /*!
799 \remark Left Click and drag.
800 \remark Cursor keys to shift object.
801 \remark Or Spacebar to end rectangle.
802 
803 \sa a2dStToolContr
804 
805  \ingroup tools
806 */
807 class A2DCANVASDLLEXP a2dDrawRectangleTool: public a2dStDrawTool
808 {
809 public:
810 
811  //! push this tool on the tools stack
812  /*! \ingroup commandid
813  */
815 
816  a2dDrawRectangleTool( a2dStToolContr* controller );
818  bool ZoomSave() { return true; }
819 
820  void SetRadius( double radius ) { m_radius = radius; }
821 
822 protected:
823 
824  virtual void GenerateAnotation();
825 
826  void OnMouseEvent( wxMouseEvent& event );
827 
828  virtual wxString GetCommandGroupName() { return _( "Draw Rectangle" ); }
829 
830  double m_radius;
831 
832 public:
833  DECLARE_CLASS( a2dDrawRectangleTool )
834  DECLARE_EVENT_TABLE()
835 
836 };
837 
838 //!Interactive Zooming.
839 /*! Use mouse to drag a rectangle to zoom into area.
840 
841 \remark Left Click and/or drag.
842 \remark Right Click for zoom popup.
843 \remark Double Left Click for zoom out.
844 
845 \sa a2dStToolContr
846 
847  \ingroup tools
848 */
849 class A2DCANVASDLLEXP a2dZoomTool: public a2dStTool
850 {
851 public:
852 
853  //! push this tool on the tools stack
854  /*! \ingroup commandid
855  */
857 
858  //! constructor
859  a2dZoomTool( a2dStToolContr* controller );
860 
861  //! constructor
862  a2dZoomTool( const a2dZoomTool& other, CloneOptions options, a2dRefMap* refs );
863 
864  //! destructor
865  ~a2dZoomTool();
866 
867  bool ZoomSave() {return true;};
868 
869 protected:
870 
871  virtual a2dObject* DoClone( CloneOptions options, a2dRefMap* refs ) const;
872 
873  virtual void GenerateAnotation();
874 
875  //! character handling
876  void OnChar( wxKeyEvent& event );
877 
878  void OnMouseEvent( wxMouseEvent& event );
879 
880  virtual wxString GetCommandGroupName() { return _( "Zoom objects" ); }
881 
882 public:
883 
884  DECLARE_CLASS( a2dZoomTool )
885  DECLARE_EVENT_TABLE()
886 
887 };
888 
889 //!Interactive Selection of an Object.
890 /*!Either with just one click or draging a rectangle to select many.
891 
892 \remark Left Click and/or drag.
893 \remark Shift Down to Un select.
894 
895 \sa a2dStToolContr
896 
897 */
898 class A2DCANVASDLLEXP a2dSelectTool: public a2dStTool
899 {
900 public:
901 
902  //! push this tool on the tools stack
903  /*! \ingroup commandid
904  */
906 
907  a2dSelectTool( a2dStToolContr* controller );
908  ~a2dSelectTool();
909  bool ZoomSave() { return true;};
910  void SetShiftIsAdd( bool shift_is_add = true ) { m_shift_is_add = shift_is_add; }
911 
912 protected:
913  void DeselectAll();
914 
915  virtual void GenerateAnotation();
916 
917  void OnChar( wxKeyEvent& event );
918 
919  void OnMouseEvent( wxMouseEvent& event );
920 
921  virtual bool EnterBusyMode();
922 
923  virtual bool CreateToolObjects();
924 
925  wxString GetCommandGroupName() { return _( "Select object(s)" ) ; }
926 
927 public:
928 
929  DECLARE_CLASS( a2dSelectTool )
930  DECLARE_EVENT_TABLE()
931 
932 protected:
933  //! false: shift key will unselect, true: shift will add to selection
934  bool m_shift_is_add;
935 
936  bool m_storeUndo;
937 
938 };
939 
940 //!Interactive Insertion of an a2dImage Object.
941 /*!Either with just one click or draging a rectangle to fit the image in.
942 
943 \remark Left Click and/or drag.
944 
945 \sa a2dStToolContr
946 
947 
948  \ingroup tools
949 */
950 class A2DCANVASDLLEXP a2dImageTool: public a2dStDrawTool
951 {
952 public:
953 
954  //! push this tool on the tools stack
955  /*! \ingroup commandid
956  */
958 
959  a2dImageTool( a2dStToolContr* controller );
960 
961  ~a2dImageTool();
962 
963  bool ZoomSave() { return true;};
964 
965  //! Sets if the pattern (a rectangle) will be drawn on top of this image
966  /*!
967  If set to <code>true</code> the pattern (a rect) will be drawn on top
968  of the image, else the pattern will be drawn behind the image.
969 
970  \remark By default the rectangle / pattern will be drawn behind the image
971 
972  \param drawPatternOnTop Set <code>true</code> to draw on top of the image, else <code>false</code>
973  */
974  void SetDrawPatternOnTop( bool drawPatternOnTop ) { m_drawPatternOnTop = drawPatternOnTop; }
975 
976  //! Returns if the pattern will be drawn on top of the image
977  /*!
978  \see SetDrawPatternOnTop
979 
980  \return <code>true</code> if pattern will be drawn on top of this image, else <code>false</code> (default)
981  */
982  bool GetDrawPatternOnTop() { return m_drawPatternOnTop; }
983 
984 
985 protected:
986 
987  virtual void GenerateAnotation();
988 
989  void OnChar( wxKeyEvent& event );
990 
991  void OnMouseEvent( wxMouseEvent& event );
992 
993  bool m_drawPatternOnTop;
994 
995 public:
996 
997  DECLARE_CLASS( a2dImageTool )
998  DECLARE_EVENT_TABLE()
999 
1000 };
1001 
1002 //!Interactive drag an object.
1003 /*!Uses the dragmode set for the controller.
1004 
1005 \remark Left Click and drag.
1006 \remark Key left right up down to move while draging active (Left Down)
1007 
1008 \sa a2dStToolContr
1009 
1010  \ingroup tools
1011 */
1012 class A2DCANVASDLLEXP a2dDragTool: public a2dStTool
1013 {
1014 public:
1015 
1016  //! push this tool on the tools stack
1017  /*! \ingroup commandid
1018  */
1020 
1021  //! constructor
1022  a2dDragTool( a2dStToolContr* controller, a2dCanvasObject* dragobject = NULL, double xw = 0, double yw = 0 );
1023  //! destructor
1024  ~a2dDragTool();
1025 
1026  bool StartDragging( int x, int y, a2dCanvasObject* original );
1027 
1028  bool ZoomSave() { return !GetBusy(); }
1029 
1030  //!If set to true, the dragged object is deleted if dropped outside of the window
1031  void SetDeleteOnOutsideDrop( bool val ) { m_deleteonoutsidedrop = val; }
1032 
1033  void SetDropAndDrop( bool val ) { m_dropAndDrop = val; }
1034 
1035  //! defines if an object will try to connect at the end of a drag
1036  void SetLateConnect( bool lateconnect ) { m_lateconnect = lateconnect; }
1037 
1038  //!redirect all mouse events for the canvas to this object
1039  void CaptureMouse();
1040  //!release the mouse capture for this object
1041  void ReleaseMouse();
1042 
1043  void Render();
1044 
1045  //!This is overriden by copy tools to have a minimum distance between original and copy
1046  virtual void AdjustShift( double* x, double* y );
1047 
1048 protected:
1049 
1050  void OnChar( wxKeyEvent& event );
1051 
1052  void OnMouseEvent( wxMouseEvent& event );
1053 
1054  virtual bool EnterBusyMode();
1055  virtual void FinishBusyMode( bool closeCommandGroup = true );
1056  virtual void AbortBusyMode();
1057 
1058  //!called when dragging is in progress
1059  virtual void DragAbsolute( double x, double y );
1060 
1061  virtual wxString GetCommandGroupName() { return _( "Move object" ) ; }
1062  virtual bool CreateToolObjects();
1063  virtual void CleanupToolObjects();
1064 
1065  //! old transform
1067 
1068  //! allow connecting to other obejcts
1070 
1071  //! connect when released
1073 
1074  //! is mouse captured during drag
1076 
1077  //! if true, the dragged object is deleted, if it is dropped outside of the window
1079 
1080  // DnD if implemented.
1081  bool m_dropAndDrop;
1082 
1083  //! hold start of drag
1085  //! hold start of drag
1087  //! hold start of drag
1089  //! hold start of drag
1091 
1092 public:
1093  DECLARE_CLASS( a2dDragTool )
1094  DECLARE_EVENT_TABLE()
1095 
1096 };
1097 
1098 class A2DCANVASDLLEXP a2dDragOrgTool: public a2dStTool
1099 {
1100 public:
1101 
1102  //! push this tool on the tools stack
1103  /*! \ingroup commandid
1104  */
1106 
1107  //! constructor
1108  a2dDragOrgTool( a2dStToolContr* controller );
1109  //! destructor
1110  ~a2dDragOrgTool();
1111 
1112  bool StartDragging( int x, int y, a2dCanvasObject* original );
1113 
1114  bool ZoomSave() { return !GetBusy(); }
1115 
1116  //!If set to true, the dragged object is deleted if dropped outside of the window
1117  void SetDeleteOnOutsideDrop( bool val ) { m_deleteonoutsidedrop = val; }
1118 
1119  //!redirect all mouse events for the canvas to this object
1120  void CaptureMouse();
1121  //!release the mouse capture for this object
1122  void ReleaseMouse();
1123 
1124  void Render();
1125 
1126  //!This is overriden by copy tools to have a minimum distance between original and copy
1127  virtual void AdjustShift( double* x, double* y );
1128 
1129 protected:
1130 
1131  void OnChar( wxKeyEvent& event );
1132 
1133  void OnMouseEvent( wxMouseEvent& event );
1134 
1135  virtual bool EnterBusyMode();
1136  virtual void FinishBusyMode( bool closeCommandGroup = true );
1137  virtual void AbortBusyMode();
1138 
1139  //!called when dragging is in progress
1140  virtual void DragAbsolute( double x, double y );
1141 
1142  virtual wxString GetCommandGroupName() { return _( "Move object" ) ; }
1143  virtual bool CreateToolObjects();
1144  virtual void CleanupToolObjects();
1145 
1146  //! old transform
1148 
1149  //! allow connecting to othere object when placed
1151 
1152  //! connect only when released
1154 
1155  //! is mosue captured when dragging
1157 
1158  //! if true, the dragged object is deleted, if it is dropped outside of the window
1160 
1161  //! hold start of drag
1163  //! hold start of drag
1165  //! hold start of drag
1167  //! hold start of drag
1169 
1170 public:
1171  DECLARE_CLASS( a2dDragOrgTool )
1172  DECLARE_EVENT_TABLE()
1173 
1174 };
1175 
1176 DECLARE_MENU_ITEMID( CmdMenu_NoDragMenu )
1177 
1178 //!Interactive drag a new object into a drawing.
1179 /*!This is like a2dDragTool but it goes automatically into drag mode
1180  if it receives a mouse event.
1181 
1182 \remark Left Click to drop.
1183 \remark Key left right up down to move while draging active (Left Down)
1184 
1185 \sa a2dDragTool
1186 
1187  \ingroup tools
1188 */
1189 class A2DCANVASDLLEXP a2dDragNewTool: public a2dDragTool
1190 {
1191 public:
1192 
1193  //! push this tool on the tools stack
1194  /*! \ingroup commandid
1195  */
1197 
1198  /*!
1199  \param controller controller to place tool in
1200  \param newObject the canvas object that is drag & droped
1201  */
1202  a2dDragNewTool( a2dStToolContr* controller, a2dCanvasObject* newObject, const a2dMenuIdItem& initiatingMenuId = CmdMenu_NoDragMenu() );
1203  ~a2dDragNewTool();
1204 
1205  void SetBoxCenterDrag( bool boxCenterDrag ) { m_boxCenterDrag = boxCenterDrag; }
1206  bool GetBoxCenterDrag() { return m_boxCenterDrag; }
1207 
1208  a2dCanvasObject* GetTemplateObject() const { return m_newObject; }
1209 
1210  bool ZoomSave() { return true; }
1211 
1212  bool RotateObject90LeftRight( bool right );
1213 
1214  void OnMouseEvent( wxMouseEvent& event );
1215 
1216  virtual void AdjustRenderOptions();
1217 
1218 protected:
1219 
1220  void OnComEvent( a2dComEvent& event );
1221 
1222  //! when dragging an object from another window into the tool its window, this window wants to have the focus.
1223  void OnEnter( wxMouseEvent& WXUNUSED( event ) );
1224 
1225  void OnChar( wxKeyEvent& event );
1226 
1227  virtual wxString GetCommandGroupName() { return _( "Create new object" ) ; }
1228  virtual void DoStopTool( bool abort );
1229  virtual bool EnterBusyMode();
1230  virtual void FinishBusyMode( bool closeCommandGroup = true );
1231 
1232  a2dCanvasObjectPtr m_newObject;
1233  //! This is the parent, to which the temporary object was added.
1234  /*! This must be remembered, because it changes if the shows object changes */
1236 
1237  //! drag from origin of object or center of bbox
1239 
1240 public:
1241  DECLARE_CLASS( a2dDragNewTool )
1242  DECLARE_EVENT_TABLE()
1243 };
1244 
1245 //!Interactive copy an object.
1246 /*!
1247 \remark Left Click and drag.
1248 
1249 \sa a2dStToolContr
1250 
1251  \ingroup tools
1252 */
1253 class A2DCANVASDLLEXP a2dCopyTool: public a2dDragTool
1254 {
1255 public:
1256 
1257  //! push this tool on the tools stack
1258  /*! \ingroup commandid
1259  */
1261 
1262  a2dCopyTool( a2dStToolContr* controller, a2dCanvasObject* copyobject = NULL, double xw = 0, double yw = 0 );
1263  bool ZoomSave() { return !GetBusy(); };
1264 
1265  void SetDeepCopy( bool deepCopy ) { m_deepCopy = deepCopy ; }
1266 
1267  bool GetDeepCopy() { return m_deepCopy; }
1268 
1269 protected:
1270  void OnMouseEvent( wxMouseEvent& event );
1271 
1272  virtual bool CreateToolObjects();
1273  bool EnterBusyMode();
1274  void FinishBusyMode( bool closeCommandGroup = true );
1275 
1276  virtual void AdjustShift( double* x, double* y );
1277 
1278  // minimum distance of the copy from the original
1279  double m_mindist;
1280  bool m_deepCopy;
1281 
1282  virtual wxString GetCommandGroupName() { return _( "Copy" ); }
1283 
1284 public:
1285  DECLARE_CLASS( a2dCopyTool )
1286  DECLARE_EVENT_TABLE()
1287 };
1288 
1289 //!Interactive rotate an object.
1290 /*!
1291 \remark Left Click and drag.
1292 
1293 \sa a2dStToolContr
1294 */
1295 class A2DCANVASDLLEXP a2dRotateTool: public a2dStTool
1296 {
1297 public:
1298 
1299  //! push this tool on the tools stack
1300  /*! \ingroup commandid
1301  */
1303 
1304  a2dRotateTool( a2dStToolContr* controller );
1305  ~a2dRotateTool();
1306  bool ZoomSave() { return !GetBusy(); };
1307 
1308 
1309  //!redirect all mouse events for the canvas to this object
1310  void CaptureMouse();
1311  //!release the mouse capture for this object
1312  void ReleaseMouse();
1313 
1314 protected:
1315 
1316  bool EnterBusyMode();
1317  virtual void FinishBusyMode( bool closeCommandGroup = true );
1318  void AbortBusyMode();
1319 
1320  void OnChar( wxKeyEvent& event );
1321 
1322  void OnIdle( wxIdleEvent& event );
1323 
1324  void OnMouseEvent( wxMouseEvent& event );
1325 
1326  virtual wxString GetCommandGroupName() { return _( "Rotate object" ) ; }
1327 
1328  double m_xr;
1329  double m_yr;
1330 
1331  bool m_mode;
1332 
1333  //! old transform
1335 
1336  double m_ang;
1337 
1338 public:
1339  DECLARE_CLASS( a2dRotateTool )
1340  DECLARE_EVENT_TABLE()
1341 
1342 };
1343 
1344 
1345 //!Interactive delete an object.
1346 /*!
1347 \remark Left Click on object to delete.
1348 
1349 \sa a2dStToolContr
1350 
1351  \ingroup tools
1352 */
1353 class A2DCANVASDLLEXP a2dDeleteTool: public a2dStTool
1354 {
1355 public:
1356 
1357  //! push this tool on the tools stack
1358  /*! \ingroup commandid
1359  */
1361 
1363  bool ZoomSave() { return true;};
1364  void SetWhichObjectsFlagMask( a2dCanvasObjectFlagsMask whichobjects ) { m_whichobjects = whichobjects; }
1365 
1366 protected:
1367 
1368  void OnChar( wxKeyEvent& event );
1369 
1370  void OnMouseEvent( wxMouseEvent& event );
1371 
1372  virtual wxString GetCommandGroupName() { return _( "Delete object" ) ; }
1373 
1374 public:
1375  DECLARE_CLASS( a2dDeleteTool )
1376  DECLARE_EVENT_TABLE()
1377 
1378 protected:
1379  a2dCanvasObjectFlagsMask m_whichobjects;
1380 
1381 };
1382 
1383 
1384 //!Interactive drawing of a Circle.
1385 /*!
1386 \remark Left Click and drag.
1387 \remark Cursor keys to shift object.
1388 \remark Or Spacebar to end line.
1389 
1390 \sa a2dStToolContr
1391 */
1392 class A2DCANVASDLLEXP a2dDrawCircleTool: public a2dStDrawTool
1393 {
1394 public:
1395 
1396  //! push this tool on the tools stack
1397  /*! \ingroup commandid
1398  */
1400 
1401  a2dDrawCircleTool( a2dStToolContr* controller );
1402  bool ZoomSave() { return true;};
1403 
1404  void SetMode( int mode );
1405 
1406 protected:
1407 
1408  void OnIdle( wxIdleEvent& event );
1409 
1410  void OnChar( wxKeyEvent& event );
1411 
1412  void OnMouseEvent( wxMouseEvent& event );
1413 
1414  virtual void GenerateAnotation();
1415 
1416  double m_start_x;
1417  double m_start_y;
1418  double m_radius;
1419 
1420 public:
1421  DECLARE_CLASS( a2dDrawCircleTool )
1422  DECLARE_EVENT_TABLE()
1423 
1424 };
1425 
1426 //!Interactive drawing of a EllipticArc.
1427 /*!
1428 \remark Left Click for first point and second point again.
1429 \remark Cursor keys to shift object.
1430 \remark Or Spacebar to end line.
1431 
1432 \sa a2dStToolContr
1433 
1434  \ingroup tools
1435 */
1436 class A2DCANVASDLLEXP a2dDrawLineTool: public a2dStDrawTool
1437 {
1438 public:
1439 
1440  //! push this tool on the tools stack
1441  /*! \ingroup commandid
1442  */
1444  static const a2dCommandId COMID_PushTool_DrawLineScaledArrow;
1445 
1446  a2dDrawLineTool( a2dStToolContr* controller, a2dSLine* templateObject = NULL );
1447 
1448  ~a2dDrawLineTool();
1449 
1450  bool ZoomSave() { return true;};
1451 
1452  //!defines line begin object for line and polyline drawing tools
1453  void SetLineBegin( a2dCanvasObject* begin );
1454 
1455  //!defines line end object for line and polyline drawing tools
1456  void SetLineEnd( a2dCanvasObject* end );
1457 
1458  //!get current line begin object for line and polyline drawing tools.
1459  /*!\return Null if not set. */
1460  a2dCanvasObject* GetLineBegin() { return m_templateObject->GetBegin(); }
1461 
1462  //!get current line end object for line and polyline drawing tools
1463  /*!return: Null if not set. */
1464  a2dCanvasObject* GetLineEnd() { return m_templateObject->GetEnd(); }
1465 
1466  //!scaling in X for begin and end objects of lines and polylines
1467  void SetEndScaleX( double xs );
1468  //!scaling in Y for begin and end objects of lines and polylines
1469  void SetEndScaleY( double ys );
1470 
1471  //!get scaling in X for begin and end objects of lines and polylines
1472  double GetEndScaleX() { return m_templateObject->GetEndScaleX(); }
1473 
1474  //!get scaling in Y for begin and end objects of lines and polylines
1475  double GetEndScaleY() { return m_templateObject->GetEndScaleY(); }
1476 
1477  //! Set when m_contourwidth != 0 what is the end of the line should be.
1478  void SetPathType( a2dPATH_END_TYPE pathtype );
1479 
1480  //! get when m_contourwidth != 0 what is the end of the line looks like.
1481  a2dPATH_END_TYPE GetPathType() { return m_templateObject->GetPathType(); }
1482 
1483  //! set template for line object
1484  a2dSLine* GetTemplateObject() { return m_templateObject; }
1485 
1486  //! get template for line object
1487  void SetTemplateObject( a2dSLine* templateobject ) { m_templateObject = templateobject; }
1488 
1489 protected:
1490 
1491  void OnChar( wxKeyEvent& event );
1492 
1493  void OnMouseEvent( wxMouseEvent& event );
1494 
1495  void OnDoEvent( a2dCommandProcessorEvent& event );
1496 
1497  virtual void GenerateAnotation();
1498 
1499  double m_x1;
1500  double m_y1;
1501  double m_x2;
1502  double m_y2;
1503 
1504  //! object to clone to use as start
1506 
1507 public:
1508  DECLARE_CLASS( a2dDrawLineTool )
1509  DECLARE_EVENT_TABLE()
1510 
1511 };
1512 
1513 //!Interactive drawing of a Ellipse.
1514 /*!
1515 \remark Left Click and drag.
1516 \remark Cursor keys to shift object.
1517 \remark Or Spacebar to end line.
1518 
1519 \sa a2dStToolContr
1520 
1521  \ingroup tools
1522 */
1523 class A2DCANVASDLLEXP a2dDrawEllipseTool: public a2dStDrawTool
1524 {
1525 public:
1526 
1527  //! push this tool on the tools stack
1528  /*! \ingroup commandid
1529  */
1531 
1532  a2dDrawEllipseTool( a2dStToolContr* controller );
1533  bool ZoomSave() { return true;};
1534 
1535  void SetMode( int mode );
1536 
1537 protected:
1538 
1539  void OnIdle( wxIdleEvent& event );
1540 
1541  void OnMouseEvent( wxMouseEvent& event );
1542 
1543  void OnChar( wxKeyEvent& event );
1544 
1545  virtual void GenerateAnotation();
1546 
1547  double m_start_x;
1548  double m_start_y;
1549 
1550 
1551 public:
1552  DECLARE_CLASS( a2dDrawEllipseTool )
1553  DECLARE_EVENT_TABLE()
1554 
1555 };
1556 
1557 //!Interactive drawing of a EllipticArc.
1558 /*!
1559 \remark Left Click and drag/move.
1560 \remark Left Click again Or Spacebar to end arc drawing.
1561 \remark Return/Enter to cycle through drawing mode2 for changing start and end angle.
1562 \remark Cursor keys to shift object.
1563 \remark Shift drag/move to change start angle.
1564 
1565 \sa a2dStToolContr
1566 
1567  \ingroup tools
1568 */
1569 class A2DCANVASDLLEXP a2dDrawEllipticArcTool: public a2dStDrawTool
1570 {
1571 public:
1572 
1573  //! push this tool on the tools stack
1574  /*! \ingroup commandid
1575  */
1577  //! push this tool on the tools stack
1578  /*! \ingroup commandid
1579  */
1581 
1582  a2dDrawEllipticArcTool( a2dStToolContr* controller, a2dEllipticArc* templateObject = NULL );
1583  bool ZoomSave() { return true;};
1584 
1585  void SetMode( int mode );
1586 
1587  //! change mode of drawing
1588  void SetMode2( int mode );
1589 
1590  void SetChord( bool chord ) { m_chord = chord; };
1591 
1592  bool GetChord() const { return m_chord; }
1593 
1594 protected:
1595 
1596  void OnIdle( wxIdleEvent& event );
1597 
1598  void OnChar( wxKeyEvent& event );
1599 
1600  void OnMouseEvent( wxMouseEvent& event );
1601 
1602  virtual void GenerateAnotation();
1603 
1604  //! object to clone to use as start
1606 
1607  //! start arc
1608  double m_arcstart;
1609  //! end arc
1610  double m_arcend;
1611 
1612  //! start x
1613  double m_start_x;
1614  //! start y
1615  double m_start_y;
1616 
1617  //! draw just a cord object, not filled.
1618  bool m_chord;
1619 
1620  //! mode to change what is drawn
1621  int m_mode2;
1622 
1623 public:
1624  DECLARE_CLASS( a2dDrawEllipticArcTool )
1625  DECLARE_EVENT_TABLE()
1626 
1627 };
1628 
1629 //!Interactive drawing of a circular arc.
1630 /*!
1631 \remark Left Click and drag/move.
1632 \remark Left Click again Or Spacebar to end arc drawing.
1633 \remark Return/Enter to cycle through drawing mode2 for changing start and end angle.
1634 \remark Cursor keys to shift object.
1635 \remark Shift drag/move to change start angle.
1636 
1637 \sa a2dStToolContr
1638 
1639  \ingroup tools
1640 */
1641 class A2DCANVASDLLEXP a2dDrawArcTool: public a2dStDrawTool
1642 {
1643 public:
1644 
1645  //! push this tool on the tools stack
1646  /*! \ingroup commandid
1647  */
1649  //! push this tool on the tools stack
1650  /*! \ingroup commandid
1651  */
1653 
1654  a2dDrawArcTool( a2dStToolContr* controller );
1655  bool ZoomSave() { return true;};
1656 
1657  void SetMode( int mode );
1658 
1659  //! change mode of drawing
1660  void SetMode2( int mode );
1661 
1662  //! draw jus a cord object
1663  void SetChord( bool chord ) { m_chord = chord; };
1664 
1665  bool GetChord() const { return m_chord; }
1666 
1667 protected:
1668 
1669  void OnIdle( wxIdleEvent& event );
1670 
1671  void OnChar( wxKeyEvent& event );
1672 
1673  void OnMouseEvent( wxMouseEvent& event );
1674 
1675  virtual void GenerateAnotation();
1676 
1677  virtual wxString GetCommandGroupName() { return _( "Draw Arc" ) ; }
1678 
1679  //! way of drawing
1680  int m_mode2;
1681 
1682 
1683  //! start arc
1684  double m_arcstart;
1685  //! end arc
1686  double m_arcend;
1687 
1688  //! start x
1689  double m_start_x;
1690  //! start y
1691  double m_start_y;
1692 
1693  //! draw just a cord object, not filled.
1694  bool m_chord;
1695 
1696 public:
1697  DECLARE_CLASS( a2dDrawArcTool )
1698  DECLARE_EVENT_TABLE()
1699 
1700 };
1701 
1702 
1703 //!Interactive drawing of a polygon.
1704 /*!
1705 \remark Left Click to add points.
1706 \remark Space bar or Double click to end drawing.
1707 \remark Cursor keys to shift object.
1708 \remark Cursor keys + control to shift point.
1709 \remark Right Click to zoom.
1710 
1711 \sa a2dStToolContr
1712 
1713  \ingroup tools
1714 */
1715 class A2DCANVASDLLEXP a2dDrawPolygonLTool: public a2dStDrawTool
1716 {
1717 public:
1718 
1719  //! push this tool on the tools stack
1720  /*! \ingroup commandid
1721  */
1723  //! push this tool on the tools stack
1724  /*! \ingroup commandid
1725  */
1727 
1728  //! constructor
1729  /*!
1730  \param controller tool controller one which this tool is pushed.
1731  \param templateObject when not NULL, this object is cloned and used for the new drawn object.
1732  */
1733  a2dDrawPolygonLTool( a2dStToolContr* controller, a2dPolygonL* templateObject = NULL );
1734 
1736 
1737  //! save to zoom while drawing
1738  bool ZoomSave() { return true;};
1739 
1740  //! mode of drawing, can be swicthed with Tab key.
1741  void SetMode( int mode );
1742 
1743  //!certain drawing tools like polygon drawing use this setting
1744  /*! You might want to reset m_newObjectsGetCommandProcStyle also.
1745  Otherwise the command processor will overwrite what you set here
1746  */
1747  void SetSpline( bool spline );
1748 
1749  //!certain drawing tools like polygon drawing use this setting
1750  bool GetSpline() {return m_templateObject->GetSpline();}
1751 
1752 protected:
1753 
1754  void OnIdle( wxIdleEvent& event );
1755 
1756  void OnChar( wxKeyEvent& event );
1757 
1758  void OnMouseEvent( wxMouseEvent& event );
1759 
1760  void OnDoEvent( a2dCommandProcessorEvent& event );
1761  void OnUndoEvent( a2dCommandProcessorEvent& event );
1762  void OnRedoEvent( a2dCommandProcessorEvent& event );
1763 
1764  void AddPoint( a2dLineSegment* point );
1765  void BeginPolygon( double x, double y );
1766  void AddPoint( double x, double y );
1767 
1768 
1769  virtual wxString GetCommandGroupName() { return _( "Draw polygon" ) ; }
1770 
1771  //! object to clone to use as start
1773 
1774  //! previous x
1775  double m_prev_x;
1776  //! previous y
1777  double m_prev_y;
1778 
1779  //! points sofar
1781 
1782  //! last point
1784 
1785  //! end to begin wire.
1787 
1788 public:
1789  DECLARE_CLASS( a2dDrawPolygonLTool )
1790  DECLARE_EVENT_TABLE()
1791 
1792 };
1793 
1794 //!Interactive drawing of a polyline.
1795 /*!
1796 \remark Left Click to add points.
1797 \remark Space bar or Double click to end drawing.
1798 \remark Cursor keys to shift object.
1799 \remark Cursor keys + control to shift point.
1800 \remark Right Click to zoom.
1801 
1802 \sa a2dStToolContr
1803 
1804  \ingroup tools
1805 */
1806 class A2DCANVASDLLEXP a2dDrawPolylineLTool: public a2dDrawPolygonLTool
1807 {
1808 public:
1809 
1810  //! push this tool on the tools stack
1811  /*! \ingroup commandid
1812  */
1814  //! push this tool on the tools stack
1815  /*! \ingroup commandid
1816  */
1818 
1819  //! constructor
1820  /*!
1821  \param controller tool controller one which this tool is pushed.
1822  \param templateObject when not NULL, this object is cloned and used for the new drawn object.
1823  */
1824  a2dDrawPolylineLTool( a2dStToolContr* controller, a2dPolylineL* templateObject = NULL );
1825 
1827 
1828  //!defines line begin object for line and polyline drawing tools
1829  /*! You might want to reset m_newObjectsGetCommandProcStyle also.
1830  Otherwise the command processor will overwrite what you set here
1831  */
1832  void SetLineBegin( a2dCanvasObject* begin );
1833 
1834  //!defines line end object for line and polyline drawing tools
1835  /*! You might want to reset m_newObjectsGetCommandProcStyle also.
1836  Otherwise the command processor will overwrite what you set here
1837  */
1838  void SetLineEnd( a2dCanvasObject* end );
1839 
1840  //!get current line begin object for line and polyline drawing tools.
1841  /*!\return Null if not set. */
1842  a2dCanvasObject* GetLineBegin() { return m_templatePline->GetBegin(); }
1843 
1844  //!get current line end object for line and polyline drawing tools
1845  /*!return: Null if not set. */
1846  a2dCanvasObject* GetLineEnd() { return m_templatePline->GetEnd(); }
1847 
1848  //!scaling in X for begin and end objects of lines and polylines
1849  void SetEndScaleX( double xs );
1850  //!scaling in Y for begin and end objects of lines and polylines
1851  void SetEndScaleY( double ys );
1852 
1853  //!get scaling in X for begin and end objects of lines and polylines
1854  double GetEndScaleX() { return m_templatePline->GetEndScaleX(); }
1855 
1856  //!get scaling in Y for begin and end objects of lines and polylines
1857  double GetEndScaleY() { return m_templatePline->GetEndScaleY(); }
1858 
1859  //! Set when m_contourwidth != 0 what is the end of the line should be.
1860  void SetPathType( a2dPATH_END_TYPE pathtype );
1861 
1862  //! get when m_contourwidth != 0 what is the end of the line looks like.
1863  a2dPATH_END_TYPE GetPathType() { return m_templatePline->GetPathType(); }
1864 
1865 protected:
1866 
1867  void OnMouseEvent( wxMouseEvent& event );
1868 
1869  void OnDoEvent( a2dCommandProcessorEvent& event );
1870 
1871  void OnComEvent( a2dComEvent& event );
1872 
1873  a2dSmrtPtr<a2dPolylineL> m_templatePline;
1874 
1875 public:
1876  DECLARE_CLASS( a2dDrawPolylineLTool )
1877  DECLARE_EVENT_TABLE()
1878 
1879 };
1880 
1881 //! the way a new wire is created
1883 {
1884  //! the pin which is clicked as start pin for the wire, its pinclass is used to
1885  //! find a connecting pinclass in the wire beginpin. Only usefull if there is only
1886  //! one type of wire possible for that pinclass.
1888  //! the tool provides a starting wire pinclass, only pins which can connect to his wirepin its pinclass,
1889  //! will be clickable. Use this to only draw specific wires from this tool.
1891  a2d_BasedOnObjectClassRequired,
1892  //! the wire will be decided when the end pin for the wire is hit, based on the start pin and endpin.
1893  //! use this if more then on type of wire can start from a certain pinclass, and it depends on the end pin
1894  //! what type of wire it will be.
1896  a2d_StartGenerateSearchFinish
1897 };
1898 
1899 
1900 //!Interactive drawing of a polyline wire.
1901 /*!
1902  This tool is used to draw wires in between a2dCanvasObject's which have a2dPin's.
1903  a2dPin's are used to connect objects with eachother. A wire is a special kind of a2dCanvasObject
1904  since it is designed to keep other objects connected when moving them around.
1905  Rerouting algorithms take care of this.
1906 
1907  This tool here first waits for a pin that is clicked. It uses a a2dConnectionGenerator::GetPinClassForTask()
1908  to get a connection a2dPinClass for the pin which was clicked.
1909  From that the pin clicked, a suitable wire is found via a2dConnectionGenerator::CreateConnectObject()
1910  The wire returned has a pin which matches the pin clicked at the start, and an end pin is generated
1911  by a2dConnectionGenerator itself. The end pin must eventually fits a pin which will be clicked to end the wire.
1912 
1913  If you want this tool to start only on specific pins, for a specific wire type and/or pin class,
1914  you must set a a2dConnectionGenerator that does only returns that type of pin in its GetPinClassForTask().
1915  When more start pin classes are allowed, and pins overlap the first one found is returned. That might
1916  be not be the one you want.
1917 
1918  For usage of those features, think here of graphs of a2dCanvasObjects with more then one flow.
1919 
1920  \remark Left Click to add points.
1921  \remark Space bar or Double click to end drawing.
1922  \remark Cursor keys to shift object.
1923  \remark Cursor keys + control to shift point.
1924  \remark Right Click to zoom.
1925 
1926  \sa a2dStToolContr
1927 
1928  \ingroup tools
1929 */
1930 class A2DCANVASDLLEXP a2dDrawWirePolylineLTool: public a2dDrawPolylineLTool
1931 {
1932 
1933 public:
1934 
1935  //! push this tool on the tools stack
1936  /*! \ingroup commandid
1937  */
1939 
1942 
1943  void SetWiringMode( a2dWiringMode wiringMode ) { m_wiringMode = wiringMode; }
1944 
1945  //! if set, end of wire splits connecting wire.
1946  void SetEndMode( bool splitAtEnd ) { m_splitAtEnd = splitAtEnd; }
1947 
1948  bool GetEndMode() { return m_splitAtEnd; }
1949 
1950  //! with this set to 1 or 2 the next point to add to the wire is a two segment piece.
1951  //! angle can be altered with the TAB key. Set to 0 is a straight line.
1952  void SetEndSegmentMode( a2dNextSeg mode );
1953 
1954  a2dNextSeg GetEndSegmentMode() { return m_endSegmentMode; }
1955 
1956 public:
1957 
1958  //! Helper function to find a pin in a DIRECT child object of the given root object
1959  /*! if a pin is found, return the m_connectionGenerator is used to find the pin which can connect
1960  to the pin found.
1961  */
1962  a2dPin* FindPin( a2dCanvasObject* root, double x, double y );
1963 
1964 protected:
1965 
1966  void AtNewVertex();
1967 
1968  void OnKeyDown( wxKeyEvent& event );
1969  void OnChar( wxKeyEvent& event );
1970 
1971  void OnUndoEvent( a2dCommandProcessorEvent& event );
1972  void OnRedoEvent( a2dCommandProcessorEvent& event );
1973 
1974  void OnIdle( wxIdleEvent& event );
1975 
1976  a2dWiringMode m_wiringMode;
1977 
1978  //! required pin class at start of wire
1980 
1981  //! required pin class at start of wire
1983 
1984  //! if set, end of wire splits connecting wire.
1986 
1987  virtual bool EnterBusyMode();
1988  virtual void FinishBusyMode( bool closeCommandGroup = true );
1989  virtual void AbortBusyMode();
1990 
1991  void AdjustRenderOptions();
1992  void OnMouseEvent( wxMouseEvent& event );
1993  void SetActive( bool active );
1994 
1995  virtual wxString GetCommandGroupName() { return _( "Draw wire" ) ; }
1996 
1997  int m_startWireX;
1998  int m_startWireY;
1999  int m_startWireXdev;
2000  int m_startWireYdev;
2001  bool m_hadDoubleClick;
2002 
2003  //! manhattan point
2005 
2006  a2dNextSeg m_endSegmentMode;
2007 
2008  bool m_manhattan;
2009  bool m_like;
2010  double m_manx, m_many;
2011 
2012 public:
2013  DECLARE_CLASS( a2dDrawWirePolylineLTool )
2014  DECLARE_EVENT_TABLE()
2015 };
2016 
2017 //!Drag Selected canvasObjects
2018 /*! \sa a2dStToolContr
2019  \ingroup tools
2020 */
2021 class A2DCANVASDLLEXP a2dDragMultiTool: public a2dStTool
2022 {
2023 public:
2024 
2025  //! push this tool on the tools stack
2026  /*! \ingroup commandid
2027  */
2029 
2030  a2dDragMultiTool( a2dStToolContr* controller );
2031  ~a2dDragMultiTool();
2032  bool ZoomSave() { return !GetBusy(); };
2033 
2034  bool StartDragging( int x, int y, a2dCanvasObject* original );
2035 
2036  //! defines if an object will try to connect at the end of a drag
2037  void SetLateConnect( bool lateconnect ) { m_lateconnect = lateconnect; }
2038 
2039  void SetOnlyKeys( bool onlyKeys ) { m_onlyKeys = onlyKeys; }
2040 
2041 protected:
2042 
2043  void OnKeyDown( wxKeyEvent& event );
2044  void OnKeyUp( wxKeyEvent& event );
2045  void OnChar( wxKeyEvent& event );
2046 
2047  void OnMouseEvent( wxMouseEvent& event );
2048 
2049  virtual bool EnterBusyMode();
2050  virtual void FinishBusyMode( bool closeCommandGroup = true );
2051  virtual void AbortBusyMode();
2052 
2053  //!redirect all mouse events for the canvas to this object
2054  void CaptureMouse();
2055  //!release the mouse capture for this object
2056  void ReleaseMouse();
2057 
2058  void DragAbsolute( double x, double y );
2059 
2060  //!render in drag style
2061  virtual void Render();
2062  //!This is overriden by copy tools to have a minimum distance between original and copy
2063  virtual void AdjustShift( double* x, double* y );
2064 
2065  virtual wxString GetCommandGroupName() { return _( "Move multiple objects" ) ; }
2066  virtual bool CreateToolObjects();
2067  virtual void CleanupToolObjects();
2068 
2069  //!the list of selected objects
2071 
2072  a2dCanvasObjectList m_copies;
2073 
2074  //! hold start of drag
2076  //! hold start of drag
2078  //! hold start of drag
2080  //! hold start of drag
2082 
2083  //! allow connecting to other obejcts
2085 
2086  bool m_onlyKeys;
2087 
2088 
2089 public:
2090  DECLARE_CLASS( a2dDragMultiTool )
2091  DECLARE_EVENT_TABLE()
2092 
2093 };
2094 
2095 class A2DCANVASDLLEXP a2dDragMultiNewTool: public a2dDragMultiTool
2096 {
2097 public:
2098 
2099  //! push this tool on the tools stack
2100  /*! \ingroup commandid
2101  */
2103 
2104  /*!
2105  \param controller controller to place tool in
2106  \param originals the canvas objects that is drag & droped
2107  */
2108  a2dDragMultiNewTool( a2dStToolContr* controller, a2dCanvasObjectList* originals );
2110 
2111  bool ZoomSave() { return true; }
2112 
2113  void OnMouseEvent( wxMouseEvent& event );
2114 
2115  virtual void AdjustRenderOptions();
2116 
2117  bool StartDragging( int x, int y );
2118 
2119 protected:
2120 
2121  void OnComEvent( a2dComEvent& event );
2122 
2123  //! when dragging an object from another window into the tool its window, this window wants to have the focus.
2124  void OnEnter( wxMouseEvent& WXUNUSED( event ) );
2125 
2126  virtual wxString GetCommandGroupName() { return _( "Create new object" ) ; }
2127  virtual void DoStopTool( bool abort );
2128  virtual bool EnterBusyMode();
2129  virtual void AbortBusyMode();
2130  virtual void FinishBusyMode( bool closeCommandGroup = true );
2131 
2132  a2dCanvasObjectList m_originals;
2133 
2134  //! This is the parent, to which the temporary object was added.
2135  /*! This must be remembered, because it changes if the shows object changes */
2137 
2138 public:
2139  DECLARE_CLASS( a2dDragMultiNewTool )
2140  DECLARE_EVENT_TABLE()
2141 };
2142 
2143 
2144 //!Drag and Copy Selected canvasObjects
2145 /*!\sa a2dStToolContr
2146  \ingroup tools
2147 */
2148 class A2DCANVASDLLEXP a2dCopyMultiTool: public a2dDragMultiTool
2149 {
2150 public:
2151 
2152  //! push this tool on the tools stack
2153  /*! \ingroup commandid
2154  */
2156 
2157  a2dCopyMultiTool( a2dStToolContr* controller );
2158 
2159  bool StartDragging( int x, int y, a2dCanvasObject* original );
2160 
2161 protected:
2162 
2163  void OnChar( wxKeyEvent& event );
2164 
2165  void OnMouseEvent( wxMouseEvent& event );
2166 
2167  void AdjustShift( double* x, double* y );
2168 
2169  virtual wxString GetCommandGroupName() { return _( "Copy multiple objects" ) ; }
2170 
2171  // minimum distance of the copy from the original
2172  double m_mindist;
2173 public:
2174  DECLARE_CLASS( a2dCopyMultiTool )
2175  DECLARE_EVENT_TABLE()
2176 
2177 };
2178 
2179 //!Interactive drawing a text object.
2180 /*!
2181 \remark Cursor keys to navigate through text
2182 \remark Home & End (goto begin or end of line)
2183 \remark control + Home & End (goto begin or end of text object)
2184 \remark altdown + Cursor keys to shift text object
2185 \remark controldown + Cursor keys (default canvas behaviour)
2186 
2187 \sa a2dStToolContr
2188 
2189  \ingroup tools
2190 */
2191 class A2DCANVASDLLEXP a2dDrawTextTool: public a2dStDrawTool
2192 {
2193 public:
2194 
2195  //! push this tool on the tools stack
2196  /*! \ingroup commandid
2197  */
2199 
2200  //! constructor
2201  /*!
2202  \param controller tool controller one which this tool is pushed.
2203  \param templateObject when not NULL, this object is cloned and used for the new drawn object.
2204  */
2205  a2dDrawTextTool( a2dStToolContr* controller, a2dText* templateObject = NULL );
2206  ~a2dDrawTextTool();
2207 
2208  //! set template for line object
2210 
2211  //! get template for line object
2212  void SetTemplateObject( a2dText* templateobject ) { m_templateObject = templateobject; }
2213 
2214  bool ZoomSave() { return true;};
2215 
2217 
2218 protected:
2219 
2220  void OnMouseEvent( wxMouseEvent& event );
2221 
2222  //! object to clone to use as start
2223  a2dSmrtPtr<a2dText> m_templateObject;
2224 
2225 public:
2226  DECLARE_CLASS( a2dDrawTextTool )
2227  DECLARE_EVENT_TABLE()
2228 
2229 };
2230 
2231 
2232 //!Interactive edit properties of an object.
2233 /*!
2234 \remark Left Click on object edit properties of
2235 
2236 \sa a2dStToolContr
2237 
2238  \ingroup tools
2239 */
2240 class A2DCANVASDLLEXP a2dPropertyTool: public a2dStTool
2241 {
2242 public:
2243 
2244  //! push this tool on the tools stack
2245  /*! \ingroup commandid
2246  */
2248 
2249  a2dPropertyTool( a2dStToolContr* controller );
2250 
2251  bool StartEditing( double x, double y );
2252 
2253  bool StartEditing( int x, int y );
2254 
2255  bool ZoomSave() { return true;};
2256 
2257 protected:
2258 
2259  void OnChar( wxKeyEvent& event );
2260 
2261  void OnMouseEvent( wxMouseEvent& event );
2262 
2263  //! id of property to set
2265 
2266  //! undoable or not
2268 
2269 public:
2270  DECLARE_CLASS( a2dPropertyTool )
2271  DECLARE_EVENT_TABLE()
2272 
2273 };
2274 
2275 
2276 //! behaviour model of a2dStTool tools
2277 /*!
2278 
2279  Tries to model general behaviour for tools controlled by a2dStToolContr, and tools known in wxArt2D.
2280  If you want different behaviour you can derive or develop your own a2dToolEvtHandler.
2281 
2282  A a2dToolEvtHandler is/can be set to a a2dBaseTool as an event handler in between the tool its own event handler.
2283  This is the easiest way to make a whole set of tools behave to a certain model.
2284 
2285  \ingroup tools
2286 */
2287 class A2DCANVASDLLEXP a2dStToolEvtHandler: public a2dToolEvtHandler
2288 {
2289  DECLARE_EVENT_TABLE()
2290 
2291 public:
2292 
2293  //! Enum for hit test options
2294  enum options
2295  {
2296  a2dTakeToolstyleNon = 0x0000,
2297 
2298  //! can be used to take over style from the a2dCentralCanvasCommandProcessor
2299  /*!
2300  when set fill stroke and other specific properties are set as current status to the
2301  a2dCentralCanvasCommandProcessor when a drawing tool is pushed.
2302  */
2303  a2dTakeToolstyleToCmdhOnPush = 0x0001,
2304 
2305  //! can be used to set style to the a2dCentralCanvasCommandProcessor
2306  /*!
2307  when set fill stroke contour and other specific properties are taken from the
2308  a2dCentralCanvasCommandProcessor when a drawing tool is poped.
2309  */
2310  a2dTakeToolstyleFromCmdhOnPop = 0x0002,
2311 
2312  //! can be used to set style to the a2dCentralCanvasCommandProcessor
2313  /*!
2314  when set fill stroke contour and other specific properties are taken from the
2315  a2dCentralCanvasCommandProcessor when a drawing tool is pushed.
2316  */
2317  a2dTakeToolstyleFromCmdhOnPush = 0x0004,
2318 
2319  //! new object added or object edited gets tool style
2320  a2dTakeToolstyleToNewObject = 0x0008,
2321 
2322  //! editing an object, its style becomes the central style.
2323  a2dTakeToolstyleToCentral = 0x0010,
2324 
2325  //! all
2326  a2d_ALL = 0xFFFF
2327  };
2328 
2329  //! constructor
2330  a2dStToolEvtHandler( a2dStToolContr* controller );
2331  //! destructor
2333 
2334  void SetTakeToolstyleToCmdhOptions( wxUint32 set ) { m_options = set; }
2335  wxUint32 GetTakeToolstyleToCmdhOptions() { return m_options; }
2336 
2337  void TakeToCmdhFromEditedObject( a2dObjectEditTool* editTool );
2338 
2339 protected:
2340 
2341  void OnKeyDown( wxKeyEvent& event );
2342  void OnKeyUp( wxKeyEvent& event );
2343  void OnDoEvent( a2dCommandProcessorEvent& event );
2344  void OnUndoEvent( a2dCommandProcessorEvent& event );
2345  void OnRedoEvent( a2dCommandProcessorEvent& event );
2346  void OnComEvent( a2dComEvent& event );
2347  void OnIdle( wxIdleEvent& event );
2348 
2349  //! tools using this controller
2351 
2352  wxUint32 m_options;
2353 };
2354 
2355 
2356 //! OR-ing a2dHitOption is allowed
2357 
2359 {
2360  return ( a2dStToolEvtHandler::options ) ( ( int ) a | ( int ) b );
2361 }
2362 
2363 
2364 //! makes a tool fixed in style.
2365 /*!
2366  Tools like a2dZoomTool or a2dDrawWirePolylineLTool do in general have a style which is not influenced by
2367  the interactive style change in the application.
2368 */
2370 {
2371  DECLARE_EVENT_TABLE()
2372 
2373 public:
2374 
2375  //! constructor
2377  //! destructor
2379 
2380  //! can be used to take over style from the a2dCentralCanvasCommandProcessor
2381  /*!
2382  when set fill stroke contour and other specific properties are set as current status to the
2383  a2dCentralCanvasCommandProcessor when a drawing tool is pushed.
2384  */
2385  void SetTakeToolstyleToCmdhOnPush( bool set ) { m_takeToolstyleToCmdhOnPush = set; }
2386  //! see SetTakeToolstyleToCmdhOnPush()
2387  bool GetTakeToolstyleToCmdhOnPush() { return m_takeToolstyleToCmdhOnPush; }
2388 
2389 protected:
2390 
2391  void OnKeyDown( wxKeyEvent& event );
2392  void OnKeyUp( wxKeyEvent& event );
2393  void OnDoEvent( a2dCommandProcessorEvent& event );
2394  void OnUndoEvent( a2dCommandProcessorEvent& event );
2395  void OnRedoEvent( a2dCommandProcessorEvent& event );
2396 
2397  void OnComEvent( a2dComEvent& event );
2398 
2399  //! tools using this controller
2401 
2402  //! can be used to take over style from the a2dCentralCanvasCommandProcessor
2404 };
2405 
2406 
2407 
2408 
2409 
2410 
2411 
2412 
2413 
2414 //!Interactive drawing of a polygon.
2415 /*!
2416 \remark Left Click to add points.
2417 \remark Space bar or Double click to end drawing.
2418 \remark Cursor keys to shift object.
2419 \remark Cursor keys + control to shift point.
2420 \remark Right Click to zoom.
2421 
2422 \sa a2dStToolContr
2423 
2424  \ingroup tools
2425 */
2426 class A2DCANVASDLLEXP a2dDrawVPathTool: public a2dStDrawTool
2427 {
2428 public:
2429 
2430  //! push this tool on the tools stack
2431  /*! \ingroup commandid
2432  */
2434 
2435  //! constructor
2436  /*!
2437  \param controller tool controller one which this tool is pushed.
2438  \param templateObject when not NULL, this object is cloned and used for the new drawn object.
2439  */
2440  a2dDrawVPathTool( a2dStToolContr* controller, a2dVectorPath* templateObject = NULL );
2441 
2442  ~a2dDrawVPathTool();
2443 
2444  //! save to zoom while drawing
2445  bool ZoomSave() { return true;};
2446 
2447  //! mode of drawing, can be swicthed with Tab key.
2448  void SetMode( int mode );
2449 
2450 protected:
2451 
2452  void OnIdle( wxIdleEvent& event );
2453 
2454  void OnChar( wxKeyEvent& event );
2455 
2456  void OnMouseEvent( wxMouseEvent& event );
2457 
2458  void OnUndoEvent( a2dCommandProcessorEvent& event );
2459  void OnRedoEvent( a2dCommandProcessorEvent& event );
2460 
2461  void AddSegment( a2dVpathSegment* segment );
2462 
2463  virtual wxString GetCommandGroupName() { return _( "Draw polygon" ) ; }
2464 
2465  //! object to clone to use as start
2467  a2dSmrtPtr<a2dPolylineL> m_controlPoints;
2468 
2469  //! previous x
2470  double m_prev_x;
2471  //! previous y
2472  double m_prev_y;
2473 
2474  //! previous x
2476  //! previous y
2478 
2479  bool m_controlSet;
2480  bool m_endSegment;
2481  bool m_bezier;
2482 
2483  //! points sofar
2485 
2486  //! last point
2488  a2dVpathSegment* m_segmentPrev;
2489 
2490  //! end to begin wire.
2492 
2493 public:
2494  DECLARE_CLASS( a2dDrawVPathTool )
2495  DECLARE_EVENT_TABLE()
2496 
2497 };
2498 
2499 //!Interactive follow link.
2500 /*!
2501 \sa a2dStToolContr
2502 
2503  \ingroup tools
2504 */
2505 class A2DCANVASDLLEXP a2dFollowLink: public a2dStTool
2506 {
2507 public:
2508 
2509  //! push this tool on the tools stack
2510  /*! \ingroup commandid
2511  */
2513 
2514  a2dFollowLink( a2dStToolContr* controller );
2515 
2516  bool StartEditing( double x, double y );
2517 
2518  bool StartEditing( int x, int y );
2519 
2520  bool ZoomSave() { return true;};
2521 
2522 protected:
2523 
2524  void OnChar( wxKeyEvent& event );
2525 
2526  void OnMouseEvent( wxMouseEvent& event );
2527 
2528  //! undoable or not
2530 
2531 public:
2532  DECLARE_CLASS( a2dFollowLink )
2533  DECLARE_EVENT_TABLE()
2534 
2535 };
2536 
2537 //!Interactive drag a a2dPin on a wire.
2538 /*!
2539 
2540 \remark Left Click and drag on Pin.
2541 \remark Key left right up down to move while draging active (Left Down)
2542 
2543 \sa a2dStToolContr
2544 
2545  \ingroup tools
2546 */
2547 class A2DCANVASDLLEXP a2dMovePinTool: public a2dDragTool
2548 {
2549 public:
2550 
2551  //! push this tool on the tools stack
2552  /*! \ingroup commandid
2553  */
2555 
2556  //! constructor
2557  a2dMovePinTool( a2dStToolContr* controller, a2dPin* dragPin = NULL, double xw = 0, double yw = 0, bool disConnectFirst = false );
2558  //! destructor
2559  ~a2dMovePinTool();
2560 
2561  bool ZoomSave() { return !GetBusy(); }
2562 
2563  void OnMouseEvent( wxMouseEvent& event );
2564 
2565  virtual void AdjustRenderOptions();
2566 
2567 protected:
2568 
2569  void OnComEvent( a2dComEvent& event );
2570 
2571  //! when dragging an object from another window into the tool its window, this window wants to have the focus.
2572  void OnEnter( wxMouseEvent& WXUNUSED( event ) );
2573 
2574  virtual wxString GetCommandGroupName() { return _( "Move Pin object" ) ; }
2575  virtual void DoStopTool( bool abort );
2576  virtual bool EnterBusyMode();
2577  virtual void FinishBusyMode( bool closeCommandGroup = true );
2578  virtual void AbortBusyMode();
2579 
2580  a2dSmrtPtr<a2dPin> m_dragPin;
2581  //! This is the parent, to which the temporary object was added.
2582  /*! This must be remembered, because it changes if the shows object changes */
2584  //! dummy object that is dragged
2586  //! the pin on the dummy object that is dragged
2588 
2589 public:
2590 
2591  DECLARE_CLASS( a2dMovePinTool )
2592  DECLARE_EVENT_TABLE()
2593 };
2594 
2595 
2596 
2597 
2598 #endif /* __A2DCANVASSTTOOL_H__ */
2599 
2600 
2601 
double GetEndScaleX()
get scaling in X for begin and end objects of lines and polylines
Definition: sttool.h:1472
Display Part of a a2dDrawing, in which a2dCanvasObjects are shown.
Definition: drawer.h:470
int m_mouse_x
mouse position
Definition: sttool.h:735
bool m_renderEditcopy
if yes, the editcopy is rendered in place
Definition: sttool.h:400
a2dLineSegment * m_pointmanhattan
manhattan point
Definition: sttool.h:2004
static const a2dCommandId COMID_PushTool_Rotate
push this tool on the tools stack
Definition: sttool.h:1302
DRAGMODE
Definition: sttool.h:66
a2dCanvasObjectPtr m_canvasobject
This is the object currently edited.
Definition: sttool.h:381
a2dPATH_END_TYPE
defines the way a polyline with a contour width is ended.
Definition: polyver.h:31
bool m_chord
draw just a cord object, not filled.
Definition: sttool.h:1694
bool m_draggingCanvasOption
can canvas be dragged using RightMouse.
Definition: sttool.h:750
void SetFormat(const wxString &format)
set the format for double to be this
Definition: sttool.h:619
static const a2dSignal sig_toolComEventAddObject
Definition: sttool.h:121
bool ZoomSave()
Is Zooming while the tool is busy Save.
Definition: sttool.h:1363
Interactive drag a new object into a drawing.
Definition: sttool.h:1189
a2dAffineMatrix m_transform
old transform
Definition: sttool.h:1334
bool m_dragStarted
used to indicate that a first drag event has arrived.
Definition: sttool.h:374
bool m_renderEditcopyEdit
if yes, the editcopy is rendered on top in edit style
Definition: sttool.h:404
a2dSmrtPtr< a2dBaseTool > m_topTool
tool always on top of the stack, or non if NULL
Definition: sttool.h:770
The a2dBaseTool is used to derive tools from that are controlled by.
Definition: tools.h:379
a2dCanvasObject * GetLineEnd()
get current line end object for line and polyline drawing tools
Definition: sttool.h:1464
void SetDrawPatternOnTop(bool drawPatternOnTop)
Sets if the pattern (a rectangle) will be drawn on top of this image.
Definition: sttool.h:974
int GetNoSnapKey()
what is the key to disable snapping in tools
Definition: sttool.h:679
double m_start_x
start x
Definition: sttool.h:1613
virtual wxString GetCommandGroupName()
return the command group name for commands of a derived class
Definition: sttool.h:1995
bool ZoomSave()
Is Zooming while the tool is busy Save.
Definition: sttool.h:1210
bool GetZoomoutCentered()
see SetZoomoutCentered()
Definition: sttool.h:534
int m_mouse_y
mouse position
Definition: sttool.h:738
a2dCanvasObject * GetLineBegin()
get current line begin object for line and polyline drawing tools.
Definition: sttool.h:1460
static const a2dCommandId COMID_PushTool_DrawEllipse
push this tool on the tools stack
Definition: sttool.h:1530
bool m_wasMayConnect
allow connecting to other obejcts
Definition: sttool.h:1069
class to map references to objects stored in XML, in order to make the connection later on...
Definition: gen.h:3462
a2dWiringMode
the way a new wire is created
Definition: sttool.h:1882
a2dAffineMatrix m_transform
old transform
Definition: sttool.h:1066
static const a2dCommandId COMID_PushTool_DrawPolygonL
push this tool on the tools stack
Definition: sttool.h:1722
a2dDocumentRenderStyle operator|(a2dDocumentRenderStyle a, a2dDocumentRenderStyle b)
OR-ing a2dDocumentRenderStyle is allowed.
Definition: canglob.h:50
a2dPinClass * m_pinClassStartWire
required pin class at start of wire
Definition: sttool.h:1979
bool ZoomSave()
Is Zooming while the tool is busy Save.
Definition: sttool.h:1263
bool ZoomSave()
Is Zooming while the tool is busy Save.
Definition: sttool.h:1028
bool GetSelectionStateUndo() const
set if selection state of tools object is set during undo.
Definition: sttool.h:682
Interactive drawing of a circular arc.
Definition: sttool.h:1641
int m_x
x of mouse in device
Definition: sttool.h:352
bool m_splitAtEnd
if set, end of wire splits connecting wire.
Definition: sttool.h:1985
a2dCanvasObjectPtr m_original
This is the original object selected for editing.
Definition: sttool.h:388
a2dPATH_END_TYPE GetPathType()
get when m_contourwidth != 0 what is the end of the line looks like.
Definition: sttool.h:1863
double m_startMousex
hold start of drag
Definition: sttool.h:1166
a2dPin is used in a2dCanvasObject to add pins to it.
Definition: canpin.h:233
This is a class/type description for a2dPin&#39;s.
Definition: canpin.h:628
double m_contrmid_y
previous y
Definition: sttool.h:2477
polygon defined with list of points.
Definition: polygon.h:45
bool GetAllowModifyTemplate()
template adepts to style change from outside or not
Definition: sttool.h:440
a2dSmrtPtr< a2dSLine > m_templateObject
object to clone to use as start
Definition: sttool.h:1505
Ref Counted base object.
Definition: gen.h:1045
bool ZoomSave()
Is Zooming while the tool is busy Save.
Definition: sttool.h:963
bool m_wasMayConnect
allow connecting to othere object when placed
Definition: sttool.h:1150
wxPoint GetMousePosition()
return mouse position in device coordinates
Definition: sttool.h:631
The a2dStTool is used to derive tools from.
Definition: sttool.h:115
bool GetSelectAtEnd() const
set tool object as selected at end of action
Definition: sttool.h:687
a2dSmrtPtr< a2dBaseTool > m_toolForZoom
tool used for zooming
Definition: sttool.h:773
double m_startObjectx
hold start of drag
Definition: sttool.h:1084
virtual void Render()
implement rendering
Definition: sttool.cpp:1402
wxZoomList & GetZoomList()
Get zoom stack list, that is use to store zooming areas.
Definition: sttool.h:616
int m_dragstarty
y of mouse in device at start drag
Definition: sttool.h:371
store a menu Id generated by XRCID( menuIdString ) plus a menustring and helpstring ...
Definition: comevt.h:1563
a2dCanvasObject * GetLineBegin()
get current line begin object for line and polyline drawing tools.
Definition: sttool.h:1842
void SetConnectionGenerator(a2dConnectionGenerator *connectionGenerator)
Set class for generating new connection objects between object and pins.
Definition: sttool.h:214
virtual wxString GetCommandGroupName()
return the command group name for commands of a derived class
Definition: sttool.h:2463
void SetUseOpaqueEditcopy(bool editOpaque)
When set true, instead of using a special style for editcopies, a clone of the.
Definition: sttool.h:666
a2dVpathSegment * m_segment
last point
Definition: sttool.h:2487
a2dOpaqueMode m_useEditOpaque
when true editcopies are using a half transparent cloned style.
Definition: sttool.h:415
wxString GetCommandGroupName()
return the command group name for commands of a derived class
Definition: sttool.h:925
virtual wxString GetCommandGroupName()
return the command group name for commands of a derived class
Definition: sttool.h:1061
Interactive Zooming.
Definition: sttool.h:849
static const a2dCommandId COMID_PushTool_MovePin
push this tool on the tools stack
Definition: sttool.h:2554
a2dStToolContr * m_stcontroller
controller for canvas
Definition: sttool.h:391
bool ZoomSave()
Is Zooming while the tool is busy Save.
Definition: sttool.h:867
double m_startObjecty
hold start of drag
Definition: sttool.h:2077
wxString m_anotation
anotation string, which is in general modified by the tools to display position etc.
Definition: sttool.h:340
int m_dragstartx
x of mouse in device at start drag
Definition: sttool.h:369
double m_ywprev
y world coordinates old or new value of mouse
Definition: sttool.h:366
virtual void FinishBusyMode(bool closeCommandGroup=true)
Called when the user finishes editing a distinct object */.
Definition: sttool.cpp:1737
The base class for all drawable objects in a a2dCanvasDocument.
int m_mouse_yprev
previous y of mouse in device
Definition: sttool.h:744
wxUint8 GetOpacityFactorEditcopy()
see SetOpacityFactorEditcopy()
Definition: sttool.h:658
snapping engine, for snapping while editing a drawing
static const a2dCommandId COMID_PushTool_DrawPolylineL
push this tool on the tools stack
Definition: sttool.h:1813
#define DECLARE_PROPERTIES()
check if class has the given id as a valid id for this object
Definition: gen.h:835
virtual wxString GetCommandGroupName()
return the command group name for commands of a derived class
Definition: sttool.h:880
a2dSnapToWhatMask GetSnapTargetFeatures() const
Definition: sttool.h:265
bool m_noStatusEvent
if set no event is send to m_where, instead a statusbar text is set directly
Definition: sttool.h:719
a2dCanvasObjectList m_objects
the list of selected objects
Definition: sttool.h:2070
bool ZoomSave()
Is Zooming while the tool is busy Save.
Definition: sttool.h:2561
a2dCanvasObject is the base class for Canvas Objects.
Definition: canobj.h:371
a2dPinClass * m_pinClassEndWire
required pin class at start of wire
Definition: sttool.h:1982
a2dPropertyId * m_id
id of property to set
Definition: sttool.h:2264
bool m_chord
draw just a cord object, not filled.
Definition: sttool.h:1618
static const a2dCommandId COMID_PushTool_DrawArc
push this tool on the tools stack
Definition: sttool.h:1648
draw a rectangle the size of the bounding box of the object draged.
Definition: sttool.h:79
static const a2dCommandId COMID_PushTool_DragNew
push this tool on the tools stack
Definition: sttool.h:2102
bool m_renderEditcopyOnTop
if yes, the editcopy is rendered on top in usual style
Definition: sttool.h:402
wxZoomList m_zoomstack
zoom stack containing previous zooms
Definition: sttool.h:729
bool m_mousecaptured
is mouse captured during drag
Definition: sttool.h:1075
bool m_lateconnect
connect when released
Definition: sttool.h:1072
double m_start_y
start y
Definition: sttool.h:1615
Interactive rotate an object.
Definition: sttool.h:1295
wxMenu * GetMousePopupMenu()
to get the current mouse menu of the controller
Definition: sttool.h:509
virtual bool CreateToolObjects()
Create the editcopy and other tool objects (e.g. decorations)
Definition: sttool.cpp:1711
Interactive drawing of a Rectangle.
Definition: sttool.h:807
void SetOpacityFactorEditcopy(wxUint8 editOpacity)
when enabling m_useEditOpaque, this is how transparent the editcopy will be made. ...
Definition: sttool.h:203
bool ZoomSave()
Is Zooming while the tool is busy Save.
Definition: sttool.h:909
vertex list of line and arc segments.
Definition: polyver.h:600
virtual wxString GetCommandGroupName()
return the command group name for commands of a derived class
Definition: sttool.h:2126
double m_start_x
start x
Definition: sttool.h:1689
bool ZoomSave()
Is Zooming while the tool is busy Save.
Definition: sttool.h:1655
static const a2dSignal sig_toolComEventSetEditObject
Definition: sttool.h:124
bool m_lateconnect
allow connecting to other obejcts
Definition: sttool.h:2084
bool m_deleteonoutsidedrop
if true, the dragged object is deleted, if it is dropped outside of the window
Definition: sttool.h:1159
bool m_takeToolstyleToCmdhOnPush
can be used to take over style from the a2dCentralCanvasCommandProcessor
Definition: sttool.h:2403
static const a2dCommandId COMID_PushTool_CopyMulti
push this tool on the tools stack
Definition: sttool.h:2155
bool m_renderEditcopyRectangle
if yes, the editcopy is rendered on top as bounding box rectangle
Definition: sttool.h:406
a2dSmrtPtr< a2dEllipticArc > m_templateobject
object to clone to use as start
Definition: sttool.h:1605
bool m_withUndo
undoable or not
Definition: sttool.h:2267
bool EnterBusyMode()
starts a new action (e.g drawing something ) in a tool that is already pushed.
Definition: sttool.cpp:1731
Interactive Insertion of an a2dImage Object.
Definition: sttool.h:950
double m_startMousexw
hold start of drag
Definition: sttool.h:2079
void SetAllowModifyTemplate(bool allowModifyTemplate)
template adepts to style change from outside or not
Definition: sttool.h:437
a2dDrawStyle
Define the manner in which a2dCanvasView draws to the device.
Definition: artglob.h:280
a2dVpath * m_vpath
points sofar
Definition: sttool.h:2484
static const a2dCommandId COMID_PushTool_Property
push this tool on the tools stack
Definition: sttool.h:2247
void SetLateConnect(bool lateconnect)
defines if an object will try to connect at the end of a drag
Definition: sttool.h:1036
wxUint64 a2dCanvasObjectFlagsMask
mask flags for a2dCanvasObject
Definition: candefs.h:152
bool ZoomSave()
save to zoom while drawing
Definition: sttool.h:2445
virtual wxString GetCommandGroupName()
return the command group name for commands of a derived class
Definition: sttool.h:828
Interactive delete an object.
Definition: sttool.h:1353
double m_startMousey
hold start of drag
Definition: sttool.h:1168
a2dCanvasObjectPtr m_parentAddedTo
This is the parent, to which the temporary object was added.
Definition: sttool.h:2583
virtual wxString GetCommandGroupName()
return the command group name for commands of a derived class
Definition: sttool.h:2065
void SetSnapTargetFeature(a2dRestrictionEngine::a2dSnapToWhat snapTargetFeature, bool value=true)
set one of the snapping features for targets to true or false, leaf others as is
Definition: sttool.h:251
double m_prev_x
previous x
Definition: sttool.h:2470
virtual wxString GetCommandGroupName()
return the command group name for commands of a derived class
Definition: sttool.h:1282
Interactive edit properties of an object.
Definition: sttool.h:2240
bool ZoomSave()
Is Zooming while the tool is busy Save.
Definition: sttool.h:1450
a2dText is an abstract base class.
Definition: cantext.h:93
void SetEditAtEnd(bool editatend)
flag for setting editing tool after drawing a primitive.
Definition: sttool.h:185
base for tools that draw and are stack based.
Definition: sttool.h:427
void SetEndMode(bool splitAtEnd)
if set, end of wire splits connecting wire.
Definition: sttool.h:1946
virtual bool EditProperties(const a2dPropertyId *id, bool withUndo=true)
edit properties of the object
Definition: gen.cpp:1499
wxFrame * GetFrame()
what frame has the statusbar
Definition: sttool.h:634
virtual wxString GetCommandGroupName()
return the command group name for commands of a derived class
Definition: sttool.h:2574
bool ZoomSave()
save to zoom while drawing
Definition: sttool.h:1738
static const a2dCommandId COMID_PushTool_Delete
push this tool on the tools stack
Definition: sttool.h:1360
a2dSmrtPtr< a2dPin > m_dragPinObjPin
the pin on the dummy object that is dragged
Definition: sttool.h:2587
void SetDefaultBehavior(unsigned int behavior)
Control the default behavior.
Definition: sttool.h:575
Interactive drag an object.
Definition: sttool.h:1012
virtual wxString GetCommandGroupName()
return the command group name for commands of a derived class
Definition: sttool.h:1227
a2dSmrtPtr< a2dPolygonL > m_templateObject
object to clone to use as start
Definition: sttool.h:1772
a2dStToolContr * m_stcontroller
tools using this controller
Definition: sttool.h:2400
void SetTemplateObject(a2dText *templateobject)
get template for line object
Definition: sttool.h:2212
polyline defined with list of points.
Definition: polygon.h:332
static const a2dCommandId COMID_PushTool_DrawPolylineL_Splined
push this tool on the tools stack
Definition: sttool.h:1817
The a2dStToolContr is a Tool Controller specialized for working with a2dCanvasView.
Definition: sttool.h:485
a2dCanvasObject * GetOriginal()
object to draw or edit
Definition: sttool.h:220
double GetEndScaleY()
get scaling in Y for begin and end objects of lines and polylines
Definition: sttool.h:1475
virtual void DoStopTool(bool abort)
to do tool specific stuff to stop a tool. Called from StopTool().
Definition: tools.cpp:796
bool GetEditAtEnd()
see SetEditAtEnd
Definition: sttool.h:188
bool m_useEditOpaque
when true editcopies are using a half transparent cloned style.
Definition: sttool.h:779
static const a2dCommandId COMID_PushTool_Copy
push this tool on the tools stack
Definition: sttool.h:1260
bool m_editatend
when drawing something editing must follow, using the a2dRecursiveEditTool
Definition: sttool.h:409
const long TC_UNDO
zoom menu
Interactive drawing of a Circle.
Definition: sttool.h:1392
double m_arcstart
start arc
Definition: sttool.h:1684
DRAGMODE m_dragmode
manner to drag
Definition: sttool.h:761
wxMenu * m_mousemenu
popup menu
Definition: sttool.h:732
void SetSnapSourceFeatures(wxUint32 snapSourceFeatures)
Definition: sttool.h:233
Normal straight line segment in a2dVpath.
Definition: polyver.h:878
Interactive drawing of a polyline wire.
Definition: sttool.h:1930
a2dSLine * GetTemplateObject()
set template for line object
Definition: sttool.h:1484
static const a2dCommandId COMID_PushTool_DragNew
push this tool on the tools stack
Definition: sttool.h:1196
static const a2dCommandId COMID_PushTool_DrawRectangle
push this tool on the tools stack
Definition: sttool.h:814
void SetDragMode(DRAGMODE mode)
drag mode used in drag tool (if used)
Definition: sttool.h:563
Normal straight line segment in a2dVertexList and a2dVertexArray.
Definition: polyver.h:163
double m_contrmid_x
previous x
Definition: sttool.h:2475
double m_startObjecty
hold start of drag
Definition: sttool.h:1086
int m_yanotation
y position of anotation text
Definition: sttool.h:346
a2dSLine
Definition: canprim.h:987
DRAGMODE GetDragMode()
Returns drag mode.
Definition: sttool.h:567
bool ZoomSave()
Is Zooming while the tool is busy Save.
Definition: sttool.h:2255
bool m_mousecaptured
is mosue captured when dragging
Definition: sttool.h:1156
bool m_zoomoutCentered
when true zoom out and center to middle of the view
Definition: sttool.h:758
int m_mouse_xprev
previous x of mouse in device
Definition: sttool.h:741
void SetSnapTargetFeatures(wxUint32 snapTargetFeatures)
Definition: sttool.h:248
bool ZoomSave()
Is Zooming while the tool is busy Save.
Definition: sttool.h:1402
void SetUseOpaqueEditcopy(a2dOpaqueMode editOpaque)
When set true, instead of using a special style for editcopies, a clone of the.
Definition: sttool.h:211
static const a2dCommandId COMID_PushTool_DrawWirePolylineL
push this tool on the tools stack
Definition: sttool.h:1938
static const a2dCommandId COMID_PushTool_DrawPolygonL_Splined
push this tool on the tools stack
Definition: sttool.h:1726
bool GetDrawPatternOnTop()
Returns if the pattern will be drawn on top of the image.
Definition: sttool.h:982
bool ZoomSave()
Is Zooming while the tool is busy Save.
Definition: sttool.h:2032
bool ZoomSave()
Is Zooming while the tool is busy Save.
Definition: sttool.h:1114
void SetSnapSourceFeature(a2dRestrictionEngine::a2dSnapToWhat snapSourceFeature, bool value=true)
set one of the snapping features for the source to true or false, leaf others as is ...
Definition: sttool.h:236
int m_yprev
previous y of mouse in device
Definition: sttool.h:360
bool GetTakeToolstyleToCmdhOnPush()
see SetTakeToolstyleToCmdhOnPush()
Definition: sttool.h:2387
Drag Selected canvasObjects.
Definition: sttool.h:2021
bool m_reverse
end to begin wire.
Definition: sttool.h:1786
a2dAffineMatrix m_transform
old transform
Definition: sttool.h:1147
bool ZoomSave()
Is Zooming while the tool is busy Save.
Definition: sttool.h:818
bool m_deleteonoutsidedrop
if true, the dragged object is deleted, if it is dropped outside of the window
Definition: sttool.h:1078
static const a2dCommandId COMID_PushTool_Zoom
push this tool on the tools stack
Definition: sttool.h:856
wxTC_BEHAVIOR
Definition: sttool.h:91
static const a2dCommandId COMID_PushTool_DragMulti
push this tool on the tools stack
Definition: sttool.h:2028
static const a2dCommandId COMID_PushTool_DrawLine
push this tool on the tools stack
Definition: sttool.h:1443
bool ZoomSave()
Is Zooming while the tool is busy Save.
Definition: sttool.h:2214
void SetZoomoutCentered(bool center)
if true a zoomout is centered to the view.
Definition: sttool.h:531
void OnKeyUp(wxKeyEvent &event)
called on key up events
Definition: sttool.cpp:1793
wxUint32 a2dSnapToWhatMask
mask for a2dSnapToWhat flags
Definition: restrict.h:26
This tool is for editing a single object.
Definition: edit.h:73
Each a2dCommand is given a command id at construction.
Definition: comevt.h:99
void SetChord(bool chord)
draw jus a cord object
Definition: sttool.h:1663
static const a2dCommandId COMID_PushTool_Image
push this tool on the tools stack
Definition: sttool.h:957
double m_startMousex
hold start of drag
Definition: sttool.h:1088
Drag and Copy Selected canvasObjects.
Definition: sttool.h:2148
void SetNoSnapKey(int keyCode)
set key to disable snapping in tools
Definition: sttool.h:676
a2dSnapToWhatMask GetSnapSourceFeatures() const
Definition: sttool.h:244
A 2x3 affine matrix class for 2D transformations.
Definition: afmatrix.h:53
unsigned int m_defaultBehavior
control the default behavior
Definition: sttool.h:767
makes a tool fixed in style.
Definition: sttool.h:2369
bool ZoomSave()
Is Zooming while the tool is busy Save.
Definition: sttool.h:1306
double m_xwprev
x world coordinates old or new value of mouse
Definition: sttool.h:363
To implement behaviour on a set of tools.
Definition: tools.h:884
bool ZoomSave()
Is Zooming while the tool is busy Save.
Definition: sttool.h:2111
std::vector< wxString > & GetStatusStrings()
Get the array containing statusbar strings.
Definition: sttool.h:637
object stay in document and it is redrawn while dragging, and so are all objects above and below it...
Definition: sttool.h:83
static const a2dCommandId COMID_PushTool_Drag
push this tool on the tools stack
Definition: sttool.h:1019
bool ZoomSave()
Is Zooming while the tool is busy Save.
Definition: sttool.h:1583
Interactive drawing of a EllipticArc.
Definition: sttool.h:1569
Interactive copy an object.
Definition: sttool.h:1253
while iterating a a2dCanvasDocument, this holds the context.
Definition: canobj.h:3212
virtual wxString GetCommandGroupName()
return the command group name for commands of a derived class
Definition: sttool.h:2169
double m_prev_y
previous y
Definition: sttool.h:2472
void SetOpacityFactorEditcopy(wxUint8 editOpacity)
when enabling m_useEditOpaque, this is how transparent the editcopy will be made. ...
Definition: sttool.h:655
double GetEndScaleY()
get scaling in Y for begin and end objects of lines and polylines
Definition: sttool.h:1857
a2dCanvasObjectPtr m_parentAddedTo
This is the parent, to which the temporary object was added.
Definition: sttool.h:2136
int m_mode2
mode to change what is drawn
Definition: sttool.h:1621
static const a2dCommandId COMID_PushTool_DrawEllipticArc_Chord
push this tool on the tools stack
Definition: sttool.h:1580
virtual wxString GetCommandGroupName()
return the command group name for commands of a derived class
Definition: sttool.h:1677
bool GetUseOpaqueEditcopy()
see SetUseOpaqueEditcopy()
Definition: sttool.h:669
a2dLineSegment * m_point
last point
Definition: sttool.h:1783
static const a2dCommandId COMID_PushTool_DrawEllipticArc
push this tool on the tools stack
Definition: sttool.h:1576
a2dCanvasObjectPtr m_parentAddedTo
This is the parent, to which the temporary object was added.
Definition: sttool.h:1235
int m_y
y of mouse in device
Definition: sttool.h:354
double m_startMousey
hold start of drag
Definition: sttool.h:1090
void SetTakeToolstyleToCmdhOnPush(bool set)
can be used to take over style from the a2dCentralCanvasCommandProcessor
Definition: sttool.h:2385
Interactive drawing of a polygon.
Definition: sttool.h:1715
bool GetSpline()
certain drawing tools like polygon drawing use this setting
Definition: sttool.h:1750
double m_arcend
end arc
Definition: sttool.h:1686
double m_prev_y
previous y
Definition: sttool.h:1777
bool ZoomSave()
Is Zooming while the tool is busy Save.
Definition: sttool.h:1533
Interactive drawing a text object.
Definition: sttool.h:2191
a2dSnapToWhatMask m_snapTargetFeatures
set to the a2dSnapToWhat target features enabled by the engine and/or snap source object ...
Definition: sttool.h:337
bool m_reverse
end to begin wire.
Definition: sttool.h:2491
void AbortBusyMode()
Called when the user aborts editing a distinct object */.
Definition: sttool.cpp:1763
Interactive drawing of a EllipticArc.
Definition: sttool.h:1436
virtual void CleanupToolObjects()
Cleanup the editcopy other tool objects (e.g. decorations)
Definition: sttool.cpp:1265
static const a2dCommandId COMID_PushTool_FollowLink
push this tool on the tools stack
Definition: sttool.h:2512
static const a2dCommandId COMID_PushTool_DrawText
push this tool on the tools stack
Definition: sttool.h:2198
Interactive drag a a2dPin on a wire.
Definition: sttool.h:2547
This is the base class for all kinds of property id&#39;s for a2dObject.
Definition: id.h:154
a2dStToolContr * GetStToolContr()
return the staacked tool controller
Definition: sttool.h:174
double m_arcend
end arc
Definition: sttool.h:1610
bool m_draggingCanvas
used to indicate that dragging canvas is in action.
Definition: sttool.h:747
void SetTemplateObject(a2dSLine *templateobject)
get template for line object
Definition: sttool.h:1487
a2dConnectionGenerator * m_connectionGenerator
Use this connection generator for wires and pins.
Definition: sttool.h:394
static const a2dCommandId COMID_PushTool_DrawVPath
push this tool on the tools stack
Definition: sttool.h:2433
double m_start_y
start y
Definition: sttool.h:1691
int m_dragstartx
x of mouse in device at start drag
Definition: sttool.h:753
void SetLateConnect(bool lateconnect)
defines if an object will try to connect at the end of a drag
Definition: sttool.h:2037
options
Enum for hit test options.
Definition: sttool.h:2294
wxUint8 m_editOpacityFactor
when using cloned style for editcopy, use this opacity.
Definition: sttool.h:412
Event sent to a2dCommandProcessor.
Definition: comevt.h:701
a2dOpaqueMode
how editing transparency will be handled
Definition: sttool.h:191
a2dVertexList * m_points
points sofar
Definition: sttool.h:1780
see a2dComEvent
Definition: gen.h:371
a2dSmrtPtr< a2dVectorPath > m_templateObject
object to clone to use as start
Definition: sttool.h:2466
static const a2dCommandId COMID_PushTool_DrawArc_Chord
push this tool on the tools stack
Definition: sttool.h:1652
int m_dragstarty
y of mouse in device at start drag
Definition: sttool.h:755
base classes for tools and controller on top of the tools.
static const wxEventType sm_showCursor
Definition: sttool.h:791
The a2dBoundingBox class stores one a2dBoundingBox of a a2dCanvasObject.
Definition: bbox.h:39
static const a2dCommandId COMID_PushTool_DragOrg
push this tool on the tools stack
Definition: sttool.h:1105
double m_arcstart
start arc
Definition: sttool.h:1608
a2dPATH_END_TYPE GetPathType()
get when m_contourwidth != 0 what is the end of the line looks like.
Definition: sttool.h:1481
bool m_boxCenterDrag
drag from origin of object or center of bbox
Definition: sttool.h:1238
double m_startObjectx
hold start of drag
Definition: sttool.h:2075
double m_startObjecty
hold start of drag
Definition: sttool.h:1164
wxUint8 m_editOpacityFactor
when using cloned style for editcopy, use this opacity.
Definition: sttool.h:776
a2dConnectionGenerator * GetConnectionGenerator() const
Get class for generating new connection objects between object and pins.
Definition: sttool.h:217
a2dCanvasObjectPtr m_dragPinObj
dummy object that is dragged
Definition: sttool.h:2585
static const a2dCommandId COMID_PushTool_DrawCircle
push this tool on the tools stack
Definition: sttool.h:1399
void OnKeyDown(wxKeyEvent &event)
called on key down events
Definition: sttool.cpp:1769
void SetDeleteOnOutsideDrop(bool val)
If set to true, the dragged object is deleted if dropped outside of the window.
Definition: sttool.h:1117
a2dCanvasObject for a Vector Path
Definition: vpath.h:55
a clone is created which is draged in an outline mode, original stays at position until drag is finis...
Definition: sttool.h:85
The a2dToolContr is the base class for Tool controller classes.
Definition: tools.h:87
This template class is for property ids with a known data type.
Definition: id.h:477
Vector Path.
Definition: polyver.h:1211
static const a2dCanvasObjectFlagsMask ALL
Definition: candefs.h:220
bool GetBusy()
Check if the tool is busy editing a distinct object */.
Definition: tools.h:513
a2dSnapToWhatMask m_snapSourceFeatures
set to the a2dSnapToWhat features enabled by the engine for the source object
Definition: sttool.h:334
void AdjustRenderOptions()
Adjust the rendering options to the needs of this tool.
Definition: sttool.cpp:1807
Interactive drawing of a polyline.
Definition: sttool.h:1806
Interactive drawing of a polygon.
Definition: sttool.h:2426
double GetEndScaleX()
get scaling in X for begin and end objects of lines and polylines
Definition: sttool.h:1854
a2dCanvasObject * GetLineEnd()
get current line end object for line and polyline drawing tools
Definition: sttool.h:1846
a2dStToolContr * m_stcontroller
tools using this controller
Definition: sttool.h:2350
double m_startMouseyw
hold start of drag
Definition: sttool.h:2081
a2dDrawStyle m_drawmode
manner to draw
Definition: sttool.h:764
virtual wxString GetCommandGroupName()
return the command group name for commands of a derived class
Definition: sttool.h:1372
void SetDeleteOnOutsideDrop(bool val)
If set to true, the dragged object is deleted if dropped outside of the window.
Definition: sttool.h:1031
bool m_renderOriginal
if yes, the original object is rendered in place
Definition: sttool.h:397
virtual wxString GetCommandGroupName()
return the command group name for commands of a derived class
Definition: sttool.h:1769
bool m_lateconnect
connect only when released
Definition: sttool.h:1153
int m_xprev
previous x of mouse in device
Definition: sttool.h:357
Interactive Selection of an Object.
Definition: sttool.h:898
virtual wxString GetCommandGroupName()
return the command group name for commands of a derived class
Definition: sttool.h:1326
seperate the object from the document, and layer, so it will be draged on top of all other objects...
Definition: sttool.h:81
Interactive drawing of a Ellipse.
Definition: sttool.h:1523
int m_xanotation
x position of anotation text
Definition: sttool.h:343
bool GetSnapTargetFeature(a2dRestrictionEngine::a2dSnapToWhat snapTargetFeature) const
return the setting of a specific snapping feature
Definition: sttool.h:258
int m_mode2
way of drawing
Definition: sttool.h:1680
double m_prev_x
previous x
Definition: sttool.h:1775
virtual void SetActive(bool active=true)
set the tool active or inactive.
Definition: sttool.cpp:1099
static const a2dCommandId COMID_PushTool_Select
push this tool on the tools stack
Definition: sttool.h:905
CloneOptions
options for cloning
Definition: gen.h:1200
behaviour model of a2dStTool tools
Definition: sttool.h:2287
when a new wire or other connection object needs to be created,
Definition: connectgen.h:153
a2dText * GetTemplateObject() const
set template for line object
Definition: sttool.h:2209
wxFrame * m_where
statusbar frame
Definition: sttool.h:722
double m_startObjectx
hold start of drag
Definition: sttool.h:1162
a2dEllipticArc centered at x,y
Definition: canprim.h:697
virtual wxString GetCommandGroupName()
return the command group name for commands of a derived class
Definition: sttool.h:1142
sttool.h Source File -- Sun Oct 12 2014 17:04:25 -- Sun Oct 12 2014 -- 1.8.5 -- wxArt2D -- . -- Main Page Reference Documentation