From 907d8fc018ee03bf28549354ff7ad56f157883d0 Mon Sep 17 00:00:00 2001 From: Seth Hillbrand Date: Fri, 1 Jul 2022 11:37:55 -0700 Subject: [PATCH] Revert "Fix Swatch sizes" This reverts commit 25c3a4681ff5fa306f3e4a205e5659e821de0dab. Windows default sizes are too big when they are the correct size on Linux. We need the DU scaling for swatches --- common/widgets/color_swatch.cpp | 33 +++----------------- common/widgets/grid_color_swatch_helpers.cpp | 2 +- include/widgets/color_swatch.h | 10 +----- pcbnew/widgets/appearance_controls.cpp | 2 +- 4 files changed, 8 insertions(+), 39 deletions(-) diff --git a/common/widgets/color_swatch.cpp b/common/widgets/color_swatch.cpp index 0a2814271d..bab2c2b628 100644 --- a/common/widgets/color_swatch.cpp +++ b/common/widgets/color_swatch.cpp @@ -124,36 +124,13 @@ COLOR_SWATCH::COLOR_SWATCH( wxWindow* aParent, const COLOR4D& aColor, int aID, switch( aSwatchSize ) { - case SWATCH_MEDIUM: - m_size = ConvertDialogToPixels( SWATCH_SIZE_MEDIUM_DU ); - m_checkerboardSize = ConvertDialogToPixels( CHECKERBOARD_SIZE_DU ); - break; - case SWATCH_SMALL: - m_size = ConvertDialogToPixels( SWATCH_SIZE_SMALL_DU ); - m_checkerboardSize = ConvertDialogToPixels( CHECKERBOARD_SIZE_DU ); - break; - case SWATCH_LARGE: - m_size = ConvertDialogToPixels( SWATCH_SIZE_LARGE_DU ); - m_checkerboardSize = ConvertDialogToPixels( CHECKERBOARD_SIZE_DU ); - break; - case SWATCH_EXPAND: - m_size = ConvertDialogToPixels( SWATCH_SIZE_LARGE_DU ); - m_checkerboardSize = ConvertDialogToPixels( CHECKERBOARD_SIZE_DU ); - break; - case SWATCH_FIXED_SMALL: - m_size = SWATCH_SIZE_SMALL_PX; - m_checkerboardSize = CHECKERBOARD_SIZE_PX; - break; - case SWATCH_FIXED_MEDIUM: - m_size = SWATCH_SIZE_MEDIUM_PX; - m_checkerboardSize = CHECKERBOARD_SIZE_PX; - break; - case SWATCH_FIXED_LARGE: - m_size = SWATCH_SIZE_LARGE_PX; - m_checkerboardSize = CHECKERBOARD_SIZE_PX; - break; + case SWATCH_MEDIUM: m_size = ConvertDialogToPixels( SWATCH_SIZE_MEDIUM_DU ); break; + case SWATCH_SMALL: m_size = ConvertDialogToPixels( SWATCH_SIZE_SMALL_DU ); break; + case SWATCH_LARGE: m_size = ConvertDialogToPixels( SWATCH_SIZE_LARGE_DU ); break; + case SWATCH_EXPAND: m_size = ConvertDialogToPixels( SWATCH_SIZE_LARGE_DU ); break; } + m_checkerboardSize = ConvertDialogToPixels( CHECKERBOARD_SIZE_DU ); m_checkerboardBg = aParent->GetBackgroundColour(); auto sizer = new wxBoxSizer( wxHORIZONTAL ); diff --git a/common/widgets/grid_color_swatch_helpers.cpp b/common/widgets/grid_color_swatch_helpers.cpp index f382c3b514..7588aea4e8 100644 --- a/common/widgets/grid_color_swatch_helpers.cpp +++ b/common/widgets/grid_color_swatch_helpers.cpp @@ -43,7 +43,7 @@ GRID_CELL_COLOR_RENDERER::GRID_CELL_COLOR_RENDERER( wxWindow* aParent, SWATCH_SI case SWATCH_MEDIUM: m_size = m_parent->ConvertDialogToPixels( SWATCH_SIZE_MEDIUM_DU ); break; case SWATCH_SMALL: m_size = m_parent->ConvertDialogToPixels( SWATCH_SIZE_SMALL_DU ); break; case SWATCH_LARGE: m_size = m_parent->ConvertDialogToPixels( SWATCH_SIZE_LARGE_DU ); break; - default: m_size = wxDefaultSize; break; + case SWATCH_EXPAND: m_size = wxDefaultSize; break; } m_checkerboardSize = m_parent->ConvertDialogToPixels( CHECKERBOARD_SIZE_DU ); diff --git a/include/widgets/color_swatch.h b/include/widgets/color_swatch.h index a6d6952cc7..d9578315d0 100644 --- a/include/widgets/color_swatch.h +++ b/include/widgets/color_swatch.h @@ -40,10 +40,7 @@ enum SWATCH_SIZE SWATCH_SMALL, SWATCH_MEDIUM, SWATCH_LARGE, - SWATCH_EXPAND, - SWATCH_FIXED_SMALL, - SWATCH_FIXED_MEDIUM, - SWATCH_FIXED_LARGE + SWATCH_EXPAND }; @@ -52,11 +49,6 @@ const static wxSize SWATCH_SIZE_MEDIUM_DU( 24, 10 ); const static wxSize SWATCH_SIZE_LARGE_DU( 24, 16 ); const static wxSize CHECKERBOARD_SIZE_DU( 3, 3 ); -const static wxSize SWATCH_SIZE_SMALL_PX( 24, 24 ); -const static wxSize SWATCH_SIZE_MEDIUM_PX( 48, 48 ); -const static wxSize SWATCH_SIZE_LARGE_PX( 64, 64 ); -const static wxSize CHECKERBOARD_SIZE_PX( 9, 12 ); - /** * A simple color swatch of the kind used to set layer colors. diff --git a/pcbnew/widgets/appearance_controls.cpp b/pcbnew/widgets/appearance_controls.cpp index 6fabe7de29..def1330857 100644 --- a/pcbnew/widgets/appearance_controls.cpp +++ b/pcbnew/widgets/appearance_controls.cpp @@ -1461,7 +1461,7 @@ void APPEARANCE_CONTROLS::rebuildLayers() COLOR_SWATCH* swatch = new COLOR_SWATCH( panel, COLOR4D::UNSPECIFIED, layer, bgColor, theme->GetColor( layer ), - SWATCH_FIXED_SMALL ); + SWATCH_SMALL ); swatch->SetToolTip( _( "Double click or middle click for color change, " "right click for menu" ) );