EE_SELECTION_TOOL correctly identifies buses and wires for auto starting

This commit is contained in:
James 2021-02-15 14:57:06 +00:00 committed by Jon Evans
parent cf42d692bf
commit 9205f1571d
1 changed files with 30 additions and 4 deletions

View File

@ -314,6 +314,7 @@ int EE_SELECTION_TOOL::Main( const TOOL_EVENT& aEvent )
while( TOOL_EVENT* evt = Wait() )
{
bool displayWireCursor = false;
bool displayBusCursor = false;
KIID rolloverItem = lastRolloverItem;
m_additive = m_subtractive = m_exclusive_or = false;
@ -356,7 +357,18 @@ int EE_SELECTION_TOOL::Main( const TOOL_EVENT& aEvent )
if( m_frame->eeconfig()->m_Drawing.auto_start_wires
&& collector[0]->IsPointClickableAnchor( (wxPoint) snappedCursorPos ) )
{
OPT_TOOL_EVENT newEvt = EE_ACTIONS::drawWire.MakeEvent();
OPT_TOOL_EVENT newEvt;
SCH_CONNECTION* connection = collector[0]->Connection();
if( connection && connection->IsBus() )
{
newEvt = EE_ACTIONS::drawBus.MakeEvent();
}
else
{
newEvt = EE_ACTIONS::drawWire.MakeEvent();
}
auto* params = newEvt->Parameter<DRAW_SEGMENT_EVENT_PARAMS*>();
auto* newParams = new DRAW_SEGMENT_EVENT_PARAMS();
@ -557,8 +569,18 @@ int EE_SELECTION_TOOL::Main( const TOOL_EVENT& aEvent )
if( m_frame->eeconfig()->m_Drawing.auto_start_wires
&& collector[0]->IsPointClickableAnchor( (wxPoint) snappedCursorPos ) )
{
SCH_CONNECTION* connection = collector[0]->Connection();
if( connection && connection->IsBus() )
{
displayBusCursor = true;
}
else
{
displayWireCursor = true;
}
getViewControls()->ForceCursorPosition( true, snappedCursorPos );
}
else if( collector[0]->IsHypertext()
@ -614,6 +636,10 @@ int EE_SELECTION_TOOL::Main( const TOOL_EVENT& aEvent )
{
m_nonModifiedCursor = KICURSOR::LINE_WIRE_ADD;
}
else if( displayBusCursor )
{
m_nonModifiedCursor = KICURSOR::LINE_BUS;
}
else if( rolloverItem != niluuid )
{
m_nonModifiedCursor = KICURSOR::HAND;