Do not show click to start wire cursor for hidden pins.

Selecting show hidden pins will allow users to connect to hidden pins.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/17145
This commit is contained in:
Wayne Stambaugh 2024-04-21 10:54:34 -04:00
parent 7d8215401a
commit ca18dc8ec8
3 changed files with 45 additions and 0 deletions

View File

@ -1103,6 +1103,29 @@ SCH_PIN* SCH_SYMBOL::GetPin( const wxString& aNumber ) const
}
const SCH_PIN* SCH_SYMBOL::GetPin( const VECTOR2I& aPos ) const
{
for( const std::unique_ptr<SCH_PIN>& pin : m_pins )
{
int pin_unit = pin->GetLibPin() ? pin->GetLibPin()->GetUnit()
: GetUnit();
int pin_bodyStyle = pin->GetLibPin() ? pin->GetLibPin()->GetBodyStyle()
: GetBodyStyle();
if( pin_unit > 0 && pin_unit != GetUnit() )
continue;
if( pin_bodyStyle > 0 && pin_bodyStyle != GetBodyStyle() )
continue;
if( pin->IsPointClickableAnchor( aPos ) )
return pin.get();
}
return nullptr;
}
std::vector<SCH_PIN*> SCH_SYMBOL::GetLibPins() const
{
if( m_part )

View File

@ -619,6 +619,15 @@ public:
*/
SCH_PIN* GetPin( SCH_PIN* aLibPin ) const;
/**
* Return the #SCH_PIN object found at \a aPosition.
*
* @param aPosition is the position of the pin to fetch.
*
* @return the #SCH_PIN object found at \a aPosition or nullptr.
*/
const SCH_PIN* GetPin( const VECTOR2I& aPosition ) const;
/**
* Retrieve a list of the SCH_PINs for the given sheet path.
*

View File

@ -965,6 +965,19 @@ OPT_TOOL_EVENT EE_SELECTION_TOOL::autostartEvent( TOOL_EVENT* aEvent, EE_GRID_HE
if( possibleConnection.IsBus() )
newEvt = EE_ACTIONS::drawBus.MakeEvent();
}
else if( aItem->Type() == SCH_SYMBOL_T )
{
const SCH_SYMBOL* symbol = static_cast<const SCH_SYMBOL*>( aItem );
wxCHECK( symbol, OPT_TOOL_EVENT() );
const SCH_PIN* pin = symbol->GetPin( pos );
wxCHECK( pin, OPT_TOOL_EVENT() );
if( !pin->IsVisible() && !m_frame->eeconfig()->m_Appearance.show_hidden_pins )
return OPT_TOOL_EVENT();
}
newEvt->SetMousePosition( pos );
newEvt->SetHasPosition( true );