From 284cda1fcadc682c80588d6b40c6315098dda8cc Mon Sep 17 00:00:00 2001 From: Alex Shvartzkop Date: Mon, 27 May 2024 01:00:51 +0300 Subject: [PATCH] Improve copper zone dialog layer list checkbox alignment on hidpi. --- pcbnew/zone_settings.cpp | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-) diff --git a/pcbnew/zone_settings.cpp b/pcbnew/zone_settings.cpp index 9f05fca52a..6c814a3a9e 100644 --- a/pcbnew/zone_settings.cpp +++ b/pcbnew/zone_settings.cpp @@ -259,7 +259,9 @@ void ZONE_SETTINGS::SetupLayersList( wxDataViewListCtrl* aList, PCB_BASE_FRAME* if( aFpEditorMode ) aLayers.set( In1_Cu ); - wxDataViewColumn* checkColumn = aList->AppendToggleColumn( wxEmptyString ); + wxDataViewColumn* checkColumn = aList->AppendToggleColumn( + wxEmptyString, wxDATAVIEW_CELL_ACTIVATABLE, wxCOL_WIDTH_DEFAULT, wxALIGN_CENTER ); + wxDataViewColumn* layerColumn = aList->AppendIconTextColumn( wxEmptyString ); wxDataViewColumn* layerIDColumn = aList->AppendTextColumn( wxEmptyString ); layerIDColumn->SetHidden( true ); @@ -293,22 +295,13 @@ void ZONE_SETTINGS::SetupLayersList( wxDataViewListCtrl* aList, PCB_BASE_FRAME* aList->SetToggleValue( true, (unsigned) aList->GetItemCount() - 1, 0 ); } - int checkColSize = 22; - int layerColSize = textWidth + LAYER_BITMAP_SIZE.x + 15; - -#ifdef __WXMAC__ - // TODO: something in wxWidgets 3.1.x pads checkbox columns with extra space. (It used to - // also be that the width of the column would get set too wide (to 30), but that's patched in - // our local wxWidgets fork.) - int checkColMargins = 40; -#else - int checkColMargins = 0; -#endif + int checkColSize = aList->FromDIP( 22 ); + int layerColSize = textWidth + LAYER_BITMAP_SIZE.x + aList->FromDIP( 15 ); // 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( checkColSize + checkColMargins + layerColSize, + aList->SetMinClientSize( wxSize( checkColSize + layerColSize, aList->GetMinClientSize().y ) ); checkColumn->SetWidth( checkColSize );