7
mirror of https://gitlab.com/kicad/code/kicad.git synced 2025-04-04 23:35:31 +00:00

Support both short and long item descriptions.

This commit is contained in:
Jeff Young 2024-06-27 10:11:55 +01:00
parent c4f61c2eaf
commit 16340e6cf4
89 changed files with 180 additions and 173 deletions

View File

@ -237,9 +237,10 @@ bool DS_DRAW_ITEM_TEXT::HitTest( const BOX2I& aRect, bool aContains, int aAccura
}
wxString DS_DRAW_ITEM_TEXT::GetItemDescription( UNITS_PROVIDER* aUnitsProvider ) const
wxString DS_DRAW_ITEM_TEXT::GetItemDescription( UNITS_PROVIDER* aUnitsProvider, bool aFull ) const
{
return wxString::Format( _( "Text '%s'" ), KIUI::EllipsizeMenuText( GetText() ) );
return wxString::Format( _( "Text '%s'" ),
aFull ? GetShownText( false ) : KIUI::EllipsizeMenuText( GetText() ) );
}
@ -332,7 +333,7 @@ bool DS_DRAW_ITEM_POLYPOLYGONS::HitTest( const BOX2I& aRect, bool aContained, in
}
wxString DS_DRAW_ITEM_POLYPOLYGONS::GetItemDescription( UNITS_PROVIDER* aUnitsProvider ) const
wxString DS_DRAW_ITEM_POLYPOLYGONS::GetItemDescription( UNITS_PROVIDER* aUnitsProvider, bool aFull ) const
{
return _( "Imported Shape" );
}
@ -431,7 +432,7 @@ bool DS_DRAW_ITEM_RECT::HitTest( const BOX2I& aRect, bool aContained, int aAccur
}
wxString DS_DRAW_ITEM_RECT::GetItemDescription( UNITS_PROVIDER* aUnitsProvider ) const
wxString DS_DRAW_ITEM_RECT::GetItemDescription( UNITS_PROVIDER* aUnitsProvider, bool aFull ) const
{
return wxString::Format( _( "Rectangle, width %s height %s" ),
aUnitsProvider->MessageTextFromValue( std::abs( GetStart().x - GetEnd().x ) ),
@ -464,7 +465,7 @@ bool DS_DRAW_ITEM_LINE::HitTest( const VECTOR2I& aPosition, int aAccuracy ) cons
}
wxString DS_DRAW_ITEM_LINE::GetItemDescription( UNITS_PROVIDER* aUnitsProvider ) const
wxString DS_DRAW_ITEM_LINE::GetItemDescription( UNITS_PROVIDER* aUnitsProvider, bool aFull ) const
{
return wxString::Format( _( "Line, length %s" ),
aUnitsProvider->MessageTextFromValue( GetStart().Distance( GetEnd() ) ) );
@ -516,13 +517,13 @@ bool DS_DRAW_ITEM_BITMAP::HitTest( const BOX2I& aRect, bool aContains, int aAccu
}
wxString DS_DRAW_ITEM_BITMAP::GetItemDescription( UNITS_PROVIDER* aUnitsProvider ) const
wxString DS_DRAW_ITEM_BITMAP::GetItemDescription( UNITS_PROVIDER* aUnitsProvider, bool aFull ) const
{
return _( "Image" );
}
wxString DS_DRAW_ITEM_PAGE::GetItemDescription( UNITS_PROVIDER* aUnitsProvider ) const
wxString DS_DRAW_ITEM_PAGE::GetItemDescription( UNITS_PROVIDER* aUnitsProvider, bool aFull ) const
{
return _( "Page Limits" );
}

View File

@ -105,7 +105,7 @@ INSPECT_RESULT EDA_ITEM::Visit( INSPECTOR inspector, void* testData,
}
wxString EDA_ITEM::GetItemDescription( UNITS_PROVIDER* aUnitsProvider ) const
wxString EDA_ITEM::GetItemDescription( UNITS_PROVIDER* aUnitsProvider, bool aFull ) const
{
wxFAIL_MSG( wxT( "GetItemDescription() was not overridden for schematic item type " ) +
GetClass() );

View File

@ -133,9 +133,9 @@ wxString RC_ITEM::ShowReport( UNITS_PROVIDER* aUnitsProvider, SEVERITY aSeverity
GetViolatingRuleDesc(),
severity,
showCoord( aUnitsProvider, mainItem->GetPosition()),
mainItem->GetItemDescription( aUnitsProvider ),
mainItem->GetItemDescription( aUnitsProvider, true ),
showCoord( aUnitsProvider, auxItem->GetPosition()),
auxItem->GetItemDescription( aUnitsProvider ) );
auxItem->GetItemDescription( aUnitsProvider, true ) );
}
else if( mainItem )
{
@ -145,7 +145,7 @@ wxString RC_ITEM::ShowReport( UNITS_PROVIDER* aUnitsProvider, SEVERITY aSeverity
GetViolatingRuleDesc(),
severity,
showCoord( aUnitsProvider, mainItem->GetPosition()),
mainItem->GetItemDescription( aUnitsProvider ) );
mainItem->GetItemDescription( aUnitsProvider, true ) );
}
else
{
@ -190,7 +190,7 @@ void RC_ITEM::GetJsonViolation( RC_JSON::VIOLATION& aViolation, UNITS_PROVIDER*
if( mainItem )
{
RC_JSON::AFFECTED_ITEM item;
item.description = mainItem->GetItemDescription( aUnitsProvider );
item.description = mainItem->GetItemDescription( aUnitsProvider, true );
item.uuid = mainItem->m_Uuid.AsString();
item.pos.x = EDA_UNIT_UTILS::UI::ToUserUnit( aUnitsProvider->GetIuScale(),
aUnitsProvider->GetUserUnits(),
@ -204,7 +204,7 @@ void RC_ITEM::GetJsonViolation( RC_JSON::VIOLATION& aViolation, UNITS_PROVIDER*
if( auxItem )
{
RC_JSON::AFFECTED_ITEM item;
item.description = auxItem->GetItemDescription( aUnitsProvider );
item.description = auxItem->GetItemDescription( aUnitsProvider, true );
item.uuid = auxItem->m_Uuid.AsString();
item.pos.x = EDA_UNIT_UTILS::UI::ToUserUnit( aUnitsProvider->GetIuScale(),
aUnitsProvider->GetUserUnits(),
@ -467,7 +467,7 @@ void RC_TREE_MODEL::GetValue( wxVariant& aVariant,
}
if( item )
msg += item->GetItemDescription( m_editFrame );
msg += item->GetItemDescription( m_editFrame, true );
msg.Replace( wxS( "\n" ), wxS( " " ) );
aVariant = msg;

View File

@ -286,18 +286,18 @@ bool SELECTION_TOOL::doSelectionMenu( COLLECTOR* aCollector )
{
#ifdef __WXMAC__
menuText = wxString::Format( "%s\t%d",
item->GetItemDescription( unitsProvider ),
item->GetItemDescription( unitsProvider, false ),
i + 1 );
#else
menuText = wxString::Format( "&%d %s\t%d",
i + 1,
item->GetItemDescription( unitsProvider ),
item->GetItemDescription( unitsProvider, false ),
i + 1 );
#endif
}
else
{
menuText = item->GetItemDescription( unitsProvider );
menuText = item->GetItemDescription( unitsProvider, false );
}
menu.Add( menuText, i + 1, item->GetMenuImage() );

View File

@ -1579,7 +1579,7 @@ void CONNECTION_GRAPH::collectAllDriverValues()
UNITS_PROVIDER unitsProvider( schIUScale, EDA_UNITS::MILLIMETRES );
wxLogTrace( ConnTrace, wxS( "Unexpected strong driver %s" ),
driver->GetItemDescription( &unitsProvider ) );
driver->GetItemDescription( &unitsProvider, true ) );
break;
}
}
@ -1850,7 +1850,7 @@ void CONNECTION_GRAPH::processSubGraphs()
wxS( "%ld (%s) weakly driven by unique sheet pin %s, "
"promoting" ),
subgraph->m_code, name,
subgraph->m_driver->GetItemDescription( &unitsProvider ) );
subgraph->m_driver->GetItemDescription( &unitsProvider, true ) );
subgraph->m_strong_driver = true;
}

View File

@ -338,14 +338,14 @@ void ERC_TREE_MODEL::GetValue( wxVariant& aVariant, wxDataViewItem const& aItem,
schEditFrame->SetCurrentSheet( aSheet );
aSheet.UpdateAllScreenReferences();
{
desc = aCurrItem->GetItemDescription( m_editFrame );
desc = aCurrItem->GetItemDescription( m_editFrame, true );
}
schEditFrame->SetCurrentSheet( curSheet );
curSheet.UpdateAllScreenReferences();
}
else
{
desc = aCurrItem->GetItemDescription( m_editFrame );
desc = aCurrItem->GetItemDescription( m_editFrame, true );
}
return desc;

View File

@ -1510,7 +1510,7 @@ std::vector<LIB_SYMBOL_UNIT> LIB_SYMBOL::GetUnitDrawItems()
#define REPORT( msg ) { if( aReporter ) aReporter->Report( msg ); }
#define ITEM_DESC( item ) ( item )->GetItemDescription( &unitsProvider )
#define ITEM_DESC( item ) ( item )->GetItemDescription( &unitsProvider, true )
int LIB_SYMBOL::Compare( const LIB_SYMBOL& aRhs, int aCompareFlags, REPORTER* aReporter ) const
{

View File

@ -133,7 +133,7 @@ public:
void MirrorVertically( int aCenter ) override;
void Rotate( const VECTOR2I& aCenter, bool aRotateCCW ) override;
wxString GetItemDescription( UNITS_PROVIDER* aUnitsProvider ) const override
wxString GetItemDescription( UNITS_PROVIDER* aUnitsProvider, bool aFull ) const override
{
return wxString( _( "Image" ) );
}

View File

@ -443,13 +443,13 @@ bool SCH_BUS_ENTRY_BASE::HasConnectivityChanges( const SCH_ITEM* aItem,
}
wxString SCH_BUS_WIRE_ENTRY::GetItemDescription( UNITS_PROVIDER* aUnitsProvider ) const
wxString SCH_BUS_WIRE_ENTRY::GetItemDescription( UNITS_PROVIDER* aUnitsProvider, bool aFull ) const
{
return wxString( _( "Bus to Wire Entry" ) );
}
wxString SCH_BUS_BUS_ENTRY::GetItemDescription( UNITS_PROVIDER* aUnitsProvider ) const
wxString SCH_BUS_BUS_ENTRY::GetItemDescription( UNITS_PROVIDER* aUnitsProvider, bool aFull ) const
{
return wxString( _( "Bus to Bus Entry" ) );
}

View File

@ -191,7 +191,7 @@ public:
( aItem->GetLayer() == LAYER_WIRE || aItem->GetLayer() == LAYER_BUS );
}
wxString GetItemDescription( UNITS_PROVIDER* aUnitsProvider ) const override;
wxString GetItemDescription( UNITS_PROVIDER* aUnitsProvider, bool aFull ) const override;
EDA_ITEM* Clone() const override;
@ -239,7 +239,7 @@ public:
return aItem->Type() == SCH_LINE_T && aItem->GetLayer() == LAYER_BUS;
}
wxString GetItemDescription( UNITS_PROVIDER* aUnitsProvider ) const override;
wxString GetItemDescription( UNITS_PROVIDER* aUnitsProvider, bool aFull ) const override;
EDA_ITEM* Clone() const override;

