Allow clicking on terminal point to finish a bus unfold.
Fixes https://gitlab.com/kicad/code/kicad/issues/7413
This commit is contained in:
parent
088ff5b2bb
commit
d70cebcd62
|
@ -485,38 +485,40 @@ bool SCH_SCREEN::IsTerminalPoint( const wxPoint& aPosition, int aLayer )
|
|||
wxCHECK_MSG( aLayer == LAYER_NOTES || aLayer == LAYER_BUS || aLayer == LAYER_WIRE, false,
|
||||
wxT( "Invalid layer type passed to SCH_SCREEN::IsTerminalPoint()." ) );
|
||||
|
||||
SCH_SHEET_PIN* label;
|
||||
SCH_TEXT* text;
|
||||
SCH_CONNECTION conn;
|
||||
|
||||
switch( aLayer )
|
||||
{
|
||||
case LAYER_BUS:
|
||||
|
||||
{
|
||||
if( GetBus( aPosition ) )
|
||||
return true;
|
||||
|
||||
label = GetSheetLabel( aPosition );
|
||||
SCH_SHEET_PIN* sheetPin = GetSheetPin( aPosition );
|
||||
|
||||
if( label && conn.MightBeBusLabel( label->GetText() ) && label->IsConnected( aPosition ) )
|
||||
if( sheetPin && SCH_CONNECTION::MightBeBusLabel( sheetPin->GetText() )
|
||||
&& sheetPin->IsConnected( aPosition ) )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
text = GetLabel( aPosition );
|
||||
SCH_TEXT* label = GetLabel( aPosition );
|
||||
|
||||
if( text && conn.MightBeBusLabel( text->GetText() ) && text->IsConnected( aPosition )
|
||||
&& (text->Type() != SCH_LABEL_T) )
|
||||
if( label && SCH_CONNECTION::MightBeBusLabel( label->GetText() )
|
||||
&& label->IsConnected( aPosition ) && label->Type() != SCH_LABEL_T )
|
||||
{
|
||||
return true;
|
||||
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case LAYER_NOTES:
|
||||
|
||||
{
|
||||
if( GetLine( aPosition ) )
|
||||
return true;
|
||||
|
||||
}
|
||||
break;
|
||||
|
||||
case LAYER_WIRE:
|
||||
{
|
||||
if( GetItem( aPosition, Mils2iu( 6 ), SCH_BUS_WIRE_ENTRY_T) )
|
||||
return true;
|
||||
|
||||
|
@ -532,16 +534,22 @@ bool SCH_SCREEN::IsTerminalPoint( const wxPoint& aPosition, int aLayer )
|
|||
if( GetWire( aPosition ) )
|
||||
return true;
|
||||
|
||||
text = GetLabel( aPosition );
|
||||
SCH_TEXT* label = GetLabel( aPosition );
|
||||
|
||||
if( text && text->IsConnected( aPosition ) && !conn.MightBeBusLabel( text->GetText() ) )
|
||||
if( label && !SCH_CONNECTION::MightBeBusLabel( label->GetText() )
|
||||
&& label->IsConnected( aPosition ) && label->Type() != SCH_LABEL_T )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
label = GetSheetLabel( aPosition );
|
||||
SCH_SHEET_PIN* sheetPin = GetSheetPin( aPosition );
|
||||
|
||||
if( label && label->IsConnected( aPosition ) && !conn.MightBeBusLabel( label->GetText() ) )
|
||||
if( sheetPin && sheetPin->IsConnected( aPosition )
|
||||
&& !SCH_CONNECTION::MightBeBusLabel( sheetPin->GetText() ) )
|
||||
{
|
||||
return true;
|
||||
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
|
@ -892,7 +900,7 @@ LIB_PIN* SCH_SCREEN::GetPin( const wxPoint& aPosition, SCH_COMPONENT** aSymbol,
|
|||
}
|
||||
|
||||
|
||||
SCH_SHEET_PIN* SCH_SCREEN::GetSheetLabel( const wxPoint& aPosition )
|
||||
SCH_SHEET_PIN* SCH_SCREEN::GetSheetPin( const wxPoint& aPosition )
|
||||
{
|
||||
SCH_SHEET_PIN* sheetPin = nullptr;
|
||||
|
||||
|
|
|
@ -390,7 +390,7 @@ public:
|
|||
* @param aPosition The position to test.
|
||||
* @return The sheet label object if found otherwise NULL.
|
||||
*/
|
||||
SCH_SHEET_PIN* GetSheetLabel( const wxPoint& aPosition );
|
||||
SCH_SHEET_PIN* GetSheetPin( const wxPoint& aPosition );
|
||||
|
||||
/**
|
||||
* Clear the annotation for the components in \a aSheetPath on the screen.
|
||||
|
|
|
@ -628,10 +628,9 @@ int SCH_LINE_WIRE_BUS_TOOL::doDrawSegments( const std::string& aTool, int aType,
|
|||
// Create a new segment if we're out of previously-created ones
|
||||
else if( !segment->IsNull() || ( forceHV && !m_wires[ m_wires.size() - 2 ]->IsNull() ) )
|
||||
{
|
||||
// Terminate the command if the end point is on a pin, junction, or another
|
||||
// Terminate the command if the end point is on a pin, junction, label, or another
|
||||
// wire or bus.
|
||||
if( !m_busUnfold.in_progress
|
||||
&& screen->IsTerminalPoint( cursorPos, segment->GetLayer() ) )
|
||||
if( screen->IsTerminalPoint( cursorPos, segment->GetLayer() ) )
|
||||
{
|
||||
finishSegments();
|
||||
segment = nullptr;
|
||||
|
|
Loading…
Reference in New Issue