wxArt2D
edsttool.cpp
1 /*! \file canvas/src/sttool.cpp
2  \author Klaas Holwerda
3 
4  Copyright: 2001-2004 (c) Klaas Holwerda
5 
6  Licence: wxWidgets Licence
7 
8  RCS-ID: $Id: sttool.cpp,v 1.389 2009/10/01 19:22:35 titato Exp $
9 */
10 
11 #include "a2dprec.h"
12 
13 #ifdef __BORLANDC__
14 #pragma hdrstop
15 #endif
16 
17 #ifndef WX_PRECOMP
18 #include "wx/wx.h"
19 #endif
20 
21 #include <wx/regex.h>
22 #include <wx/url.h>
23 
24 
25 #include "wx/docview/doccom.h"
26 #include "wx/canvas/canmod.h"
27 #include "wx/editor/recurdoc.h"
28 #include "wx/filename.h"
29 
30 #include "wx/editor/edsttool.h"
31 
32 #if defined(__WXMSW__) && defined(__MEMDEBUG__)
33 #include <wx/msw/msvcrt.h>
34 #endif
35 
36 IMPLEMENT_CLASS( a2dLinkTool, a2dStDrawTool )
37 
38 const a2dCommandId a2dLinkTool::COMID_PushTool_Link( wxT( "PushTool_Link" ) );
39 
40 BEGIN_EVENT_TABLE( a2dLinkTool, a2dStDrawTool )
41  EVT_CHAR( a2dLinkTool::OnChar )
42  EVT_MOUSE_EVENTS( a2dLinkTool::OnMouseEvent )
43 END_EVENT_TABLE()
44 
45 a2dLinkTool::a2dLinkTool( a2dStToolContr* controller ): a2dStDrawTool( controller )
46 {
47  m_eventHandler = controller->GetDefaultToolEventHandlerFixedStyle();
48 
49  m_anotate = true;//false;
50  m_toolcursor = a2dCanvasGlobals->GetCursor( a2dCURSOR_PENCIL );
51  m_toolBusyCursor = a2dCanvasGlobals->GetCursor( a2dCURSOR_CROSS );
52 
53  //i like transparent fill and specific stroke
54  SetFill( *a2dTRANSPARENT_FILL );
55  SetStroke( a2dStroke( *wxRED, 1, a2dSTROKE_DOT ) );
56  m_font = *a2dDEFAULT_CANVASFONT;
57 }
58 
59 a2dLinkTool::~a2dLinkTool()
60 {
61 }
62 
64 {
65  // Add old (and later new) annotation area to pending region
67 
68  a2dRect* rec = wxStaticCast( m_canvasobject.Get(), a2dRect );
69  m_anotation.Printf( _T( "w %6.3f h %6.3f" ), rec->GetWidth(), rec->GetHeight() );
70 
71  wxCoord w, h, d, l;
72  GetTextExtent( m_anotation, &w, &h, &d, &l );
73  m_xanotation = m_x + ( int ) h;
74  m_yanotation = m_y + ( int ) h;
76 }
77 
78 void a2dLinkTool::OnChar( wxKeyEvent& event )
79 {
80  if ( !GetBusy() )
81  {
82  switch( event.GetKeyCode() )
83  {
84  case WXK_RETURN:
85  {
87  }
88  break;
89  case WXK_SUBTRACT:
90  {
92  }
93  break;
94  default:
95  event.Skip();
96  }
97  }
98  else
99  event.Skip();
100 }
101 
102 void a2dLinkTool::OnMouseEvent( wxMouseEvent& event )
103 {
104  if ( !m_active )
105  {
106  event.Skip();
107  return;
108  }
109 
110  if ( GetBusy() )
111  GetDrawingPart()->SetCursor( m_toolBusyCursor );
112  else
113  GetDrawingPart()->SetCursor( m_toolcursor );
114 
115  m_x = event.GetX();
116  m_y = event.GetY();
118 
119  a2dRestrictionEngine* restrict = GetDrawing()->GetHabitat()->GetRestrictionEngine();
120  if( restrict )
121  restrict->RestrictPoint( m_xwprev, m_ywprev );
122 
123  if ( event.LeftDClick() && !GetBusy() )
124  {
125 
126  }
127  else if ( event.LeftDown() && !GetBusy() )
128  {
129  GetDrawing()->GetHabitat()->SetLastXyEntry( m_xwprev, m_ywprev );
130  a2dRect* rec = new a2dRect( m_xwprev, m_ywprev, 0, 0, 0 );
131  rec->SetRoot( GetDrawingPart()->GetDrawing() );
132  rec->SetFill( m_fill );
133  rec->SetStroke( m_stroke );
135 
136  m_original = rec;
137  if ( !EnterBusyMode() )
138  return;
139 
140  //special case to have the canvas itself recieve at least this one also.
141  //because often the zoomtool is active as only tool, but
142  //some object on the canvas are meant to react to MD (Href's etc.)
143  event.Skip();
144  }
145  else if ( event.LeftDown() && GetBusy() )
146  {
147  GetDrawing()->GetHabitat()->SetLastXyEntry( m_xwprev, m_ywprev );
149 
150  a2dRect* rec = wxStaticCast( m_canvasobject.Get(), a2dRect );
151 
152  double w = GetDrawer2D()->WorldToDeviceXRel( rec->GetWidth() );
153  double h = GetDrawer2D()->WorldToDeviceYRel( rec->GetHeight() );
154 
155  static wxString link_dir = *( a2dGeneralGlobals->GetVariablesHash().GetVariableString( wxT( "APPLICATION_DATA" ) ) );
156 
157  static wxString filter = _T( "All files (*.*)| *.*| CVG files (*.cvg)| *.cvg" );
158 
159  wxFileName link_file;
160 
161  wxFileDialog dialog( GetDisplayWindow(), _T( "Select Image File" ), link_dir, link_file.GetFullPath(), filter, wxFD_OPEN );
162 
163  if ( dialog.ShowModal() != wxID_OK )
164  return;
165 
166  // save for the next time
167  link_dir = dialog.GetPath();
168  link_file = dialog.GetFilename();
169 
170  wxFileName link_dirf = wxFileName( link_dir );
171  link_dir = link_dirf.GetVolume() + link_dirf.GetVolumeSeparator() + link_dirf.GetPathWithSep( wxPATH_UNIX );
172 
173  a2dSmrtPtr<a2dText> otext;
174 
175  wxString link_fullpath = link_dir + link_file.GetFullName();
176 
177  double x1 = rec->GetBbox().GetMinX();
178  double y1 = rec->GetBbox().GetMaxY();
179  double link_w = fabs( rec->GetWidth() );
180  double link_h = fabs( rec->GetHeight() );
181 
182  bool up = false;
183  if ( GetDrawingPart() && GetDrawingPart()->GetDrawer2D() )
184  up = !GetDrawingPart()->GetDrawer2D()->GetYaxis();
185 
186  a2dFont font = m_font;
187  if ( fabs( w ) < 3 && fabs( h ) < 3 )
188  {
189  //use current font
190  otext = new a2dCanvasDocumentReferenceAsText( link_fullpath, x1, y1, font, 0, up );
191  }
192  else
193  {
194  font.SetSize( link_h );
195  otext = new a2dCanvasDocumentReferenceAsText( link_fullpath, x1, y1, font, 0, up );
196  }
197  //central font like this, else editing takes over the wrong one.
198  GetDrawing()->GetHabitat()->SetFont( font );
199 
200  otext->SetRoot( GetDrawingPart()->GetDrawing() );
201  otext->SetFill( *a2dTRANSPARENT_FILL );
202  otext->SetStroke( *a2dTRANSPARENT_STROKE );
203  otext->SetFill( m_fill );
204  otext->SetStroke( m_stroke );
205  otext->SetLayer( m_layer );
206 
207  bool backupstartedit = m_editatend;
208  m_editatend = false;
210  FinishBusyMode();
211  m_editatend = backupstartedit;
212 
213  m_original = otext;
214  AddCurrent( otext );
215  if ( !EnterBusyMode() )
216  return;
217  FinishBusyMode();
218  GetDrawingPart()->Update( a2dCANVIEW_UPDATE_SYNC_DRAWERS );
219  }
220  else if ( ( event.Dragging() && GetBusy() ) || ( event.Moving() && GetBusy() ) )
221  {
222  a2dRect* rec = wxStaticCast( m_canvasobject.Get(), a2dRect );
223  rec->SetWidth( m_xwprev - rec->GetPosX() );
224  rec->SetHeight( m_ywprev - rec->GetPosY() );
225 
226  m_pending = true;
227  }
228  else
229  event.Skip();
230 }
231 
232 //-----------------------------------------------------------
233 // a2dFollowLinkDocDrawCam
234 //-----------------------------------------------------------
235 
236 IMPLEMENT_CLASS( a2dFollowLinkDocDrawCam, a2dStTool )
237 
238 const a2dCommandId a2dFollowLinkDocDrawCam::COMID_PushTool_FollowLinkDocDrawCam( wxT( "PushTool_FollowLinkDocDrawCam" ) );
239 
240 BEGIN_EVENT_TABLE( a2dFollowLinkDocDrawCam, a2dStTool )
241  EVT_CHAR( a2dFollowLinkDocDrawCam::OnChar )
242  EVT_MOUSE_EVENTS( a2dFollowLinkDocDrawCam::OnMouseEvent )
243 END_EVENT_TABLE()
244 
245 a2dFollowLinkDocDrawCam::a2dFollowLinkDocDrawCam( a2dStToolContr* controller ): a2dStTool( controller )
246 {
247  m_eventHandler = controller->GetDefaultToolEventHandlerFixedStyle();
248 
249  m_toolcursor = a2dCanvasGlobals->GetCursor( a2dCURSOR_BULLSEYE );
250  m_canvasobject = 0;
251 }
252 
253 void a2dFollowLinkDocDrawCam::OnChar( wxKeyEvent& event )
254 {
255  if ( GetBusy() )
256  {
257  switch( event.GetKeyCode() )
258  {
259  case WXK_SPACE:
260  {
261  FinishBusyMode();
262  }
263  break;
264  default:
265  event.Skip();
266  }
267  }
268  else
269  event.Skip();
270 
271 }
272 
273 void a2dFollowLinkDocDrawCam::OnMouseEvent( wxMouseEvent& event )
274 {
275  if ( !m_active )
276  {
277  event.Skip();
278  return;
279  }
280  GetDrawingPart()->SetCursor( m_toolcursor );
281 
282  int x = event.GetX();
283  int y = event.GetY();
284 
285  //to world coordinates to do hit test in world coordinates
286  double xw, yw;
287  MouseToToolWorld( x, y, xw, yw );
288 
289  if ( event.LeftDown() )
290  {
292 
293  if ( !m_canvasobject )
294  {
295  m_canvasobject = 0;
296  event.Skip();
297  return;
298  }
299 
300  //if ( event.ControlDown() )
301  {
302  wxURI uri = m_canvasobject->GetURI();
303  wxString link = uri.BuildURI();
304  if ( !link.IsEmpty() )
305  {
306  wxString file = link;
307  wxString scheme = uri.GetScheme();
308  if ( scheme == wxT( "file" ) )
309  {
310  wxRegEx reVolume( wxT("^\\/[a-fA-F].*$") );
311  file = uri.GetPath();
312  if ( reVolume.Matches( file ) )
313  file = file.Mid( 1 );
314 
315  if ( !::wxFileExists( file ) )
316  {
317  wxFileName fileo = wxFileName( file, wxPATH_UNIX );
318  file = *( a2dGeneralGlobals->GetVariablesHash().GetVariableString( wxT( "APPLICATION_DATA" ) ) ) + wxFileName::GetPathSeparator(wxPATH_UNIX) + fileo.GetFullName();
319  if ( !::wxFileExists( file ) )
320  {
321  //a2dGeneralGlobals->ReportErrorF( a2dError_FileCouldNotOpen, _( "Sorry, could not open file %s" ), file.c_str() );
322  a2dDocumentPtr doc;
324  doc->SetTitle( file, true );
325  doc->SetFilename( wxFileName( file ), true );
326  return;
327  }
328  }
329  a2dDocumentPtr doc;
331  }
332  }
333  }
334 
335  m_canvasobject->SetPending( true );
337  m_canvasobject = 0;
338  if ( m_oneshot )
339  StopTool();
340  }
341  else
342  event.Skip();
343 
344 }
345 
346 bool a2dFollowLinkDocDrawCam::StartFollowHere( double x, double y )
347 {
348  int mouse_x = GetDrawer2D()->WorldToDeviceX( x );
349  int mouse_y = GetDrawer2D()->WorldToDeviceY( y );
350 
351  return StartFollowHere( mouse_x, mouse_y );
352 }
353 
354 bool a2dFollowLinkDocDrawCam::StartFollowHere( int x, int y )
355 {
356  wxMouseEvent event( wxEVT_LEFT_DOWN );
357  event.m_x = x;
358  event.m_y = y;
359 
360  OnMouseEvent( event );
361 
362  return true;
363 }
364 
365 //----------------------------------------------------------------------------
366 // a2dMasterTagGroups3Link
367 //----------------------------------------------------------------------------
368 
369 IMPLEMENT_CLASS( a2dMasterTagGroups3Link , a2dMasterTagGroups3 )
370 
371 BEGIN_EVENT_TABLE( a2dMasterTagGroups3Link , a2dMasterTagGroups3 )
372 END_EVENT_TABLE()
373 
374 a2dMasterTagGroups3Link ::a2dMasterTagGroups3Link ( a2dStToolContr* controller ):
375  a2dMasterTagGroups3( controller )
376 {
377  m_drawWire = false;
378 
379  controller->SetDefaultBehavior( controller->GetDefaultBehavior() | wxTC_NoDefaultKeys | wxTC_NoDefaultMouseActions );
380  m_toolcursor = a2dCanvasGlobals->GetCursor( a2dCURSOR_Select );
381 }
382 
383 a2dMasterTagGroups3Link::~a2dMasterTagGroups3Link ()
384 {
385 }
386 
387 wxString a2dMasterTagGroups3Link::GetToolString() const
388 {
389  wxString str = "Edit";
390  if ( m_drawWire )
391  return str + " Wires";
392  if ( m_dlgOrEdit )
393  return str + " Dlg";
394  return str;
395 }
396 
397 void a2dMasterTagGroups3Link::PushEditTool( a2dCanvasObject* hit )
398 {
400 
401  tool->SetShowAnotation( m_anotate );
402  tool->SetOneShot();
403  tool->SetCursorType( a2dCanvasGlobals->GetCursor( a2dCURSOR_EditSegment ) );
404  tool->SetBusyCursorType( a2dCanvasGlobals->GetCursor( a2dCURSOR_EditSegment ) );
405 
406  if ( hit )
407  {
408 
409  }
410  //tool->SetEvtHandler( m_eventHandler );
411 
412  m_stcontroller->PushTool( tool );
413  SelectHitObject( hit );
414  tool->StartToEdit( hit );
415 }
416 
417 void a2dMasterTagGroups3Link::PushLinkTool( a2dCanvasObject* hit )
418 {
419  a2dSmrtPtr< a2dFollowLinkDocDrawCam > tool = new a2dFollowLinkDocDrawCam( m_stcontroller );
420 
421  tool->SetShowAnotation( m_anotate );
422  tool->SetOneShot();
423 
424  if ( hit )
425  {
426 
427  }
428  //tool->SetEvtHandler( m_eventHandler );
429 
430  m_stcontroller->PushTool( tool );
431  SelectHitObject( hit );
432  tool->StartFollowHere( m_x, m_y );
433 }
434 
435 void a2dMasterTagGroups3Link::EditDlgOrHandles( a2dCanvasObject* hit, bool modifier, bool noHandleEditForWire )
436 {
437  if ( hit )
438  {
439  if ( m_dlgOrEdit && !modifier )
440  {
442  if ( link )
443  {
444  hit->SetSelected( m_modehitLastSelectState );
445  GetDrawingPart()->SetCursor( a2dCanvasGlobals->GetCursor( a2dCURSOR_Select ) );
446  m_mode = mode_edit;
447  PushLinkTool( hit );
448  }
449  else if ( !m_dlgOrEditModal )
451  else
452  {
453  bool hitSel = hit->GetSelected();
454  hit->SetSelected( true );
455 
456  a2dExtFill eFi;
457  a2dExtStroke eSt;
458  wxUint32 nrst = 0;
459  wxUint32 nrfi = 0;
460 
461  bool withFill = false;
463  //nrst = a2dSetExtStroke( eSt, objects, a2dCanvasOFlags::SELECTED, a2dCanvasGlobals->GetLayerSetup() );
464  //nrfi = a2dSetExtFill( eFi, objects, a2dCanvasOFlags::SELECTED, GetDrawing()->GetHabitat()->GetLayerSetup() );
465  nrst = a2dSetExtStroke( eSt, objects, a2dCanvasOFlags::SELECTED, GetDrawing()->GetLayerSetup() );
466  nrfi = a2dSetExtFill( eFi, objects, a2dCanvasOFlags::SELECTED, GetDrawing()->GetLayerSetup() );
467  bool showDlg = true;
468  if ( nrst + nrfi == 0 )
469  {
470  //eFi.Set( hit->GetFill() );
471  //eSt.Set( hit->GetStroke() );
472  //withFill = true; // we want to be able to choose a fill
473  showDlg = false;
474  }
475  else
476  withFill = 0 != nrfi;
477 
478  if ( showDlg )
479  {
480  a2dDialogStyle dlg( NULL, false, withFill, true );
481  dlg.SetUnitsScale( GetDrawing()->GetUnitsScale() );
482  dlg.SetExtFill(eFi);
483  dlg.SetExtStroke(eSt);
484  //dlg.SetCustomColors(....);
485 
486  if ( wxID_OK == dlg.ShowModal() )
487  {
488  eSt = dlg.GetExtStroke(); // get edited ExtStroke from dialog
489  eFi = dlg.GetExtFill(); // get edited ExtFill from dialog
490 
491  if ( !hit->GetSelected() )
492  {
493  hit->SetFill( eFi.Get( hit->GetFill() ) );
494  hit->SetStroke( eSt.Get( hit->GetStroke() ) );
495  }
496  else
498  }
499  //SetCustomColors(dlg.GetCustomColors());
500  }
501  hit->SetSelected( hitSel );
502  objects->SetSpecificFlags( false, a2dCanvasOFlags::BIN2 );
503  }
504  }
505  else
506  {
507  {
509  if ( (wire && wire->GetSelected() ) || (wire && !noHandleEditForWire ) || !wire )
510  {
511  hit->SetSelected( m_modehitLastSelectState );
512  GetDrawingPart()->SetCursor( a2dCanvasGlobals->GetCursor( a2dCURSOR_Select ) );
513  m_mode = mode_edit;
514  PushEditTool( hit );
515  }
516  }
517  }
518  }
519 }
520 
int WorldToDeviceXRel(double x) const
convert x relative from world to device coordinates
Definition: drawer2d.h:460
a2dCanvasObjectPtr m_canvasobject
This is the object currently edited.
Definition: sttool.h:381
bool SetSpecificFlags(bool setOrClear, a2dCanvasObjectFlagsMask which, const wxString &classname=wxT(""), a2dCanvasObjectFlagsMask whichobjects=a2dCanvasOFlags::ALL, const a2dBoundingBox &bbox=wxNonValidBbox, const a2dAffineMatrix &tworld=a2dIDENTITY_MATRIX)
set all given bit flags at once recursive for all objects in given boundingbox
Definition: objlist.cpp:519
#define wxDynamicCast(obj, className)
Define wxDynamicCast so that it will give a compiler error for unrelated types.
Definition: gen.h:75
Base class for all types of strokes, understood by a2dDrawer2D classes.
Definition: stylebase.h:378
void SetRoot(a2dDrawing *root, bool recurse=true)
Sets this object to a a2dCanvasDocument.
Definition: canobj.cpp:5933
bool m_pending
set when tool needs an redraw (after a a2dCanvas Repaint etc.)
Definition: tools.h:814
bool PushTool(a2dBaseTool *tool)
specialize to keep first tool on the stack active
Definition: sttool.cpp:451
wxUint16 m_layer
layer for a new object
Definition: tools.h:832
void SetShowAnotation(bool show)
when true anotation will be shown, if used inside a tool
Definition: tools.h:564
int WorldToDeviceY(double y) const
convert y from world to device coordinates
Definition: drawer2d.h:455
wxCursor m_toolcursor
cursor to use
Definition: tools.h:768
void SetFilename(const wxFileName &filename, bool notifyViews=false)
Sets the filename for this document. Usually called by the framework.
static const a2dCanvasObjectFlagsMask BIN2
Definition: candefs.h:193
int m_x
x of mouse in device
Definition: sttool.h:352
a2dCanvasObjectPtr m_original
This is the original object selected for editing.
Definition: sttool.h:388
The a2dStTool is used to derive tools from.
Definition: sttool.h:115
void SetOneShot()
Only one action of the tool, after that it will ask the controller to stop this tool.
Definition: tools.h:430
a2dDrawingPart * GetDrawingPart()
Access to the tool controllers drawer.
Definition: tools.h:632
virtual bool Update(UpdateMode mode)
Update the state of the object according to its current position etc.
Definition: canobj.cpp:5149
Defines a font to be set to a2dDrawer2D or stored in a2dCanvsObject etc.
Definition: stylebase.h:779
a2dStToolContr * m_stcontroller
controller for canvas
Definition: sttool.h:391
a2dDrawing * GetDrawing()
Returns a pointer to the drawing.
Definition: tools.cpp:969
wxString m_anotation
anotation string, which is in general modified by the tools to display position etc.
Definition: sttool.h:340
void Update(unsigned int how=(a2dCANVIEW_UPDATE_ALL|a2dCANVIEW_UPDATE_BLIT), wxObject *hintObject=NULL)
see OnUpdate
Definition: drawer.cpp:1744
bool m_anotate
when true anotation will be shown, if used inside a tool
Definition: tools.h:839
virtual void SetPending(bool pending)
set this object pending for update
Definition: canobj.cpp:2585
bool GetYaxis() const
get y axis orientation
Definition: drawer2d.h:280
bool m_active
tool is operational
Definition: tools.h:777
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
virtual void FinishBusyMode(bool closeCommandGroup=true)
Called when the user finishes editing a distinct object */.
Definition: sttool.cpp:1161
double GetWidth() const
return width
Definition: canprim.h:337
a2dError FileNew(a2dDocumentPtr &doc, a2dTemplateFlagMask docTemplateFlags=a2dTemplateFlag::VISIBLE)
Creates a document from a list of templates (if more than one template).
Definition: doccom.cpp:535
a2dCanvasObject is the base class for Canvas Objects.
Definition: canobj.h:371
void SetSize(double size)
Set the font size.
Definition: stylebase.cpp:2909
virtual void GenerateAnotation()
to display a string along with a tool drawing.
Definition: edsttool.cpp:63
Docview framework its controlling class.
void Zoomout()
show all on canvas
Definition: sttool.cpp:378
void SetWidth(double w)
set width of rectangle
Definition: canprim.h:328
a2dCanvasObjectList * GetChildObjectList()
get the list where the child objects are stored in.
Definition: canobj.cpp:2551
bool GetSelected() const
is the object selected flag set
Definition: canobj.h:1603
void SetSelected(bool selected)
Set the object selected flag if allowed.
Definition: canobj.h:1620
a2dStroke m_stroke
stroke for new object
Definition: tools.h:826
bool EnterBusyMode()
starts a new action (e.g drawing something ) in a tool that is already pushed.
Definition: sttool.cpp:1731
void ZoomUndo()
go to previous zoom area (used while another tool is active)
Definition: sttool.cpp:362
int WorldToDeviceYRel(double y) const
convert y relative from world to device coordinates
Definition: drawer2d.h:465
void SetHeight(double h)
set height of rectangle
Definition: canprim.h:334
a2dWirePolylineL is a polyline that adjusts itself when the objects it connects move ...
Definition: wire.h:42
a2dDrawer2D * GetDrawer2D()
Access to the tool controllers drawers drawer2d.
Definition: tools.cpp:959
base for tools that draw and are stack based.
Definition: sttool.h:427
double GetMinX() const
get minimum X of the boundingbox
Definition: bbox.cpp:304
a2dFill m_fill
fill for new object
Definition: tools.h:823
void AddAnotationToPendingUpdateArea()
after calculating anotation position and string, extend the boundingbox of the tools with it...
Definition: sttool.cpp:1358
The a2dStToolContr is a Tool Controller specialized for working with a2dCanvasView.
Definition: sttool.h:485
wxWindow * GetDisplayWindow()
Access to the tool controllers drawers canvas.
Definition: tools.cpp:964
double GetPosX() const
get x position from affine matrix
Definition: canobj.h:527
bool m_editatend
when drawing something editing must follow, using the a2dRecursiveEditTool
Definition: sttool.h:409
wxCursor m_toolBusyCursor
cursor to use when the tool is busy doing something.
Definition: tools.h:771
#define wxStaticCast(obj, className)
The wxWindows 2.4.2 wxStaticCast is buggy. It evaluates its argument twice.
Definition: gen.h:123
a2dCanvasObject * GetShowObject() const
return pointer of then currently shown object on the drawer.
Definition: drawer.h:680
bool m_oneshot
do it only once
Definition: tools.h:817
int m_yanotation
y position of anotation text
Definition: sttool.h:346
objects which fit the mask are given a new fill and stroke style
Definition: drawing.h:3525
A2DGENERALDLLEXP a2dSmrtPtr< a2dGeneralGlobal > a2dGeneralGlobals
a global pointer to get to global instance of important classes.
Definition: comevt.cpp:1148
Restriction engine for editing restrictions like snapping.
Definition: restrict.h:88
int WorldToDeviceX(double x) const
convert x from world to device coordinates
Definition: drawer2d.h:453
a2dDrawer2D * GetDrawer2D()
get the internal m_drawer2D that is used for rendering the document
Definition: drawer.h:1125
if set, respect layer order, hit testing is done per layer from the top.
Definition: canobj.h:82
static const a2dCanvasObjectFlagsMask SELECTED
Definition: candefs.h:180
a2dError FileOpenCheck(a2dDocumentPtr &doc, const wxFileName &file, bool checkModification)
Return existing document, or open it from file.
Definition: doccom.cpp:612
wxURI GetURI() const
quick way to get to PROPID_URI property
Definition: gen.cpp:1650
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 SetLastXyEntry(double x, double y)
set last mouse X position in world coordinates, as set by tools.
Definition: canglob.h:774
double m_xwprev
x world coordinates old or new value of mouse
Definition: sttool.h:363
bool ShowDlgStyle(bool onOff)
show style dialog or not, return true of changed from previous state
Definition: drawing.cpp:6095
double GetPosY() const
get y position from affine matrix
Definition: canobj.h:530
Interactive Insertion of an text object with a wxURI Object.
Definition: edsttool.h:39
All updates of these modes force an update (e.g. update non-pending valid bounding boxes) ...
Definition: canobj.h:1107
const a2dFont * a2dDEFAULT_CANVASFONT
global a2dFont stock object for default font
virtual bool Submit(a2dCommand *command, bool storeIt=true)
Definition: drawing.cpp:5966
a2dDocviewGlobal * a2dDocviewGlobals
a global pointer to get to global instance of important classes.
Definition: doccom.cpp:2348
void SetStroke(const wxColour &strokecolor, double width=0, a2dStrokeStyle style=a2dSTROKE_SOLID)
Set a stroke for the object which will be used instead of the layer stroke.
Definition: canobj.cpp:2924
int m_y
y of mouse in device
Definition: sttool.h:354
a2dRestrictionEngine * GetRestrictionEngine()
Get restriction engine (grid snapping)
Definition: canglob.cpp:934
a2dCanvasCommandProcessor * GetCanvasCommandProcessor()
get a pointer to the command processor
Definition: drawing.cpp:375
virtual void CleanupToolObjects()
Cleanup the editcopy other tool objects (e.g. decorations)
Definition: sttool.cpp:1265
double GetMaxY() const
get maximum Y of the boundingbox
Definition: bbox.cpp:322
to display a2dCanvasObject references
Definition: recurdoc.h:122
a2dCanvasObject * IsHitWorld(double x, double y, int layer=wxLAYER_ALL, a2dHitOption option=a2dCANOBJHITOPTION_NONE, bool filterSelectableLayers=false)
do a hittest on the view at coordinates x,y
Definition: drawer.cpp:1565
void SetFont(const a2dFont &font)
used for to set the font for non Text objects
Definition: canglob.cpp:971
Master tool for objects graphics slecting and dragging.
const a2dStroke * a2dTRANSPARENT_STROKE
global a2dStroke stock object for TRANSPARENT stroking
void GetTextExtent(const wxString &string, wxCoord *w, wxCoord *h, wxCoord *descent=NULL, wxCoord *externalLeading=NULL)
return text extends of string
Definition: sttool.cpp:1069
a2dDocumentCommandProcessor * GetDocviewCommandProcessor() const
Gets a2dDocumentCommandProcessor pointer.
Definition: doccom.h:1034
a2dRect
Definition: canprim.h:440
void SetTitle(const wxString &title, bool notifyViews=false)
Sets the title for this document.
stack based tools controller and tools for drawing and editing.
a2dCanvasGlobal * a2dCanvasGlobals
global a2dCanvasGlobal to have easy access to global settings
Definition: canglob.cpp:1234
all headers of the canvas module
void MouseToToolWorld(int x, int y, double &xWorldLocal, double &yWorldLocal)
calculate world coordinates from devide coordinates
Definition: sttool.cpp:1622
void SetCursorType(const wxCursor &cursor)
Sets cursor which the tool should use when started.
Definition: tools.h:582
holds one error report.
Definition: gen.h:623
void AddCurrent(a2dCanvasObject *objectToAdd)
add the current canvas object to parent as child
Definition: sttool.cpp:1087
bool GetBusy()
Check if the tool is busy editing a distinct object */.
Definition: tools.h:513
double GetHeight() const
return height
Definition: canprim.h:339
void SetBusyCursorType(const wxCursor &cursor)
Sets cursor which the tool should use when busy.
Definition: tools.h:591
virtual void SetLayer(wxUint16 layer)
set layer index where this object is drawn upon.
Definition: canobj.cpp:5920
int m_xanotation
x position of anotation text
Definition: sttool.h:343
void StopTool(bool abort=false)
call to stop a tool, internal and external.
Definition: tools.cpp:785
Interactive follow link.
Definition: edsttool.h:84
virtual void CloseCommandGroup()
called when ending an editing operation (e.g. mouse up)
Definition: tools.cpp:883
a2dBoundingBox & GetBbox()
get boundingbox in world coordinates exclusive stroke width relative to its parent ...
Definition: canobj.cpp:3175
virtual bool RestrictPoint(double &x, double &y, wxUint32 sourceRequired=snapToAll, bool ignoreEngine=false)
Restrict a single point of a line or polyline.
Definition: restrict.cpp:227
void SetFill(const a2dFill &fill)
Set a fill for the object which will be used instead of the layer fill.
Definition: canobj.cpp:2874
void StartToEdit(a2dCanvasObject *startObject)
start editing this object
Definition: edit.cpp:1445
const a2dFill * a2dTRANSPARENT_FILL
global a2dFill stock object for TRANSPARENT filling
#define a2dREFOBJECTPTR_KEEPALIVE
Definition: gen.h:1631
edsttool.cpp Source File -- Sun Oct 12 2014 17:04:19 -- Sun Oct 12 2014 -- 1.8.5 -- wxArt2D -- . -- Main Page Reference Documentation