From 16340e6cf49759fe8f2483ae296f03adcfaf75a7 Mon Sep 17 00:00:00 2001 From: Jeff Young Date: Thu, 27 Jun 2024 10:11:55 +0100 Subject: [PATCH] Support both short and long item descriptions. --- common/drawing_sheet/ds_draw_item.cpp | 15 +++++----- common/eda_item.cpp | 2 +- common/rc_item.cpp | 12 ++++---- common/tool/selection_tool.cpp | 6 ++-- eeschema/connection_graph.cpp | 4 +-- eeschema/erc/erc_item.cpp | 4 +-- eeschema/lib_symbol.cpp | 2 +- eeschema/sch_bitmap.h | 2 +- eeschema/sch_bus_entry.cpp | 4 +-- eeschema/sch_bus_entry.h | 4 +-- eeschema/sch_connection.cpp | 4 ++- eeschema/sch_field.cpp | 6 ++-- eeschema/sch_field.h | 2 +- eeschema/sch_junction.h | 2 +- eeschema/sch_label.cpp | 17 ++++++----- eeschema/sch_label.h | 14 +++++---- eeschema/sch_line.cpp | 2 +- eeschema/sch_line.h | 2 +- eeschema/sch_marker.cpp | 4 +-- eeschema/sch_marker.h | 2 +- eeschema/sch_no_connect.h | 2 +- eeschema/sch_pin.cpp | 2 +- eeschema/sch_pin.h | 2 +- eeschema/sch_rule_area.cpp | 2 +- eeschema/sch_rule_area.h | 2 +- eeschema/sch_shape.cpp | 2 +- eeschema/sch_shape.h | 2 +- eeschema/sch_sheet.cpp | 5 ++-- eeschema/sch_sheet.h | 2 +- eeschema/sch_sheet_path.cpp | 2 +- eeschema/sch_sheet_pin.cpp | 4 +-- eeschema/sch_sheet_pin.h | 2 +- eeschema/sch_symbol.cpp | 2 +- eeschema/sch_symbol.h | 2 +- eeschema/sch_table.cpp | 2 +- eeschema/sch_table.h | 2 +- eeschema/sch_tablecell.cpp | 2 +- eeschema/sch_tablecell.h | 2 +- eeschema/sch_text.cpp | 5 ++-- eeschema/sch_text.h | 2 +- eeschema/sch_textbox.cpp | 2 +- eeschema/sch_textbox.h | 2 +- gerbview/gerber_draw_item.cpp | 2 +- gerbview/gerber_draw_item.h | 2 +- include/board_item.h | 2 +- include/drawing_sheet/ds_draw_item.h | 12 ++++---- include/eda_item.h | 3 +- pcbnew/board.cpp | 2 +- pcbnew/board.h | 2 +- pcbnew/dialogs/dialog_group_properties.cpp | 4 +-- pcbnew/dialogs/dialog_position_relative.cpp | 2 +- pcbnew/drc/drc_engine.cpp | 30 +++++++++---------- .../drc/drc_test_provider_library_parity.cpp | 2 +- pcbnew/footprint.cpp | 2 +- pcbnew/footprint.h | 2 +- pcbnew/generators/pcb_tuning_pattern.cpp | 2 +- pcbnew/pad.cpp | 2 +- pcbnew/pad.h | 2 +- pcbnew/pcb_dimension.cpp | 4 +-- pcbnew/pcb_dimension.h | 2 +- pcbnew/pcb_field.cpp | 29 ++++++++---------- pcbnew/pcb_field.h | 2 +- pcbnew/pcb_generator.cpp | 2 +- pcbnew/pcb_generator.h | 2 +- pcbnew/pcb_group.cpp | 2 +- pcbnew/pcb_group.h | 2 +- pcbnew/pcb_marker.cpp | 11 ++++--- pcbnew/pcb_marker.h | 2 +- pcbnew/pcb_reference_image.h | 2 +- pcbnew/pcb_shape.cpp | 2 +- pcbnew/pcb_shape.h | 2 +- pcbnew/pcb_table.cpp | 2 +- pcbnew/pcb_table.h | 2 +- pcbnew/pcb_tablecell.cpp | 2 +- pcbnew/pcb_tablecell.h | 2 +- pcbnew/pcb_target.cpp | 2 +- pcbnew/pcb_target.h | 2 +- pcbnew/pcb_text.cpp | 12 ++++---- pcbnew/pcb_text.h | 2 +- pcbnew/pcb_textbox.cpp | 4 +-- pcbnew/pcb_textbox.h | 2 +- pcbnew/pcb_track.cpp | 4 +-- pcbnew/pcb_track.h | 4 +-- pcbnew/router/pns_kicad_iface.cpp | 2 +- pcbnew/router/pns_shove.cpp | 2 +- pcbnew/tools/board_inspection_tool.cpp | 2 +- pcbnew/tools/pcb_control.cpp | 4 +-- pcbnew/zone.cpp | 2 +- pcbnew/zone.h | 2 +- 89 files changed, 180 insertions(+), 173 deletions(-) diff --git a/common/drawing_sheet/ds_draw_item.cpp b/common/drawing_sheet/ds_draw_item.cpp index 7fedf7c5ec..bf12e88c93 100644 --- a/common/drawing_sheet/ds_draw_item.cpp +++ b/common/drawing_sheet/ds_draw_item.cpp @@ -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" ); } diff --git a/common/eda_item.cpp b/common/eda_item.cpp index 1c93019386..69b9ec5a8b 100644 --- a/common/eda_item.cpp +++ b/common/eda_item.cpp @@ -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() ); diff --git a/common/rc_item.cpp b/common/rc_item.cpp index acc95fe857..bfdf1be75d 100644 --- a/common/rc_item.cpp +++ b/common/rc_item.cpp @@ -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; diff --git a/common/tool/selection_tool.cpp b/common/tool/selection_tool.cpp index ffee8af308..4c3c185bbe 100644 --- a/common/tool/selection_tool.cpp +++ b/common/tool/selection_tool.cpp @@ -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() ); diff --git a/eeschema/connection_graph.cpp b/eeschema/connection_graph.cpp index f002209f21..b9506d31ba 100644 --- a/eeschema/connection_graph.cpp +++ b/eeschema/connection_graph.cpp @@ -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; } diff --git a/eeschema/erc/erc_item.cpp b/eeschema/erc/erc_item.cpp index 12cc56a6c3..8de95075ea 100644 --- a/eeschema/erc/erc_item.cpp +++ b/eeschema/erc/erc_item.cpp @@ -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; diff --git a/eeschema/lib_symbol.cpp b/eeschema/lib_symbol.cpp index 3d06d60984..ec902d139f 100644 --- a/eeschema/lib_symbol.cpp +++ b/eeschema/lib_symbol.cpp @@ -1510,7 +1510,7 @@ std::vector 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 { diff --git a/eeschema/sch_bitmap.h b/eeschema/sch_bitmap.h index 597b96ab83..cea7e9c237 100644 --- a/eeschema/sch_bitmap.h +++ b/eeschema/sch_bitmap.h @@ -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" ) ); } diff --git a/eeschema/sch_bus_entry.cpp b/eeschema/sch_bus_entry.cpp index 556a1406e8..d50c9fd3ef 100644 --- a/eeschema/sch_bus_entry.cpp +++ b/eeschema/sch_bus_entry.cpp @@ -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" ) ); } diff --git a/eeschema/sch_bus_entry.h b/eeschema/sch_bus_entry.h index 4c8f3b0fa1..2a45ba1e33 100644 --- a/eeschema/sch_bus_entry.h +++ b/eeschema/sch_bus_entry.h @@ -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; diff --git a/eeschema/sch_connection.cpp b/eeschema/sch_connection.cpp index 415efbf034..dce4684eb1 100644 --- a/eeschema/sch_connection.cpp +++ b/eeschema/sch_connection.cpp @@ -467,7 +467,9 @@ void SCH_CONNECTION::AppendInfoToMsgPanel( std::vector& 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 diff --git a/eeschema/sch_field.cpp b/eeschema/sch_field.cpp index 950bf4e9dc..2f35a76e65 100644 --- a/eeschema/sch_field.cpp +++ b/eeschema/sch_field.cpp @@ -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() ) ); } diff --git a/eeschema/sch_field.h b/eeschema/sch_field.h index 1cb84b6e71..3b3d98f018 100644 --- a/eeschema/sch_field.h +++ b/eeschema/sch_field.h @@ -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& aList ) override; BITMAPS GetMenuImage() const override; diff --git a/eeschema/sch_junction.h b/eeschema/sch_junction.h index 20b9e9cb98..d85438cdaf 100644 --- a/eeschema/sch_junction.h +++ b/eeschema/sch_junction.h @@ -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" ) ); } diff --git a/eeschema/sch_label.cpp b/eeschema/sch_label.cpp index 62485d66d0..8fa5e4106a 100644 --- a/eeschema/sch_label.cpp +++ b/eeschema/sch_label.cpp @@ -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() ) ); } diff --git a/eeschema/sch_label.h b/eeschema/sch_label.h index 62f273b7a8..c52fd82f90 100644 --- a/eeschema/sch_label.h +++ b/eeschema/sch_label.h @@ -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& aPoints, + void CreateGraphicShape( const RENDER_SETTINGS* aSettings, + std::vector& 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& aPoints, + void CreateGraphicShape( const RENDER_SETTINGS* aRenderSettings, + std::vector& 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; diff --git a/eeschema/sch_line.cpp b/eeschema/sch_line.cpp index 8233e2f786..f6b387994c 100644 --- a/eeschema/sch_line.cpp +++ b/eeschema/sch_line.cpp @@ -735,7 +735,7 @@ void SCH_LINE::GetSelectedPoints( std::vector& aPoints ) const } -wxString SCH_LINE::GetItemDescription( UNITS_PROVIDER* aUnitsProvider ) const +wxString SCH_LINE::GetItemDescription( UNITS_PROVIDER* aUnitsProvider, bool aFull ) const { wxString txtfmt; diff --git a/eeschema/sch_line.h b/eeschema/sch_line.h index ce7a99d714..88797b5f41 100644 --- a/eeschema/sch_line.h +++ b/eeschema/sch_line.h @@ -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; diff --git a/eeschema/sch_marker.cpp b/eeschema/sch_marker.cpp index 0fb568b9f1..3871ed2e36 100644 --- a/eeschema/sch_marker.cpp +++ b/eeschema/sch_marker.cpp @@ -308,10 +308,10 @@ void SCH_MARKER::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vectorGetItem( 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 ); } diff --git a/eeschema/sch_marker.h b/eeschema/sch_marker.h index 837636098e..b3654b3a0f 100644 --- a/eeschema/sch_marker.h +++ b/eeschema/sch_marker.h @@ -96,7 +96,7 @@ public: void GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector& aList ) override; - wxString GetItemDescription( UNITS_PROVIDER* aUnitsProvider ) const override + wxString GetItemDescription( UNITS_PROVIDER* aUnitsProvider, bool aFull ) const override { return wxString( _( "ERC Marker" ) ); } diff --git a/eeschema/sch_no_connect.h b/eeschema/sch_no_connect.h index 774f9f73be..150712c8b2 100644 --- a/eeschema/sch_no_connect.h +++ b/eeschema/sch_no_connect.h @@ -93,7 +93,7 @@ public: std::vector GetConnectionPoints() const override; - wxString GetItemDescription( UNITS_PROVIDER* aUnitsProvider ) const override + wxString GetItemDescription( UNITS_PROVIDER* aUnitsProvider, bool aFull ) const override { return wxString( _( "No Connect" ) ); } diff --git a/eeschema/sch_pin.cpp b/eeschema/sch_pin.cpp index 0930814bf6..fac162f579 100644 --- a/eeschema/sch_pin.cpp +++ b/eeschema/sch_pin.cpp @@ -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 ) { diff --git a/eeschema/sch_pin.h b/eeschema/sch_pin.h index fd9a250e47..13428ef768 100644 --- a/eeschema/sch_pin.h +++ b/eeschema/sch_pin.h @@ -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; diff --git a/eeschema/sch_rule_area.cpp b/eeschema/sch_rule_area.cpp index 4f3fbbc848..d2b20aa55b 100644 --- a/eeschema/sch_rule_area.cpp +++ b/eeschema/sch_rule_area.cpp @@ -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" ); } diff --git a/eeschema/sch_rule_area.h b/eeschema/sch_rule_area.h index 67c5b3c678..948bd3a5e6 100644 --- a/eeschema/sch_rule_area.h +++ b/eeschema/sch_rule_area.h @@ -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 ); diff --git a/eeschema/sch_shape.cpp b/eeschema/sch_shape.cpp index 91e24c18e1..9d4f0699a7 100644 --- a/eeschema/sch_shape.cpp +++ b/eeschema/sch_shape.cpp @@ -507,7 +507,7 @@ void SCH_SHAPE::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector& aList ) override; - wxString GetItemDescription( UNITS_PROVIDER* aUnitsProvider ) const override; + wxString GetItemDescription( UNITS_PROVIDER* aUnitsProvider, bool aFull ) const override; BITMAPS GetMenuImage() const override; diff --git a/eeschema/sch_sheet.cpp b/eeschema/sch_sheet.cpp index cefb958595..98ad1fd07a 100644 --- a/eeschema/sch_sheet.cpp +++ b/eeschema/sch_sheet.cpp @@ -1180,10 +1180,11 @@ void SCH_SHEET::RunOnChildren( const std::function& aFunction } -wxString SCH_SHEET::GetItemDescription( UNITS_PROVIDER* aUnitsProvider ) const +wxString SCH_SHEET::GetItemDescription( UNITS_PROVIDER* aUnitsProvider, bool aFull ) const { return wxString::Format( _( "Hierarchical Sheet %s" ), - KIUI::EllipsizeMenuText( m_fields[ SHEETNAME ].GetText() ) ); + aFull ? m_fields[ SHEETNAME ].GetShownText( false ) + : KIUI::EllipsizeMenuText( m_fields[ SHEETNAME ].GetText() ) ); } diff --git a/eeschema/sch_sheet.h b/eeschema/sch_sheet.h index ff099a9cdb..b93a9c4762 100644 --- a/eeschema/sch_sheet.h +++ b/eeschema/sch_sheet.h @@ -387,7 +387,7 @@ public: bool GetDNP() const { return m_DNP; } void SetDNP( bool aDNP ) { m_DNP = aDNP; } - wxString GetItemDescription( UNITS_PROVIDER* aUnitsProvider ) const override; + wxString GetItemDescription( UNITS_PROVIDER* aUnitsProvider, bool aFull ) const override; BITMAPS GetMenuImage() const override; diff --git a/eeschema/sch_sheet_path.cpp b/eeschema/sch_sheet_path.cpp index 3158437e80..86d442d0d7 100644 --- a/eeschema/sch_sheet_path.cpp +++ b/eeschema/sch_sheet_path.cpp @@ -52,7 +52,7 @@ public: SCH_ITEM( nullptr, NOT_USED ) {} - wxString GetItemDescription( UNITS_PROVIDER* aUnitsProvider ) const override + wxString GetItemDescription( UNITS_PROVIDER* aUnitsProvider, bool aFull ) const override { return _( "(Deleted Item)" ); } diff --git a/eeschema/sch_sheet_pin.cpp b/eeschema/sch_sheet_pin.cpp index 5e1702bbb7..20c0945c70 100644 --- a/eeschema/sch_sheet_pin.cpp +++ b/eeschema/sch_sheet_pin.cpp @@ -334,10 +334,10 @@ void SCH_SHEET_PIN::GetEndPoints( std::vector& aItemList ) } -wxString SCH_SHEET_PIN::GetItemDescription( UNITS_PROVIDER* aUnitsProvider ) const +wxString SCH_SHEET_PIN::GetItemDescription( UNITS_PROVIDER* aUnitsProvider, bool aFull ) const { return wxString::Format( _( "Hierarchical Sheet Pin %s" ), - KIUI::EllipsizeMenuText( GetText() ) ); + aFull ? GetShownText( false ) : KIUI::EllipsizeMenuText( GetText() ) ); } diff --git a/eeschema/sch_sheet_pin.h b/eeschema/sch_sheet_pin.h index 418d6bf692..3d3511f63e 100644 --- a/eeschema/sch_sheet_pin.h +++ b/eeschema/sch_sheet_pin.h @@ -187,7 +187,7 @@ public: bool HasConnectivityChanges( const SCH_ITEM* aItem, const SCH_SHEET_PATH* aInstance = nullptr ) const override; - wxString GetItemDescription( UNITS_PROVIDER* aUnitsProvider ) const override; + wxString GetItemDescription( UNITS_PROVIDER* aUnitsProvider, bool aFull ) const override; BITMAPS GetMenuImage() const override; diff --git a/eeschema/sch_symbol.cpp b/eeschema/sch_symbol.cpp index b766f294ee..3a33aa5d3f 100644 --- a/eeschema/sch_symbol.cpp +++ b/eeschema/sch_symbol.cpp @@ -2231,7 +2231,7 @@ SCH_ITEM* SCH_SYMBOL::GetDrawItem( const VECTOR2I& aPosition, KICAD_T aType ) } -wxString SCH_SYMBOL::GetItemDescription( UNITS_PROVIDER* aUnitsProvider ) const +wxString SCH_SYMBOL::GetItemDescription( UNITS_PROVIDER* aUnitsProvider, bool aFull ) const { return wxString::Format( _( "Symbol %s [%s]" ), KIUI::EllipsizeMenuText( GetField( REFERENCE_FIELD )->GetText() ), diff --git a/eeschema/sch_symbol.h b/eeschema/sch_symbol.h index 2b0fbe1ad9..0c4c9b40a7 100644 --- a/eeschema/sch_symbol.h +++ b/eeschema/sch_symbol.h @@ -786,7 +786,7 @@ public: */ SCH_ITEM* GetDrawItem( const VECTOR2I& aPosition, KICAD_T aType = TYPE_NOT_INIT ); - wxString GetItemDescription( UNITS_PROVIDER* aUnitsProvider ) const override; + wxString GetItemDescription( UNITS_PROVIDER* aUnitsProvider, bool aFull ) const override; BITMAPS GetMenuImage() const override; diff --git a/eeschema/sch_table.cpp b/eeschema/sch_table.cpp index 2701b81627..68b04dbc6c 100644 --- a/eeschema/sch_table.cpp +++ b/eeschema/sch_table.cpp @@ -395,7 +395,7 @@ INSPECT_RESULT SCH_TABLE::Visit( INSPECTOR aInspector, void* aTestData, } -wxString SCH_TABLE::GetItemDescription( UNITS_PROVIDER* aUnitsProvider ) const +wxString SCH_TABLE::GetItemDescription( UNITS_PROVIDER* aUnitsProvider, bool aFull ) const { return wxString::Format( _( "%d Column Table" ), m_colCount ); } diff --git a/eeschema/sch_table.h b/eeschema/sch_table.h index d29fbda3f8..57823c149f 100644 --- a/eeschema/sch_table.h +++ b/eeschema/sch_table.h @@ -191,7 +191,7 @@ public: return false; } - wxString GetItemDescription( UNITS_PROVIDER* aUnitsProvider ) const override; + wxString GetItemDescription( UNITS_PROVIDER* aUnitsProvider, bool aFull ) const override; BITMAPS GetMenuImage() const override; diff --git a/eeschema/sch_tablecell.cpp b/eeschema/sch_tablecell.cpp index 65fb10abf8..1dc8fae7f4 100644 --- a/eeschema/sch_tablecell.cpp +++ b/eeschema/sch_tablecell.cpp @@ -47,7 +47,7 @@ void SCH_TABLECELL::SwapData( SCH_ITEM* aItem ) } -wxString SCH_TABLECELL::GetItemDescription( UNITS_PROVIDER* aUnitsProvider ) const +wxString SCH_TABLECELL::GetItemDescription( UNITS_PROVIDER* aUnitsProvider, bool aFull ) const { return wxString::Format( _( "Table Cell %s" ), GetAddr() ); } diff --git a/eeschema/sch_tablecell.h b/eeschema/sch_tablecell.h index ea69be0c8a..c8731a598e 100644 --- a/eeschema/sch_tablecell.h +++ b/eeschema/sch_tablecell.h @@ -43,7 +43,7 @@ public: return wxT( "SCH_TABLECELL" ); } - wxString GetItemDescription( UNITS_PROVIDER* aUnitsProvider ) const override; + wxString GetItemDescription( UNITS_PROVIDER* aUnitsProvider, bool aFull ) const override; EDA_ITEM* Clone() const override { diff --git a/eeschema/sch_text.cpp b/eeschema/sch_text.cpp index 7f92aff694..529c2094d7 100644 --- a/eeschema/sch_text.cpp +++ b/eeschema/sch_text.cpp @@ -450,9 +450,10 @@ void SCH_TEXT::DoHypertextAction( EDA_DRAW_FRAME* aFrame ) const } -wxString SCH_TEXT::GetItemDescription( UNITS_PROVIDER* aUnitsProvider ) const +wxString SCH_TEXT::GetItemDescription( UNITS_PROVIDER* aUnitsProvider, bool aFull ) const { - return wxString::Format( _( "Graphic Text '%s'" ), KIUI::EllipsizeMenuText( GetText() ) ); + return wxString::Format( _( "Graphic Text '%s'" ), + aFull ? GetShownText( false ) : KIUI::EllipsizeMenuText( GetText() ) ); } diff --git a/eeschema/sch_text.h b/eeschema/sch_text.h index ec0f9261e6..15eff8439b 100644 --- a/eeschema/sch_text.h +++ b/eeschema/sch_text.h @@ -134,7 +134,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; diff --git a/eeschema/sch_textbox.cpp b/eeschema/sch_textbox.cpp index 9ad01b402f..afcad2b4ed 100644 --- a/eeschema/sch_textbox.cpp +++ b/eeschema/sch_textbox.cpp @@ -416,7 +416,7 @@ void SCH_TEXTBOX::DoHypertextAction( EDA_DRAW_FRAME* aFrame ) const } -wxString SCH_TEXTBOX::GetItemDescription( UNITS_PROVIDER* aUnitsProvider ) const +wxString SCH_TEXTBOX::GetItemDescription( UNITS_PROVIDER* aUnitsProvider, bool aFull ) const { return wxString::Format( _( "Text Box" ) ); } diff --git a/eeschema/sch_textbox.h b/eeschema/sch_textbox.h index 7e8d576dea..cb17131bb4 100644 --- a/eeschema/sch_textbox.h +++ b/eeschema/sch_textbox.h @@ -125,7 +125,7 @@ public: virtual bool IsReplaceable() const override { return true; } - wxString GetItemDescription( UNITS_PROVIDER* aUnitsProvider ) const override; + wxString GetItemDescription( UNITS_PROVIDER* aUnitsProvider, bool aFull ) const override; BITMAPS GetMenuImage() const override; diff --git a/gerbview/gerber_draw_item.cpp b/gerbview/gerber_draw_item.cpp index 0087a08391..d0f91c7c32 100644 --- a/gerbview/gerber_draw_item.cpp +++ b/gerbview/gerber_draw_item.cpp @@ -1029,7 +1029,7 @@ INSPECT_RESULT GERBER_DRAW_ITEM::Visit( INSPECTOR inspector, void* testData, } -wxString GERBER_DRAW_ITEM::GetItemDescription( UNITS_PROVIDER* aUnitsProvider ) const +wxString GERBER_DRAW_ITEM::GetItemDescription( UNITS_PROVIDER* aUnitsProvider, bool aFull ) const { wxString layerName = GERBER_FILE_IMAGE_LIST::GetImagesList().GetDisplayName( GetLayer(), true ); diff --git a/gerbview/gerber_draw_item.h b/gerbview/gerber_draw_item.h index 96aa20a6a2..4496de8c8e 100644 --- a/gerbview/gerber_draw_item.h +++ b/gerbview/gerber_draw_item.h @@ -221,7 +221,7 @@ public: const std::vector& aScanTypes ) override; ///< @copydoc EDA_ITEM::GetItemDescription() - virtual wxString GetItemDescription( UNITS_PROVIDER* aUnitsProvider ) const override; + virtual wxString GetItemDescription( UNITS_PROVIDER* aUnitsProvider, bool aFull ) const override; ///< @copydoc EDA_ITEM::GetMenuImage() BITMAPS GetMenuImage() const override; diff --git a/include/board_item.h b/include/board_item.h index cf762f9a65..9c40bc20da 100644 --- a/include/board_item.h +++ b/include/board_item.h @@ -427,7 +427,7 @@ public: BOARD_ITEM( nullptr, NOT_USED ) {} - wxString GetItemDescription( UNITS_PROVIDER* aUnitsProvider ) const override + wxString GetItemDescription( UNITS_PROVIDER* aUnitsProvider, bool aFull ) const override { return _( "(Deleted Item)" ); } diff --git a/include/drawing_sheet/ds_draw_item.h b/include/drawing_sheet/ds_draw_item.h index 336f9ed4f2..29e8b4d57f 100644 --- a/include/drawing_sheet/ds_draw_item.h +++ b/include/drawing_sheet/ds_draw_item.h @@ -155,7 +155,7 @@ public: void PrintWsItem( const RENDER_SETTINGS* aSettings, const VECTOR2I& aOffset ) override; - wxString GetItemDescription( UNITS_PROVIDER* aUnitsProvider ) const override; + wxString GetItemDescription( UNITS_PROVIDER* aUnitsProvider, bool aFull ) const override; #if defined(DEBUG) void Show( int nestLevel, std::ostream& os ) const override { ShowDummy( os ); } @@ -190,7 +190,7 @@ public: void PrintWsItem( const RENDER_SETTINGS* aSettings, const VECTOR2I& aOffset ) override; - wxString GetItemDescription( UNITS_PROVIDER* aUnitsProvider ) const override; + wxString GetItemDescription( UNITS_PROVIDER* aUnitsProvider, bool aFull ) const override; #if defined(DEBUG) void Show( int nestLevel, std::ostream& os ) const override { ShowDummy( os ); } @@ -243,7 +243,7 @@ public: bool HitTest( const VECTOR2I& aPosition, int aAccuracy = 0 ) const override; bool HitTest( const BOX2I& aRect, bool aContained, int aAccuracy = 0 ) const override; - wxString GetItemDescription( UNITS_PROVIDER* aUnitsProvider ) const override; + wxString GetItemDescription( UNITS_PROVIDER* aUnitsProvider, bool aFull ) const override; #if defined(DEBUG) void Show( int nestLevel, std::ostream& os ) const override { ShowDummy( os ); } @@ -290,7 +290,7 @@ public: const BOX2I GetBoundingBox() const override; bool HitTest( const VECTOR2I& aPosition, int aAccuracy = 0 ) const override { return false; } - wxString GetItemDescription( UNITS_PROVIDER* aUnitsProvider ) const override; + wxString GetItemDescription( UNITS_PROVIDER* aUnitsProvider, bool aFull ) const override; #if defined(DEBUG) void Show( int nestLevel, std::ostream& os ) const override { ShowDummy( os ); } @@ -343,7 +343,7 @@ public: bool HitTest( const VECTOR2I& aPosition, int aAccuracy = 0 ) const override; bool HitTest( const BOX2I& aRect, bool aContained, int aAccuracy = 0 ) const override; - wxString GetItemDescription( UNITS_PROVIDER* aUnitsProvider ) const override; + wxString GetItemDescription( UNITS_PROVIDER* aUnitsProvider, bool aFull ) const override; #if defined(DEBUG) void Show( int nestLevel, std::ostream& os ) const override { ShowDummy( os ); } @@ -380,7 +380,7 @@ public: const BOX2I GetBoundingBox() const override; - wxString GetItemDescription( UNITS_PROVIDER* aUnitsProvider ) const override; + wxString GetItemDescription( UNITS_PROVIDER* aUnitsProvider, bool aFull ) const override; #if defined(DEBUG) void Show( int nestLevel, std::ostream& os ) const override { ShowDummy( os ); } diff --git a/include/eda_item.h b/include/eda_item.h index 5cfbe442cd..384fa10976 100644 --- a/include/eda_item.h +++ b/include/eda_item.h @@ -347,9 +347,10 @@ public: * returns a string to indicate that it was not overridden to provide the object * specific text. * + * @param aLong indicates a long string is acceptable * @return The menu text string. */ - virtual wxString GetItemDescription( UNITS_PROVIDER* aUnitsProvider ) const; + virtual wxString GetItemDescription( UNITS_PROVIDER* aUnitsProvider, bool aFull ) const; /** * Return a pointer to an image to be used in menus. diff --git a/pcbnew/board.cpp b/pcbnew/board.cpp index 9ec0a90507..f6bdfc3d2e 100644 --- a/pcbnew/board.cpp +++ b/pcbnew/board.cpp @@ -1207,7 +1207,7 @@ void BOARD::RemoveAll( std::initializer_list aTypes ) } -wxString BOARD::GetItemDescription( UNITS_PROVIDER* aUnitsProvider ) const +wxString BOARD::GetItemDescription( UNITS_PROVIDER* aUnitsProvider, bool aFull ) const { return wxString::Format( _( "PCB" ) ); } diff --git a/pcbnew/board.h b/pcbnew/board.h index 94b28bfd64..9bd0c304bc 100644 --- a/pcbnew/board.h +++ b/pcbnew/board.h @@ -673,7 +673,7 @@ public: const TITLE_BLOCK& GetTitleBlock() const { return m_titles; } void SetTitleBlock( const TITLE_BLOCK& aTitleBlock ) { m_titles = aTitleBlock; } - wxString GetItemDescription( UNITS_PROVIDER* aUnitsProvider ) const override; + wxString GetItemDescription( UNITS_PROVIDER* aUnitsProvider, bool aFull ) const override; EDA_UNITS GetUserUnits() { return m_userUnits; } void SetUserUnits( EDA_UNITS aUnits ) { m_userUnits = aUnits; } diff --git a/pcbnew/dialogs/dialog_group_properties.cpp b/pcbnew/dialogs/dialog_group_properties.cpp index d69b208893..69ada33ae9 100644 --- a/pcbnew/dialogs/dialog_group_properties.cpp +++ b/pcbnew/dialogs/dialog_group_properties.cpp @@ -49,7 +49,7 @@ DIALOG_GROUP_PROPERTIES::DIALOG_GROUP_PROPERTIES( PCB_BASE_EDIT_FRAME* aParent, m_locked->Show( dynamic_cast( aParent ) != nullptr ); for( BOARD_ITEM* item : m_group->GetItems() ) - m_membersList->Append( item->GetItemDescription( m_brdEditor ), item ); + m_membersList->Append( item->GetItemDescription( m_brdEditor, true ), item ); SetupStandardButtons(); @@ -151,7 +151,7 @@ void DIALOG_GROUP_PROPERTIES::DoAddMember( EDA_ITEM* aItem ) if( aItem == m_group ) return; - m_membersList->Append( aItem->GetItemDescription( m_brdEditor ), aItem ); + m_membersList->Append( aItem->GetItemDescription( m_brdEditor, true ), aItem ); } diff --git a/pcbnew/dialogs/dialog_position_relative.cpp b/pcbnew/dialogs/dialog_position_relative.cpp index 8512d4e009..9c6f8f32c7 100644 --- a/pcbnew/dialogs/dialog_position_relative.cpp +++ b/pcbnew/dialogs/dialog_position_relative.cpp @@ -239,7 +239,7 @@ void DIALOG_POSITION_RELATIVE::updateAnchorInfo( BOARD_ITEM* aItem ) wxString msg = _( "" ); if( aItem ) - msg = aItem->GetItemDescription( &unitsProvider ); + msg = aItem->GetItemDescription( &unitsProvider, true ); m_referenceInfo->SetLabel( wxString::Format( _( "Reference item: %s" ), msg ) ); break; diff --git a/pcbnew/drc/drc_engine.cpp b/pcbnew/drc/drc_engine.cpp index 29c9775024..3a40330379 100644 --- a/pcbnew/drc/drc_engine.cpp +++ b/pcbnew/drc/drc_engine.cpp @@ -734,7 +734,7 @@ DRC_CONSTRAINT DRC_ENGINE::EvalRules( DRC_CONSTRAINT_T aConstraintType, const BO { REPORT( "" ) REPORT( wxString::Format( _( "Local override on %s; clearance: %s." ), - EscapeHTML( a->GetItemDescription( this ) ), + EscapeHTML( a->GetItemDescription( this, true ) ), MessageTextFromValue( overrideA.value() ) ) ) override_val = ac->GetClearanceOverrides( &msg ).value(); @@ -744,7 +744,7 @@ DRC_CONSTRAINT DRC_ENGINE::EvalRules( DRC_CONSTRAINT_T aConstraintType, const BO { REPORT( "" ) REPORT( wxString::Format( _( "Local override on %s; clearance: %s." ), - EscapeHTML( b->GetItemDescription( this ) ), + EscapeHTML( b->GetItemDescription( this, true ) ), EscapeHTML( MessageTextFromValue( overrideB.value() ) ) ) ) if( overrideB > override_val ) @@ -793,7 +793,7 @@ DRC_CONSTRAINT DRC_ENGINE::EvalRules( DRC_CONSTRAINT_T aConstraintType, const BO REPORT( "" ) REPORT( wxString::Format( _( "Local override on %s; zone connection: %s." ), - EscapeHTML( pad->GetItemDescription( this ) ), + EscapeHTML( pad->GetItemDescription( this, true ) ), EscapeHTML( PrintZoneConnection( override ) ) ) ) constraint.SetName( msg ); @@ -810,7 +810,7 @@ DRC_CONSTRAINT DRC_ENGINE::EvalRules( DRC_CONSTRAINT_T aConstraintType, const BO REPORT( "" ) REPORT( wxString::Format( _( "Local override on %s; thermal relief gap: %s." ), - EscapeHTML( pad->GetItemDescription( this ) ), + EscapeHTML( pad->GetItemDescription( this, true ) ), EscapeHTML( MessageTextFromValue( gap_override ) ) ) ) constraint.SetName( msg ); @@ -827,7 +827,7 @@ DRC_CONSTRAINT DRC_ENGINE::EvalRules( DRC_CONSTRAINT_T aConstraintType, const BO REPORT( "" ) REPORT( wxString::Format( _( "Local override on %s; thermal spoke width: %s." ), - EscapeHTML( pad->GetItemDescription( this ) ), + EscapeHTML( pad->GetItemDescription( this, true ) ), EscapeHTML( MessageTextFromValue( spoke_override ) ) ) ) if( zone && zone->GetMinThickness() > spoke_override ) @@ -836,7 +836,7 @@ DRC_CONSTRAINT DRC_ENGINE::EvalRules( DRC_CONSTRAINT_T aConstraintType, const BO REPORT( "" ) REPORT( wxString::Format( _( "%s min thickness: %s." ), - EscapeHTML( zone->GetItemDescription( this ) ), + EscapeHTML( zone->GetItemDescription( this, true ) ), EscapeHTML( MessageTextFromValue( spoke_override ) ) ) ) } @@ -1070,12 +1070,12 @@ DRC_CONSTRAINT DRC_ENGINE::EvalRules( DRC_CONSTRAINT_T aConstraintType, const BO else if( a_is_non_copper ) { REPORT( wxString::Format( _( "%s contains no copper. Rule ignored." ), - EscapeHTML( a->GetItemDescription( this ) ) ) ) + EscapeHTML( a->GetItemDescription( this, true ) ) ) ) } else if( b_is_non_copper ) { REPORT( wxString::Format( _( "%s contains no copper. Rule ignored." ), - EscapeHTML( b->GetItemDescription( this ) ) ) ) + EscapeHTML( b->GetItemDescription( this, true ) ) ) ) } return; @@ -1193,7 +1193,7 @@ DRC_CONSTRAINT DRC_ENGINE::EvalRules( DRC_CONSTRAINT_T aConstraintType, const BO { // Report non-drilled-holes as an implicit condition REPORT( wxString::Format( _( "%s is not a drilled hole; rule ignored." ), - a->GetItemDescription( this ) ) ) + a->GetItemDescription( this, true ) ) ) } else if( !c->condition || c->condition->GetExpression().IsEmpty() ) { @@ -1313,7 +1313,7 @@ DRC_CONSTRAINT DRC_ENGINE::EvalRules( DRC_CONSTRAINT_T aConstraintType, const BO } REPORT( wxString::Format( _( "Local clearance on %s: %s." ), - EscapeHTML( a->GetItemDescription( this ) ), + EscapeHTML( a->GetItemDescription( this, true ) ), MessageTextFromValue( localA ) ) ) if( localA > clearance ) @@ -1337,7 +1337,7 @@ DRC_CONSTRAINT DRC_ENGINE::EvalRules( DRC_CONSTRAINT_T aConstraintType, const BO } REPORT( wxString::Format( _( "Local clearance on %s: %s." ), - EscapeHTML( b->GetItemDescription( this ) ), + EscapeHTML( b->GetItemDescription( this, true ) ), MessageTextFromValue( localB ) ) ) if( localB > clearance ) @@ -1396,7 +1396,7 @@ DRC_CONSTRAINT DRC_ENGINE::EvalRules( DRC_CONSTRAINT_T aConstraintType, const BO { REPORT( "" ) REPORT( wxString::Format( _( "%s zone connection: %s." ), - EscapeHTML( parentFootprint->GetItemDescription( this ) ), + EscapeHTML( parentFootprint->GetItemDescription( this, true ) ), EscapeHTML( PrintZoneConnection( local ) ) ) ) constraint.SetParentRule( nullptr ); @@ -1412,7 +1412,7 @@ DRC_CONSTRAINT DRC_ENGINE::EvalRules( DRC_CONSTRAINT_T aConstraintType, const BO REPORT( "" ) REPORT( wxString::Format( _( "%s pad connection: %s." ), - EscapeHTML( zone->GetItemDescription( this ) ), + EscapeHTML( zone->GetItemDescription( this, true ) ), EscapeHTML( PrintZoneConnection( local ) ) ) ) constraint.SetParentRule( nullptr ); @@ -1429,7 +1429,7 @@ DRC_CONSTRAINT DRC_ENGINE::EvalRules( DRC_CONSTRAINT_T aConstraintType, const BO REPORT( "" ) REPORT( wxString::Format( _( "%s thermal relief gap: %s." ), - EscapeHTML( zone->GetItemDescription( this ) ), + EscapeHTML( zone->GetItemDescription( this, true ) ), EscapeHTML( MessageTextFromValue( local ) ) ) ) constraint.SetParentRule( nullptr ); @@ -1446,7 +1446,7 @@ DRC_CONSTRAINT DRC_ENGINE::EvalRules( DRC_CONSTRAINT_T aConstraintType, const BO REPORT( "" ) REPORT( wxString::Format( _( "%s thermal spoke width: %s." ), - EscapeHTML( zone->GetItemDescription( this ) ), + EscapeHTML( zone->GetItemDescription( this, true ) ), EscapeHTML( MessageTextFromValue( local ) ) ) ) constraint.SetParentRule( nullptr ); diff --git a/pcbnew/drc/drc_test_provider_library_parity.cpp b/pcbnew/drc/drc_test_provider_library_parity.cpp index 0a8f5f4c51..1474590c6a 100644 --- a/pcbnew/drc/drc_test_provider_library_parity.cpp +++ b/pcbnew/drc/drc_test_provider_library_parity.cpp @@ -119,7 +119,7 @@ public: return diff; \ } while (0) -#define ITEM_DESC( item ) ( item )->GetItemDescription( &g_unitsProvider ) +#define ITEM_DESC( item ) ( item )->GetItemDescription( &g_unitsProvider, true ) #define PAD_DESC( pad ) wxString::Format( _( "Pad %s" ), ( pad )->GetNumber() ) diff --git a/pcbnew/footprint.cpp b/pcbnew/footprint.cpp index b8dfd9ba8d..3b7ef89ec4 100644 --- a/pcbnew/footprint.cpp +++ b/pcbnew/footprint.cpp @@ -2002,7 +2002,7 @@ INSPECT_RESULT FOOTPRINT::Visit( INSPECTOR inspector, void* testData, } -wxString FOOTPRINT::GetItemDescription( UNITS_PROVIDER* aUnitsProvider ) const +wxString FOOTPRINT::GetItemDescription( UNITS_PROVIDER* aUnitsProvider, bool aFull ) const { wxString reference = GetReference(); diff --git a/pcbnew/footprint.h b/pcbnew/footprint.h index 529710582a..894e038b77 100644 --- a/pcbnew/footprint.h +++ b/pcbnew/footprint.h @@ -863,7 +863,7 @@ public: return wxT( "FOOTPRINT" ); } - wxString GetItemDescription( UNITS_PROVIDER* aUnitsProvider ) const override; + wxString GetItemDescription( UNITS_PROVIDER* aUnitsProvider, bool aFull ) const override; BITMAPS GetMenuImage() const override; diff --git a/pcbnew/generators/pcb_tuning_pattern.cpp b/pcbnew/generators/pcb_tuning_pattern.cpp index dfec05050d..af6384eb6a 100644 --- a/pcbnew/generators/pcb_tuning_pattern.cpp +++ b/pcbnew/generators/pcb_tuning_pattern.cpp @@ -251,7 +251,7 @@ public: wxString GetGeneratorType() const override { return wxS( "tuning_pattern" ); } - wxString GetItemDescription( UNITS_PROVIDER* aUnitsProvider ) const override + wxString GetItemDescription( UNITS_PROVIDER* aUnitsProvider, bool aFull ) const override { return wxString( _( "Tuning Pattern" ) ); } diff --git a/pcbnew/pad.cpp b/pcbnew/pad.cpp index 88175bd38c..7bd5920ecb 100644 --- a/pcbnew/pad.cpp +++ b/pcbnew/pad.cpp @@ -1431,7 +1431,7 @@ wxString PAD::ShowPadAttr() const } -wxString PAD::GetItemDescription( UNITS_PROVIDER* aUnitsProvider ) const +wxString PAD::GetItemDescription( UNITS_PROVIDER* aUnitsProvider, bool aFull ) const { FOOTPRINT* parentFP = nullptr; diff --git a/pcbnew/pad.h b/pcbnew/pad.h index 1a18962c33..0023506afd 100644 --- a/pcbnew/pad.h +++ b/pcbnew/pad.h @@ -769,7 +769,7 @@ public: void Rotate( const VECTOR2I& aRotCentre, const EDA_ANGLE& aAngle ) override; - wxString GetItemDescription( UNITS_PROVIDER* aUnitsProvider ) const override; + wxString GetItemDescription( UNITS_PROVIDER* aUnitsProvider, bool aFull ) const override; BITMAPS GetMenuImage() const override; diff --git a/pcbnew/pcb_dimension.cpp b/pcbnew/pcb_dimension.cpp index 36c96efb57..fc4f69ebf3 100644 --- a/pcbnew/pcb_dimension.cpp +++ b/pcbnew/pcb_dimension.cpp @@ -562,10 +562,10 @@ const BOX2I PCB_DIMENSION_BASE::GetBoundingBox() const } -wxString PCB_DIMENSION_BASE::GetItemDescription( UNITS_PROVIDER* aUnitsProvider ) const +wxString PCB_DIMENSION_BASE::GetItemDescription( UNITS_PROVIDER* aUnitsProvider, bool aFull ) const { return wxString::Format( _( "Dimension '%s' on %s" ), - KIUI::EllipsizeMenuText( GetText() ), + aFull ? GetShownText( false ) : KIUI::EllipsizeMenuText( GetText() ), GetLayerName() ); } diff --git a/pcbnew/pcb_dimension.h b/pcbnew/pcb_dimension.h index 00152d694c..3ddaec3abe 100644 --- a/pcbnew/pcb_dimension.h +++ b/pcbnew/pcb_dimension.h @@ -276,7 +276,7 @@ public: std::shared_ptr GetEffectiveShape( PCB_LAYER_ID aLayer, FLASHING aFlash = FLASHING::DEFAULT ) const override; - wxString GetItemDescription( UNITS_PROVIDER* aUnitsProvider ) const override; + wxString GetItemDescription( UNITS_PROVIDER* aUnitsProvider, bool aFull ) const override; const BOX2I ViewBBox() const override; diff --git a/pcbnew/pcb_field.cpp b/pcbnew/pcb_field.cpp index 2344c083df..a4c0e77d40 100644 --- a/pcbnew/pcb_field.cpp +++ b/pcbnew/pcb_field.cpp @@ -139,34 +139,31 @@ wxString PCB_FIELD::GetTextTypeDescription() const } -wxString PCB_FIELD::GetItemDescription( UNITS_PROVIDER* aUnitsProvider ) const +wxString PCB_FIELD::GetItemDescription( UNITS_PROVIDER* aUnitsProvider, bool aFull ) const { + wxString content = aFull ? GetShownText( false ) : KIUI::EllipsizeMenuText( GetText() ); + wxString ref = GetParentFootprint()->GetReference(); + switch( m_id ) { case REFERENCE_FIELD: - return wxString::Format( _( "Reference '%s'" ), - GetParentFootprint()->GetReference() ); + return wxString::Format( _( "Reference field of %s" ), ref ); case VALUE_FIELD: - return wxString::Format( _( "Value '%s' of %s" ), - KIUI::EllipsizeMenuText( GetText() ), - GetParentFootprint()->GetReference() ); + return wxString::Format( _( "Value field of %s (%s)" ), ref, content ); case FOOTPRINT_FIELD: - return wxString::Format( _( "Footprint '%s' of %s" ), - KIUI::EllipsizeMenuText( GetText() ), - GetParentFootprint()->GetReference() ); + return wxString::Format( _( "Footprint field of %s (%s)" ), ref, content ); + case DATASHEET_FIELD: - return wxString::Format( _( "Datasheet '%s' of %s" ), - KIUI::EllipsizeMenuText( GetText() ), - GetParentFootprint()->GetReference() ); + return wxString::Format( _( "Datasheet field of %s (%s)" ), ref, content ); default: - break; // avoid unreachable code / missing return statement warnings + if( GetName().IsEmpty() ) + return wxString::Format( _( "Field of %s (%s)" ), ref, content ); + else + return wxString::Format( _( "%s field of %s (%s)" ), GetName(), ref, content ); } - - return wxString::Format( _( "Field '%s' of %s" ), KIUI::EllipsizeMenuText( GetText() ), - GetParentFootprint()->GetReference() ); } diff --git a/pcbnew/pcb_field.h b/pcbnew/pcb_field.h index c05a3e7595..f91c611546 100644 --- a/pcbnew/pcb_field.h +++ b/pcbnew/pcb_field.h @@ -76,7 +76,7 @@ public: wxString GetTextTypeDescription() const override; - wxString GetItemDescription( UNITS_PROVIDER* aUnitsProvider ) const override; + wxString GetItemDescription( UNITS_PROVIDER* aUnitsProvider, bool aFull ) const override; double ViewGetLOD( int aLayer, KIGFX::VIEW* aView ) const override; diff --git a/pcbnew/pcb_generator.cpp b/pcbnew/pcb_generator.cpp index 861ce1d403..462fa97ec8 100644 --- a/pcbnew/pcb_generator.cpp +++ b/pcbnew/pcb_generator.cpp @@ -211,7 +211,7 @@ std::vector> PCB_GENERATOR::GetRowData() } -wxString PCB_GENERATOR::GetItemDescription( UNITS_PROVIDER* aUnitsProvider ) const +wxString PCB_GENERATOR::GetItemDescription( UNITS_PROVIDER* aUnitsProvider, bool aFull ) const { return wxString( _( "Generator" ) ); } diff --git a/pcbnew/pcb_generator.h b/pcbnew/pcb_generator.h index 6fb0577b68..dc2b901487 100644 --- a/pcbnew/pcb_generator.h +++ b/pcbnew/pcb_generator.h @@ -103,7 +103,7 @@ public: virtual void ShowPropertiesDialog( PCB_BASE_EDIT_FRAME* aEditFrame ) {}; - wxString GetItemDescription( UNITS_PROVIDER* aUnitsProvider ) const override; + wxString GetItemDescription( UNITS_PROVIDER* aUnitsProvider, bool aFull ) const override; virtual wxString GetPluralName() const = 0; diff --git a/pcbnew/pcb_group.cpp b/pcbnew/pcb_group.cpp index f8effac58c..ba2206f531 100644 --- a/pcbnew/pcb_group.cpp +++ b/pcbnew/pcb_group.cpp @@ -363,7 +363,7 @@ void PCB_GROUP::Flip( const VECTOR2I& aCentre, bool aFlipLeftRight ) } -wxString PCB_GROUP::GetItemDescription( UNITS_PROVIDER* aUnitsProvider ) const +wxString PCB_GROUP::GetItemDescription( UNITS_PROVIDER* aUnitsProvider, bool aFull ) const { if( m_name.empty() ) return wxString::Format( _( "Unnamed Group, %zu members" ), m_items.size() ); diff --git a/pcbnew/pcb_group.h b/pcbnew/pcb_group.h index 53c101d931..10f8ad36ee 100644 --- a/pcbnew/pcb_group.h +++ b/pcbnew/pcb_group.h @@ -185,7 +185,7 @@ public: void Flip( const VECTOR2I& aCentre, bool aFlipLeftRight ) override; /// @copydoc EDA_ITEM::GetItemDescription - wxString GetItemDescription( UNITS_PROVIDER* aUnitsProvider ) const override; + wxString GetItemDescription( UNITS_PROVIDER* aUnitsProvider, bool aFull ) const override; /// @copydoc EDA_ITEM::GetMenuImage BITMAPS GetMenuImage() const override; diff --git a/pcbnew/pcb_marker.cpp b/pcbnew/pcb_marker.cpp index 52e450aed0..00fa812f3d 100644 --- a/pcbnew/pcb_marker.cpp +++ b/pcbnew/pcb_marker.cpp @@ -227,10 +227,10 @@ void PCB_MARKER::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vectorGetItem( 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 ); } @@ -260,11 +260,10 @@ std::shared_ptr PCB_MARKER::GetEffectiveShape( PCB_LAYER_ID aLayer, FLASH } -wxString PCB_MARKER::GetItemDescription( UNITS_PROVIDER* aUnitsProvider ) const +wxString PCB_MARKER::GetItemDescription( UNITS_PROVIDER* aUnitsProvider, bool aFull ) const { - // m_rcItem->GetErrorMessage() could be used instead, but is probably too long - // for menu duty. - return wxString::Format( _( "Marker (%s)" ), m_rcItem->GetErrorText() ); + return wxString::Format( _( "Marker (%s)" ), + aFull ? m_rcItem->GetErrorMessage() : m_rcItem->GetErrorText() ); } diff --git a/pcbnew/pcb_marker.h b/pcbnew/pcb_marker.h index d31869b2da..485d907323 100644 --- a/pcbnew/pcb_marker.h +++ b/pcbnew/pcb_marker.h @@ -98,7 +98,7 @@ public: return BOARD_ITEM::Matches( m_rcItem->GetErrorMessage(), aSearchData ); } - wxString GetItemDescription( UNITS_PROVIDER* aUnitsProvider ) const override; + wxString GetItemDescription( UNITS_PROVIDER* aUnitsProvider, bool aFull ) const override; BITMAPS GetMenuImage() const override; diff --git a/pcbnew/pcb_reference_image.h b/pcbnew/pcb_reference_image.h index 8272b61e67..46d59666e2 100644 --- a/pcbnew/pcb_reference_image.h +++ b/pcbnew/pcb_reference_image.h @@ -120,7 +120,7 @@ public: void Flip( const VECTOR2I& aCentre, bool aFlipLeftRight ) override; void Rotate( const VECTOR2I& aCenter, const EDA_ANGLE& aAngle ) override; - wxString GetItemDescription( UNITS_PROVIDER* aUnitsProvider ) const override + wxString GetItemDescription( UNITS_PROVIDER* aUnitsProvider, bool aFull ) const override { return wxString( _( "Reference Image" ) ); } diff --git a/pcbnew/pcb_shape.cpp b/pcbnew/pcb_shape.cpp index c1352c496c..53f84d4344 100644 --- a/pcbnew/pcb_shape.cpp +++ b/pcbnew/pcb_shape.cpp @@ -698,7 +698,7 @@ void PCB_SHAPE::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector& aList ) override; diff --git a/pcbnew/pcb_target.cpp b/pcbnew/pcb_target.cpp index 2e411f2bae..62bf5ae341 100644 --- a/pcbnew/pcb_target.cpp +++ b/pcbnew/pcb_target.cpp @@ -119,7 +119,7 @@ std::shared_ptr PCB_TARGET::GetEffectiveShape( PCB_LAYER_ID aLayer, FLASH } -wxString PCB_TARGET::GetItemDescription( UNITS_PROVIDER* aUnitsProvider ) const +wxString PCB_TARGET::GetItemDescription( UNITS_PROVIDER* aUnitsProvider, bool aFull ) const { // Targets are on *every* layer by definition return _( "Target" ); diff --git a/pcbnew/pcb_target.h b/pcbnew/pcb_target.h index ace5b06e79..b8889a976d 100644 --- a/pcbnew/pcb_target.h +++ b/pcbnew/pcb_target.h @@ -86,7 +86,7 @@ public: std::shared_ptr GetEffectiveShape( PCB_LAYER_ID aLayer, FLASHING aFlash = FLASHING::DEFAULT ) const override; - wxString GetItemDescription( UNITS_PROVIDER* aUnitsProvider ) const override; + wxString GetItemDescription( UNITS_PROVIDER* aUnitsProvider, bool aFull ) const override; BITMAPS GetMenuImage() const override; diff --git a/pcbnew/pcb_text.cpp b/pcbnew/pcb_text.cpp index ca69b304ce..803e97375c 100644 --- a/pcbnew/pcb_text.cpp +++ b/pcbnew/pcb_text.cpp @@ -487,17 +487,17 @@ wxString PCB_TEXT::GetTextTypeDescription() const } -wxString PCB_TEXT::GetItemDescription( UNITS_PROVIDER* aUnitsProvider ) const +wxString PCB_TEXT::GetItemDescription( UNITS_PROVIDER* aUnitsProvider, bool aFull ) const { + wxString content = aFull ? GetShownText( false ) : KIUI::EllipsizeMenuText( GetText() ); + if( FOOTPRINT* parentFP = GetParentFootprint() ) { - return wxString::Format( _( "Footprint Text '%s' of %s" ), - KIUI::EllipsizeMenuText( GetText() ), parentFP->GetReference() ); + wxString ref = parentFP->GetReference(); + return wxString::Format( _( "Footprint text of %s (%s)" ), ref, content ); } - return wxString::Format( _( "PCB Text '%s' on %s" ), - KIUI::EllipsizeMenuText( GetText() ), - GetLayerName() ); + return wxString::Format( _( "PCB text '%s' on %s" ), content, GetLayerName() ); } diff --git a/pcbnew/pcb_text.h b/pcbnew/pcb_text.h index d7df044e89..f426a5ec6b 100644 --- a/pcbnew/pcb_text.h +++ b/pcbnew/pcb_text.h @@ -142,7 +142,7 @@ public: virtual wxString GetTextTypeDescription() const; - wxString GetItemDescription( UNITS_PROVIDER* aUnitsProvider ) const override; + wxString GetItemDescription( UNITS_PROVIDER* aUnitsProvider, bool aFull ) const override; BITMAPS GetMenuImage() const override; diff --git a/pcbnew/pcb_textbox.cpp b/pcbnew/pcb_textbox.cpp index 10336c71a9..f163ea5483 100644 --- a/pcbnew/pcb_textbox.cpp +++ b/pcbnew/pcb_textbox.cpp @@ -483,10 +483,10 @@ bool PCB_TEXTBOX::HitTest( const BOX2I& aRect, bool aContained, int aAccuracy ) } -wxString PCB_TEXTBOX::GetItemDescription( UNITS_PROVIDER* aUnitsProvider ) const +wxString PCB_TEXTBOX::GetItemDescription( UNITS_PROVIDER* aUnitsProvider, bool aFull ) const { return wxString::Format( _( "PCB Text Box '%s' on %s" ), - KIUI::EllipsizeMenuText( GetText() ), + aFull ? GetShownText( false ) : KIUI::EllipsizeMenuText( GetText() ), GetLayerName() ); } diff --git a/pcbnew/pcb_textbox.h b/pcbnew/pcb_textbox.h index a26638fe06..55c33c1835 100644 --- a/pcbnew/pcb_textbox.h +++ b/pcbnew/pcb_textbox.h @@ -140,7 +140,7 @@ public: std::shared_ptr GetEffectiveShape( PCB_LAYER_ID aLayer = UNDEFINED_LAYER, FLASHING aFlash = FLASHING::DEFAULT ) const override; - wxString GetItemDescription( UNITS_PROVIDER* aUnitsProvider ) const override; + wxString GetItemDescription( UNITS_PROVIDER* aUnitsProvider, bool aFull ) const override; BITMAPS GetMenuImage() const override; diff --git a/pcbnew/pcb_track.cpp b/pcbnew/pcb_track.cpp index 475cc2f262..93971f35c9 100644 --- a/pcbnew/pcb_track.cpp +++ b/pcbnew/pcb_track.cpp @@ -136,7 +136,7 @@ EDA_ITEM* PCB_VIA::Clone() const } -wxString PCB_VIA::GetItemDescription( UNITS_PROVIDER* aUnitsProvider ) const +wxString PCB_VIA::GetItemDescription( UNITS_PROVIDER* aUnitsProvider, bool aFull ) const { wxString formatStr; @@ -1529,7 +1529,7 @@ bool PCB_VIA::HitTest( const BOX2I& aRect, bool aContained, int aAccuracy ) cons } -wxString PCB_TRACK::GetItemDescription( UNITS_PROVIDER* aUnitsProvider ) const +wxString PCB_TRACK::GetItemDescription( UNITS_PROVIDER* aUnitsProvider, bool aFull ) const { return wxString::Format( Type() == PCB_ARC_T ? _("Track (arc) %s on %s, length %s" ) : _("Track %s on %s, length %s" ), diff --git a/pcbnew/pcb_track.h b/pcbnew/pcb_track.h index 276974a4b8..cc011cda21 100644 --- a/pcbnew/pcb_track.h +++ b/pcbnew/pcb_track.h @@ -199,7 +199,7 @@ public: virtual MINOPTMAX GetWidthConstraint( wxString* aSource = nullptr ) const; - wxString GetItemDescription( UNITS_PROVIDER* aUnitsProvider ) const override; + wxString GetItemDescription( UNITS_PROVIDER* aUnitsProvider, bool aFull ) const override; BITMAPS GetMenuImage() const override; @@ -457,7 +457,7 @@ public: return wxT( "PCB_VIA" ); } - wxString GetItemDescription( UNITS_PROVIDER* aUnitsProvider ) const override; + wxString GetItemDescription( UNITS_PROVIDER* aUnitsProvider, bool aFull ) const override; BITMAPS GetMenuImage() const override; diff --git a/pcbnew/router/pns_kicad_iface.cpp b/pcbnew/router/pns_kicad_iface.cpp index b1b069111a..34c9b212ab 100644 --- a/pcbnew/router/pns_kicad_iface.cpp +++ b/pcbnew/router/pns_kicad_iface.cpp @@ -1263,7 +1263,7 @@ bool PNS_KICAD_IFACE_BASE::syncZone( PNS::NODE* aWorld, ZONE* aZone, SHAPE_POLY_ if( !poly->IsTriangulationUpToDate() ) { UNITS_PROVIDER unitsProvider( pcbIUScale, GetUnits() ); - msg.Printf( _( "%s is malformed." ), aZone->GetItemDescription( &unitsProvider ) ); + msg.Printf( _( "%s is malformed." ), aZone->GetItemDescription( &unitsProvider, true ) ); KIDIALOG dlg( nullptr, msg, KIDIALOG::KD_WARNING ); dlg.ShowDetailedText( _( "This zone cannot be handled by the router.\n" diff --git a/pcbnew/router/pns_shove.cpp b/pcbnew/router/pns_shove.cpp index 3bb6be36b9..26aacbb66a 100644 --- a/pcbnew/router/pns_shove.cpp +++ b/pcbnew/router/pns_shove.cpp @@ -1349,7 +1349,7 @@ SHOVE::SHOVE_STATUS SHOVE::shoveIteration( int aIter ) UNITS_PROVIDER up( pcbIUScale, EDA_UNITS::MILLIMETRES ); PNS_DBG( Dbg(), Message, wxString::Format( wxT( "NI: %s (%s)" ), ni->Format(), - ni->Parent() ? ni->Parent()->GetItemDescription( &up ) + ni->Parent() ? ni->Parent()->GetItemDescription( &up, false ) : wxString( wxT( "null" ) ) ) ); unwindLineStack( ni ); diff --git a/pcbnew/tools/board_inspection_tool.cpp b/pcbnew/tools/board_inspection_tool.cpp index d9ba218724..dd02b5fb72 100644 --- a/pcbnew/tools/board_inspection_tool.cpp +++ b/pcbnew/tools/board_inspection_tool.cpp @@ -191,7 +191,7 @@ wxString BOARD_INSPECTION_TOOL::getItemDescription( BOARD_ITEM* aItem ) if( !aItem ) return wxString(); - wxString msg = aItem->GetItemDescription( m_frame ); + wxString msg = aItem->GetItemDescription( m_frame, true ); if( aItem->IsConnected() && !isNPTHPad( aItem ) ) { diff --git a/pcbnew/tools/pcb_control.cpp b/pcbnew/tools/pcb_control.cpp index 1bb20297c7..593f5f8d57 100644 --- a/pcbnew/tools/pcb_control.cpp +++ b/pcbnew/tools/pcb_control.cpp @@ -1566,8 +1566,8 @@ int PCB_CONTROL::UpdateMessagePanel( const TOOL_EVENT& aEvent ) BOARD_ITEM* a = static_cast( selection[0] ); BOARD_ITEM* b = static_cast( selection[1] ); - msgItems.emplace_back( MSG_PANEL_ITEM( a->GetItemDescription( m_frame ), - b->GetItemDescription( m_frame ) ) ); + msgItems.emplace_back( MSG_PANEL_ITEM( a->GetItemDescription( m_frame, false ), + b->GetItemDescription( m_frame, false ) ) ); BOARD_CONNECTED_ITEM* a_conn = dyn_cast( a ); BOARD_CONNECTED_ITEM* b_conn = dyn_cast( b ); diff --git a/pcbnew/zone.cpp b/pcbnew/zone.cpp index 76143dd9cd..a8a90d86fd 100644 --- a/pcbnew/zone.cpp +++ b/pcbnew/zone.cpp @@ -820,7 +820,7 @@ bool ZONE::AppendCorner( VECTOR2I aPosition, int aHoleIdx, bool aAllowDuplicatio } -wxString ZONE::GetItemDescription( UNITS_PROVIDER* aUnitsProvider ) const +wxString ZONE::GetItemDescription( UNITS_PROVIDER* aUnitsProvider, bool aFull ) const { LSEQ layers = m_layerSet.Seq(); wxString layerDesc; diff --git a/pcbnew/zone.h b/pcbnew/zone.h index b60ceab032..0fb908d7bf 100644 --- a/pcbnew/zone.h +++ b/pcbnew/zone.h @@ -682,7 +682,7 @@ public: void AddPolygon( const SHAPE_LINE_CHAIN& aPolygon ); - wxString GetItemDescription( UNITS_PROVIDER* aUnitsProvider ) const override; + wxString GetItemDescription( UNITS_PROVIDER* aUnitsProvider, bool aFull ) const override; BITMAPS GetMenuImage() const override;