34 bool a2dMasterTagGroups3::m_selectMoreAtShift =
false;
39 EVT_MOUSE_EVENTS( a2dMasterTagGroups3 ::OnMouseEvent )
40 EVT_CHAR( a2dMasterTagGroups3 ::OnChar )
41 EVT_KEY_DOWN( a2dMasterTagGroups3 ::OnKeyDown )
42 EVT_KEY_UP( a2dMasterTagGroups3 ::OnKeyUp )
46 a2dMasterTagGroups3 ::a2dMasterTagGroups3 (
a2dStToolContr* controller ):
48 m_AllowDoubleClickModifier( true ),
49 m_shiftWasDown( false ),
50 m_ctrlWasDown( false ),
51 m_altWasDown( false ),
52 m_generatePinsNonWire( true ),
53 m_generatePinsAlsoNonWireMode( true ),
57 m_selectedObjects = NULL;
64 a2dMasterTagGroups3 ::~a2dMasterTagGroups3 ()
67 if ( m_selectedObjects )
68 delete m_selectedObjects;
71 wxString a2dMasterTagGroups3 ::GetToolString()
const
73 wxString str = GetClassInfo()->GetClassName();
75 return str +
" Wires";
105 case mode_cntrlselect:
130 SetToolMode(
false,
false,
false );
135 void a2dMasterTagGroups3::OnComEvent(
a2dComEvent& event )
137 if ( GetEvtHandlerEnabled() )
139 a2dSignal comId =
event.GetId();
149 m_endSegmentMode = wiretool->GetEndSegmentMode();
160 comId == a2dHabitat::sig_changedStroke ||
161 comId == a2dHabitat::sig_changedLayer
167 bool OnSelected =
false;
169 if ( !m_dlgOrEditModal )
173 if ( objects.size() > 0 )
182 if ( objects.size() > 0 )
199 if ( comId == a2dHabitat::sig_changedStroke && ! tool->
GetStroke().IsSameAs( s ) )
214 if ( comId == a2dHabitat::sig_changedStroke )
219 if ( comId == a2dHabitat::sig_changedLayer )
229 comId == a2dHabitat::sig_changedTextFill ||
230 comId == a2dHabitat::sig_changedTextStroke
236 bool OnSelected =
false;
238 if ( !m_dlgOrEditModal )
242 if ( objects.size() > 0 )
251 if ( objects.size() > 0 )
263 if ( comId == a2dHabitat::sig_changedTextFill && ! m_modehit->GetFill().IsSameAs( f ) )
268 if ( comId == a2dHabitat::sig_changedTextStroke && ! m_modehit->GetStroke().IsSameAs( s ) )
278 if ( comId == a2dHabitat::sig_changedTextFill )
283 if ( comId == a2dHabitat::sig_changedTextStroke )
298 void a2dMasterTagGroups3::OnChar( wxKeyEvent& event )
315 case mode_cntrlselect:
328 void a2dMasterTagGroups3 ::OnKeyDown( wxKeyEvent& event )
336 switch( event.GetKeyCode() )
341 m_drawWire = !m_drawWire;
342 SetToolMode( event.m_controlDown, event.m_shiftDown, event.AltDown() );
346 if ( event.m_controlDown || event.m_shiftDown || event.AltDown() )
347 SetToolMode( event.m_controlDown, event.m_shiftDown, event.AltDown() );
352 void a2dMasterTagGroups3 ::OnKeyUp( wxKeyEvent& event )
360 switch( event.GetKeyCode() )
365 SetToolMode( event.m_controlDown, event.m_shiftDown, event.AltDown() );
369 if ( !event.m_controlDown || !event.m_shiftDown || !event.AltDown() )
370 SetToolMode( event.m_controlDown, event.m_shiftDown, event.AltDown() );
379 float minDist = FLT_MAX;
380 for( i = 0; i < hitinfo.
m_extended.size(); i++ )
383 if( wire2 && hitinfo.
m_extended[i].GetHitType().m_distance < minDist && hitinfo.
m_extended[i].GetHitType().IsStrokeHit() )
397 m_modehitinfo = how2;
400 switch( how2.m_stroke2 )
402 case a2dHit::stroke2_vertex:
404 SetStateString( _(
"drag to move vertex on the wire"), STAT_toolHelp );
405 m_mode = mode_editwire_vertex;
407 case a2dHit::stroke2_edgehor:
408 case a2dHit::stroke2_edgevert:
409 case a2dHit::stroke2_edgeother:
411 SetStateString( _(
"drag to insert vertex on the wire"), STAT_toolHelp );
412 m_mode = mode_editwire_segmentinsert;
421 switch( how2.m_stroke2 )
423 case a2dHit::stroke2_vertex:
425 SetStateString( _(
"click to remove vertex from wire"), STAT_toolHelp );
426 m_mode = mode_editwire_vertex;
428 case a2dHit::stroke2_edgehor:
430 SetStateString( _(
"drag to move segment of the wire"), STAT_toolHelp );
431 m_mode = mode_editwire_segmenthorizontal;
433 case a2dHit::stroke2_edgevert:
435 SetStateString( _(
"drag to move segment of the wire"), STAT_toolHelp );
436 m_mode = mode_editwire_segmentvertical;
438 case a2dHit::stroke2_edgeother:
440 SetStateString( _(
"drag to move segment, Alt key to insert a vertex on wire"), STAT_toolHelp );
441 m_mode = mode_editwire_segment;
452 void a2dMasterTagGroups3::SetToolMode(
bool ctrl,
bool shift,
bool alt )
459 ic.SetLayer( wxLAYER_ALL );
481 if ( !pin && !ctrl && shift )
486 SetStateString( _(
"click to select, double click to edit"), STAT_toolHelp );
492 SetStateString( _(
"click on object or drag rectangle to select extra objects"), STAT_toolHelp );
495 m_mode = mode_select;
525 bool drawWireAtempt =
false;
532 drawWireAtempt =
true;
534 drawWireAtempt =
false;
539 drawWireAtempt =
true;
541 drawWireAtempt =
false;
545 drawWireAtempt = ( m_drawWire && !ctrl ) || ( !m_drawWire && ctrl );
549 if ( drawWireAtempt )
552 if( restrict && ( m_hitinfo.
m_how.m_stroke2 == a2dHit::stroke2_edgehor || m_hitinfo.
m_how.m_stroke2 == a2dHit::stroke2_edgevert ) )
577 if ( !drawWireAtempt &&
582 SetStateString( _(
"drag the pin and reroute wires"), STAT_toolHelp );
583 m_mode = mode_move_pin;
586 if ( !drawWireAtempt &&
594 SetStateString( _(
"drag to rewire"), STAT_toolHelp );
595 m_mode = mode_rewire_pin;
603 SetStateString( _(
"draw a wire from pin"), STAT_toolHelp );
604 m_mode = mode_drawwire;
620 SetStateString( _(
"draw a wire from pin, or drag to rewire"), STAT_toolHelp );
621 m_mode = mode_drawwire;
627 SetStateString( _(
"draw a wire from pin"), STAT_toolHelp );
628 m_mode = mode_drawwire;
636 SetStateString( _(
"Drag the pin or start a wire with a click"), STAT_toolHelp );
637 m_mode = mode_drawwire;
644 SetStateString( _(
"start a wire with a click"), STAT_toolHelp );
645 m_mode = mode_drawwire;
651 if ( ! drawWireAtempt )
656 SetWireCursor( wire, m_hitinfo, ctrl, shift, alt );
683 SetStateString( _(
"click to select object"), STAT_toolHelp );
684 m_mode = mode_select;
693 if ( !pin && !shift )
697 if ( m_generatePinsNonWire && ( m_generatePinsAlsoNonWireMode || drawWireAtempt ) )
720 if ( !drawWireAtempt &&
724 m_mode = mode_move_pin;
725 SetStateString( _(
"drag the pin and reroute wires"), STAT_toolHelp );
732 SetStateString( _(
"Rewire this pin"), STAT_toolHelp );
733 m_mode = mode_rewire_pin;
740 SetStateString( _(
"draw a wire from this pin"), STAT_toolHelp );
741 m_mode = mode_drawwire;
748 SetStateString( _(
"Rewire this pin"), STAT_toolHelp );
749 m_mode = mode_rewire_pin;
754 m_mode = mode_drawwire;
762 SetStateString( _(
"draw a wire from this pin"), STAT_toolHelp );
763 m_mode = mode_drawwire;
776 m_mode = mode_copymulti;
777 SetStateString( _(
"drag to copy selected objects"), STAT_toolHelp );
782 SetStateString( _(
"drag to move selected objects, double click to edit"), STAT_toolHelp );
783 m_mode = mode_dragmulti;
792 SetStateString( _(
"click to select object, double click to edit"), STAT_toolHelp );
793 m_mode = mode_select;
800 SetStateString( _(
"drag to move object"), STAT_toolHelp );
808 SetStateString( _(
"can not drag this object, double click to edit"), STAT_toolHelp );
809 m_mode = mode_select;
818 SetStateString( _(
"click on object, drag rectangle to select objects"), STAT_toolHelp );
819 m_mode = mode_select;
825 void a2dMasterTagGroups3::OnMouseEvent( wxMouseEvent& event )
830 m_shiftWasDown =
event.ShiftDown();
831 m_ctrlWasDown =
event.ControlDown();
832 m_altWasDown =
event.AltDown();
846 if ( event.LeftDClick() &&
851 m_hadDoubleClick =
true;
859 if ( !m_shiftWasDown && !m_modehitLastSelectState )
861 else if ( m_modehit && m_modehitLastSelectState )
863 if ( m_selectedObjects )
870 delete m_selectedObjects;
871 m_selectedObjects = NULL;
873 m_modehit->
SetSelected( m_modehitLastSelectState );
874 SetLastSelected( m_modehit, m_modehitLastSelectState );
878 bool singleedit =
false;
879 if ( m_AllowDoubleClickModifier && m_shiftWasDown && !moreSelectedObjects )
882 EditDlgOrHandles( m_modehit, singleedit, m_drawWire );
894 if ( m_selectedObjects )
901 delete m_selectedObjects;
902 m_selectedObjects = NULL;
904 m_modehit->
SetSelected( m_modehitLastSelectState );
905 SetLastSelected( m_modehit, m_modehitLastSelectState );
907 SetToolMode( m_ctrlWasDown, m_shiftWasDown, m_altWasDown );
923 case mode_cntrlselect:
933 PushDragMultiTool( m_modehit );
940 PushCopyMultiTool( m_modehit );
947 PushDragTool( m_modehit );
954 PushCopyTool( m_modehit );
961 PushMovePinTool( m_modehit );
962 wxMouseEvent mouseevent( wxEVT_LEFT_DOWN );
967 case mode_rewire_pin:
970 PushRewirePinTool( m_modehit );
971 wxMouseEvent mouseevent( wxEVT_LEFT_DOWN );
976 case mode_editwire_vertex:
979 PushEditWireVertexTool( m_modehit, m_modehitinfo.
m_index );
980 wxMouseEvent mouseevent( wxEVT_LEFT_DOWN );
985 case mode_editwire_segmenthorizontal:
988 PushEditWireSegmentHorizontalTool( m_modehit, m_modehitinfo.
m_index );
989 wxMouseEvent mouseevent( wxEVT_LEFT_DOWN );
994 case mode_editwire_segmentvertical:
997 PushEditWireSegmentVerticalTool( m_modehit, m_modehitinfo.
m_index );
998 wxMouseEvent mouseevent( wxEVT_LEFT_DOWN );
1003 case mode_editwire_segmentinsert:
1006 PushEditWireSegmentInsertTool( m_modehit, m_modehitinfo.
m_index );
1007 wxMouseEvent mouseevent( wxEVT_LEFT_DOWN );
1012 case mode_editwire_segment:
1015 PushEditSegmentTool( m_modehit, m_modehitinfo.
m_index );
1016 wxMouseEvent mouseevent( wxEVT_LEFT_DOWN );
1031 else if ( event.Moving() && !m_toolBusy )
1033 SetToolMode( m_ctrlWasDown, m_shiftWasDown, m_altWasDown );
1036 else if( event.LeftDown() && !m_toolBusy )
1038 if ( m_selectedObjects )
1040 delete m_selectedObjects;
1041 m_selectedObjects = NULL;
1045 m_modehitLastSelectState =
false;
1047 m_modehitLastSelectState = m_modehit->
GetSelected();
1049 SetStateString(
"" );
1059 m_mode = mode_select;
1068 case mode_dragmulti:
1069 case mode_copymulti:
1070 case mode_editwire_segmenthorizontal:
1071 case mode_editwire_segmentvertical:
1072 case mode_editwire_segmentinsert:
1073 case mode_editwire_segment:
1076 if ( m_shiftWasDown )
1085 SetLastSelected( m_modehit,
false );
1086 SetLastSelected( GetTopLeftSelected(),
true );
1092 SetLastSelected( m_modehit,
true );
1098 if ( m_selectMoreAtShift || !m_modehit )
1108 SetLastSelected( m_modehit,
true );
1112 m_modehit->
SetSelected( !m_modehitLastSelectState );
1113 SetLastSelected( m_modehit, !m_modehitLastSelectState );
1122 case mode_rewire_pin:
1128 case mode_editwire_vertex:
1132 PushEditWireVertexTool( m_modehit, m_modehitinfo.
m_index );
1155 else if( event.LeftUp() && m_toolBusy )
1161 if ( m_mode == mode_drawwire )
1172 m_mode = mode_drawwire;
1174 PushDrawWireTool( m_modehit );
1176 wxMouseEvent mouseevent( wxEVT_LEFT_DOWN );
1177 mouseevent.m_x = m_generatedPinX;
1178 mouseevent.m_y = m_generatedPinY;
1179 mouseevent.m_controlDown =
true;
1180 mouseevent.m_leftDown =
true;
1181 mouseevent.SetEventObject(
this);
1185 wxMouseEvent mouseevent2( wxEVT_LEFT_UP );
1186 mouseevent2.m_x = m_generatedPinX;
1187 mouseevent2.m_y = m_generatedPinY;
1188 mouseevent2.m_controlDown =
true;
1189 mouseevent2.m_leftDown =
true;
1190 mouseevent2.SetEventObject(
this);
1196 else if( event.RightDown() && !
GetBusy() )
1213 EVT_MOUSE_EVENTS( a2dMasterSingleClick ::OnMouseEvent )
1214 EVT_CHAR( a2dMasterSingleClick ::OnChar )
1215 EVT_KEY_DOWN( a2dMasterSingleClick ::OnKeyDown )
1216 EVT_KEY_UP( a2dMasterSingleClick ::OnKeyUp )
1228 a2dMasterSingleClick ::~a2dMasterSingleClick ()
1233 wxString a2dMasterSingleClick ::GetToolString()
const
1235 wxString str = GetClassInfo()->GetClassName();
1237 return str +
" Wires";
1239 return str +
" Dlg";
1267 case mode_cntrlselect:
1286 m_mode = mode_select;
1310 void a2dMasterSingleClick::OnComEvent(
a2dComEvent& event )
1312 if ( GetEvtHandlerEnabled() )
1314 a2dSignal comId =
event.GetId();
1323 bool OnSelected =
false;
1329 if ( objects.size() > 0 )
1342 if ( comId == a2dHabitat::sig_changedStroke && ! tool->
GetStroke().IsSameAs( s ) )
1352 comId == a2dHabitat::sig_changedStroke ||
1353 comId == a2dHabitat::sig_changedLayer
1363 if ( comId == a2dHabitat::sig_changedStroke )
1368 if ( comId == a2dHabitat::sig_changedLayer )
1381 void a2dMasterSingleClick::OnChar( wxKeyEvent& event )
1398 case mode_cntrlselect:
1411 void a2dMasterSingleClick ::OnKeyDown( wxKeyEvent& event )
1419 switch( event.GetKeyCode() )
1424 m_drawWire = !m_drawWire;
1425 SetToolMode( event.m_controlDown, event.m_shiftDown, event.AltDown() );
1429 if ( event.m_controlDown || event.m_shiftDown || event.AltDown() )
1430 SetToolMode( event.m_controlDown, event.m_shiftDown, event.AltDown() );
1435 void a2dMasterSingleClick ::OnKeyUp( wxKeyEvent& event )
1443 switch( event.GetKeyCode() )
1448 SetToolMode( event.m_controlDown, event.m_shiftDown, event.AltDown() );
1452 if ( !event.m_controlDown || !event.m_shiftDown || !event.AltDown() )
1453 SetToolMode( event.m_controlDown, event.m_shiftDown, event.AltDown() );
1462 float minDist = FLT_MAX;
1463 for( i = 0; i < hitinfo.
m_extended.size(); i++ )
1466 if( wire2 && hitinfo.
m_extended[i].GetHitType().m_distance < minDist && hitinfo.
m_extended[i].GetHitType().IsStrokeHit() )
1480 m_modehitinfo = how2;
1483 switch( how2.m_stroke2 )
1485 case a2dHit::stroke2_vertex:
1487 SetStateString( _(
"drag to move vertex on the wire"), STAT_toolHelp );
1488 m_mode = mode_editwire_vertex;
1490 case a2dHit::stroke2_edgehor:
1491 case a2dHit::stroke2_edgevert:
1492 case a2dHit::stroke2_edgeother:
1494 SetStateString( _(
"drag to insert vertex on the wire"), STAT_toolHelp );
1495 m_mode = mode_editwire_segmentinsert;
1499 m_modehitinfo =
a2dHit();
1504 switch( how2.m_stroke2 )
1506 case a2dHit::stroke2_vertex:
1508 SetStateString( _(
"click to remove vertex from wire"), STAT_toolHelp );
1509 m_mode = mode_editwire_vertex;
1511 case a2dHit::stroke2_edgehor:
1513 SetStateString( _(
"drag to move segment of the wire"), STAT_toolHelp );
1514 m_mode = mode_editwire_segmenthorizontal;
1516 case a2dHit::stroke2_edgevert:
1518 SetStateString( _(
"drag to move segment of the wire"), STAT_toolHelp );
1519 m_mode = mode_editwire_segmentvertical;
1521 case a2dHit::stroke2_edgeother:
1523 SetStateString( _(
"drag to move segment, Alt key to insert a vertex on wire"), STAT_toolHelp );
1524 m_mode = mode_editwire_segment;
1528 m_modehitinfo =
a2dHit();
1535 void a2dMasterSingleClick::SetToolMode(
bool ctrl,
bool shift,
bool alt )
1542 ic.SetLayer( wxLAYER_ALL );
1552 m_modehitinfo =
a2dHit();
1564 if ( !pin && !ctrl && shift )
1569 SetStateString( _(
"click to select"), STAT_toolHelp );
1575 SetStateString( _(
"move to object and click to select"), STAT_toolHelp );
1578 m_mode = mode_select;
1590 bool drawWireAtempt =
false;
1597 drawWireAtempt =
true;
1599 drawWireAtempt =
false;
1604 drawWireAtempt =
true;
1606 drawWireAtempt =
false;
1610 drawWireAtempt = ( m_drawWire && !ctrl ) || ( !m_drawWire && ctrl );
1612 if ( wire && wire->
GetSelected() && drawWireAtempt )
1620 if ( drawWireAtempt )
1645 SetStateString( _(
"drag the pin and reroute wires"), STAT_toolHelp );
1646 m_mode = mode_move_pin;
1649 if ( ! drawWireAtempt &&
1657 SetStateString( _(
"drag to rewire"), STAT_toolHelp );
1658 m_mode = mode_rewire_pin;
1666 SetStateString( _(
"draw a wire from pin"), STAT_toolHelp );
1667 m_mode = mode_drawwire;
1683 SetStateString( _(
"draw a wire from pin, or drag to rewire"), STAT_toolHelp );
1684 m_mode = mode_drawwire;
1690 SetStateString( _(
"draw a wire from pin"), STAT_toolHelp );
1691 m_mode = mode_drawwire;
1699 SetStateString( _(
"Drag the pin or start a wire with a click"), STAT_toolHelp );
1700 m_mode = mode_drawwire;
1707 SetStateString( _(
"start a wire with a click"), STAT_toolHelp );
1708 m_mode = mode_drawwire;
1714 if ( drawWireAtempt )
1718 SetStateString( _(
"draw a wire"), STAT_toolHelp );
1719 m_mode = mode_drawwire;
1726 SetWireCursor( wire, m_hitinfo, ctrl, shift, alt );
1731 SetStateString( _(
"click to select or deselect"), STAT_toolHelp );
1732 m_mode = mode_select;
1741 if ( !pin && !shift )
1745 if ( drawWireAtempt )
1767 if ( !drawWireAtempt &&
1771 m_mode = mode_move_pin;
1772 SetStateString( _(
"drag the pin and reroute wires"), STAT_toolHelp );
1779 SetStateString( _(
"Rewire this pin"), STAT_toolHelp );
1780 m_mode = mode_rewire_pin;
1787 SetStateString( _(
"draw a wire from this pin"), STAT_toolHelp );
1788 m_mode = mode_drawwire;
1795 SetStateString( _(
"Rewire this pin"), STAT_toolHelp );
1796 m_mode = mode_rewire_pin;
1801 m_mode = mode_drawwire;
1809 SetStateString( _(
"draw a wire from this pin"), STAT_toolHelp );
1810 m_mode = mode_drawwire;
1823 if ( ctrl && shift )
1825 m_mode = mode_copymulti;
1826 SetStateString( _(
"drag to copy selected objects"), STAT_toolHelp );
1831 SetStateString( _(
"drag to move selected objects"), STAT_toolHelp );
1832 m_mode = mode_dragmulti;
1841 SetStateString( _(
"click to select object, double click to edit"), STAT_toolHelp );
1849 SetStateString( _(
"drag to move object"), STAT_toolHelp );
1858 SetStateString( _(
"click to (de)select, double click for dlg"), STAT_toolHelp );
1859 m_mode = mode_select;
1868 SetStateString( _(
"click on object, to edit or drag"), STAT_toolHelp );
1869 m_mode = mode_select;
1875 void a2dMasterSingleClick ::OnMouseEvent( wxMouseEvent& event )
1877 MouseDump( event,
"OnM " );
1902 wxString state, form;
1904 state.Printf( form, bbox.
GetMinX()*unitScale, bbox.
GetMinY()*unitScale );
1905 SetStateString( state, 10 );
1908 SetStateString( state, 11 );
1911 if ( event.LeftDClick() &&
1916 m_hadDoubleClick =
true;
1920 if ( m_dlgOrEdit && ! hit->
GetFixedStyle() && !
event.ShiftDown() ||
1924 if ( !m_dlgOrEditModal )
1928 a2dStyleDialog styleDlg(
GetDrawing()->GetHabitat(), NULL, wxDEFAULT_DIALOG_STYLE | wxDIALOG_NO_PARENT | wxMINIMIZE_BOX | wxMAXIMIZE_BOX,
true );
1929 styleDlg.SetFill( hit->GetFill() );
1930 styleDlg.SetStroke( hit->GetStroke() );
1931 if ( styleDlg.ShowModal() == wxID_OK )
1933 hit->
SetFill( styleDlg.GetFill() );
1943 if ( (wire && wire->
GetSelected() ) || (wire && !m_drawWire ) || !wire )
1946 SetLastSelected( hit, m_modehitLastSelectState );
1949 PushEditTool( m_modehit );
1954 else if ( event.Dragging() && m_toolBusy && !
m_dragStarted )
1960 SetToolMode( event.ControlDown(),
event.ShiftDown(),
event.AltDown() );
1970 case mode_dragmulti:
1973 PushDragMultiTool( m_modehit );
1977 case mode_copymulti:
1980 PushCopyMultiTool( m_modehit );
1993 PushDragTool( m_modehit );
2000 PushMovePinTool( m_modehit );
2001 wxMouseEvent mouseevent( wxEVT_LEFT_DOWN );
2006 case mode_rewire_pin:
2009 PushRewirePinTool( m_modehit );
2010 wxMouseEvent mouseevent( wxEVT_LEFT_DOWN );
2015 case mode_editwire_vertex:
2018 PushEditWireVertexTool( m_modehit, m_modehitinfo.
m_index );
2019 wxMouseEvent mouseevent( wxEVT_LEFT_DOWN );
2024 case mode_editwire_segmenthorizontal:
2027 PushEditWireSegmentHorizontalTool( m_modehit, m_modehitinfo.
m_index );
2028 wxMouseEvent mouseevent( wxEVT_LEFT_DOWN );
2033 case mode_editwire_segmentvertical:
2036 PushEditWireSegmentVerticalTool( m_modehit, m_modehitinfo.
m_index );
2037 wxMouseEvent mouseevent( wxEVT_LEFT_DOWN );
2042 case mode_editwire_segmentinsert:
2045 PushEditWireSegmentInsertTool( m_modehit, m_modehitinfo.
m_index );
2046 wxMouseEvent mouseevent( wxEVT_LEFT_DOWN );
2051 case mode_editwire_segment:
2054 PushEditSegmentTool( m_modehit, m_modehitinfo.
m_index );
2055 wxMouseEvent mouseevent( wxEVT_LEFT_DOWN );
2069 else if ( event.Moving() && !m_toolBusy )
2071 SetToolMode( event.ControlDown(),
event.ShiftDown(),
event.AltDown() );
2074 else if( event.LeftDown() && !m_toolBusy )
2076 SetStateString(
"" );
2086 m_mode = mode_select;
2103 case mode_rewire_pin:
2109 case mode_editwire_vertex:
2111 if ( event.AltDown() )
2113 PushEditWireVertexTool( m_modehit, m_modehitinfo.
m_index );
2120 case mode_editwire_segmenthorizontal:
2121 case mode_editwire_segmentvertical:
2122 case mode_editwire_segmentinsert:
2123 case mode_editwire_segment:
2140 else if( event.LeftUp() && m_toolBusy )
2146 m_modehitLastSelectState =
false;
2148 m_modehitLastSelectState = m_modehit->
GetSelected();
2150 if ( m_mode == mode_select || ( m_mode == mode_drawwire && event.ShiftDown() ) )
2156 m_modehit->
SetSelected( !m_modehitLastSelectState );
2157 SetLastSelected( m_modehit, !m_modehitLastSelectState );
2160 else if ( m_mode == mode_drawwire )
2170 m_mode = mode_drawwire;
2172 PushDrawWireTool( m_modehit );
2174 wxMouseEvent mouseevent( wxEVT_LEFT_DOWN );
2177 mouseevent.m_controlDown =
true;
2178 mouseevent.m_leftDown =
true;
2179 mouseevent.SetEventObject(
this);
2183 wxMouseEvent mouseevent2( wxEVT_LEFT_UP );
2186 mouseevent2.m_controlDown =
true;
2187 mouseevent2.m_leftDown =
true;
2188 mouseevent2.SetEventObject(
this);
2202 PushEditTool( m_modehit );
2244 SetToolMode( event.ControlDown(),
event.ShiftDown(),
event.AltDown() );
2246 else if( event.RightDown() && !
GetBusy() )
a2dStroke GetTextStroke() const
get the current text stroke
a2dPin * FindNonWirePin(a2dCanvasObjectFlagsMask mask=a2dCanvasOFlags::ALL)
a2dHit m_how
return in which way the object was hit (stroke, fill, ...)
virtual void SetActive(bool active=true)
set the tool active or inactive.
double GetHeight() const
returns height of the 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.
wxUint16 GetLayer() const
layer set for new objects.
unsigned int m_index
For edge/vertex hits the index of the edge / vertex.
static const a2dSignal sig_changedFill
when active drawing is set, this signal is send to the drawing.
bool GetEditable() const
get if the object may be edited
virtual void DoStopTool(bool abort)
to do tool specific stuff to stop a tool. Called from StopTool().
a2dPin is used in a2dCanvasObject to add pins to it.
generate pins, given Connect/wire pinclass
void ConnectEvent(wxEventType type, wxEvtHandler *eventSink)
void Update(unsigned int how=(a2dCANVIEW_UPDATE_ALL|a2dCANVIEW_UPDATE_BLIT), wxObject *hintObject=NULL)
see OnUpdate
a command processor specially designed to work with a a2dCanvasDocument
void DoStopTool(bool abort)
to do tool specific stuff to stop a tool. Called from StopTool().
a2dPin * IsConnectedTo(a2dPin *pin=a2dAnyPin) const
Return the pin to which this pin is connected.
float m_distance
For margin hits, the distance from the stroke center in fractions of the margin.
set layer of objects which fit the mask
a2dCanvasObject is the base class for Canvas Objects.
property to hold a a2dObjectPtr smart pointer type variable to be associated with a a2dObject ...
wxUint32 GetConnectedPinsNr() const
Get the number of connected pins.
a2dPin * FindWirePin(a2dCanvasObjectFlagsMask mask=a2dCanvasOFlags::ALL)
a2dCanvasObjectList * GetChildObjectList()
get the list where the child objects are stored in.
bool GetSelected() const
is the object selected flag set
void SetSelected(bool selected)
Set the object selected flag if allowed.
void AbortBusyMode()
Called when the user aborts editing a distinct object */.
void DoStopTool(bool abort)
to do tool specific stuff to stop a tool. Called from StopTool().
used to change style of canvas objects in a a2dCanvasDocument
bool IsVisible() const
get visibility (rendering depends on layer settings also)
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.
void Expand(const a2dPoint2D &, const a2dPoint2D &)
expand boundingbox width two points
double GetMinX() const
get minimum X of the boundingbox
#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
const a2dStroke & GetStroke() const
get the current stroke
static const a2dCanvasObjectFlagsMask SELECTABLE
#define EVT_COM_EVENT(func)
static wxEvtHandler for communication event
void Render()
implement rendering
a2dCanvasObject * GetShowObject() const
return pointer of then currently shown object on the drawer.
objects which fit the mask are given a new fill and stroke style
Restriction engine for editing restrictions like snapping.
int CollectObjects(a2dCanvasObjectList *total, const wxString &type=wxT(""), a2dCanvasObjectFlagsMask mask=a2dCanvasOFlags::ALL, const a2dPropertyId *id=NULL, const a2dBoundingBox &bbox=wxNonValidBbox)
Copy objects fitting the given filter to the total list.
if set, respect layer order, hit testing is done per layer from the top.
static const a2dCanvasObjectFlagsMask SELECTED
void SetEndSegmentMode(a2dNextSeg mode)
a2dDrawWirePolylineLTool segment mode initilization
bool IsSelected() const
Is the object selected flag set.
void RemovePins(bool NotConnected=false, bool onlyTemporary=false, bool now=false)
Remove all a2dPin children.
a2dFill GetTextFill() const
get the current text fill
a2dCanvasObject * ChildIsHitWorld(a2dIterC &ic, a2dHitEvent &hitEvent, bool filterSelectableLayers=false)
Do hittest on children.
bool IsTemporaryPin() const
return true if this pin is a temporary pin
void SetLastXyEntry(double x, double y)
set last mouse X position in world coordinates, as set by tools.
void AbortBusyMode()
Called when the user aborts editing a distinct object */.
void InitMouseEvent(wxMouseEvent &eventnew, int x, int y, wxMouseEvent &event)
bool GetFixedStyle() const
Get object fixed style setting.
bool ShowDlgStyle(bool onOff)
show style dialog or not, return true of changed from previous state
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
const a2dFill & GetFill() const
get the current fill
a2dConnectionGenerator * GetConnectionGenerator() const
Get class for generating new connection objects between object and pins.
virtual bool Submit(a2dCommand *command, bool storeIt=true)
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.
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.
bool GetRelease() const
get release flag
a2dCanvasCommandProcessor * GetCanvasCommandProcessor()
get a pointer to the command processor
double GetWidth() const
returns width of the boundingbox
Master tool for objects graphics slecting and dragging.
a2dCanvasObject * Find(a2dCanvasObject *obj) const
return the object if it is part of the list
bool GetSelectable() const
is the object selectable flag set
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 ...
virtual void SetActive(bool active=true)
set the tool active or inactive.
a2dCanvasObjectList * Clone(a2dObject::CloneOptions options) const
Clone everything ( Clones objects also) in a new created list.
double GetMinY() const
get minimum Y of the boundingbox
bool GetSelected2() const
is the object selected2 flag set
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.
int CollectObjects(a2dCanvasObjectList *total, const wxString &classname=wxT(""), a2dCanvasObjectFlagsMask mask=a2dCanvasOFlags::ALL, const a2dPropertyId *id=0, const a2dBoundingBox &bbox=wxNonValidBbox) const
Copy objects with the right conditions to the total list.
void Render()
implement rendering
a2dCanvasObject * GetParent() const
get parent object of the pin
virtual bool IsConnect() const
return true, if this object is used to connect other object's using rubberband like structures...
void ToolWorldToMouse(double xWorld, double yWorld, int &x, int &y)
A pointer class, that automatically calls SmrtPtrOwn/SmrtPtrRelease.
bool DisconnectEvent(wxEventType type, wxEvtHandler *eventSink)
bool GetDraggable() const
get if the object can be dragged
a2dBoundingBox & GetBbox()
get boundingbox in world coordinates exclusive stroke width relative to its parent ...
structure to give as parameter to member functions of a2dCanvasObject
virtual bool RestrictPoint(double &x, double &y, wxUint32 sourceRequired=snapToAll, bool ignoreEngine=false)
Restrict a single point of a line or polyline.
void SetFill(const a2dFill &fill)
Set a fill for the object which will be used instead of the layer fill.