DIALOG_LABEL_PROPERTIES, add global label: better filtering of candidates.
The list of candidates (names) must be restricted to existing global labels and symbols creating a global net name: power symbols having only one power input pin (a power output does not create net name). Fixes #14319 https://gitlab.com/kicad/code/kicad/issues/14319
This commit is contained in:
parent
fc6279a2ea
commit
8b144539e8
|
@ -286,7 +286,11 @@ bool DIALOG_LABEL_PROPERTIES::TransferDataToWindow()
|
||||||
for( SCH_ITEM* item : screen->Items().OfType( SCH_SYMBOL_LOCATE_POWER_T ) )
|
for( SCH_ITEM* item : screen->Items().OfType( SCH_SYMBOL_LOCATE_POWER_T ) )
|
||||||
{
|
{
|
||||||
const SCH_SYMBOL* power = static_cast<const SCH_SYMBOL*>( item );
|
const SCH_SYMBOL* power = static_cast<const SCH_SYMBOL*>( item );
|
||||||
existingLabels.insert( UnescapeString( power->GetValueFieldText( false ) ) );
|
|
||||||
|
// Ensure the symbol has the Power (i.e. equivalent to a global label
|
||||||
|
// before adding its value in list
|
||||||
|
if( power->IsSymbolLikePowerGlobalLabel() )
|
||||||
|
existingLabels.insert( UnescapeString( power->GetValueFieldText( false ) ) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2329,3 +2329,22 @@ bool SCH_SYMBOL::IsPointClickableAnchor( const VECTOR2I& aPos ) const
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool SCH_SYMBOL::IsSymbolLikePowerGlobalLabel() const
|
||||||
|
{
|
||||||
|
// return true if the symbol is equivalent to a global label:
|
||||||
|
// It is a Power symbol
|
||||||
|
// It has only one pin type Power input
|
||||||
|
|
||||||
|
if( !GetLibSymbolRef() || !GetLibSymbolRef()->IsPower() )
|
||||||
|
return false;
|
||||||
|
|
||||||
|
std::vector<LIB_PIN*> pin_list = GetAllLibPins();
|
||||||
|
|
||||||
|
if( pin_list.size() != 1 )
|
||||||
|
return false;
|
||||||
|
|
||||||
|
return pin_list[0]->GetType() == ELECTRICAL_PINTYPE::PT_POWER_IN;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
@ -756,6 +756,13 @@ public:
|
||||||
|
|
||||||
bool IsPointClickableAnchor( const VECTOR2I& aPos ) const override;
|
bool IsPointClickableAnchor( const VECTOR2I& aPos ) const override;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return true if the symbol is equivalent to a global label:
|
||||||
|
* It is a Power symbol
|
||||||
|
* It has only one pin type Power input
|
||||||
|
*/
|
||||||
|
bool IsSymbolLikePowerGlobalLabel() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
BOX2I doGetBoundingBox( bool aIncludePins, bool aIncludeFields ) const;
|
BOX2I doGetBoundingBox( bool aIncludePins, bool aIncludeFields ) const;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue