From 577e99d49d5f0edda563ecc428417699241125b8 Mon Sep 17 00:00:00 2001 From: Wayne Stambaugh Date: Mon, 16 Nov 2020 17:46:39 -0500 Subject: [PATCH] Minor hotkey list panel layout improvement. Use wxCOL_WIDTH_AUTOSIZE instead of fixed column sizes. This doesn't fix the initial sizer layout issue on wxWidgets 3.0 but at least resizing the dialog has better column width behavior. --- common/dialogs/dialog_hotkey_list.cpp | 2 +- common/dialogs/panel_hotkeys_editor.cpp | 8 +++----- common/widgets/widget_hotkey_list.cpp | 24 +++++++++++------------- 3 files changed, 15 insertions(+), 19 deletions(-) diff --git a/common/dialogs/dialog_hotkey_list.cpp b/common/dialogs/dialog_hotkey_list.cpp index a193e400df..934f3baefe 100644 --- a/common/dialogs/dialog_hotkey_list.cpp +++ b/common/dialogs/dialog_hotkey_list.cpp @@ -57,4 +57,4 @@ DIALOG_LIST_HOTKEYS::DIALOG_LIST_HOTKEYS( EDA_BASE_FRAME* aParent, TOOL_MANAGER* bool DIALOG_LIST_HOTKEYS::TransferDataToWindow() { return m_hk_list->TransferDataToWindow(); -} \ No newline at end of file +} diff --git a/common/dialogs/panel_hotkeys_editor.cpp b/common/dialogs/panel_hotkeys_editor.cpp index ab4be27c8d..874b41a001 100644 --- a/common/dialogs/panel_hotkeys_editor.cpp +++ b/common/dialogs/panel_hotkeys_editor.cpp @@ -80,17 +80,15 @@ PANEL_HOTKEYS_EDITOR::PANEL_HOTKEYS_EDITOR( EDA_BASE_FRAME* aFrame, wxWindow* aW mainSizer->Add( bMargins, 1, wxEXPAND | wxRIGHT | wxLEFT, side_margins ); - SetSizer( mainSizer ); - Layout(); - #ifdef __WXGTK__ // Work around a bug that clips the text vertically in the wxSearchCtrl on GTK filterSearch->SetMinSize( wxSize( filterSearch->GetSize().x, int( filterSearch->GetSize().y * 1.6 ) ) ); - - Layout(); #endif + SetSizer( mainSizer ); + Layout(); + // Connect Events filterSearch->Bind( wxEVT_COMMAND_TEXT_UPDATED, &PANEL_HOTKEYS_EDITOR::OnFilterSearch, this ); } diff --git a/common/widgets/widget_hotkey_list.cpp b/common/widgets/widget_hotkey_list.cpp index 9f61e6e226..48a809ee63 100644 --- a/common/widgets/widget_hotkey_list.cpp +++ b/common/widgets/widget_hotkey_list.cpp @@ -2,7 +2,7 @@ * This program source code file is part of KiCad, a free EDA CAD application. * * Copyright (C) 2016 Chris Pavlina - * Copyright (C) 2016-2019 KiCad Developers, see AUTHORS.txt for contributors. + * Copyright (C) 2016-2020 KiCad Developers, see AUTHORS.txt for contributors. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -45,9 +45,9 @@ enum ID_WHKL_MENU_IDS /** - * WIDGET_HOTKEY_CLIENT_DATA - * Stores the hotkey change data associated with each row. To change a - * hotkey, edit it via GetCurrentValue() in the row's client data, then call + * Store the hotkey change data associated with each row. + * + * To change a hotkey, edit it via GetCurrentValue() in the row's client data, then call * WIDGET_HOTKEY_LIST::UpdateFromClientData(). */ class WIDGET_HOTKEY_CLIENT_DATA : public wxClientData @@ -64,7 +64,6 @@ public: /** - * HK_PROMPT_DIALOG * Dialog to prompt the user to enter a key. */ class HK_PROMPT_DIALOG : public DIALOG_SHIM @@ -213,8 +212,6 @@ protected: /** - * HOTKEY_FILTER - * * Class to manage logic for filtering hotkeys based on user input */ class HOTKEY_FILTER @@ -227,9 +224,7 @@ public: } /** - * Method FilterMatches - * - * Checks if the filter matches the given hotkey + * Check if the filter matches the given hotkey * * @return true on match (or if filter is disabled) */ @@ -456,9 +451,12 @@ WIDGET_HOTKEY_LIST::WIDGET_HOTKEY_LIST( wxWindow* aParent, HOTKEY_STORE& aHotkey if( !m_readOnly ) command_header << " " << _( "(double-click to edit)" ); - AppendColumn( command_header, 320, wxALIGN_LEFT, wxCOL_RESIZABLE | wxCOL_SORTABLE ); - AppendColumn( _( "Hotkey" ), 110, wxALIGN_LEFT, wxCOL_RESIZABLE | wxCOL_SORTABLE ); - AppendColumn( _( "Description" ), 1000, wxALIGN_LEFT, wxCOL_RESIZABLE | wxCOL_SORTABLE ); + AppendColumn( command_header, wxCOL_WIDTH_AUTOSIZE, wxALIGN_LEFT, + wxCOL_RESIZABLE | wxCOL_SORTABLE ); + AppendColumn( _( "Hotkey" ), wxCOL_WIDTH_AUTOSIZE, wxALIGN_LEFT, + wxCOL_RESIZABLE | wxCOL_SORTABLE ); + AppendColumn( _( "Description" ), wxCOL_WIDTH_AUTOSIZE, wxALIGN_LEFT, + wxCOL_RESIZABLE | wxCOL_SORTABLE ); GetDataView()->SetIndent( 10 ); if( !m_readOnly )