Properties Panel: Plain-language descriptive noun function of EDA_ITEM

This commit is contained in:
Roberto Fernandez Bautista 2022-05-08 23:54:24 +01:00 committed by Jon Evans
parent f5a75a4001
commit bfdb39f418
3 changed files with 16 additions and 3 deletions

View File

@ -303,6 +303,15 @@ std::ostream& EDA_ITEM::NestedSpace( int nestLevel, std::ostream& os )
#endif
wxString EDA_ITEM::GetTypeDesc()
{
//@see EDA_ITEM_DESC for definition of ENUM_MAP<KICAD_T>
wxString typeDescr = ENUM_MAP<KICAD_T>::Instance().ToString( Type() );
return wxGetTranslation( typeDescr );
}
static struct EDA_ITEM_DESC
{
EDA_ITEM_DESC()

View File

@ -90,9 +90,7 @@ void PROPERTIES_PANEL::update( const SELECTION& aSelection )
}
else
{
// TODO: Plain-language descriptive noun function in EDA_ITEM classes
// TODO: Need to override this in PCB editor vs. schematic
m_caption->SetLabel( aSelection.Front()->GetClass() );
m_caption->SetLabel( aSelection.Front()->GetTypeDesc() );
}
PROPERTY_MANAGER& propMgr = PROPERTY_MANAGER::Instance();

View File

@ -350,6 +350,12 @@ public:
*/
virtual wxString GetClass() const = 0;
/**
* Return a translated description of the type for this EDA_ITEM for display in user facing
* messages.
*/
wxString GetTypeDesc();
/**
* Return the text to display to be used in the selection clarification context menu
* when multiple items are found at the current cursor position.