View File

@ -467,7 +467,9 @@ void SCH_CONNECTION::AppendInfoToMsgPanel( std::vector<MSG_PANEL_ITEM>& aList )
{
UNITS_PROVIDER unitsProvider( schIUScale, EDA_UNITS::MILLIMETRES );
msg.Printf( wxS( "%s at %p" ), driver->GetItemDescription( &unitsProvider ), driver );
msg.Printf( wxS( "%s at %p" ),
driver->GetItemDescription( &unitsProvider, false ),
driver );
aList.emplace_back( wxT( "Connection Source" ), msg );
}
#endif

View File

@ -1054,9 +1054,11 @@ void SCH_FIELD::CalcEdit( const VECTOR2I& aPosition )
}
wxString SCH_FIELD::GetItemDescription( UNITS_PROVIDER* aUnitsProvider ) const
wxString SCH_FIELD::GetItemDescription( UNITS_PROVIDER* aUnitsProvider, bool aFull ) const
{
return wxString::Format( "%s '%s'", UnescapeString( GetName() ), KIUI::EllipsizeMenuText( GetText() ) );
return wxString::Format( _( "Field %s '%s'" ),
UnescapeString( GetName() ),
aFull ? GetShownText( false ) : KIUI::EllipsizeMenuText( GetText() ) );
}

