34 bool a2dMasterTagGroups33::m_selectMoreAtShift =
false;
39 EVT_MOUSE_EVENTS( a2dMasterTagGroups33 ::OnMouseEvent )
40 EVT_CHAR( a2dMasterTagGroups33 ::OnChar )
41 EVT_KEY_DOWN( a2dMasterTagGroups33 ::OnKeyDown )
42 EVT_KEY_UP( a2dMasterTagGroups33 ::OnKeyUp )
44 EVT_TIMER( -1, a2dMasterTagGroups33::OnTimer )
47 a2dMasterTagGroups33 ::a2dMasterTagGroups33 (
a2dStToolContr* controller ):
49 m_selectionIfNoDoubleClick( false ),
50 m_drawWireIfNoDoubleClick( false ),
51 m_AllowDoubleClickModifier( false ),
52 m_editIfDelayed( false ),
53 m_startEditIfDelayed( true ),
54 m_AllowDelayedEdit( false ),
55 m_shiftWasDown( false ),
56 m_ctrlWasDown( false ),
57 m_altWasDown( false ),
67 a2dMasterTagGroups33 ::~a2dMasterTagGroups33 ()
72 wxString a2dMasterTagGroups33 ::GetToolString()
const
74 wxString str = GetClassInfo()->GetClassName();
76 return str +
" Wires";
106 case mode_cntrlselect:
125 SetToolMode(
false,
false,
false );
129 void a2dMasterTagGroups33::OnComEvent(
a2dComEvent& event )
131 if ( GetEvtHandlerEnabled() )
133 a2dSignal comId =
event.GetId();
142 bool OnSelected =
false;
144 if ( !m_dlgOrEditModal )
148 if ( objects.size() > 0 )
157 if ( objects.size() > 0 )
174 if ( comId == a2dHabitat::sig_changedStroke && ! tool->
GetStroke().IsSameAs( s ) )
184 comId == a2dHabitat::sig_changedStroke ||
185 comId == a2dHabitat::sig_changedLayer
195 if ( comId == a2dHabitat::sig_changedStroke )
200 if ( comId == a2dHabitat::sig_changedLayer )
213 void a2dMasterTagGroups33::OnChar( wxKeyEvent& event )
230 case mode_cntrlselect:
243 void a2dMasterTagGroups33 ::OnKeyDown( wxKeyEvent& event )
251 switch( event.GetKeyCode() )
256 m_drawWire = !m_drawWire;
257 SetToolMode( event.m_controlDown, event.m_shiftDown, event.AltDown() );
261 if ( event.m_controlDown || event.m_shiftDown || event.AltDown() )
262 SetToolMode( event.m_controlDown, event.m_shiftDown, event.AltDown() );
267 void a2dMasterTagGroups33 ::OnKeyUp( wxKeyEvent& event )
275 switch( event.GetKeyCode() )
280 SetToolMode( event.m_controlDown, event.m_shiftDown, event.AltDown() );
284 if ( !event.m_controlDown || !event.m_shiftDown || !event.AltDown() )
285 SetToolMode( event.m_controlDown, event.m_shiftDown, event.AltDown() );
294 float minDist = FLT_MAX;
295 for( i = 0; i < hitinfo.
m_extended.size(); i++ )
298 if( wire2 && hitinfo.
m_extended[i].GetHitType().m_distance < minDist && hitinfo.
m_extended[i].GetHitType().IsStrokeHit() )
312 m_modehitinfo = how2;
315 switch( how2.m_stroke2 )
317 case a2dHit::stroke2_vertex:
319 SetStateString( _(
"drag to move vertex on the wire"), STAT_toolHelp );
320 m_mode = mode_editwire_vertex;
322 case a2dHit::stroke2_edgehor:
323 case a2dHit::stroke2_edgevert:
324 case a2dHit::stroke2_edgeother:
326 SetStateString( _(
"drag to insert vertex on the wire"), STAT_toolHelp );
327 m_mode = mode_editwire_segmentinsert;
336 switch( how2.m_stroke2 )
338 case a2dHit::stroke2_vertex:
340 SetStateString( _(
"click to remove vertex from wire"), STAT_toolHelp );
341 m_mode = mode_editwire_vertex;
343 case a2dHit::stroke2_edgehor:
345 SetStateString( _(
"drag to move segment of the wire"), STAT_toolHelp );
346 m_mode = mode_editwire_segmenthorizontal;
348 case a2dHit::stroke2_edgevert:
350 SetStateString( _(
"drag to move segment of the wire"), STAT_toolHelp );
351 m_mode = mode_editwire_segmentvertical;
353 case a2dHit::stroke2_edgeother:
355 SetStateString( _(
"drag to move segment, Alt key to insert a vertex on wire"), STAT_toolHelp );
356 m_mode = mode_editwire_segment;
367 void a2dMasterTagGroups33::SetToolMode(
bool ctrl,
bool shift,
bool alt )
374 ic.SetLayer( wxLAYER_ALL );
396 if ( !pin && !ctrl && shift )
401 SetStateString( _(
"drag to move object, double click to edit"), STAT_toolHelp );
407 SetStateString( _(
"move to object and click to select"), STAT_toolHelp );
410 m_mode = mode_select;
442 SetWireCursor( wire, m_hitinfo, ctrl, shift, alt );
446 if ( m_drawWire || ( !m_drawWire && ctrl ) )
465 if ( !( m_drawWire || ( !m_drawWire && ctrl ) ) &&
470 SetStateString( _(
"drag the pin and reroute wires"), STAT_toolHelp );
471 m_mode = mode_move_pin;
474 if ( !( m_drawWire || ( !m_drawWire && ctrl ) ) &&
482 SetStateString( _(
"drag to rewire"), STAT_toolHelp );
483 m_mode = mode_rewire_pin;
491 SetStateString( _(
"draw a wire from pin"), STAT_toolHelp );
492 m_mode = mode_drawwire;
508 SetStateString( _(
"draw a wire from pin, or drag to rewire"), STAT_toolHelp );
509 m_mode = mode_drawwire;
515 SetStateString( _(
"draw a wire from pin"), STAT_toolHelp );
516 m_mode = mode_drawwire;
520 else if (!
m_dragStarted && !( m_drawWire || ( !m_drawWire && ctrl ) ) )
524 SetStateString( _(
"Drag the pin or start a wire with a click"), STAT_toolHelp );
525 m_mode = mode_drawwire;
528 else if ( m_drawWire || ( !m_drawWire && ctrl ) || !
m_dragStarted )
532 SetStateString( _(
"start a wire with a click"), STAT_toolHelp );
533 m_mode = mode_drawwire;
539 if ( m_drawWire || ( !m_drawWire && ctrl ) )
543 SetStateString( _(
"draw a wire"), STAT_toolHelp );
544 m_mode = mode_drawwire;
552 SetWireCursor( wire, m_hitinfo, ctrl, shift, alt );
579 SetStateString( _(
"click to select object"), STAT_toolHelp );
580 m_mode = mode_select;
589 if ( !pin && !shift && !ctrl )
612 if ( !( m_drawWire || ( !m_drawWire && ctrl ) ) &&
616 m_mode = mode_move_pin;
617 SetStateString( _(
"drag the pin and reroute wires"), STAT_toolHelp );
624 SetStateString( _(
"Rewire this pin"), STAT_toolHelp );
625 m_mode = mode_rewire_pin;
632 SetStateString( _(
"draw a wire from this pin"), STAT_toolHelp );
633 m_mode = mode_drawwire;
640 SetStateString( _(
"Rewire this pin"), STAT_toolHelp );
641 m_mode = mode_rewire_pin;
646 m_mode = mode_drawwire;
654 SetStateString( _(
"draw a wire from this pin"), STAT_toolHelp );
655 m_mode = mode_drawwire;
668 m_mode = mode_copymulti;
669 SetStateString( _(
"drag to copy selected objects"), STAT_toolHelp );
674 SetStateString( _(
"drag to move selected objects"), STAT_toolHelp );
675 m_mode = mode_dragmulti;
684 SetStateString( _(
"click to select object, double click to edit"), STAT_toolHelp );
685 m_mode = mode_select;
692 SetStateString( _(
"drag to move object"), STAT_toolHelp );
700 SetStateString( _(
"can not drag this object, double click to edit"), STAT_toolHelp );
701 m_mode = mode_select;
710 SetStateString( _(
"click on object, drag rectangle to select objects"), STAT_toolHelp );
711 m_mode = mode_select;
717 void a2dMasterTagGroups33::OnTimer(wxTimerEvent& event)
719 if ( m_startEditIfDelayed )
720 m_editIfDelayed =
true;
721 if ( m_hadDoubleClick )
723 m_hadDoubleClick =
false;
725 m_selectionIfNoDoubleClick =
false;
726 m_drawWireIfNoDoubleClick =
false;
730 if ( m_drawWireIfNoDoubleClick )
733 m_drawWireIfNoDoubleClick =
false;
742 m_mode = mode_drawwire;
744 PushDrawWireTool( m_modehit );
746 wxMouseEvent mouseevent( wxEVT_LEFT_DOWN );
749 mouseevent.m_controlDown =
true;
750 mouseevent.m_leftDown =
true;
751 mouseevent.SetEventObject(
this);
755 wxMouseEvent mouseevent2( wxEVT_LEFT_UP );
758 mouseevent2.m_controlDown =
true;
759 mouseevent2.m_leftDown =
true;
760 mouseevent2.SetEventObject(
this);
798 if ( m_selectionIfNoDoubleClick )
801 m_selectionIfNoDoubleClick =
false;
802 if ( m_shiftWasDown )
814 if ( m_selectMoreAtShift )
816 else if ( !m_modehit )
823 m_modehit->
SetSelected( !m_modehitLastSelectState );
831 void a2dMasterTagGroups33::OnMouseEvent( wxMouseEvent& event )
836 m_shiftWasDown =
event.ShiftDown();
837 m_ctrlWasDown =
event.ControlDown();
838 m_altWasDown =
event.AltDown();
850 if ( event.LeftDClick() &&
855 m_hadDoubleClick =
true;
861 EditDlgOrHandles( m_modehit, m_AllowDoubleClickModifier ? m_shiftWasDown:
false, m_drawWire );
869 SetToolMode( m_ctrlWasDown, m_shiftWasDown, m_altWasDown );
885 case mode_cntrlselect:
895 PushDragMultiTool( m_modehit );
902 PushCopyMultiTool( m_modehit );
909 PushDragTool( m_modehit );
916 PushCopyTool( m_modehit );
923 PushMovePinTool( m_modehit );
924 wxMouseEvent mouseevent( wxEVT_LEFT_DOWN );
929 case mode_rewire_pin:
932 PushRewirePinTool( m_modehit );
933 wxMouseEvent mouseevent( wxEVT_LEFT_DOWN );
938 case mode_editwire_vertex:
941 PushEditWireVertexTool( m_modehit, m_modehitinfo.
m_index );
942 wxMouseEvent mouseevent( wxEVT_LEFT_DOWN );
947 case mode_editwire_segmenthorizontal:
950 PushEditWireSegmentHorizontalTool( m_modehit, m_modehitinfo.
m_index );
951 wxMouseEvent mouseevent( wxEVT_LEFT_DOWN );
956 case mode_editwire_segmentvertical:
959 PushEditWireSegmentVerticalTool( m_modehit, m_modehitinfo.
m_index );
960 wxMouseEvent mouseevent( wxEVT_LEFT_DOWN );
965 case mode_editwire_segmentinsert:
968 PushEditWireSegmentInsertTool( m_modehit, m_modehitinfo.
m_index );
969 wxMouseEvent mouseevent( wxEVT_LEFT_DOWN );
974 case mode_editwire_segment:
977 PushEditSegmentTool( m_modehit, m_modehitinfo.
m_index );
978 wxMouseEvent mouseevent( wxEVT_LEFT_DOWN );
993 else if ( event.Moving() && !m_toolBusy && !m_selectionIfNoDoubleClick && !m_drawWireIfNoDoubleClick )
995 SetToolMode( m_ctrlWasDown, m_shiftWasDown, m_altWasDown );
998 else if( event.LeftDown() && !m_toolBusy )
1001 m_selectionIfNoDoubleClick =
false;
1002 m_drawWireIfNoDoubleClick =
false;
1003 m_editIfDelayed =
false;
1005 SetStateString(
"" );
1015 m_mode = mode_select;
1029 case mode_rewire_pin:
1035 case mode_editwire_vertex:
1039 PushEditWireVertexTool( m_modehit, m_modehitinfo.
m_index );
1048 case mode_editwire_segmenthorizontal:
1049 case mode_editwire_segmentvertical:
1050 case mode_editwire_segmentinsert:
1051 case mode_editwire_segment:
1068 else if( event.LeftUp() && m_toolBusy )
1070 m_timer.Start( a2dDoubleClickWait,
true );
1075 m_modehitLastSelectState =
false;
1077 m_modehitLastSelectState = m_modehit->
GetSelected();
1079 if ( m_AllowDelayedEdit && m_editIfDelayed )
1081 m_editIfDelayed =
false;
1082 EditDlgOrHandles( m_modehit, m_AllowDoubleClickModifier ? m_shiftWasDown:
false, m_drawWire );
1084 if ( !m_ctrlWasDown )
1086 m_selectionIfNoDoubleClick =
true;
1088 if ( m_mode == mode_drawwire )
1090 m_drawWireIfNoDoubleClick =
true;
1094 else if( event.RightDown() && !
GetBusy() )
1109 bool a2dMasterTagGroups4::m_selectMoreAtShift =
false;
1114 EVT_MOUSE_EVENTS( a2dMasterTagGroups4 ::OnMouseEvent )
1115 EVT_CHAR( a2dMasterTagGroups4 ::OnChar )
1116 EVT_KEY_DOWN( a2dMasterTagGroups4 ::OnKeyDown )
1117 EVT_KEY_UP( a2dMasterTagGroups4 ::OnKeyUp )
1119 EVT_TIMER( -1, a2dMasterTagGroups4::OnTimer )
1122 a2dMasterTagGroups4 ::a2dMasterTagGroups4 (
a2dStToolContr* controller ):
1124 m_selectionIfNoDoubleClick( false ),
1125 m_drawWireIfNoDoubleClick( false ),
1126 m_editIfDelayed( false ),
1127 m_startEditIfDelayed( true ),
1136 a2dMasterTagGroups4 ::~a2dMasterTagGroups4 ()
1141 wxString a2dMasterTagGroups4 ::GetToolString()
const
1143 wxString str = GetClassInfo()->GetClassName();
1145 return str +
" Wires";
1147 return str +
" Dlg";
1175 case mode_cntrlselect:
1194 SetToolMode(
false,
false,
false );
1198 void a2dMasterTagGroups4::OnComEvent(
a2dComEvent& event )
1200 if ( GetEvtHandlerEnabled() )
1202 a2dSignal comId =
event.GetId();
1211 bool OnSelected =
false;
1217 if ( objects.size() > 0 )
1233 if ( comId == a2dHabitat::sig_changedStroke && ! tool->
GetStroke().IsSameAs( s ) )
1243 comId == a2dHabitat::sig_changedStroke ||
1244 comId == a2dHabitat::sig_changedLayer
1254 if ( comId == a2dHabitat::sig_changedStroke )
1259 if ( comId == a2dHabitat::sig_changedLayer )
1272 void a2dMasterTagGroups4::OnChar( wxKeyEvent& event )
1289 case mode_cntrlselect:
1302 void a2dMasterTagGroups4 ::OnKeyDown( wxKeyEvent& event )
1310 switch( event.GetKeyCode() )
1315 m_drawWire = !m_drawWire;
1316 SetToolMode( event.m_controlDown, event.m_shiftDown, event.AltDown() );
1320 if ( event.m_controlDown || event.m_shiftDown || event.AltDown() )
1321 SetToolMode( event.m_controlDown, event.m_shiftDown, event.AltDown() );
1326 void a2dMasterTagGroups4 ::OnKeyUp( wxKeyEvent& event )
1334 switch( event.GetKeyCode() )
1339 SetToolMode( event.m_controlDown, event.m_shiftDown, event.AltDown() );
1343 if ( !event.m_controlDown || !event.m_shiftDown || !event.AltDown() )
1344 SetToolMode( event.m_controlDown, event.m_shiftDown, event.AltDown() );
1353 float minDist = FLT_MAX;
1354 for( i = 0; i < hitinfo.
m_extended.size(); i++ )
1357 if( wire2 && hitinfo.
m_extended[i].GetHitType().m_distance < minDist && hitinfo.
m_extended[i].GetHitType().IsStrokeHit() )
1371 m_modehitinfo = how2;
1374 switch( how2.m_stroke2 )
1376 case a2dHit::stroke2_vertex:
1378 SetStateString( _(
"drag to move vertex on the wire"), STAT_toolHelp );
1379 m_mode = mode_editwire_vertex;
1381 case a2dHit::stroke2_edgehor:
1382 case a2dHit::stroke2_edgevert:
1383 case a2dHit::stroke2_edgeother:
1385 SetStateString( _(
"drag to insert vertex on the wire"), STAT_toolHelp );
1386 m_mode = mode_editwire_segmentinsert;
1390 m_modehitinfo =
a2dHit();
1395 switch( how2.m_stroke2 )
1397 case a2dHit::stroke2_vertex:
1399 SetStateString( _(
"click to remove vertex from wire"), STAT_toolHelp );
1400 m_mode = mode_editwire_vertex;
1402 case a2dHit::stroke2_edgehor:
1404 SetStateString( _(
"drag to move segment of the wire"), STAT_toolHelp );
1405 m_mode = mode_editwire_segmenthorizontal;
1407 case a2dHit::stroke2_edgevert:
1409 SetStateString( _(
"drag to move segment of the wire"), STAT_toolHelp );
1410 m_mode = mode_editwire_segmentvertical;
1412 case a2dHit::stroke2_edgeother:
1414 SetStateString( _(
"drag to move segment, Alt key to insert a vertex on wire"), STAT_toolHelp );
1415 m_mode = mode_editwire_segment;
1419 m_modehitinfo =
a2dHit();
1426 void a2dMasterTagGroups4::SetToolMode(
bool ctrl,
bool shift,
bool alt )
1433 ic.SetLayer( wxLAYER_ALL );
1443 m_modehitinfo =
a2dHit();
1455 if ( !pin && !ctrl && shift )
1460 SetStateString( _(
"drag to move object, double click to edit"), STAT_toolHelp );
1466 SetStateString( _(
"move to object and click to select"), STAT_toolHelp );
1469 m_mode = mode_select;
1501 SetWireCursor( wire, m_hitinfo, ctrl, shift, alt );
1505 if ( m_drawWire || ( !m_drawWire && ctrl ) )
1524 if ( !( m_drawWire || ( !m_drawWire && ctrl ) ) &&
1529 SetStateString( _(
"drag the pin and reroute wires"), STAT_toolHelp );
1530 m_mode = mode_move_pin;
1533 if ( !( m_drawWire || ( !m_drawWire && ctrl ) ) &&
1541 SetStateString( _(
"drag to rewire"), STAT_toolHelp );
1542 m_mode = mode_rewire_pin;
1550 SetStateString( _(
"draw a wire from pin"), STAT_toolHelp );
1551 m_mode = mode_drawwire;
1567 SetStateString( _(
"draw a wire from pin, or drag to rewire"), STAT_toolHelp );
1568 m_mode = mode_drawwire;
1574 SetStateString( _(
"draw a wire from pin"), STAT_toolHelp );
1575 m_mode = mode_drawwire;
1579 else if (!
m_dragStarted && !( m_drawWire || ( !m_drawWire && ctrl ) ) )
1583 SetStateString( _(
"Drag the pin or start a wire with a click"), STAT_toolHelp );
1584 m_mode = mode_drawwire;
1587 else if ( m_drawWire || ( !m_drawWire && ctrl ) || !
m_dragStarted )
1591 SetStateString( _(
"start a wire with a click"), STAT_toolHelp );
1592 m_mode = mode_drawwire;
1598 if ( m_drawWire || ( !m_drawWire && ctrl ) )
1602 SetStateString( _(
"draw a wire"), STAT_toolHelp );
1603 m_mode = mode_drawwire;
1611 SetWireCursor( wire, m_hitinfo, ctrl, shift, alt );
1638 SetStateString( _(
"click to select object"), STAT_toolHelp );
1639 m_mode = mode_select;
1648 if ( !pin && !shift && !ctrl )
1671 if ( !( m_drawWire || ( !m_drawWire && ctrl ) ) &&
1675 m_mode = mode_move_pin;
1676 SetStateString( _(
"drag the pin and reroute wires"), STAT_toolHelp );
1683 SetStateString( _(
"draw a wire from this pin"), STAT_toolHelp );
1684 m_mode = mode_drawwire;
1691 SetStateString( _(
"Rewire this pin"), STAT_toolHelp );
1692 m_mode = mode_rewire_pin;
1700 SetStateString( _(
"draw a wire from this pin"), STAT_toolHelp );
1701 m_mode = mode_drawwire;
1712 if ( ctrl && shift )
1714 m_mode = mode_copymulti;
1715 SetStateString( _(
"drag to copy selected objects"), STAT_toolHelp );
1720 SetStateString( _(
"drag to move selected objects"), STAT_toolHelp );
1721 m_mode = mode_dragmulti;
1730 SetStateString( _(
"click to select object, double click to edit"), STAT_toolHelp );
1731 m_mode = mode_select;
1738 SetStateString( _(
"drag to move object"), STAT_toolHelp );
1746 SetStateString( _(
"can not drag this object, double click to edit"), STAT_toolHelp );
1747 m_mode = mode_select;
1756 SetStateString( _(
"click on object, drag rectangle to select objects"), STAT_toolHelp );
1757 m_mode = mode_select;
1763 void a2dMasterTagGroups4::EditDlgOrHandles(
a2dCanvasObject* hit,
bool modifier,
bool noHandleEditForWire )
1773 hit = m_modehit = m_modehit->
GetParent();
1781 if ( !m_dlgOrEditModal )
1785 a2dStyleDialog styleDlg(
GetDrawing()->GetHabitat(), NULL, wxDEFAULT_DIALOG_STYLE | wxDIALOG_NO_PARENT | wxMINIMIZE_BOX | wxMAXIMIZE_BOX,
true );
1786 styleDlg.SetFill( hit->GetFill() );
1787 styleDlg.SetStroke( hit->GetStroke() );
1788 if ( styleDlg.ShowModal() == wxID_OK )
1792 hit->
SetFill( styleDlg.GetFill() );
1805 if ( (wire && wire->
GetSelected() ) || (wire && !noHandleEditForWire ) || !wire )
1810 PushEditTool( m_modehit );
1816 void a2dMasterTagGroups4::OnTimer(wxTimerEvent& event)
1818 if ( m_startEditIfDelayed )
1819 m_editIfDelayed =
true;
1820 if ( m_hadDoubleClick )
1822 m_hadDoubleClick =
false;
1824 m_selectionIfNoDoubleClick =
false;
1825 m_drawWireIfNoDoubleClick =
false;
1829 if ( m_drawWireIfNoDoubleClick && m_mode == mode_drawwire )
1838 m_mode = mode_drawwire;
1840 PushDrawWireTool( m_modehit );
1842 wxMouseEvent mouseevent( wxEVT_LEFT_DOWN );
1845 mouseevent.m_controlDown =
true;
1846 mouseevent.m_leftDown =
true;
1847 mouseevent.SetEventObject(
this);
1851 wxMouseEvent mouseevent2( wxEVT_LEFT_UP );
1854 mouseevent2.m_controlDown =
true;
1855 mouseevent2.m_leftDown =
true;
1856 mouseevent2.SetEventObject(
this);
1860 m_drawWireIfNoDoubleClick =
false;
1863 if ( m_selectionIfNoDoubleClick )
1865 if ( m_selectMoreAtShift )
1867 else if ( !m_modehit )
1874 m_modehit->
SetSelected( !m_modehitLastSelectState );
1876 m_selectionIfNoDoubleClick =
false;
1882 void a2dMasterTagGroups4::OnMouseEvent( wxMouseEvent& event )
1896 if ( event.LeftDClick() &&
1901 m_hadDoubleClick =
true;
1902 EditDlgOrHandles( m_modehit, event.ControlDown(), m_drawWire );
1904 else if ( event.Dragging() && m_toolBusy && !
m_dragStarted )
1910 SetToolMode( event.ControlDown(),
event.ShiftDown(),
event.AltDown() );
1914 case mode_cntrlselect:
1921 case mode_dragmulti:
1924 PushDragMultiTool( m_modehit );
1928 case mode_copymulti:
1931 PushCopyMultiTool( m_modehit );
1938 PushDragTool( m_modehit );
1945 PushCopyTool( m_modehit );
1952 PushMovePinTool( m_modehit );
1953 wxMouseEvent mouseevent( wxEVT_LEFT_DOWN );
1958 case mode_rewire_pin:
1961 PushRewirePinTool( m_modehit );
1962 wxMouseEvent mouseevent( wxEVT_LEFT_DOWN );
1976 else if ( event.Moving() && !m_toolBusy )
1978 SetToolMode( event.ControlDown(),
event.ShiftDown(),
event.AltDown() );
1981 else if( event.LeftDown() && !m_toolBusy )
1984 m_timer.Start( 280,
true );
1985 m_editIfDelayed =
false;
1987 SetStateString(
"" );
1997 m_mode = mode_select;
2011 case mode_rewire_pin:
2017 case mode_editwire_vertex:
2018 case mode_editwire_segmenthorizontal:
2019 case mode_editwire_segmentvertical:
2020 case mode_editwire_segmentinsert:
2021 case mode_editwire_segment:
2038 else if( event.LeftUp() && m_toolBusy )
2044 m_modehitLastSelectState =
false;
2046 m_modehitLastSelectState = m_modehit->
GetSelected();
2048 if ( m_editIfDelayed )
2050 m_editIfDelayed =
false;
2051 EditDlgOrHandles( m_modehit, event.ControlDown(), m_drawWire );
2053 if ( !event.ControlDown() && !
event.ShiftDown() )
2055 m_selectionIfNoDoubleClick =
true;
2057 if ( event.ControlDown() )
2059 m_drawWireIfNoDoubleClick =
true;
2061 else if ( event.ShiftDown() )
2073 SetToolMode( event.ControlDown(),
event.ShiftDown(),
event.AltDown() );
2075 else if( event.RightDown() && !
GetBusy() )
a2dPin * FindNonWirePin(a2dCanvasObjectFlagsMask mask=a2dCanvasOFlags::ALL)
void AbortBusyMode()
Called when the user aborts editing a distinct object */.
#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.
void Render()
implement rendering
void Render()
implement rendering
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)
a command processor specially designed to work with a a2dCanvasDocument
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
void DoStopTool(bool abort)
to do tool specific stuff to stop a tool. Called from StopTool().
a2dCanvasObject is the base class for Canvas Objects.
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.
virtual a2dCanvasObject * GetParent() const
used to change style of canvas objects in a a2dCanvasDocument
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.
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
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
if set, respect layer order, hit testing is done per layer from the top.
static const a2dCanvasObjectFlagsMask SELECTED
bool IsSelected() const
Is the object selected flag set.
void RemovePins(bool NotConnected=false, bool onlyTemporary=false, bool now=false)
Remove all a2dPin children.
Master tool for objects graphics slecting and dragging.
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 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)
virtual void SetActive(bool active=true)
set the tool active or inactive.
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
a2dCanvasCommandProcessor * GetCanvasCommandProcessor()
get a pointer to the command processor
void DoStopTool(bool abort)
to do tool specific stuff to stop a tool. Called from StopTool().
void AbortBusyMode()
Called when the user aborts editing a distinct object */.
a2dCanvasObject * Find(a2dCanvasObject *obj) const
return the object if it is part of the list
bool GetSelectable() const
is the object selectable flag set
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 ...
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.
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...
bool DisconnectEvent(wxEventType type, wxEvtHandler *eventSink)
bool GetDraggable() const
get if the object can be dragged
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.
virtual void SetActive(bool active=true)
set the tool active or inactive.