From 90e17ecabd22e98ff97ba6d63a1aaf78d6d13fa1 Mon Sep 17 00:00:00 2001 From: Jeff Young Date: Sat, 26 Apr 2025 21:24:09 +0100 Subject: [PATCH] Make various menu button presentations consistent. Fixes https://gitlab.com/kicad/code/kicad/-/issues/20783 Fixes https://gitlab.com/kicad/code/kicad/-/issues/20774 --- common/widgets/lib_tree.cpp | 19 +++++++----- common/widgets/search_pane.cpp | 2 +- common/widgets/search_pane_base.cpp | 10 +++---- common/widgets/search_pane_base.fbp | 16 +++++----- common/widgets/search_pane_base.h | 4 +-- include/widgets/lib_tree.h | 2 +- pcbnew/pcb_edit_frame.cpp | 41 +++++++++++++------------- pcbnew/widgets/net_inspector_panel.cpp | 19 +++++++----- 8 files changed, 59 insertions(+), 54 deletions(-) diff --git a/common/widgets/lib_tree.cpp b/common/widgets/lib_tree.cpp index 156ead8f90..3c99bbf543 100644 --- a/common/widgets/lib_tree.cpp +++ b/common/widgets/lib_tree.cpp @@ -23,7 +23,7 @@ */ #include -#include +#include #include #include #include @@ -37,6 +37,7 @@ #include #include #include +#include #include #include // for GetAssociatedDocument() @@ -86,11 +87,14 @@ LIB_TREE::LIB_TREE( wxWindow* aParent, const wxString& aRecentSearchesKey, LIB_T m_debounceTimer = new wxTimer( this ); - search_sizer->Add( m_query_ctrl, 1, wxEXPAND | wxRIGHT, 5 ); + search_sizer->Add( m_query_ctrl, 1, wxEXPAND|wxALIGN_CENTER_VERTICAL|wxRIGHT, 4 ); - m_sort_ctrl = new STD_BITMAP_BUTTON( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, - wxDefaultSize, wxBU_AUTODRAW|0 ); - m_sort_ctrl->SetBitmap( KiBitmapBundle( BITMAPS::small_sort_desc ) ); + wxStaticLine* separator = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_VERTICAL ); + search_sizer->Add( separator, 0, wxEXPAND|wxTOP|wxBOTTOM, 3 ); + + m_sort_ctrl = new BITMAP_BUTTON( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, + wxDefaultSize, wxBU_AUTODRAW|0 ); + m_sort_ctrl->SetBitmap( KiBitmapBundle( BITMAPS::config ) ); m_sort_ctrl->Bind( wxEVT_LEFT_DOWN, [&]( wxMouseEvent& aEvent ) { @@ -132,10 +136,9 @@ LIB_TREE::LIB_TREE( wxWindow* aParent, const wxString& aRecentSearchesKey, LIB_T } ); m_sort_ctrl->Bind( wxEVT_CHAR_HOOK, &LIB_TREE::onTreeCharHook, this ); + search_sizer->Add( m_sort_ctrl, 0, wxEXPAND|wxALIGN_CENTER_VERTICAL, 5 ); - search_sizer->Add( m_sort_ctrl, 0, wxEXPAND, 5 ); - - sizer->Add( search_sizer, 0, wxEXPAND | wxBOTTOM, 5 ); + sizer->Add( search_sizer, 0, wxEXPAND, 5 ); m_query_ctrl->Bind( wxEVT_TEXT, &LIB_TREE::onQueryText, this ); diff --git a/common/widgets/search_pane.cpp b/common/widgets/search_pane.cpp index 97a0a4b216..1affddadfb 100644 --- a/common/widgets/search_pane.cpp +++ b/common/widgets/search_pane.cpp @@ -26,7 +26,7 @@ #include #include #include -#include +#include #define ID_TOGGLE_ZOOM_TO_SELECTION 14000 diff --git a/common/widgets/search_pane_base.cpp b/common/widgets/search_pane_base.cpp index f5ba3bf71c..a68e053e9a 100644 --- a/common/widgets/search_pane_base.cpp +++ b/common/widgets/search_pane_base.cpp @@ -5,7 +5,7 @@ // PLEASE DO *NOT* EDIT THIS FILE! /////////////////////////////////////////////////////////////////////////// -#include "widgets/std_bitmap_button.h" +#include "widgets/bitmap_button.h" #include "search_pane_base.h" @@ -23,13 +23,13 @@ SEARCH_PANE_BASE::SEARCH_PANE_BASE( wxWindow* parent, wxWindowID id, const wxPoi m_searchCtrl1->ShowSearchButton( true ); #endif m_searchCtrl1->ShowCancelButton( false ); - bSizer2->Add( m_searchCtrl1, 1, wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM|wxRIGHT, 3 ); + bSizer2->Add( m_searchCtrl1, 1, wxALIGN_CENTER_VERTICAL|wxRIGHT, 4 ); m_staticline1 = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_VERTICAL ); - bSizer2->Add( m_staticline1, 0, wxEXPAND|wxALL, 5 ); + bSizer2->Add( m_staticline1, 0, wxEXPAND|wxTOP|wxBOTTOM, 3 ); - m_menuButton = new STD_BITMAP_BUTTON( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, wxBU_AUTODRAW|0 ); - bSizer2->Add( m_menuButton, 0, wxALIGN_CENTER_VERTICAL|wxLEFT, 3 ); + m_menuButton = new BITMAP_BUTTON( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, wxBU_AUTODRAW|0 ); + bSizer2->Add( m_menuButton, 0, wxALIGN_CENTER_VERTICAL, 2 ); m_sizerOuter->Add( bSizer2, 0, wxEXPAND, 5 ); diff --git a/common/widgets/search_pane_base.fbp b/common/widgets/search_pane_base.fbp index d32eba55be..f0e8772edc 100644 --- a/common/widgets/search_pane_base.fbp +++ b/common/widgets/search_pane_base.fbp @@ -72,8 +72,8 @@ wxHORIZONTAL none - 3 - wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM|wxRIGHT + 4 + wxALIGN_CENTER_VERTICAL|wxRIGHT 1 1 @@ -139,8 +139,8 @@ - 5 - wxEXPAND|wxALL + 3 + wxEXPAND|wxTOP|wxBOTTOM 0 1 @@ -198,8 +198,8 @@ - 3 - wxALIGN_CENTER_VERTICAL|wxLEFT + 2 + wxALIGN_CENTER_VERTICAL 0 1 @@ -236,7 +236,7 @@ 0 0 wxID_ANY - MyButton + menu 0 @@ -259,7 +259,7 @@ 1 - STD_BITMAP_BUTTON; widgets/std_bitmap_button.h; forward_declare + BITMAP_BUTTON; widgets/bitmap_button.h; forward_declare 0 diff --git a/common/widgets/search_pane_base.h b/common/widgets/search_pane_base.h index f8744d4edf..502daa9b4f 100644 --- a/common/widgets/search_pane_base.h +++ b/common/widgets/search_pane_base.h @@ -10,7 +10,7 @@ #include #include #include -class STD_BITMAP_BUTTON; +class BITMAP_BUTTON; #include #include @@ -41,7 +41,7 @@ class SEARCH_PANE_BASE : public wxPanel wxBoxSizer* m_sizerOuter; wxSearchCtrl* m_searchCtrl1; wxStaticLine* m_staticline1; - STD_BITMAP_BUTTON* m_menuButton; + BITMAP_BUTTON* m_menuButton; wxNotebook* m_notebook; // Virtual event handlers, override them in your derived class diff --git a/include/widgets/lib_tree.h b/include/widgets/lib_tree.h index 2d780cf543..282c9127a0 100644 --- a/include/widgets/lib_tree.h +++ b/include/widgets/lib_tree.h @@ -256,7 +256,7 @@ protected: wxObjectDataPtr m_adapter; wxSearchCtrl* m_query_ctrl; - STD_BITMAP_BUTTON* m_sort_ctrl; + BITMAP_BUTTON* m_sort_ctrl; WX_DATAVIEWCTRL* m_tree_ctrl; HTML_WINDOW* m_details_ctrl; wxTimer* m_debounceTimer; diff --git a/pcbnew/pcb_edit_frame.cpp b/pcbnew/pcb_edit_frame.cpp index 4c612c9982..c1e41eaf9a 100644 --- a/pcbnew/pcb_edit_frame.cpp +++ b/pcbnew/pcb_edit_frame.cpp @@ -346,18 +346,18 @@ PCB_EDIT_FRAME::PCB_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ) : .CloseButton( false ) ); m_auimgr.AddPane( m_designBlocksPane, EDA_PANE().Name( DesignBlocksPaneName() ) - .Right().Layer( 5 ) - .Caption( _( "Design Blocks" ) ) - .CaptionVisible( true ) - .PaneBorder( true ) - .TopDockable( false ) - .BottomDockable( false ) - .CloseButton( true ) - .MinSize( FromDIP( wxSize( 240, 60 ) ) ) - .BestSize( FromDIP( wxSize( 300, 200 ) ) ) - .FloatingSize( FromDIP( wxSize( 800, 600 ) ) ) - .FloatingPosition( FromDIP( wxPoint( 50, 200 ) ) ) - .Show( true ) ); + .Right().Layer( 5 ) + .Caption( _( "Design Blocks" ) ) + .CaptionVisible( true ) + .PaneBorder( true ) + .TopDockable( false ) + .BottomDockable( false ) + .CloseButton( true ) + .MinSize( FromDIP( wxSize( 240, 60 ) ) ) + .BestSize( FromDIP( wxSize( 300, 200 ) ) ) + .FloatingSize( FromDIP( wxSize( 800, 600 ) ) ) + .FloatingPosition( FromDIP( wxPoint( 50, 200 ) ) ) + .Show( true ) ); m_auimgr.AddPane( m_propertiesPanel, EDA_PANE().Name( PropertiesPaneName() ) .Left().Layer( 5 ) @@ -371,15 +371,14 @@ PCB_EDIT_FRAME::PCB_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ) : m_auimgr.AddPane( GetCanvas(), EDA_PANE().Canvas().Name( wxS( "DrawFrame" ) ) .Center() ); - m_auimgr.AddPane( m_netInspectorPanel, EDA_PANE() - .Name( NetInspectorPanelName() ) - .Bottom() - .Caption( _( "Net Inspector" ) ) - .PaneBorder( false ) - .MinSize( FromDIP( wxSize( 240, 60 ) ) ) - .BestSize( FromDIP( wxSize( 300, 200 ) ) ) - .FloatingSize( wxSize( 300, 200 ) ) - .CloseButton( true ) ); + m_auimgr.AddPane( m_netInspectorPanel, EDA_PANE().Name( NetInspectorPanelName() ) + .Bottom() + .Caption( _( "Net Inspector" ) ) + .PaneBorder( false ) + .MinSize( FromDIP( wxSize( 240, 60 ) ) ) + .BestSize( FromDIP( wxSize( 300, 200 ) ) ) + .FloatingSize( wxSize( 300, 200 ) ) + .CloseButton( true ) ); m_auimgr.AddPane( m_searchPane, EDA_PANE().Name( SearchPaneName() ) .Bottom() diff --git a/pcbnew/widgets/net_inspector_panel.cpp b/pcbnew/widgets/net_inspector_panel.cpp index ee5e1822ce..89cad8a825 100644 --- a/pcbnew/widgets/net_inspector_panel.cpp +++ b/pcbnew/widgets/net_inspector_panel.cpp @@ -22,6 +22,7 @@ #include #include +#include NET_INSPECTOR_PANEL::NET_INSPECTOR_PANEL( wxWindow* parent, EDA_BASE_FRAME* aFrame, wxWindowID id, const wxPoint& pos, const wxSize& size, long style, @@ -33,25 +34,27 @@ NET_INSPECTOR_PANEL::NET_INSPECTOR_PANEL( wxWindow* parent, EDA_BASE_FRAME* aFra m_sizerOuter->SetFlexibleDirection( wxBOTH ); m_sizerOuter->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED ); - m_searchCtrl = new wxSearchCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, - wxDefaultSize, 0 ); + m_searchCtrl = new wxSearchCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); #ifndef __WXMAC__ m_searchCtrl->ShowSearchButton( true ); #endif m_searchCtrl->ShowCancelButton( false ); m_searchCtrl->SetDescriptiveText( _( "Filter" ) ); - m_sizerOuter->Add( m_searchCtrl, wxGBPosition( 0, 0 ), wxGBSpan( 1, 1 ), wxEXPAND, 5 ); + m_sizerOuter->Add( m_searchCtrl, wxGBPosition( 0, 0 ), wxGBSpan( 1, 1 ), + wxEXPAND|wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM|wxRIGHT, 2 ); + + wxStaticLine* separator = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_VERTICAL ); + m_sizerOuter->Add( separator, wxGBPosition( 0, 1 ), wxGBSpan( 1, 1 ), wxEXPAND|wxTOP|wxBOTTOM|wxLEFT, 3 ); m_configureBtn = new BITMAP_BUTTON( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 ); m_configureBtn->SetToolTip( _( "Configure netlist inspector" ) ); - m_configureBtn->SetBitmap( KiBitmapBundle( BITMAPS::options_generic_16 ) ); + m_configureBtn->SetBitmap( KiBitmapBundle( BITMAPS::config ) ); m_configureBtn->SetPadding( 2 ); - m_sizerOuter->Add( m_configureBtn, wxGBPosition( 0, 1 ), wxGBSpan( 1, 1 ), 0, 5 ); + m_sizerOuter->Add( m_configureBtn, wxGBPosition( 0, 2 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxLEFT, 3 ); - m_netsList = new wxDataViewCtrl( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, - wxDV_MULTIPLE ); + m_netsList = new wxDataViewCtrl( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxDV_MULTIPLE ); m_netsList->SetFont( KIUI::GetDockedPaneFont( this ) ); - m_sizerOuter->Add( m_netsList, wxGBPosition( 1, 0 ), wxGBSpan( 1, 2 ), wxEXPAND, 5 ); + m_sizerOuter->Add( m_netsList, wxGBPosition( 1, 0 ), wxGBSpan( 1, 3 ), wxEXPAND, 5 ); m_sizerOuter->AddGrowableCol( 0 ); m_sizerOuter->AddGrowableRow( 1 );