View File

@ -255,7 +255,7 @@ public:
bool Replace( const EDA_SEARCH_DATA& aSearchData, void* aAuxData = nullptr ) override;
wxString GetItemDescription( UNITS_PROVIDER* aUnitsProvider ) const override;
wxString GetItemDescription( UNITS_PROVIDER* aUnitsProvider, bool aFull ) const override;
void GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>& aList ) override;
BITMAPS GetMenuImage() const override;

View File

@ -97,7 +97,7 @@ public:
|| aItem->Type() == SCH_DIRECTIVE_LABEL_T );
}
wxString GetItemDescription( UNITS_PROVIDER* aUnitsProvider ) const override
wxString GetItemDescription( UNITS_PROVIDER* aUnitsProvider, bool aFull ) const override
{
return wxString( _( "Junction" ) );
}

View File

@ -1529,10 +1529,10 @@ const BOX2I SCH_LABEL::GetBodyBoundingBox() const
}
wxString SCH_LABEL::GetItemDescription( UNITS_PROVIDER* aUnitsProvider ) const
wxString SCH_LABEL::GetItemDescription( UNITS_PROVIDER* aUnitsProvider, bool aFull ) const
{
return wxString::Format( _( "Label '%s'" ),
KIUI::EllipsizeMenuText( GetShownText( false ) ) );
aFull ? GetShownText( false ) : KIUI::EllipsizeMenuText( GetText() ) );
}
@ -1796,7 +1796,7 @@ void SCH_DIRECTIVE_LABEL::AutoplaceFields( SCH_SCREEN* aScreen, bool aManual )
}
wxString SCH_DIRECTIVE_LABEL::GetItemDescription( UNITS_PROVIDER* aUnitsProvider ) const
wxString SCH_DIRECTIVE_LABEL::GetItemDescription( UNITS_PROVIDER* aUnitsProvider, bool aFull ) const
{
if( m_fields.empty() )
{
@ -1806,7 +1806,8 @@ wxString SCH_DIRECTIVE_LABEL::GetItemDescription( UNITS_PROVIDER* aUnitsProvider
{
return wxString::Format( _( "Directive Label [%s %s]" ),
UnescapeString( m_fields[0].GetName() ),
KIUI::EllipsizeMenuText( m_fields[0].GetShownText( false ) ) );
aFull ? m_fields[0].GetShownText( false )
: KIUI::EllipsizeMenuText( m_fields[0].GetText() ) );
}
}
@ -2049,10 +2050,10 @@ void SCH_GLOBALLABEL::CreateGraphicShape( const RENDER_SETTINGS* aRenderSettings
}
wxString SCH_GLOBALLABEL::GetItemDescription( UNITS_PROVIDER* aUnitsProvider ) const
wxString SCH_GLOBALLABEL::GetItemDescription( UNITS_PROVIDER* aUnitsProvider, bool aFull ) const
{
return wxString::Format( _( "Global Label '%s'" ),
KIUI::EllipsizeMenuText( GetShownText( false ) ) );
aFull ? GetShownText( false ) : KIUI::EllipsizeMenuText( GetText() ) );
}
@ -2196,10 +2197,10 @@ VECTOR2I SCH_HIERLABEL::GetSchematicTextOffset( const RENDER_SETTINGS* aSettings
}
wxString SCH_HIERLABEL::GetItemDescription( UNITS_PROVIDER* aUnitsProvider ) const
wxString SCH_HIERLABEL::GetItemDescription( UNITS_PROVIDER* aUnitsProvider, bool aFull ) const
{
return wxString::Format( _( "Hierarchical Label '%s'" ),
KIUI::EllipsizeMenuText( GetShownText( false ) ) );
aFull ? GetShownText( false ) : KIUI::EllipsizeMenuText( GetText() ) );
}

