diff --git a/common/common.cpp b/common/common.cpp index b087c17dd2..64689ab62c 100644 --- a/common/common.cpp +++ b/common/common.cpp @@ -37,81 +37,6 @@ #include -wxSize GetTextSize( const wxString& aSingleLine, wxWindow* aWindow ) -{ - wxCoord width; - wxCoord height; - - { - wxClientDC dc( aWindow ); - dc.SetFont( aWindow->GetFont() ); - dc.GetTextExtent( aSingleLine, &width, &height ); - } - - return wxSize( width, height ); -} - - -bool EnsureTextCtrlWidth( wxTextCtrl* aCtrl, const wxString* aString ) -{ - wxWindow* window = aCtrl->GetParent(); - - if( !window ) - window = aCtrl; - - wxString ctrlText; - - if( !aString ) - { - ctrlText = aCtrl->GetValue(); - aString = &ctrlText; - } - - wxSize textz = GetTextSize( *aString, window ); - wxSize ctrlz = aCtrl->GetSize(); - - if( ctrlz.GetWidth() < textz.GetWidth() + 10 ) - { - ctrlz.SetWidth( textz.GetWidth() + 10 ); - aCtrl->SetSizeHints( ctrlz ); - return true; - } - - return false; -} - - -void SelectReferenceNumber( wxTextEntry* aTextEntry ) -{ - wxString ref = aTextEntry->GetValue(); - - if( ref.find_first_of( '?' ) != ref.npos ) - { - aTextEntry->SetSelection( ref.find_first_of( '?' ), ref.find_last_of( '?' ) + 1 ); - } - else - { - wxString num = ref; - - while( !num.IsEmpty() && ( !isdigit( num.Last() ) || !isdigit( num.GetChar( 0 ) ) ) ) - { - // Trim non-digit from end - if( !isdigit( num.Last() ) ) - num.RemoveLast(); - - // Trim non-digit from the start - if( !num.IsEmpty() && !isdigit( num.GetChar( 0 ) ) ) - num = num.Right( num.Length() - 1 ); - } - - aTextEntry->SetSelection( ref.Find( num ), ref.Find( num ) + num.Length() ); - - if( num.IsEmpty() ) - aTextEntry->SetSelection( -1, -1 ); - } -} - - int ProcessExecute( const wxString& aCommandLine, int aFlags, wxProcess *callback ) { return (int) wxExecute( aCommandLine, aFlags, callback ); diff --git a/common/eda_draw_frame.cpp b/common/eda_draw_frame.cpp index fe6d4c520e..91355a4997 100644 --- a/common/eda_draw_frame.cpp +++ b/common/eda_draw_frame.cpp @@ -55,6 +55,7 @@ #include #include #include +#include #define FR_HISTORY_LIST_CNT 10 ///< Maximum size of the find/replace history stacks. @@ -113,22 +114,22 @@ EDA_DRAW_FRAME::EDA_DRAW_FRAME( KIWAY* aKiway, wxWindow* aParent, FRAME_T aFrame // as the width of '0' unless the font is fixed width, and it usually won't be. // zoom: - GetTextSize( wxT( "Z 762000" ), stsbar ).x + 10, + KIUI::GetTextSize( wxT( "Z 762000" ), stsbar ).x + 10, // cursor coords - GetTextSize( wxT( "X 0234.567890 Y 0234.567890" ), stsbar ).x + 10, + KIUI::GetTextSize( wxT( "X 0234.567890 Y 0234.567890" ), stsbar ).x + 10, // delta distances - GetTextSize( wxT( "dx 0234.567890 dx 0234.567890 d 0234.567890" ), stsbar ).x + 10, + KIUI::GetTextSize( wxT( "dx 0234.567890 dx 0234.567890 d 0234.567890" ), stsbar ).x + 10, // grid size - GetTextSize( wxT( "grid X 0234.567890 Y 0234.567890" ), stsbar ).x + 10, + KIUI::GetTextSize( wxT( "grid X 0234.567890 Y 0234.567890" ), stsbar ).x + 10, // units display, Inches is bigger than mm - GetTextSize( _( "Inches" ), stsbar ).x + 10, + KIUI::GetTextSize( _( "Inches" ), stsbar ).x + 10, // Size for the "Current Tool" panel; longest string from SetTool() - GetTextSize( wxT( "Add layer alignment target" ), stsbar ).x + 10, + KIUI::GetTextSize( wxT( "Add layer alignment target" ), stsbar ).x + 10, }; SetStatusWidths( arrayDim( dims ), dims ); diff --git a/common/lib_tree_model_adapter.cpp b/common/lib_tree_model_adapter.cpp index 950cb3bdf9..31468d7b85 100644 --- a/common/lib_tree_model_adapter.cpp +++ b/common/lib_tree_model_adapter.cpp @@ -26,6 +26,7 @@ #include #include #include +#include #include #include @@ -266,7 +267,7 @@ void LIB_TREE_MODEL_ADAPTER::AttachTo( wxDataViewCtrl* aDataViewCtrl ) // The extent of the text doesn't take into account the space on either side // in the header, so artificially pad it by M - wxSize partHeadMinWidth = GetTextSize( partHead + "M", aDataViewCtrl ); + wxSize partHeadMinWidth = KIUI::GetTextSize( partHead + "M", aDataViewCtrl ); if( aDataViewCtrl->GetColumnCount() > 0 ) { diff --git a/common/widgets/net_selector.cpp b/common/widgets/net_selector.cpp index ffa4e52b75..f77f42456f 100644 --- a/common/widgets/net_selector.cpp +++ b/common/widgets/net_selector.cpp @@ -268,7 +268,7 @@ protected: wxSize updateSize() { int listTop = m_listBox->GetRect().y; - int itemHeight = GetTextSize( wxT( "Xy" ), this ).y + LIST_ITEM_PADDING; + int itemHeight = KIUI::GetTextSize( wxT( "Xy" ), this ).y + LIST_ITEM_PADDING; int listHeight = m_listBox->GetCount() * itemHeight + LIST_PADDING; if( listTop + listHeight >= m_maxPopupHeight ) @@ -278,7 +278,7 @@ protected: for( size_t i = 0; i < m_listBox->GetCount(); ++i ) { - int itemWidth = GetTextSize( m_listBox->GetString( i ), m_listBox ).x; + int itemWidth = KIUI::GetTextSize( m_listBox->GetString( i ), m_listBox ).x; listWidth = std::max( listWidth, itemWidth + LIST_PADDING * 3 ); } diff --git a/common/widgets/ui_common.cpp b/common/widgets/ui_common.cpp index 0bea072f75..b69ed7d50d 100644 --- a/common/widgets/ui_common.cpp +++ b/common/widgets/ui_common.cpp @@ -50,3 +50,78 @@ wxString SeverityToString( const SEVERITY& aSeverity ) else return wxT( "error" ); } + + +wxSize KIUI::GetTextSize( const wxString& aSingleLine, wxWindow* aWindow ) +{ + wxCoord width; + wxCoord height; + + { + wxClientDC dc( aWindow ); + dc.SetFont( aWindow->GetFont() ); + dc.GetTextExtent( aSingleLine, &width, &height ); + } + + return wxSize( width, height ); +} + + +bool KIUI::EnsureTextCtrlWidth( wxTextCtrl* aCtrl, const wxString* aString ) +{ + wxWindow* window = aCtrl->GetParent(); + + if( !window ) + window = aCtrl; + + wxString ctrlText; + + if( !aString ) + { + ctrlText = aCtrl->GetValue(); + aString = &ctrlText; + } + + wxSize textz = GetTextSize( *aString, window ); + wxSize ctrlz = aCtrl->GetSize(); + + if( ctrlz.GetWidth() < textz.GetWidth() + 10 ) + { + ctrlz.SetWidth( textz.GetWidth() + 10 ); + aCtrl->SetSizeHints( ctrlz ); + return true; + } + + return false; +} + + +void KIUI::SelectReferenceNumber( wxTextEntry* aTextEntry ) +{ + wxString ref = aTextEntry->GetValue(); + + if( ref.find_first_of( '?' ) != ref.npos ) + { + aTextEntry->SetSelection( ref.find_first_of( '?' ), ref.find_last_of( '?' ) + 1 ); + } + else + { + wxString num = ref; + + while( !num.IsEmpty() && ( !isdigit( num.Last() ) || !isdigit( num.GetChar( 0 ) ) ) ) + { + // Trim non-digit from end + if( !isdigit( num.Last() ) ) + num.RemoveLast(); + + // Trim non-digit from the start + if( !num.IsEmpty() && !isdigit( num.GetChar( 0 ) ) ) + num = num.Right( num.Length() - 1 ); + } + + aTextEntry->SetSelection( ref.Find( num ), ref.Find( num ) + num.Length() ); + + if( num.IsEmpty() ) + aTextEntry->SetSelection( -1, -1 ); + } +} \ No newline at end of file diff --git a/cvpcb/dialogs/fp_conflict_assignment_selector.cpp b/cvpcb/dialogs/fp_conflict_assignment_selector.cpp index 489b828388..7f53b42f41 100644 --- a/cvpcb/dialogs/fp_conflict_assignment_selector.cpp +++ b/cvpcb/dialogs/fp_conflict_assignment_selector.cpp @@ -155,10 +155,10 @@ void DIALOG_FP_CONFLICT_ASSIGNMENT_SELECTOR::OnSize( wxSizeEvent& aEvent ) void DIALOG_FP_CONFLICT_ASSIGNMENT_SELECTOR::recalculateColumns() { - const int margin = 16; - int totalLength = 0; - int sel_length = GetTextSize( wxT("XX"), m_listFp ).x; - int maxRefLength = GetTextSize( wxT("XXX"), m_listFp ).x; + const int margin = 16; + int totalLength = 0; + int sel_length = KIUI::GetTextSize( wxT( "XX" ), m_listFp ).x; + int maxRefLength = KIUI::GetTextSize( wxT( "XXX" ), m_listFp ).x; sel_length += margin; m_listFp->SetColumnWidth( COL_SELSCH, sel_length ); @@ -167,7 +167,7 @@ void DIALOG_FP_CONFLICT_ASSIGNMENT_SELECTOR::recalculateColumns() // Find max character width of column Reference for( int i = 0; i < m_listFp->GetItemCount(); i++ ) { - int length = GetTextSize( m_listFp->GetItemText( i, COL_REF ), m_listFp ).x; + int length = KIUI::GetTextSize( m_listFp->GetItemText( i, COL_REF ), m_listFp ).x; if( length > maxRefLength ) maxRefLength = length; diff --git a/eeschema/dialogs/dialog_edit_components_libid.cpp b/eeschema/dialogs/dialog_edit_components_libid.cpp index 3d6ba75893..3a03780240 100644 --- a/eeschema/dialogs/dialog_edit_components_libid.cpp +++ b/eeschema/dialogs/dialog_edit_components_libid.cpp @@ -784,7 +784,7 @@ void DIALOG_EDIT_COMPONENTS_LIBID::AdjustGridColumns( int aWidth ) for( int row = 0; row < m_grid->GetNumberRows(); ++row ) { wxString cellValue = m_grid->GetCellValue( row, COL_CURR_LIBID ); - colWidth = std::max( colWidth, GetTextSize( cellValue, m_grid ).x ); + colWidth = std::max( colWidth, KIUI::GetTextSize( cellValue, m_grid ).x ); } colWidth += 20; @@ -795,7 +795,7 @@ void DIALOG_EDIT_COMPONENTS_LIBID::AdjustGridColumns( int aWidth ) for( int row = 0; row < m_grid->GetNumberRows(); ++row ) { wxString cellValue = m_grid->GetCellValue( row, COL_NEW_LIBID ); - colWidth = std::max( colWidth, GetTextSize( cellValue, m_grid ).x ); + colWidth = std::max( colWidth, KIUI::GetTextSize( cellValue, m_grid ).x ); } colWidth += 20; diff --git a/eeschema/dialogs/dialog_edit_one_field.cpp b/eeschema/dialogs/dialog_edit_one_field.cpp index 3d48cd6212..5b65dff09c 100644 --- a/eeschema/dialogs/dialog_edit_one_field.cpp +++ b/eeschema/dialogs/dialog_edit_one_field.cpp @@ -172,7 +172,7 @@ void DIALOG_EDIT_ONE_FIELD::OnSetFocusText( wxFocusEvent& event ) #endif if( m_fieldId == REFERENCE ) - SelectReferenceNumber( static_cast( m_TextCtrl ) ); + KIUI::SelectReferenceNumber( static_cast( m_TextCtrl ) ); else if( m_fieldId == VALUE || m_fieldId == SHEETNAME_V ) m_TextCtrl->SetSelection( -1, -1 ); diff --git a/eeschema/dialogs/dialog_fields_editor_global.cpp b/eeschema/dialogs/dialog_fields_editor_global.cpp index 9ba420feaa..acf7d482cb 100644 --- a/eeschema/dialogs/dialog_fields_editor_global.cpp +++ b/eeschema/dialogs/dialog_fields_editor_global.cpp @@ -667,7 +667,7 @@ public: { for( int row = 0; row < GetNumberRows(); ++row ) { - width = std::max( width, GetTextSize( GetValue( row, aCol ), GetView() ).x ); + width = std::max( width, KIUI::GetTextSize( GetValue( row, aCol ), GetView() ).x ); } } else @@ -679,7 +679,7 @@ public: const KIID& compId = m_componentRefs[ compRef ].GetComp()->m_Uuid; wxString text = m_dataStore[ compId ][ column_label ]; - width = std::max( width, GetTextSize( text, GetView() ).x ); + width = std::max( width, KIUI::GetTextSize( text, GetView() ).x ); } } @@ -714,11 +714,11 @@ DIALOG_FIELDS_EDITOR_GLOBAL::DIALOG_FIELDS_EDITOR_GLOBAL( SCH_EDIT_FRAME* parent // SetWidth( wxCOL_WIDTH_AUTOSIZE ) fails here on GTK, so we calculate the title sizes and // set the column widths ourselves. auto column = m_fieldsCtrl->GetColumn( SHOW_FIELD_COLUMN ); - m_showColWidth = GetTextSize( column->GetTitle(), m_fieldsCtrl ).x + COLUMN_MARGIN; + m_showColWidth = KIUI::GetTextSize( column->GetTitle(), m_fieldsCtrl ).x + COLUMN_MARGIN; column->SetWidth( m_showColWidth ); column = m_fieldsCtrl->GetColumn( GROUP_BY_COLUMN ); - m_groupByColWidth = GetTextSize( column->GetTitle(), m_fieldsCtrl ).x + COLUMN_MARGIN; + m_groupByColWidth = KIUI::GetTextSize( column->GetTitle(), m_fieldsCtrl ).x + COLUMN_MARGIN; column->SetWidth( m_groupByColWidth ); // The fact that we're a list should keep the control from reserving space for the @@ -736,7 +736,7 @@ DIALOG_FIELDS_EDITOR_GLOBAL::DIALOG_FIELDS_EDITOR_GLOBAL( SCH_EDIT_FRAME* parent for( int row = 0; row < m_fieldsCtrl->GetItemCount(); ++row ) { const wxString& fieldName = m_fieldsCtrl->GetTextValue( row, DISPLAY_NAME_COLUMN ); - nameColWidth = std::max( nameColWidth, GetTextSize( fieldName, m_fieldsCtrl ).x ); + nameColWidth = std::max( nameColWidth, KIUI::GetTextSize( fieldName, m_fieldsCtrl ).x ); } m_fieldsCtrl->GetColumn( DISPLAY_NAME_COLUMN )->SetWidth( nameColWidth ); diff --git a/eeschema/dialogs/dialog_symbol_properties.cpp b/eeschema/dialogs/dialog_symbol_properties.cpp index 7284e8515a..a20def3087 100644 --- a/eeschema/dialogs/dialog_symbol_properties.cpp +++ b/eeschema/dialogs/dialog_symbol_properties.cpp @@ -1016,7 +1016,7 @@ void DIALOG_SYMBOL_PROPERTIES::OnUpdateUI( wxUpdateUIEvent& event ) wxGridCellEditor* cellEditor = m_fieldsGrid->GetCellEditor( REFERENCE, FDC_VALUE ); if( wxTextEntry* txt = dynamic_cast( cellEditor->GetControl() ) ) - SelectReferenceNumber( txt ); + KIUI::SelectReferenceNumber( txt ); cellEditor->DecRef(); // we're done; must release diff --git a/eeschema/dialogs/panel_setup_pinmap.cpp b/eeschema/dialogs/panel_setup_pinmap.cpp index 84781ce9a4..05694a6118 100644 --- a/eeschema/dialogs/panel_setup_pinmap.cpp +++ b/eeschema/dialogs/panel_setup_pinmap.cpp @@ -76,7 +76,7 @@ void PANEL_SETUP_PINMAP::reBuildMatrixPanel() wxSize bmapSize = dummy->GetSize(); delete dummy; - wxSize charSize = GetTextSize( "X", m_matrixPanel ); + wxSize charSize = KIUI::GetTextSize( "X", m_matrixPanel ); wxPoint pos( 0, charSize.y * 2 ); wxStaticText* text; diff --git a/gerbview/gerbview_frame.cpp b/gerbview/gerbview_frame.cpp index 40628823c5..29dd8ac7e1 100644 --- a/gerbview/gerbview_frame.cpp +++ b/gerbview/gerbview_frame.cpp @@ -651,7 +651,7 @@ void GERBVIEW_FRAME::UpdateTitleAndInfo() info.Printf( _( "Drawing layer %d not in use" ), GetActiveLayer() + 1 ); m_TextInfo->SetValue( info ); - if( EnsureTextCtrlWidth( m_TextInfo, &info ) ) // Resized + if( KIUI::EnsureTextCtrlWidth( m_TextInfo, &info ) ) // Resized m_auimgr.Update(); ClearMsgPanel(); @@ -692,7 +692,7 @@ void GERBVIEW_FRAME::UpdateTitleAndInfo() m_TextInfo->SetValue( info ); - if( EnsureTextCtrlWidth( m_TextInfo, &info ) ) // Resized + if( KIUI::EnsureTextCtrlWidth( m_TextInfo, &info ) ) // Resized m_auimgr.Update(); } } diff --git a/include/common.h b/include/common.h index 9ed697ecae..f1ec6452cd 100644 --- a/include/common.h +++ b/include/common.h @@ -39,8 +39,8 @@ #include #include #include -#include #include +#include #include #include @@ -56,33 +56,6 @@ class REPORTER; /// default name for nameless projects #define NAMELESS_PROJECT wxT( "noname" ) -/** - * Return the size of @a aSingleLine of text when it is rendered in @a aWindow - * using whatever font is currently set in that window. - */ -wxSize GetTextSize( const wxString& aSingleLine, wxWindow* aWindow ); - -/** - * Set the minimum pixel width on a text control in order to make a text - * string be fully visible within it. - * - * The current font within the text control is considered. The text can come either from - * the control or be given as an argument. If the text control is larger than needed, then - * nothing is done. - * - * @param aCtrl the text control to potentially make wider. - * @param aString the text that is used in sizing the control's pixel width. - * If NULL, then - * the text already within the control is used. - * @return bool - true if the \a aCtrl had its size changed, else false. - */ -bool EnsureTextCtrlWidth( wxTextCtrl* aCtrl, const wxString* aString = NULL ); - -/** - * Select the number (or "?") in a reference for ease of editing. - */ -void SelectReferenceNumber( wxTextEntry* aTextEntry ); - /** * Run a command in a child process. * diff --git a/include/widgets/ui_common.h b/include/widgets/ui_common.h index 73410b1ac3..87052b2929 100644 --- a/include/widgets/ui_common.h +++ b/include/widgets/ui_common.h @@ -28,6 +28,11 @@ #include +class wxSize; +class wxTextCtrl; +class wxTextEntry; +class wxWindow; + namespace KIUI { @@ -37,6 +42,33 @@ namespace KIUI */ int GetStdMargin(); +/** + * Return the size of @a aSingleLine of text when it is rendered in @a aWindow + * using whatever font is currently set in that window. + */ +wxSize GetTextSize( const wxString& aSingleLine, wxWindow* aWindow ); + +/** + * Set the minimum pixel width on a text control in order to make a text + * string be fully visible within it. + * + * The current font within the text control is considered. The text can come either from + * the control or be given as an argument. If the text control is larger than needed, then + * nothing is done. + * + * @param aCtrl the text control to potentially make wider. + * @param aString the text that is used in sizing the control's pixel width. + * If NULL, then + * the text already within the control is used. + * @return bool - true if the \a aCtrl had its size changed, else false. + */ +bool EnsureTextCtrlWidth( wxTextCtrl* aCtrl, const wxString* aString = NULL ); + +/** + * Select the number (or "?") in a reference for ease of editing. + */ +void SelectReferenceNumber( wxTextEntry* aTextEntry ); + } // Note: On windows, SEVERITY_ERROR collides with a system declaration, diff --git a/pagelayout_editor/pl_editor_frame.cpp b/pagelayout_editor/pl_editor_frame.cpp index d0100d8b9a..f89300824d 100644 --- a/pagelayout_editor/pl_editor_frame.cpp +++ b/pagelayout_editor/pl_editor_frame.cpp @@ -131,22 +131,22 @@ PL_EDITOR_FRAME::PL_EDITOR_FRAME( KIWAY* aKiway, wxWindow* aParent ) : // as the width of '0' unless the font is fixed width, and it usually won't be. // zoom: - GetTextSize( wxT( "Z 762000" ), stsbar ).x + 10, + KIUI::GetTextSize( wxT( "Z 762000" ), stsbar ).x + 10, // cursor coords - GetTextSize( wxT( "X 0234.567 Y 0234.567" ), stsbar ).x + 10, + KIUI::GetTextSize( wxT( "X 0234.567 Y 0234.567" ), stsbar ).x + 10, // delta distances - GetTextSize( wxT( "dx 0234.567 dx 0234.567" ), stsbar ).x + 10, + KIUI::GetTextSize( wxT( "dx 0234.567 dx 0234.567" ), stsbar ).x + 10, // grid size - GetTextSize( wxT( "grid 0234.567" ), stsbar ).x + 10, + KIUI::GetTextSize( wxT( "grid 0234.567" ), stsbar ).x + 10, // Coord origin (use the bigger message) - GetTextSize( _( "coord origin: Right Bottom page corner" ), stsbar ).x + 10, + KIUI::GetTextSize( _( "coord origin: Right Bottom page corner" ), stsbar ).x + 10, // units display, Inches is bigger than mm - GetTextSize( _( "Inches" ), stsbar ).x + 20 + KIUI::GetTextSize( _( "Inches" ), stsbar ).x + 20 }; SetStatusWidths( arrayDim( dims ), dims ); diff --git a/pagelayout_editor/toolbars_pl_editor.cpp b/pagelayout_editor/toolbars_pl_editor.cpp index 06dd0ab609..aaf37103a2 100644 --- a/pagelayout_editor/toolbars_pl_editor.cpp +++ b/pagelayout_editor/toolbars_pl_editor.cpp @@ -92,7 +92,7 @@ void PL_EDITOR_FRAME::ReCreateHToolbar() for( int ii = 0; ii < 5; ii++ ) { - int width = GetTextSize( choiceList[ii], m_originSelectBox ).x; + int width = KIUI::GetTextSize( choiceList[ii], m_originSelectBox ).x; minwidth = std::max( minwidth, width ); } diff --git a/pcbnew/dialogs/dialog_footprint_properties.cpp b/pcbnew/dialogs/dialog_footprint_properties.cpp index 1b4ecd6bbe..47c70563d5 100644 --- a/pcbnew/dialogs/dialog_footprint_properties.cpp +++ b/pcbnew/dialogs/dialog_footprint_properties.cpp @@ -898,7 +898,7 @@ void DIALOG_FOOTPRINT_PROPERTIES::OnUpdateUI( wxUpdateUIEvent& ) auto referenceEditor = grid->GetCellEditor( 0, 0 ); if( auto textEntry = dynamic_cast( referenceEditor->GetControl() ) ) - SelectReferenceNumber( textEntry ); + KIUI::SelectReferenceNumber( textEntry ); referenceEditor->DecRef(); } diff --git a/pcbnew/dialogs/dialog_text_properties.cpp b/pcbnew/dialogs/dialog_text_properties.cpp index 38b2006756..fface5dbcf 100644 --- a/pcbnew/dialogs/dialog_text_properties.cpp +++ b/pcbnew/dialogs/dialog_text_properties.cpp @@ -234,7 +234,7 @@ bool DIALOG_TEXT_PROPERTIES::TransferDataToWindow() m_SingleLineText->SetValue( m_edaText->GetText() ); if( m_fpText && m_fpText->GetType() == FP_TEXT::TEXT_is_REFERENCE ) - SelectReferenceNumber( static_cast( m_SingleLineText ) ); + KIUI::SelectReferenceNumber( static_cast( m_SingleLineText ) ); else m_SingleLineText->SetSelection( -1, -1 ); } diff --git a/pcbnew/zone_settings.cpp b/pcbnew/zone_settings.cpp index aeba709539..eedf6f4653 100644 --- a/pcbnew/zone_settings.cpp +++ b/pcbnew/zone_settings.cpp @@ -216,7 +216,7 @@ void ZONE_SETTINGS::SetupLayersList( wxDataViewListCtrl* aList, PCB_BASE_FRAME* layerName = _( "Inner layers" ); // wxCOL_WIDTH_AUTOSIZE doesn't work on all platforms, so we calculate width here - textWidth = std::max( textWidth, GetTextSize( layerName, aList ).x ); + textWidth = std::max( textWidth, KIUI::GetTextSize( layerName, aList ).x ); COLOR4D layerColor = aFrame->GetColorSettings()->GetColor( layerID ); auto bitmap = COLOR_SWATCH::MakeBitmap( layerColor, backgroundColor, LAYER_BITMAP_SIZE,