diff --git a/pcbnew/dialogs/dialog_copper_zones.cpp b/pcbnew/dialogs/dialog_copper_zones.cpp index f762a7caf6..042e28e2ae 100644 --- a/pcbnew/dialogs/dialog_copper_zones.cpp +++ b/pcbnew/dialogs/dialog_copper_zones.cpp @@ -112,7 +112,6 @@ DIALOG_COPPER_ZONE::DIALOG_COPPER_ZONE( PCB_BASE_FRAME* aParent, ZONE_SETTINGS* m_ptr = aSettings; m_settings = *aSettings; m_settings.SetupLayersList( m_layers, m_Parent, true ); - int layersWidth = m_layers->GetColumn( 0 )->GetWidth() + m_layers->GetColumn( 1 )->GetWidth(); m_settingsExported = false; @@ -121,13 +120,7 @@ DIALOG_COPPER_ZONE::DIALOG_COPPER_ZONE( PCB_BASE_FRAME* aParent, ZONE_SETTINGS* m_sdbSizerOK->SetDefault(); - GetSizer()->SetSizeHints( this ); - - // Must be done after SetSizeHints() else GTK will overwrite it - m_layers->SetMinSize( wxSize( layersWidth + 4, m_layers->GetMinSize().y ) ); - - // the default position, when calling the first time the dlg - Center(); + FinishDialogSettings(); } diff --git a/pcbnew/dialogs/dialog_keepout_area_properties.cpp b/pcbnew/dialogs/dialog_keepout_area_properties.cpp index 69e3236071..99ca82aa46 100644 --- a/pcbnew/dialogs/dialog_keepout_area_properties.cpp +++ b/pcbnew/dialogs/dialog_keepout_area_properties.cpp @@ -70,17 +70,10 @@ DIALOG_KEEPOUT_AREA_PROPERTIES::DIALOG_KEEPOUT_AREA_PROPERTIES( PCB_BASE_FRAME* m_ptr = aSettings; m_zonesettings = *aSettings; m_zonesettings.SetupLayersList( m_layers, m_parent, true ); - int layersWidth = m_layers->GetColumn( 0 )->GetWidth() + m_layers->GetColumn( 1 )->GetWidth(); m_sdbSizerButtonsOK->SetDefault(); - GetSizer()->SetSizeHints( this ); - - // Must be done after SetSizeHints() else GTK will overwrite it - m_layers->SetMinSize( wxSize( layersWidth + 4, m_layers->GetMinSize().y ) ); - - // the default position, when calling the first time the dlg - Center(); + FinishDialogSettings(); } diff --git a/pcbnew/dialogs/dialog_non_copper_zones_properties.cpp b/pcbnew/dialogs/dialog_non_copper_zones_properties.cpp index 5d7fe3278b..981c0ff040 100644 --- a/pcbnew/dialogs/dialog_non_copper_zones_properties.cpp +++ b/pcbnew/dialogs/dialog_non_copper_zones_properties.cpp @@ -73,15 +73,8 @@ DIALOG_NON_COPPER_ZONES_EDITOR::DIALOG_NON_COPPER_ZONES_EDITOR( PCB_BASE_FRAME* m_ptr = aSettings; m_settings = *aSettings; m_settings.SetupLayersList( m_layers, m_parent, false ); - int layersWidth = m_layers->GetColumn( 0 )->GetWidth() + m_layers->GetColumn( 1 )->GetWidth(); - GetSizer()->SetSizeHints( this ); - - // Must be done after SetSizeHints() else GTK will overwrite it - m_layers->SetMinSize( wxSize( layersWidth + 4, m_layers->GetMinSize().y ) ); - - // the default position, when calling the first time the dlg - Center(); + FinishDialogSettings(); } diff --git a/pcbnew/zone_settings.cpp b/pcbnew/zone_settings.cpp index 0deb046317..f696e3914f 100644 --- a/pcbnew/zone_settings.cpp +++ b/pcbnew/zone_settings.cpp @@ -172,7 +172,7 @@ void ZONE_SETTINGS::SetupLayersList( wxDataViewListCtrl* aList, PCB_BASE_FRAME* wxDataViewColumn* layerIDColumn = aList->AppendTextColumn( wxEmptyString ); layerIDColumn->SetHidden( true ); - int minWidth = 0; + int textWidth = 0; for( LSEQ layer = layers.UIOrder(); layer; ++layer ) { @@ -180,7 +180,7 @@ void ZONE_SETTINGS::SetupLayersList( wxDataViewListCtrl* aList, PCB_BASE_FRAME* wxString layerName = board->GetLayerName( layerID ); // wxCOL_WIDTH_AUTOSIZE doesn't work on all platforms, so we calculate width here - minWidth = std::max( minWidth, GetTextSize( layerName, aList ).x ); + textWidth = std::max( textWidth, GetTextSize( layerName, aList ).x ); COLOR4D layerColor = aFrame->Settings().Colors().GetLayerColor( layerID ); auto bitmap = COLOR_SWATCH::MakeBitmap( layerColor, backgroundColor, LAYER_BITMAP_SIZE ); @@ -197,12 +197,19 @@ void ZONE_SETTINGS::SetupLayersList( wxDataViewListCtrl* aList, PCB_BASE_FRAME* aList->SetToggleValue( true, (unsigned) aList->GetItemCount() - 1, 0 ); } - checkColumn->SetWidth( 25 ); - layerColumn->SetWidth( minWidth + LAYER_BITMAP_SIZE.x + 25 ); + int checkColWidth = 22; + int layerColWidth = textWidth + LAYER_BITMAP_SIZE.x + 12; // You'd think the fact that m_layers is a list would encourage wxWidgets not to save room // for the tree expanders... but you'd be wrong. Force indent to 0. aList->SetIndent( 0 ); + aList->SetMinClientSize( wxSize( checkColWidth + layerColWidth, aList->GetMinClientSize().y ) ); + + checkColumn->SetWidth( checkColWidth ); + layerColumn->SetWidth( layerColWidth ); + + int afterCheckColWidth = checkColumn->GetWidth(); + int afterLayerColWidth = layerColumn->GetWidth(); }