View File

@ -397,7 +397,7 @@ public:
bool IsConnectable() const override { return true; }
wxString GetItemDescription( UNITS_PROVIDER* aUnitsProvider ) const override;
wxString GetItemDescription( UNITS_PROVIDER* aUnitsProvider, bool aFull ) const override;
BITMAPS GetMenuImage() const override;
@ -460,12 +460,13 @@ public:
int GetPenWidth() const override;
void CreateGraphicShape( const RENDER_SETTINGS* aSettings, std::vector<VECTOR2I>& aPoints,
void CreateGraphicShape( const RENDER_SETTINGS* aSettings,
std::vector<VECTOR2I>& aPoints,
const VECTOR2I& aPos ) const override;
void AutoplaceFields( SCH_SCREEN* aScreen, bool aManual ) override;
wxString GetItemDescription( UNITS_PROVIDER* aUnitsProvider ) const override;
wxString GetItemDescription( UNITS_PROVIDER* aUnitsProvider, bool aFull ) const override;
bool IsConnectable() const override { return true; }
@ -531,7 +532,8 @@ public:
VECTOR2I GetSchematicTextOffset( const RENDER_SETTINGS* aSettings ) const override;
void CreateGraphicShape( const RENDER_SETTINGS* aRenderSettings, std::vector<VECTOR2I>& aPoints,
void CreateGraphicShape( const RENDER_SETTINGS* aRenderSettings,
std::vector<VECTOR2I>& aPoints,
const VECTOR2I& aPos ) const override;
bool ResolveTextVar( const SCH_SHEET_PATH* aPath, wxString* token, int aDepth ) const override;
@ -540,7 +542,7 @@ public:
void ViewGetLayers( int aLayers[], int& aCount ) const override;
wxString GetItemDescription( UNITS_PROVIDER* aUnitsProvider ) const override;
wxString GetItemDescription( UNITS_PROVIDER* aUnitsProvider, bool aFull ) const override;
BITMAPS GetMenuImage() const override;
@ -595,7 +597,7 @@ public:
bool IsConnectable() const override { return true; }
wxString GetItemDescription( UNITS_PROVIDER* aUnitsProvider ) const override;
wxString GetItemDescription( UNITS_PROVIDER* aUnitsProvider, bool aFull ) const override;
BITMAPS GetMenuImage() const override;

View File

@ -735,7 +735,7 @@ void SCH_LINE::GetSelectedPoints( std::vector<VECTOR2I>& aPoints ) const
}
wxString SCH_LINE::GetItemDescription( UNITS_PROVIDER* aUnitsProvider ) const
wxString SCH_LINE::GetItemDescription( UNITS_PROVIDER* aUnitsProvider, bool aFull ) const
{
wxString txtfmt;

View File

@ -275,7 +275,7 @@ public:
bool CanConnect( const SCH_ITEM* aItem ) const override;
wxString GetItemDescription( UNITS_PROVIDER* aUnitsProvider ) const override;
wxString GetItemDescription( UNITS_PROVIDER* aUnitsProvider, bool aFull ) const override;
BITMAPS GetMenuImage() const override;

View File

@ -308,10 +308,10 @@ void SCH_MARKER::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_
auxItem = aFrame->GetItem( m_rcItem->GetAuxItemID() );
if( mainItem )
mainText = mainItem->GetItemDescription( aFrame );
mainText = mainItem->GetItemDescription( aFrame, true );
if( auxItem )
auxText = auxItem->GetItemDescription( aFrame );
auxText = auxItem->GetItemDescription( aFrame, true );
aList.emplace_back( mainText, auxText );
}

View File

@ -96,7 +96,7 @@ public:
void GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>& aList ) override;
wxString GetItemDescription( UNITS_PROVIDER* aUnitsProvider ) const override
wxString GetItemDescription( UNITS_PROVIDER* aUnitsProvider, bool aFull ) const override
{
return wxString( _( "ERC Marker" ) );
}

