40 EVT_MOUSE_EVENTS( a2dSimpleEditPolygonTool::OnMouseEvent )
41 EVT_CHAR( a2dSimpleEditPolygonTool::OnChar )
53 m_preserve_RouteWhenDrag =
false;
56 GetDrawingPart()->SetMouseEvents(
false );
59 a2dSimpleEditPolygonTool::~a2dSimpleEditPolygonTool()
78 void a2dSimpleEditPolygonTool::FinishBusyMode()
104 SearchPinForFinishWire(
GetDrawingPart()->GetShowObject(), pin, NULL, hitDistance );
139 void a2dSimpleEditPolygonTool::OnChar( wxKeyEvent& event )
144 void a2dSimpleEditPolygonTool::OnMouseEvent( wxMouseEvent& event )
161 if ( ( event.LeftDown() ||
event.Dragging() ) && !
GetBusy() )
172 a2dVertexList::iterator iter = poly->
GetSegments()->begin();
173 a2dVertexList::iterator iterorg = original->GetSegments()->begin();
178 iter = poly->GetSegmentAtIndex( index );
179 iterorg = original->GetSegmentAtIndex( index );
183 case action_movevertex:
188 case action_movesegment:
193 case action_insertvertex:
194 if ( event.AltDown() )
207 poly->SetVisiblechilds(
true );
241 else if( ( event.LeftDown() ||
event.LeftUp() ||
event.Dragging() ) &&
GetBusy() &&
m_handle )
247 if ( event.LeftDown() )
254 if( event.LeftUp() &&
GetBusy() )
273 PrepareForRewire( dragList,
true,
false,
false,
true, &refs );
300 EVT_MOUSE_EVENTS( a2dMasterDrawBase::OnMouseEvent )
301 EVT_CHAR( a2dMasterDrawBase::OnChar )
302 EVT_KEY_DOWN( a2dMasterDrawBase::OnKeyDown )
303 EVT_KEY_UP( a2dMasterDrawBase::OnKeyUp )
307 m_dlgOrEdit( false ),
308 m_dlgOrEditModal( false ),
309 m_escapeToStopFirst( true ),
314 m_styleDlgSimple =
false;
315 m_hadDoubleClick =
false;
316 m_dragStarted =
false;
318 m_select_undo =
false;
319 m_lateconnect =
true;
320 m_wiringMode = a2d_StartGenerateSearchFinish;
324 m_vertexSegmentEdit =
false;
326 m_allowMultiEdit =
true;
337 if ( GetDrawingPart()->GetDrawer2D()->HasAlpha() || GetDrawingPart()->GetTrippleBufHasAlpha() )
339 SetFill(
a2dFill( wxColour( 66, 159, 235, 150 ) ) );
341 m_selectFill =
a2dFill( wxColour( 233, 15, 23, 150 ) );
357 void a2dMasterDrawBase::SetLastSelected(
a2dCanvasObject* lastSelect,
bool onOff )
372 wxMouseEvent& event )
377 eventnew.m_shiftDown =
event.m_shiftDown;
378 eventnew.m_controlDown =
event.m_controlDown;
379 eventnew.m_leftDown =
event.m_leftDown;
380 eventnew.m_middleDown =
event.m_middleDown;
381 eventnew.m_rightDown =
event.m_rightDown;
382 eventnew.m_altDown =
event.m_altDown;
383 eventnew.SetEventObject(
this);
384 eventnew.SetId( event.GetId());
404 void a2dMasterDrawBase::MouseDump( wxMouseEvent& event, wxString strinfo )
406 int x =
event.GetX();
407 int y =
event.GetY();
408 double xwprev, ywprev;
411 if ( event.LeftDown() )
412 strinfo <<
"LeftDown";
413 if ( event.LeftUp() )
415 if ( event.LeftDClick() )
416 strinfo <<
"LeftDoubleClick";
417 if ( event.RightDClick() )
418 strinfo <<
"RightDoubleClick";
419 if ( event.Dragging() )
420 strinfo <<
"Dragging";
421 if ( event.Moving() )
424 if ( event.ShiftDown() )
426 if ( event.ControlDown() )
428 if ( event.AltDown() )
431 wxLogDebug( strinfo );
435 void a2dMasterDrawBase::PushZoomTool()
452 m_endSegmentMode = mode;
455 void a2dMasterDrawBase::PushDrawWireTool(
a2dCanvasObject* WXUNUSED( hit ) )
459 tool->SetWiringMode( m_wiringMode );
466 SelectHitObject( hit );
485 tool->StartDragging(
m_x,
m_y, hit );
488 void a2dMasterDrawBase::PushDragMultiTool(
a2dCanvasObject* hit,
bool onlyKeys )
508 mdt->SetOnlyKeys( onlyKeys );
510 mdt->StartDragging(
m_x,
m_y, hit );
514 mdt2->StartDragging(
m_x,
m_y, hit );
519 SelectHitObject( hit );
549 mdt->StartDragging(
m_x,
m_y, hit );
552 mdt2->StartDragging(
m_x,
m_y, hit );
555 void a2dMasterDrawBase::PushSelectTool()
577 void a2dMasterDrawBase::PushDeSelectTool()
598 void a2dMasterDrawBase::PushEditWireVertexTool(
a2dCanvasObject* hit,
int vertex )
601 SelectHitObject( hit );
602 a2dSimpleEditPolygonTool* tool =
new a2dSimpleEditPolygonTool(
GetStToolContr(), hit, vertex, poly->
GetSegments()->size(), a2dSimpleEditPolygonTool::action_movevertex );
611 void a2dMasterDrawBase::PushEditSegmentTool(
a2dCanvasObject* hit,
int segment )
614 SelectHitObject( hit );
615 a2dSimpleEditPolygonTool* tool =
new a2dSimpleEditPolygonTool(
GetStToolContr(), hit, segment, poly->
GetSegments()->size(), a2dSimpleEditPolygonTool::action_movesegment );
624 void a2dMasterDrawBase::PushEditWireSegmentHorizontalTool(
a2dCanvasObject* hit,
int segment )
627 SelectHitObject( hit );
637 void a2dMasterDrawBase::PushEditWireSegmentVerticalTool(
a2dCanvasObject* hit,
int segment )
640 SelectHitObject( hit );
650 void a2dMasterDrawBase::PushEditWireSegmentInsertTool(
a2dCanvasObject* hit,
int segment )
653 SelectHitObject( hit );
665 SelectHitObject( hit );
689 tool->StartEditingSelected();
730 void a2dMasterDrawBase::EditDlgOrHandles(
a2dCanvasObject* hit,
bool modifier,
bool noHandleEditForWire )
745 if ( !m_dlgOrEditModal )
747 else if ( m_styleDlgSimple )
758 bool showStyleDlg =
false;
759 bool showFontDlg =
false;
760 bool withFill =
false;
772 textobjects.push_back( obj );
774 primitiveobjects.push_back( obj );
780 objects = &textobjects;
785 objects = &primitiveobjects;
798 if ( nrst + nrfi == 0 )
803 showStyleDlg =
false;
806 withFill = 0 != nrfi;
812 dlg.SetUnitsScale(
GetDrawing()->GetUnitsScale() );
814 dlg.SetExtStroke(eSt);
817 if ( wxID_OK == dlg.ShowModal() )
819 eSt = dlg.GetExtStroke();
820 eFi = dlg.GetExtFill();
821 eFo = dlg.GetExtFont();
825 hit->
SetFill( eFi.Get( hit->GetFill() ) );
826 hit->
SetStroke( eSt.Get( hit->GetStroke() ) );
838 else if ( showStyleDlg )
841 dlg.SetUnitsScale(
GetDrawing()->GetUnitsScale() );
843 dlg.SetExtStroke(eSt);
846 if ( wxID_OK == dlg.ShowModal() )
848 eSt = dlg.GetExtStroke();
849 eFi = dlg.GetExtFill();
853 hit->
SetFill( eFi.Get( hit->GetFill() ) );
854 hit->
SetStroke( eSt.Get( hit->GetStroke() ) );
866 a2dStyleDialog styleDlg(
GetDrawing()->GetHabitat(), NULL, wxDEFAULT_DIALOG_STYLE | wxDIALOG_NO_PARENT | wxMINIMIZE_BOX | wxMAXIMIZE_BOX,
true );
867 styleDlg.SetFill( hit->GetFill() );
868 styleDlg.SetStroke( hit->GetStroke() );
869 if ( styleDlg.ShowModal() == wxID_OK )
873 hit->
SetFill( styleDlg.GetFill() );
884 if ( (wire && wire->
GetSelected() ) || (wire && !noHandleEditForWire ) || !wire )
905 void a2dMasterDrawBase::OnChar( wxKeyEvent& event )
907 switch( event.GetKeyCode() )
933 switch( event.GetKeyCode() )
950 void a2dMasterDrawBase::OnKeyDown( wxKeyEvent& event )
955 switch( event.GetKeyCode() )
959 if ( m_escapeToStopFirst && first && first->
AllowPop() )
977 switch( event.GetKeyCode() )
981 if ( !first || ( first && !first->
GetBusy() ) )
995 m_vertexSegmentEdit =
true;
1007 if ( !first || ( first && !first->
GetBusy() ) )
1026 case WXK_NUMPAD_ENTER:
1031 case WXK_NUMPAD_ADD:
1033 if ( event.m_controlDown )
1039 case WXK_NUMPAD_SUBTRACT:
1041 if ( event.m_controlDown )
1070 PushDragMultiTool( selected,
true );
1082 void a2dMasterDrawBase::OnKeyUp( wxKeyEvent& event )
1090 switch( event.GetKeyCode() )
1095 m_vertexSegmentEdit =
false;
1110 void a2dMasterDrawBase::OnMouseEvent( wxMouseEvent& event )
1123 if( event.LeftDown() )
1140 PushDragTool( m_modehit );
1144 PushCopyTool( m_modehit );
1147 case mode_dragmulti:
1148 PushDragMultiTool( m_modehit );
1151 case mode_copymulti:
1152 PushCopyMultiTool( m_modehit );
1157 PushMovePinTool( m_modehit );
1162 PushDrawWireTool( m_modehit );
1165 case mode_editwire_vertex:
1166 PushEditWireVertexTool( m_modehit, m_modehitinfo.
m_index );
1169 case mode_editwire_segmenthorizontal:
1170 PushEditWireSegmentHorizontalTool( m_modehit, m_modehitinfo.
m_index );
1173 case mode_editwire_segmentvertical:
1174 PushEditWireSegmentVerticalTool( m_modehit, m_modehitinfo.
m_index );
1177 case mode_editwire_segmentinsert:
1178 PushEditWireSegmentInsertTool( m_modehit, m_modehitinfo.
m_index );
1181 case mode_editwire_segment:
1182 PushEditSegmentTool( m_modehit, m_modehitinfo.
m_index );
1200 if ( m_select_undo )
1258 void a2dMasterDrawBase::SelectedStatus()
1265 wxString state, form;
1267 state.Printf( form, bbox.
GetMinX()*unitScale, bbox.
GetMinY()*unitScale );
1268 SetStateString( state, 10 );
1271 SetStateString( state, 11 );
1282 EVT_MOUSE_EVENTS( a2dMasterDrawSelectFirst::OnMouseEvent )
1283 EVT_CHAR( a2dMasterDrawSelectFirst::OnChar )
1284 EVT_KEY_DOWN( a2dMasterDrawSelectFirst::OnKeyDown )
1285 EVT_KEY_UP( a2dMasterDrawSelectFirst::OnKeyUp )
1293 a2dMasterDrawSelectFirst::~a2dMasterDrawSelectFirst()
1297 void a2dMasterDrawSelectFirst::OnChar( wxKeyEvent& event )
1299 switch( event.GetKeyCode() )
1310 void a2dMasterDrawSelectFirst::OnKeyDown( wxKeyEvent& event )
1321 switch( event.GetKeyCode() )
1346 void a2dMasterDrawSelectFirst::OnKeyUp( wxKeyEvent& event )
1354 switch( event.GetKeyCode() )
1358 m_spaceDown =
false;
1377 m_mode = mode_select;
1380 m_modehitinfo =
a2dHit();
1398 if ( m_vertexSegmentEdit )
1401 float minDist = FLT_MAX;
1402 for( i = 0; i < hitinfo.
m_extended.size(); i++ )
1405 if( wire2 && hitinfo.
m_extended[i].GetHitType().m_distance < minDist && hitinfo.
m_extended[i].GetHitType().IsDirectStrokeHit() )
1418 m_modehitinfo = how2;
1419 switch( how2.m_stroke2 )
1421 case a2dHit::stroke2_vertex:
1423 m_mode = mode_editwire_vertex;
1425 case a2dHit::stroke2_edgehor:
1427 m_mode = mode_editwire_segmenthorizontal;
1429 case a2dHit::stroke2_edgevert:
1431 m_mode = mode_editwire_segmentvertical;
1433 case a2dHit::stroke2_edgeother:
1435 m_mode = mode_editwire_segmentinsert;
1440 m_modehitinfo =
a2dHit();
1446 if ( m_mode == mode_none )
1448 if ( !shift && !control )
1464 m_mode = mode_move_pin;
1471 m_mode = mode_drawwire;
1483 m_mode = mode_copymulti;
1488 m_mode = mode_dragmulti;
1494 m_mode = mode_select;
1497 m_mode = mode_select;
1507 void a2dMasterDrawSelectFirst::OnMouseEvent( wxMouseEvent& event )
1521 ic.SetLayer( wxLAYER_ALL );
1525 if ( event.ShiftDown() &&
event.ControlDown() )
1533 if ( hit && event.LeftDClick() && !
GetBusy() )
1549 PushEditTool( m_modehit );
1553 m_mode = mode_multiedit;
1554 PushMultiEditTool( m_modehit );
1557 else if ( event.Moving() && !
GetBusy() )
1559 DecideMode( hit, hitinfo, event.ShiftDown(),
event.ControlDown() );
1562 else if( event.LeftDown() && !
GetBusy() )
1570 case mode_dragmulti:
1571 PushDragMultiTool( NULL );
1574 case mode_copymulti:
1575 PushCopyMultiTool( NULL );
1591 case mode_editwire_vertex:
1592 case mode_editwire_segmenthorizontal:
1593 case mode_editwire_segmentvertical:
1594 case mode_editwire_segmentinsert:
1595 case mode_editwire_segment:
1605 else if( event.RightDown() && !
GetBusy() )
1623 EVT_MOUSE_EVENTS( a2dMasterDrawZoomFirst::OnMouseEvent )
1624 EVT_CHAR( a2dMasterDrawZoomFirst::OnChar )
1625 EVT_KEY_DOWN( a2dMasterDrawZoomFirst::OnKeyDown )
1626 EVT_KEY_UP( a2dMasterDrawZoomFirst::OnKeyUp )
1635 a2dMasterDrawZoomFirst::~a2dMasterDrawZoomFirst()
1663 case mode_cntrlselect:
1679 void a2dMasterDrawZoomFirst::OnChar( wxKeyEvent& event )
1696 case mode_cntrlselect:
1714 void a2dMasterDrawZoomFirst::OnKeyDown( wxKeyEvent& event )
1725 switch( event.GetKeyCode() )
1740 void a2dMasterDrawZoomFirst::OnKeyUp( wxKeyEvent& event )
1748 switch( event.GetKeyCode() )
1752 m_spaceDown =
false;
1763 void a2dMasterDrawZoomFirst::OnMouseEvent( wxMouseEvent& event )
1777 ic.SetLayer( wxLAYER_ALL );
1785 if ( event.LeftDClick() && !m_toolBusy && !
GetBusy() )
1802 if ( i > 1 && m_allowMultiEdit )
1804 m_mode = mode_multiedit;
1805 PushMultiEditTool( m_modehit );
1847 PushEditTool( m_modehit );
1852 else if ( event.Dragging() && m_toolBusy && !
m_dragStarted && !
event.AltDown() )
1857 if ( event.ControlDown() && !
event.ShiftDown() )
1860 m_mode = mode_cntrlselect;
1862 else if ( !event.ControlDown() &&
event.ShiftDown() )
1865 m_mode = mode_select;
1871 if ( event.ControlDown() &&
event.ShiftDown() )
1873 m_mode = mode_copymulti;
1878 m_mode = mode_dragmulti;
1894 case mode_cntrlselect:
1903 if ( m_mode == mode_select || m_mode == mode_cntrlselect )
1927 case mode_dragmulti:
1930 PushDragMultiTool( m_modehit );
1934 case mode_copymulti:
1937 PushCopyMultiTool( m_modehit );
1952 case mode_cntrlselect:
1997 else if ( event.Moving() && !
GetBusy() )
2001 m_modehitinfo =
a2dHit();
2003 if ( event.ControlDown() && !
event.ShiftDown() )
2010 m_mode = mode_cntrlselect;
2012 else if ( !event.ControlDown() &&
event.ShiftDown() )
2019 m_mode = mode_select;
2033 if ( m_vertexSegmentEdit )
2036 float minDist = FLT_MAX;
2037 for( i = 0; i < hitinfo.
m_extended.size(); i++ )
2040 if( wire2 && hitinfo.
m_extended[i].GetHitType().m_distance < minDist && hitinfo.
m_extended[i].GetHitType().IsDirectStrokeHit() )
2053 m_modehitinfo = how2;
2054 switch( how2.m_stroke2 )
2056 case a2dHit::stroke2_vertex:
2058 m_mode = mode_editwire_vertex;
2060 case a2dHit::stroke2_edgehor:
2062 m_mode = mode_editwire_segmenthorizontal;
2064 case a2dHit::stroke2_edgevert:
2066 m_mode = mode_editwire_segmentvertical;
2068 case a2dHit::stroke2_edgeother:
2070 m_mode = mode_editwire_segmentinsert;
2075 m_modehitinfo =
a2dHit();
2081 if ( m_mode == mode_none )
2083 if ( !event.ShiftDown() && !
event.ControlDown() )
2096 if ( wire && wire->
GetSelected() || m_vertexSegmentEdit )
2106 m_mode = mode_move_pin;
2113 m_mode = mode_drawwire;
2122 if ( event.ControlDown() &&
event.ShiftDown() )
2124 m_mode = mode_copymulti;
2129 m_mode = mode_dragmulti;
2147 else if( event.LeftDown() && !
GetBusy() )
2169 case mode_dragmulti:
2170 case mode_copymulti:
2177 case mode_editwire_vertex:
2178 case mode_editwire_segmenthorizontal:
2179 case mode_editwire_segmentvertical:
2180 case mode_editwire_segmentinsert:
2181 case mode_editwire_segment:
2246 case mode_cntrlselect:
2274 else if( event.LeftUp() && m_toolBusy )
2278 m_modehitLastSelectState =
false;
2280 m_modehitLastSelectState = m_modehit->
GetSelected();
2283 if ( event.ControlDown() )
2289 else if ( event.ShiftDown() )
2325 else if( event.RightDown() && !
GetBusy() )
2340 const long SUBMASTER_PUSHTOOL = wxNewId();
2341 const long SUBMASTER_MENUTOOL_DRAG = wxNewId();
2342 const long SUBMASTER_MENUTOOL_REC = wxNewId();
2343 const long SUBMASTER_MENUTOOL_EDIT = wxNewId();
2352 EVT_MOUSE_EVENTS( a2dSubDrawMasterTool::OnMouseEvent )
2353 EVT_CHAR( a2dSubDrawMasterTool::OnChar )
2362 m_mousemenu =
new wxMenu( _(
"Tool menu" ), (
long )0 );
2368 AppendTool( tool,
new wxMenuItem( m_mousemenu, SUBMASTER_MENUTOOL_DRAG, _(
"drag" ), _(
"pushes drag tool" ) ),
'd' );
2372 AppendTool( edit,
new wxMenuItem( m_mousemenu, SUBMASTER_MENUTOOL_EDIT, _(
"edit" ), _(
"pushes edit tool" ) ),
'e' );
2376 AppendTool( drawrec,
new wxMenuItem( m_mousemenu, SUBMASTER_MENUTOOL_REC, _(
"draw rectangle" ), _(
"pushes draw rectangle tool" ) ),
'r' );
2378 m_curTool = drawrec;
2381 a2dSubDrawMasterTool::~a2dSubDrawMasterTool()
2385 void a2dSubDrawMasterTool::OnPostPushTool()
2391 void a2dSubDrawMasterTool::AppendTool(
a2dBaseTool* tool, wxMenuItem* menuItem, wxChar key )
2407 void a2dSubDrawMasterTool::OnChar( wxKeyEvent& WXUNUSED( event ) )
2414 void a2dSubDrawMasterTool::OnMouseEvent( wxMouseEvent& event )
2434 if ( event.Moving() && !
GetBusy() )
2441 else if( event.LeftDown() && !
GetBusy() )
2450 void a2dSubDrawMasterTool::PushToolFromMouseMenu( wxCommandEvent& event )
2469 EVT_MOUSE_EVENTS( a2dGraphicsMasterTool::OnMouseEvent )
2470 EVT_CHAR( a2dGraphicsMasterTool::OnChar )
2471 EVT_KEY_DOWN( a2dGraphicsMasterTool::OnKeyDown )
2484 a2dGraphicsMasterTool::~a2dGraphicsMasterTool()
2505 if ( event.Moving() && !
GetBusy() && !
event.ShiftDown() && !
event.ControlDown() )
2566 if ( event.Moving() && !
GetBusy() )
2570 m_modehitinfo =
a2dHit();
2581 if ( !event.ShiftDown() && !
event.ControlDown() )
2597 if ( wire && wire->
GetSelected() || m_vertexSegmentEdit )
2648 float minDist = FLT_MAX;
2649 for( i = 0; i < hitinfo.
m_extended.size(); i++ )
2652 if( wire2 && hitinfo.
m_extended[i].GetHitType().m_distance < minDist && hitinfo.
m_extended[i].GetHitType().IsDirectStrokeHit() )
2665 m_mode = mode_drawwire;
2668 else if ( wire && event.ShiftDown() )
2673 m_modehitinfo = how2;
2674 switch( how2.m_stroke2 )
2676 case a2dHit::stroke2_vertex:
2678 m_mode = mode_editwire_vertex;
2680 case a2dHit::stroke2_edgehor:
2682 m_mode = mode_editwire_segmenthorizontal;
2684 case a2dHit::stroke2_edgevert:
2686 m_mode = mode_editwire_segmentvertical;
2688 case a2dHit::stroke2_edgeother:
2690 m_mode = mode_editwire_segmentinsert;
2695 m_modehitinfo =
a2dHit();
2704 if( !event.ControlDown() )
2710 m_mode = mode_dragmulti;
2727 m_mode = mode_copymulti;
2742 m_mode = mode_select;
2748 m_mode = mode_select;
2755 m_mode = mode_select;
2760 else if( event.LeftDown() && !
GetBusy() )
2769 case mode_dragmulti:
2771 case mode_copymulti:
2773 case mode_editwire_vertex:
2774 case mode_editwire_segmenthorizontal:
2775 case mode_editwire_segmentvertical:
2776 case mode_editwire_segmentinsert:
2777 case mode_editwire_segment:
2794 if ( m_select_undo )
static const a2dCanvasObjectFlagsMask SELECTED2
a2dHit m_how
return in which way the object was hit (stroke, fill, ...)
void PushCursor(const wxCursor &cursor)
push a cursor on the cursor stack, and set display cursor to new back being cursor.
int WorldToDeviceXRel(double x) const
convert x relative from world to device coordinates
void SetEndSegmentMode(a2dNextSeg mode)
wxPoint2DDouble a2dPoint2D
this to define if coordinate numbers are integer or doubles
double GetHeight() const
returns height of the boundingbox
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
#define wxDynamicCast(obj, className)
Define wxDynamicCast so that it will give a compiler error for unrelated types.
Base class for all types of strokes, understood by a2dDrawer2D classes.
unsigned int m_index
For edge/vertex hits the index of the edge / vertex.
bool RotateObject90LeftRight(bool right)
rotate object of first tool on the stack, when appropriate.
~a2dMasterDrawBase()
destructor
void ClearCorridorPath(bool uncapture)
Reset all corridor paths and uncapture object.
class to map references to objects stored in XML, in order to make the connection later on...
virtual a2dCanvasObject * StartEdit(a2dBaseTool *tool, wxUint16 editmode, wxEditStyle editstyle=wxEDITSTYLE_COPY, a2dRefMap *refs=NULL)
create an editcopy and initialize editing of the editcopy
static const a2dCanvasObjectFlagsMask BIN2
virtual void DoStopTool(bool abort)
to do tool specific stuff to stop a tool. Called from StopTool().
void SetSelected2(bool selected)
Set the object selected2 flag if allowed.
a2dPin is used in a2dCanvasObject to add pins to it.
polygon defined with list of points.
Master tool for objects graphics slecting and dragging nd zooming.
a2dDrawing * GetRoot() const
get a2dCanvasDocument of the object.
generate pins, given Connect/wire pinclass
virtual bool Update(UpdateMode mode)
Update the state of the object according to its current position etc.
void Update(unsigned int how=(a2dCANVIEW_UPDATE_ALL|a2dCANVIEW_UPDATE_BLIT), wxObject *hintObject=NULL)
see OnUpdate
virtual void SetPending(bool pending)
set this object pending for update
object hit should not have select flag set
a2dPin * IsConnectedTo(a2dPin *pin=a2dAnyPin) const
Return the pin to which this pin is connected.
int GetSnapThresHold() const
used to snap vertexes to a pin or point like snapping features in objects.
float m_distance
For margin hits, the distance from the stroke center in fractions of the margin.
double GetWidth() const
return width
double GetBboxMinX()
get minimum X of the boundingbox in world coordinates relative to its parents
a2dCanvasObject is the base class for Canvas Objects.
bool GetRouteWhenDrag()
route also while dragging object
void Render()
implement rendering
a2dPin * FindWirePin(a2dCanvasObjectFlagsMask mask=a2dCanvasOFlags::ALL)
for changing boolean values inside canvas objects
double GetBboxMaxY()
get maximum Y of the boundingbox in world coordinates relative to its parents
void SetWidth(double w)
set width of rectangle
a2dCanvasObjectList * GetChildObjectList()
get the list where the child objects are stored in.
handle holds a pointer to a polygon/polyline segment
bool GetSelected() const
is the object selected flag set
void SetSelected(bool selected)
Set the object selected flag if allowed.
bool IsVisible() const
get visibility (rendering depends on layer settings also)
void RotateRouteMethod()
cycle through routing methods
a2dNextSeg GetEndSegmentMode()
a2dDrawWirePolylineLTool segment mode initilization
int WorldToDeviceYRel(double y) const
convert y relative from world to device coordinates
void SetHeight(double h)
set height of rectangle
static const a2dCanvasObjectFlagsMask PENDING
general style dialog to edit a2dCanvasObject style
a2dWirePolylineL is a polyline that adjusts itself when the objects it connects move ...
bool m_xyRelToChildren
is set, m_x and m_y are supplied relative to the child objects ( object matrix m_world already applie...
wxUint32 m_option
the way to hit/traverse the document.
Interactive (De)selection Selection of an Object(s).
a2dText is an abstract base class.
double DeviceToWorldY(double y) const
convert y from device to world coordinates
bool GetValid() const
returns true if boundingbox is calculated properly and therefore its valid flag is set...
double GetMinX() const
get minimum X of the boundingbox
command on selected objects
void AddPendingUpdateArea(a2dCanvasObject *obj, wxUint8 id=0, bool refsalso=true)
add pending update for the area that is the boundingbox of the given object
void SetIgnorePendingObjects(bool onoff)
Switches ignorance of pending objects on and off.
#define forEachIn(listtype, list)
easy iteration for a2dlist
a2dExtendedResult m_extended
extended result information with e.g path to lead to the nested object hit
delete objects which fit the mask
polyline defined with list of points.
void AddOverlayObject(a2dCanvasObject *obj)
add to list of overlay objects (must be children of m_top)
double GetPosX() const
get x position from affine matrix
static const a2dCanvasObjectFlagsMask SELECTABLE
#define wxStaticCast(obj, className)
The wxWindows 2.4.2 wxStaticCast is buggy. It evaluates its argument twice.
a2dVertexListPtr GetSegments()
Get the list of points ( this is not a copy! )
bool IsInsideHit() const
true if this is a fill hit or an inside stroke hit (parent or child/member)
a2dCanvasObject * GetShowObject() const
return pointer of then currently shown object on the drawer.
void SetSpecificFlags(bool setOrClear, a2dCanvasObjectFlagsMask which)
set all bit flags in object that or true in mask to true or false
void SetMouseEvents(bool onoff)
If not set do not process mouse events.
objects which fit the mask are given a new fill and stroke style
objects which fit the mask are given a new fill and stroke style
void SetUpdatesPending(bool onoff)
Tells the document that an object has changed.
Restriction engine for editing restrictions like snapping.
wxUint16 GetLayer() const
Returns the layer index where this object is drawn upon.
bool HasPins(bool realcheck=false)
are there a2dPin derived children
if set, respect layer order, hit testing is done per layer from the top.
static const a2dCanvasObjectFlagsMask SELECTED
virtual void SetHandleToIndex(a2dPolyHandleL *handle, unsigned int index)
a handle in editing is updated to a segment at index given
editing is completely controlled by tools. No handles are added
a2dCanvasObject * ChildIsHitWorld(a2dIterC &ic, a2dHitEvent &hitEvent, bool filterSelectableLayers=false)
Do hittest on children.
void SetVisible(bool visible)
set if this object will visible (be rendered or not)
void DoStopTool(bool abort)
to do tool specific stuff to stop a tool. Called from StopTool().
A 2x3 affine matrix class for 2D transformations.
Master tool for objects graphics slecting and dragging nd zooming.
virtual bool ZoomSave()
Is Zooming while the tool is busy Save.
a2dPinClass * GetPinClass() const
return the pin class of this pin
double GetMaxX() const
get maximum X of the boundingbox
void InitMouseEvent(wxMouseEvent &eventnew, int x, int y, wxMouseEvent &event)
Interactive Selection of an Object.
bool GetFixedStyle() const
Get object fixed style setting.
bool ShowDlgStyle(bool onOff)
show style dialog or not, return true of changed from previous state
double GetPosY() const
get y position from affine matrix
common stuff for several master tools
while iterating a a2dCanvasDocument, this holds the context.
struct for how a single object on one layer was hit
All updates of these modes force an update (e.g. update non-pending valid bounding boxes) ...
a2dCanvasObject * GetOriginal()
if this is an editcopy, return the orginal else NULL
a2dConnectionGenerator * GetConnectionGenerator() const
Get class for generating new connection objects between object and pins.
virtual bool Submit(a2dCommand *command, bool storeIt=true)
for changing only the matrix of objects for which a certain mask was set
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.
void SetChildrenOnSameLayer(bool samelayer)
if set children are rendered on the same layer as this object.
static const a2dCanvasObjectFlagsMask VISIBLE
a2dRestrictionEngine * GetRestrictionEngine()
Get restriction engine (grid snapping)
double GetUnitsScale()
this is the number that defines the physical dimension in meters / inch/ etc.
a2dConnectionGenerator * GetConnectionGenerator() const
Get class for generating new connection objects between object and pins.
bool GetRelease() const
get release flag
a2dCanvasCommandProcessor * GetCanvasCommandProcessor()
get a pointer to the command processor
double DeviceToWorldX(double x) const
convert x from device to world coordinates
double GetMaxY() const
get maximum Y of the boundingbox
double GetWidth() const
returns width of the boundingbox
select objects in a rectangle area
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
objects which fit the mask are given a new font and other text properties
a2dCanvasObject * Find(a2dCanvasObject *obj) const
return the object if it is part of the list
virtual bool ProcessCanvasObjectEvent(wxEvent &event, bool &isHit, double x, double y, int margin, int layer=wxLAYER_ALL)
Corridor and captured object event processing.
void RemoveOverlayObject(a2dCanvasObject *obj)
remove from the list of overlay objects (must be children of m_top)
a2dPin * GetPin()
see SetPin()
bool GetSelectable() const
is the object selectable flag set
bool FindAndSetCorridorPath(a2dCanvasObject *findObject, bool capture)
Find the show-object child object, set the path to the given child object and capture it...
The a2dBoundingBox class stores one a2dBoundingBox of a a2dCanvasObject.
virtual void SetPinsToBeginState(a2dCanvasObject *root, a2dCanvasObjectFlagsMask mask=a2dCanvasOFlags::VISIBLE)
set begin state of pins, before a tools starts asking feedback or after tool is finsihed ...
void SetRouteWhenDrag(bool routeWhenDrag)
route also while dragging object
double GetMinY() const
get minimum Y of the boundingbox
static a2dPinClass * Any
used to ask for a new default pin on an object.
a2dCanvasGlobal * a2dCanvasGlobals
global a2dCanvasGlobal to have easy access to global settings
all headers of the canvas module
filter on this layer and mask.
void SetSnapThresHold(int thresHold)
used to snap vertexes to a pin or point like snapping features in objects.
void Append(a2dCanvasObject *obj)
append a a2dCanvasObject to the childobjects
double GetHeight() const
return height
a2dCanvasObject * GetParent() const
get parent object of the pin
void PopCursor()
pop a cursor from the cursor stack, and set display cursor to back
virtual void SetLayer(wxUint16 layer)
set layer index where this object is drawn upon.
virtual bool IsConnect() const
return true, if this object is used to connect other object's using rubberband like structures...
virtual bool LinkReferences(bool ignoreNonResolved=false)
link references to their destination
void MouseToToolWorld(int x, int y, double &xWorldLocal, double &yWorldLocal)
edit a copy of the original object
virtual void SetMappingWidthHeight(double vx1, double vy1, double width, double height)
Give the virtual size to be displayed, the mapping matrix will be calculated.
bool GetDraggable() const
get if the object can be dragged
void AbortBusyMode()
Called when the user aborts editing a distinct object */.
void SetPreRenderAsChild(bool prerender)
If set, this object has a higher priority in rendering than other children objects.
a2dBoundingBox & GetBbox()
get boundingbox in world coordinates exclusive stroke width relative to its parent ...
structure to give as parameter to member functions of a2dCanvasObject
void SetFill(const a2dFill &fill)
Set a fill for the object which will be used instead of the layer fill.
snap to pins in other objects
const a2dFill * a2dTRANSPARENT_FILL
global a2dFill stock object for TRANSPARENT filling