wxArt2D
mastertoolgroups.h
Go to the documentation of this file.
1 /*! \file wx/canvas/mastertoolgroups.h
2  \brief master tool using tags to groups object
3 
4  This contains code related to the mastertool using tags to group objects.
5 
6  \author Klaas Holwerda
7  \date Created 22/04/2012
8 
9  Copyright: 2012-2012 (c) Klaas Holwerda
10 
11  Licence: wxWidgets Licence
12 
13  RCS-ID: $Id: mastertoolgroups.h,v 1.13 2009/04/23 19:35:23 titato Exp $
14 */
15 
16 
17 #ifndef __A2DCANVASMASTERTOOLGROUPS_H__
18 #define __A2DCANVASMASTERTOOLGROUPS_H__
19 
20 
21 #ifndef WX_PRECOMP
22 #include "wx/wx.h"
23 #endif
24 
25 #include "wx/canvas/canobj.h"
26 #include "wx/canvas/objlist.h"
27 #include "wx/canvas/sttool.h"
28 #include "wx/canvas/mastertool.h"
29 #include "wx/canvas/styledialg.h"
30 
31 #define a2dDoubleClickWait 180
32 
33 class A2DCANVASDLLEXP a2dStyleDialog;
34 
35 //!Master tool for objects graphics slecting and dragging
36 /*!This tool controls other tools such that simple object graphics
37 can be edited without manually changing tools.
38 
39 - Left Down + Drag + Shift Down => select objects in rectangle add to already selected
40 - Left Down + Drag + Cntrl Down => select objects in rectangle deselect already selected first
41 - Left Down + Drag => move selected objects
42 - Left Down + Drag => move object and select it
43 - Left Down + Drag + Ctrl Down + Shift Down => copy selected objects
44 - Right Down => Drag canvas view
45 - Right Down + Up => Show Popup
46 
47 ( wire mode )
48 
49 - First LeftDown click on non wire object selects it.
50 - Shift + LeftDown to select a wire.
51 - Shift + LeftDown to select more.
52 - Second click on Selected object does NOT deselect
53 - Wire is draggable in segment and vertex and vertex insert when selected.
54 - Wire starts on pin of non wire object.
55 - Wire starts on wire and pin of wire object.
56 - LeftDown + drag on wire pin, makes it draggable.
57 - Dragging starting at non hit, or wire, starts a rectangle selection.
58 - Double Click => Edit Selected of hit
59 
60 ( select mode )
61 
62 - First LeftDown click on object selects it.
63 - Shift + LeftDown to select more.
64 - Second click on Selected object does de-select
65 - wire is draggable in segment and vertex and vertex insert, without selecting needed.
66 - Wire starts on pin of non wire object.
67 - Wire starts on wire and pin object when Ctrl is down.
68 - LeftDown + drag on wire pin, makes it draggable.
69 - Dragging starting at non hit, or wire, starts a rectangle selection.
70 - Double Click => Edit Selected of hit
71 
72 \ingroup tools
73 */
74 class A2DCANVASDLLEXP a2dMasterTagGroups : public a2dMasterDrawBase
75 {
76 public:
77 
78  a2dMasterTagGroups ( a2dStToolContr* controller );
80 
81  //! set wire first mode on or off
82  void SetWireMode( bool drawWire ) { m_drawWire = drawWire; }
83 
84  //! what is the current mode.
85  bool GetWireMode() const { return m_drawWire; }
86 
87 protected:
88 
89  void AbortBusyMode();
90 
91  void DoStopTool( bool abort );
92 
93  void OnChar( wxKeyEvent& event );
94 
95  bool SetWireCursor( a2dWirePolylineL* wire, const a2dHitEvent& hitinfo );
96  void SetToolMode( bool ctrl, bool shift );
97 
98  void OnMouseEvent( wxMouseEvent& event );
99 
100  void OnKeyDown( wxKeyEvent& event );
101  void OnKeyUp( wxKeyEvent& event );
102  void Render();
103 
104 protected:
105 
106  bool m_drawWire;
107 
108  DECLARE_CLASS( a2dMasterTagGroups )
109  DECLARE_EVENT_TABLE()
110 
111 };
112 
113 //!Master tool for objects graphics selecting and dragging
114 /*!This tool controls other tools such that simple object graphics
115 can be edited without manually changing tools.
116 
117 Main idea is that drawing wires is easy. Moving a wire pin, needs ctrl key.
118 Selecting a wire needs Shift key.
119 
120 - Left Down + Drag + Shift Down => select objects in rectangle add to already selected
121 - Left Down + Drag + Cntrl Down => select objects in rectangle deselect already selected first
122 - Left Down + Drag => move selected objects
123 - Left Down + Drag => move object and select it
124 - Left Down + Drag + Ctrl Down + Shift Down => copy selected objects
125 - Right Down => Drag canvas view
126 - Right Down + Up => Show Popup
127 
128 - First LeftDown click on object selects it.
129 - Shift + LeftDown to select more objects
130 - Shift + LeftDown to select a wire
131 - Second click on Selected object does not deselect
132 - Selected wire is draggable in segment and vertex and vertex insert.
133 - Wire starts on pin of non wire object.
134 - Wire starts on wire and pin object
135 - Ctrl + LeftDown on wire pin, makes it draggable.
136 - Dragging starting at non hit, starts a rectangle selection.
137 - Double Click => Edit Selected of hit
138 
139 \ingroup tools
140 */
141 class A2DCANVASDLLEXP a2dMasterTagGroups2 : public a2dMasterDrawBase
142 {
143 public:
144 
145  a2dMasterTagGroups2 ( a2dStToolContr* controller );
147 
148 protected:
149 
150  void AbortBusyMode();
151 
152  void DoStopTool( bool abort );
153 
154  void OnChar( wxKeyEvent& event );
155 
156  void OnMouseEvent( wxMouseEvent& event );
157 
158  void OnKeyDown( wxKeyEvent& event );
159  void OnKeyUp( wxKeyEvent& event );
160  void Render();
161 
162 public:
163  DECLARE_CLASS( a2dMasterTagGroups2 )
164  DECLARE_EVENT_TABLE()
165 
166 };
167 
168 //!Master tool for objects graphics slecting and dragging
169 /*!This tool controls other tools such that simple object graphics
170 can be edited without manually changing tools.
171 
172 - Left Down + Drag + Shift Down => select objects in rectangle add to already selected
173 - Left Down + Drag + Cntrl Down => select objects in rectangle deselect already selected first
174 - Left Down + Drag => move selected objects
175 - Left Down + Drag => move object and select it
176 - Left Down + Drag + Ctrl Down + Shift Down => copy selected objects
177 - Right Down => Drag canvas view
178 - Right Down + Up => Show Popup
179 
180 ( wire mode )
181 
182 - First LeftDown click on non wire object selects it.
183 - Shift + LeftDown to select a wire.
184 - Shift + LeftDown to select more.
185 - Second click on Selected object does NOT deselect
186 - Wire is draggable in segment and vertex and vertex insert when selected.
187 - Wire starts on pin of non wire object.
188 - Wire starts on wire and pin of wire object.
189 - LeftDown + drag on wire pin, makes it draggable.
190 - Dragging starting at non hit, or wire, starts a rectangle selection.
191 - Double Click => Edit Selected of hit
192 
193 ( select mode )
194 
195 - First LeftDown click on object selects it.
196 - Shift + LeftDown to select more.
197 - Second click on Selected object does de-select
198 - wire is draggable in segment and vertex and vertex insert, without selecting needed.
199 - Wire starts on pin of non wire object.
200 - Wire starts on wire and pin object when Ctrl is down.
201 - LeftDown + drag on wire pin, makes it draggable.
202 - Dragging starting at non hit, or wire, starts a rectangle selection.
203 - Double Click => Edit Selected of hit
204 
205 \ingroup tools
206 */
207 class A2DCANVASDLLEXP a2dMasterTagGroups3 : public a2dMasterDrawBase
208 {
209 public:
210 
211  a2dMasterTagGroups3 ( a2dStToolContr* controller );
213 
214  virtual wxString GetToolString() const;
215 
216  virtual void SetActive( bool active = true );
217 
218  static void SetSelectMoreAtShift( bool selectMoreAtShift ) { m_selectMoreAtShift = selectMoreAtShift; }
219 
220  //! set wire first mode on or off
221  void SetWireMode( bool drawWire ) { m_drawWire = drawWire; }
222 
223  //! what is the current mode.
224  bool GetWireMode() const { return m_drawWire; }
225 
226  //! set if double click can be used to switch editingmode using shift key
227  void SetAllowDoubleClickModifier( bool AllowDoubleClickModifier ) { m_AllowDoubleClickModifier = AllowDoubleClickModifier; }
228 
229  //! get if double click can be used to switch editingmode using shift key
230  bool GetAllowDoubleClickModifier() const { return m_AllowDoubleClickModifier; }
231 
232  //! set generate pins on non wire objects on or off
233  void SetGeneratePinsNonWire( bool generatePinsNonWire, bool generatePinsAlsoNonWireMode )
234  {
235  m_generatePinsNonWire = generatePinsNonWire;
236  m_generatePinsAlsoNonWireMode = generatePinsAlsoNonWireMode;
237  }
238 
239  bool GetGeneratePinsNonWire() { return m_generatePinsNonWire; }
240  bool GetGeneratePinsAlsoNonWireMode() { return m_generatePinsAlsoNonWireMode; }
241 
242 protected:
243 
244  void AbortBusyMode();
245 
246  void DoStopTool( bool abort );
247 
248  void OnComEvent( a2dComEvent& event );
249 
250  void OnChar( wxKeyEvent& event );
251 
252  bool SetWireCursor( a2dWirePolylineL* wire, const a2dHitEvent& hitinfo, bool ctrl, bool shift, bool alt );
253  void SetToolMode( bool ctrl, bool shift, bool alt );
254 
255  void OnMouseEvent( wxMouseEvent& event );
256 
257  void OnKeyDown( wxKeyEvent& event );
258  void OnKeyUp( wxKeyEvent& event );
259  void Render();
260 
261  static bool m_selectMoreAtShift;
262 
263  bool m_drawWire;
264 
265  wxTimer m_timer;
266 
267  bool m_shiftWasDown;
268  bool m_ctrlWasDown;
269  bool m_altWasDown;
270 
271  bool m_AllowDoubleClickModifier;
272 
273  a2dCanvasObjectList* m_selectedObjects;
274 
275  bool m_generatePinsNonWire;
276  bool m_generatePinsAlsoNonWireMode;
277 
278  DECLARE_CLASS( a2dMasterTagGroups3 )
279  DECLARE_EVENT_TABLE()
280 
281 };
282 
283 class A2DCANVASDLLEXP a2dMasterSingleClick : public a2dMasterDrawBase
284 {
285 public:
286 
287  a2dMasterSingleClick ( a2dStToolContr* controller );
289 
290  virtual wxString GetToolString() const;
291 
292  virtual void SetActive( bool active = true );
293 
294  //! set wire first mode on or off
295  void SetWireMode( bool drawWire ) { m_drawWire = drawWire; }
296 
297  //! what is the current mode.
298  bool GetWireMode() const { return m_drawWire; }
299 
300  //! set dlg at Double Left Down if dlgOrEdit == true
301  void SetDlgOrEdit( bool dlgOrEdit ) { m_dlgOrEdit = dlgOrEdit; }
302 
303  //! set dlg at Double Left Down if dlgOrEdit == true
304  bool GetDlgOrEdit() const { return m_dlgOrEdit; }
305 
306  //! set style dlg as modal
307  void SetDlgOrEditModal( bool dlgOrEditModal ) { m_dlgOrEditModal = dlgOrEditModal; }
308 
309  //! get style dlg as modal setting
310  bool GetDlgOrEditModal() const { return m_dlgOrEditModal; }
311 
312 protected:
313 
314  void PushEditTool( a2dCanvasObject* hit );
315 
316  void AbortBusyMode();
317 
318  void DoStopTool( bool abort );
319 
320  void OnComEvent( a2dComEvent& event );
321 
322  void OnChar( wxKeyEvent& event );
323 
324  bool SetWireCursor( a2dWirePolylineL* wire, const a2dHitEvent& hitinfo, bool ctrl, bool shift, bool alt );
325  void SetToolMode( bool ctrl, bool shift, bool alt );
326 
327  void OnMouseEvent( wxMouseEvent& event );
328 
329  void OnKeyDown( wxKeyEvent& event );
330  void OnKeyUp( wxKeyEvent& event );
331  void Render();
332 
333  void OnTimer(wxTimerEvent& event);
334 
335  wxTimer m_timer;
336  bool m_drawWireIfNoDoubleClick;
337  bool m_selectionIfNoDoubleClick;
338 
339  bool m_shiftWasDown;
340  bool m_ctrlWasDown;
341  bool m_altWasDown;
342 
343  bool m_drawWire;
344 
345  DECLARE_CLASS( a2dMasterSingleClick )
346  DECLARE_EVENT_TABLE()
347 
348 };
349 
350 //!Master tool for objects graphics slecting and dragging
351 /*!This tool controls other tools such that simple object graphics
352 can be edited without manually changing tools.
353 
354 - Left Down + Drag + Shift Down => select objects in rectangle add to already selected
355 - Left Down + Drag + Cntrl Down => select objects in rectangle deselect already selected first
356 - Left Down + Drag => move selected objects
357 - Left Down + Drag => move object and select it
358 - Left Down + Drag + Ctrl Down + Shift Down => copy selected objects
359 - Right Down => Drag canvas view
360 - Right Down + Up => Show Popup
361 
362 ( wire mode )
363 
364 - First LeftDown click on non wire object selects it.
365 - Shift + LeftDown to select a wire.
366 - Shift + LeftDown to select more.
367 - Second click on Selected object does NOT deselect
368 - Wire is draggable in segment and vertex and vertex insert when selected.
369 - Wire starts on pin of non wire object.
370 - Wire starts on wire and pin of wire object.
371 - LeftDown + drag on wire pin, makes it draggable.
372 - Dragging starting at non hit, or wire, starts a rectangle selection.
373 - Double Click => Edit Selected of hit
374 
375 ( select mode )
376 
377 - First LeftDown click on object selects it.
378 - Shift + LeftDown to select more.
379 - Second click on Selected object does de-select
380 - wire is draggable in segment and vertex and vertex insert, without selecting needed.
381 - Wire starts on pin of non wire object.
382 - Wire starts on wire and pin object when Ctrl is down.
383 - LeftDown + drag on wire pin, makes it draggable.
384 - Dragging starting at non hit, or wire, starts a rectangle selection.
385 - Double Click => Edit Selected of hit
386 
387 \ingroup tools
388 */
389 class A2DCANVASDLLEXP a2dMasterTagGroups4 : public a2dMasterDrawBase
390 {
391 public:
392 
393  a2dMasterTagGroups4 ( a2dStToolContr* controller );
395 
396  virtual wxString GetToolString() const;
397 
398  virtual void SetActive( bool active = true );
399 
400  static void SetSelectMoreAtShift( bool selectMoreAtShift ) { m_selectMoreAtShift = selectMoreAtShift; }
401 
402  //! set wire first mode on or off
403  void SetWireMode( bool drawWire ) { m_drawWire = drawWire; }
404 
405  //! what is the current mode.
406  bool GetWireMode() const { return m_drawWire; }
407 
408  //! set dlg at Double Left Down if dlgOrEdit == true
409  void SetDlgOrEdit( bool dlgOrEdit ) { m_dlgOrEdit = dlgOrEdit; }
410 
411  //! set dlg at Double Left Down if dlgOrEdit == true
412  bool GetDlgOrEdit() const { return m_dlgOrEdit; }
413 
414  //! set style dlg as modal
415  void SetDlgOrEditModal( bool dlgOrEditModal ) { m_dlgOrEditModal = dlgOrEditModal; }
416 
417  //! get style dlg as modal setting
418  bool GetDlgOrEditModal() const { return m_dlgOrEditModal; }
419 
420 
421  //! set if editing should start at a slow/delayed LeftUp event.
422  void SetEditIfDelayed( bool startEditIfDelayed ) { m_startEditIfDelayed = startEditIfDelayed; }
423 
424  //! get if editing should start at a slow/delayed LeftUp event.
425  bool GetEditIfDelayed() const { return m_startEditIfDelayed; }
426 
427 protected:
428 
429  void EditDlgOrHandles( a2dCanvasObject* hit, bool modifier, bool noHandleEditForWire );
430 
431  void AbortBusyMode();
432 
433  void DoStopTool( bool abort );
434 
435  void OnComEvent( a2dComEvent& event );
436 
437  void OnChar( wxKeyEvent& event );
438 
439  void OnTimer(wxTimerEvent& event);
440 
441  bool SetWireCursor( a2dWirePolylineL* wire, const a2dHitEvent& hitinfo, bool ctrl, bool shift, bool alt );
442  void SetToolMode( bool ctrl, bool shift, bool alt );
443 
444  void OnMouseEvent( wxMouseEvent& event );
445 
446  void OnKeyDown( wxKeyEvent& event );
447  void OnKeyUp( wxKeyEvent& event );
448  void Render();
449 
450  static bool m_selectMoreAtShift;
451 
452  bool m_drawWire;
453 
454  wxTimer m_timer;
455 
456  bool m_selectionIfNoDoubleClick;
457  bool m_drawWireIfNoDoubleClick;
458 
459  //detection for delayed Left Up
460  bool m_editIfDelayed;
461 
462  //if set, start a delayed LeftUp event will start editing.
463  bool m_startEditIfDelayed;
464 
465  DECLARE_CLASS( a2dMasterTagGroups4 )
466  DECLARE_EVENT_TABLE()
467 
468 };
469 
470 
471 class A2DCANVASDLLEXP a2dMasterTagGroups33 : public a2dMasterDrawBase
472 {
473 public:
474 
475  a2dMasterTagGroups33 ( a2dStToolContr* controller );
477 
478  virtual wxString GetToolString() const;
479 
480  virtual void SetActive( bool active = true );
481 
482  static void SetSelectMoreAtShift( bool selectMoreAtShift ) { m_selectMoreAtShift = selectMoreAtShift; }
483 
484  //! set wire first mode on or off
485  void SetWireMode( bool drawWire ) { m_drawWire = drawWire; }
486 
487  //! what is the current mode.
488  bool GetWireMode() const { return m_drawWire; }
489 
490  //! set if double click can be used to switch editingmode using shift key
491  void SetAllowDoubleClickModifier( bool AllowDoubleClickModifier ) { m_AllowDoubleClickModifier = AllowDoubleClickModifier; }
492 
493  //! get if double click can be used to switch editingmode using shift key
494  bool GetAllowDoubleClickModifier() const { return m_AllowDoubleClickModifier; }
495 
496  //! set Allow Delayed Editing
497  void SetAllowDelayedEdit( bool AllowDelayedEdit ) { m_AllowDelayedEdit = AllowDelayedEdit; }
498 
499  //! get Allow Delayed Editing
500  bool GetAllowDelayedEdit() const { return m_AllowDelayedEdit; }
501 
502  //! set if editing should start at a slow/delayed LeftUp event.
503  void SetEditIfDelayed( bool startEditIfDelayed ) { m_startEditIfDelayed = startEditIfDelayed; }
504 
505  //! get if editing should start at a slow/delayed LeftUp event.
506  bool GetEditIfDelayed() const { return m_startEditIfDelayed; }
507 
508 protected:
509 
510  void AbortBusyMode();
511 
512  void DoStopTool( bool abort );
513 
514  void OnComEvent( a2dComEvent& event );
515 
516  void OnChar( wxKeyEvent& event );
517 
518  void OnTimer(wxTimerEvent& event);
519 
520  bool SetWireCursor( a2dWirePolylineL* wire, const a2dHitEvent& hitinfo, bool ctrl, bool shift, bool alt );
521  void SetToolMode( bool ctrl, bool shift, bool alt );
522 
523  void OnMouseEvent( wxMouseEvent& event );
524 
525  void OnKeyDown( wxKeyEvent& event );
526  void OnKeyUp( wxKeyEvent& event );
527  void Render();
528 
529  static bool m_selectMoreAtShift;
530 
531  bool m_drawWire;
532 
533  wxTimer m_timer;
534 
535  bool m_selectionIfNoDoubleClick;
536  bool m_drawWireIfNoDoubleClick;
537 
538  bool m_shiftWasDown;
539  bool m_ctrlWasDown;
540  bool m_altWasDown;
541 
542  //detection for delayed Left Up
543  bool m_editIfDelayed;
544 
545  //if set, start a delayed LeftUp event will start editing.
546  bool m_startEditIfDelayed;
547 
548  bool m_AllowDoubleClickModifier;
549  bool m_AllowDelayedEdit;
550 
551  DECLARE_CLASS( a2dMasterTagGroups33 )
552  DECLARE_EVENT_TABLE()
553 
554 };
555 
556 #endif // __A2DCANVASMASTERTOOL_H__
557 
558 
void SetAllowDoubleClickModifier(bool AllowDoubleClickModifier)
set if double click can be used to switch editingmode using shift key
void SetWireMode(bool drawWire)
set wire first mode on or off
bool GetEditIfDelayed() const
get if editing should start at a slow/delayed LeftUp event.
master tools are tools on top of other tools.
dialog for defining style on an a2dCanvasObject
virtual void DoStopTool(bool abort)
to do tool specific stuff to stop a tool. Called from StopTool().
Definition: mastertool.cpp:900
bool GetWireMode() const
what is the current mode.
bool GetWireMode() const
what is the current mode.
virtual void Render()
implement rendering
Definition: sttool.cpp:1402
void SetWireMode(bool drawWire)
set wire first mode on or off
void SetDlgOrEditModal(bool dlgOrEditModal)
set style dlg as modal
The base class for all drawable objects in a a2dCanvasDocument.
a2dCanvasObject is the base class for Canvas Objects.
Definition: canobj.h:371
void SetDlgOrEdit(bool dlgOrEdit)
set dlg at Double Left Down if dlgOrEdit == true
void SetAllowDoubleClickModifier(bool AllowDoubleClickModifier)
set if double click can be used to switch editingmode using shift key
void SetWireMode(bool drawWire)
set wire first mode on or off
bool GetDlgOrEditModal() const
get style dlg as modal setting
general style dialog to edit a2dCanvasObject style
Definition: styledialg.h:60
a2dWirePolylineL is a polyline that adjusts itself when the objects it connects move ...
Definition: wire.h:42
void SetDlgOrEditModal(bool dlgOrEditModal)
set style dlg as modal
bool GetWireMode() const
what is the current mode.
void SetEditIfDelayed(bool startEditIfDelayed)
set if editing should start at a slow/delayed LeftUp event.
bool GetWireMode() const
what is the current mode.
void SetDlgOrEdit(bool dlgOrEdit)
set dlg at Double Left Down if dlgOrEdit == true
The a2dStToolContr is a Tool Controller specialized for working with a2dCanvasView.
Definition: sttool.h:485
bool GetAllowDoubleClickModifier() const
get if double click can be used to switch editingmode using shift key
void SetGeneratePinsNonWire(bool generatePinsNonWire, bool generatePinsAlsoNonWireMode)
set generate pins on non wire objects on or off
Master tool for objects graphics slecting and dragging.
Master tool for objects graphics selecting and dragging.
bool GetDlgOrEdit() const
set dlg at Double Left Down if dlgOrEdit == true
bool GetAllowDelayedEdit() const
get Allow Delayed Editing
common stuff for several master tools
Definition: mastertool.h:167
virtual void AbortBusyMode()
Called when the user aborts editing a distinct object */.
Definition: sttool.cpp:1178
bool GetAllowDoubleClickModifier() const
get if double click can be used to switch editingmode using shift key
bool GetEditIfDelayed() const
get if editing should start at a slow/delayed LeftUp event.
list for a2dCanvasObject
Master tool for objects graphics slecting and dragging.
see a2dComEvent
Definition: gen.h:371
void SetWireMode(bool drawWire)
set wire first mode on or off
Master tool for objects graphics slecting and dragging.
void SetEditIfDelayed(bool startEditIfDelayed)
set if editing should start at a slow/delayed LeftUp event.
bool GetDlgOrEdit() const
set dlg at Double Left Down if dlgOrEdit == true
void SetWireMode(bool drawWire)
set wire first mode on or off
bool GetDlgOrEditModal() const
get style dlg as modal setting
void SetAllowDelayedEdit(bool AllowDelayedEdit)
set Allow Delayed Editing
stack based tools controller and tools for drawing and editing.
bool GetWireMode() const
what is the current mode.
structure to give as parameter to member functions of a2dCanvasObject
Definition: canobj.h:252
mastertoolgroups.h Source File -- Sun Oct 12 2014 17:04:22 -- Sun Oct 12 2014 -- 1.8.5 -- wxArt2D -- . -- Main Page Reference Documentation