View File

@ -93,7 +93,7 @@ public:
std::vector<VECTOR2I> GetConnectionPoints() const override;
wxString GetItemDescription( UNITS_PROVIDER* aUnitsProvider ) const override
wxString GetItemDescription( UNITS_PROVIDER* aUnitsProvider, bool aFull ) const override
{
return wxString( _( "No Connect" ) );
}

View File

@ -1879,7 +1879,7 @@ wxString SCH_PIN::GetItemDescription( UNITS_PROVIDER* aUnitsProvider, ALT* aAlt
}
wxString SCH_PIN::GetItemDescription( UNITS_PROVIDER* aUnitsProvider ) const
wxString SCH_PIN::GetItemDescription( UNITS_PROVIDER* aUnitsProvider, bool aFull ) const
{
if( m_libPin )
{

View File

@ -228,7 +228,7 @@ public:
BITMAPS GetMenuImage() const override;
wxString GetItemDescription( UNITS_PROVIDER* aUnitsProvider ) const override;
wxString GetItemDescription( UNITS_PROVIDER* aUnitsProvider, bool aFull ) const override;
wxString GetItemDescription( UNITS_PROVIDER* aUnitsProvider, ALT* aAlt ) const;
EDA_ITEM* Clone() const override;

View File

@ -195,7 +195,7 @@ void SCH_RULE_AREA::Plot( PLOTTER* aPlotter, bool aBackground, const SCH_PLOT_OP
}
wxString SCH_RULE_AREA::GetItemDescription( UNITS_PROVIDER* aUnitsProvider ) const
wxString SCH_RULE_AREA::GetItemDescription( UNITS_PROVIDER* aUnitsProvider, bool aFull ) const
{
return _( "Schematic rule area" );
}

View File

@ -67,7 +67,7 @@ public:
virtual void Plot( PLOTTER* aPlotter, bool aBackground, const SCH_PLOT_OPTS& aPlotOpts,
int aUnit, int aBodyStyle, const VECTOR2I& aOffset, bool aDimmed ) override;
wxString GetItemDescription( UNITS_PROVIDER* aUnitsProvider ) const override;
wxString GetItemDescription( UNITS_PROVIDER* aUnitsProvider, bool aFull ) const override;
/// @brief Resets all item and directive caches, saving the current state first
void ResetCaches( KIGFX::SCH_VIEW* view );

Some files were not shown because too many files have changed in this diff Show More