Simplify hotkey editor widget
This is in preparation for making this widget optionally read-only. Major changes: * Construct panel in code, not with wxFormBuilder. This make's it easier to conditionally construct elements that won't be used in a read-only mode (e.g. the buttons). * Use a generic "button row panel" widget for the buttons, as the sizing and layout logic is reusable in nearly all dialogs, and it's simplifies layout in the higher-level dialog widget. This widget is one example of many possible "reuable widgets".
This commit is contained in:
parent
445a9fa963
commit
23038b1550
|
@ -172,12 +172,12 @@ set( COMMON_DLG_SRCS
|
|||
dialogs/panel_common_settings.cpp
|
||||
dialogs/panel_common_settings_base.cpp
|
||||
dialogs/panel_hotkeys_editor.cpp
|
||||
dialogs/panel_hotkeys_editor_base.cpp
|
||||
dialogs/wx_html_report_panel.cpp
|
||||
dialogs/wx_html_report_panel_base.cpp
|
||||
)
|
||||
|
||||
set( COMMON_WIDGET_SRCS
|
||||
widgets/button_row_panel.cpp
|
||||
widgets/color_swatch.cpp
|
||||
widgets/footprint_choice.cpp
|
||||
widgets/footprint_preview_widget.cpp
|
||||
|
|
|
@ -21,24 +21,119 @@
|
|||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#include <eda_base_frame.h>
|
||||
#include <panel_hotkeys_editor.h>
|
||||
#include <eda_base_frame.h>
|
||||
|
||||
#include <wx/srchctrl.h>
|
||||
#include <wx/panel.h>
|
||||
#include <wx/button.h>
|
||||
#include <wx/sizer.h>
|
||||
|
||||
#include <widgets/button_row_panel.h>
|
||||
|
||||
|
||||
static const wxSize default_dialog_size { 500, 350 };
|
||||
static const wxSize min_dialog_size { -1, 350 };
|
||||
static const int widget_margins = 5;
|
||||
static const int side_margins = 10;
|
||||
|
||||
/**
|
||||
* Helper function to add a filter box to a panel, with some
|
||||
* sensible defaults for that purpose.
|
||||
*
|
||||
* @param aParent The panrent widget/panel
|
||||
* @param aDescriptiveText The text to show when the box is empty.
|
||||
* @return A newly constructed filter box - the caller owns it
|
||||
*/
|
||||
static wxSearchCtrl* CreateTextFilterBox( wxWindow* aParent, const wxString& aDescriptiveText )
|
||||
{
|
||||
auto search_widget = new wxSearchCtrl( aParent, wxID_ANY );
|
||||
|
||||
search_widget->ShowSearchButton( false );
|
||||
search_widget->ShowCancelButton( true );
|
||||
|
||||
search_widget->SetDescriptiveText( aDescriptiveText);
|
||||
|
||||
return search_widget;
|
||||
}
|
||||
|
||||
|
||||
PANEL_HOTKEYS_EDITOR::PANEL_HOTKEYS_EDITOR( EDA_BASE_FRAME* aFrame, wxWindow* aWindow,
|
||||
EDA_HOTKEY_CONFIG* aHotkeys,
|
||||
EDA_HOTKEY_CONFIG* aShowHotkeys,
|
||||
const wxString& aNickname ) :
|
||||
PANEL_HOTKEYS_EDITOR_BASE( aWindow ),
|
||||
wxPanel( aWindow, wxID_ANY, wxDefaultPosition, default_dialog_size ),
|
||||
m_frame( aFrame ),
|
||||
m_hotkeys( aHotkeys ),
|
||||
m_showHotkeys( aShowHotkeys ),
|
||||
m_nickname( aNickname ),
|
||||
m_hotkeyStore( aShowHotkeys )
|
||||
{
|
||||
m_filterSearch->SetDescriptiveText( _("Type filter text") );
|
||||
auto mainSizer = new wxBoxSizer( wxVERTICAL );
|
||||
|
||||
m_hotkeyListCtrl = new WIDGET_HOTKEY_LIST( m_panelHotkeys, m_hotkeyStore );
|
||||
m_hotkeyListCtrl->InstallOnPanel( m_panelHotkeys );
|
||||
// Sub-sizer for setting a wider side margin
|
||||
// TODO: Can this be set by the parent widget- doesn't seem to be
|
||||
// this panel's responsibility?
|
||||
auto bMargins = new wxBoxSizer( wxVERTICAL );
|
||||
|
||||
auto filterSearch = CreateTextFilterBox( this, _( "Type filter text" ) );
|
||||
bMargins->Add( filterSearch, 0, wxBOTTOM | wxEXPAND | wxTOP, widget_margins );
|
||||
|
||||
m_hotkeyListCtrl = new WIDGET_HOTKEY_LIST( this, m_hotkeyStore );
|
||||
bMargins->Add( m_hotkeyListCtrl, 1, wxALL | wxEXPAND, widget_margins );
|
||||
|
||||
installButtons( bMargins );
|
||||
|
||||
mainSizer->Add( bMargins, 1, wxEXPAND | wxRIGHT | wxLEFT, side_margins );
|
||||
|
||||
this->SetSizer( mainSizer );
|
||||
this->Layout();
|
||||
|
||||
// Connect Events
|
||||
filterSearch->Bind( wxEVT_COMMAND_TEXT_UPDATED,
|
||||
&PANEL_HOTKEYS_EDITOR::OnFilterSearch, this );
|
||||
}
|
||||
|
||||
|
||||
void PANEL_HOTKEYS_EDITOR::installButtons( wxSizer* aSizer )
|
||||
{
|
||||
const BUTTON_ROW_PANEL::BTN_DEF_LIST l_btn_defs = {
|
||||
{
|
||||
wxID_RESET,
|
||||
_( "Reset Hotkeys" ),
|
||||
[this]( wxCommandEvent ){
|
||||
m_hotkeyListCtrl->ResetAllHotkeys( false );
|
||||
}
|
||||
},
|
||||
{
|
||||
wxID_ANY,
|
||||
_( "Set to Defaults" ),
|
||||
[this]( wxCommandEvent ){
|
||||
m_hotkeyListCtrl->ResetAllHotkeys( true );
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
const BUTTON_ROW_PANEL::BTN_DEF_LIST r_btn_defs = {
|
||||
{
|
||||
wxID_ANY,
|
||||
_( "Import..." ),
|
||||
[this]( wxCommandEvent ){
|
||||
m_frame->ImportHotkeyConfigFromFile( m_hotkeys, m_nickname );
|
||||
}
|
||||
},
|
||||
{
|
||||
wxID_ANY,
|
||||
_( "Export..." ),
|
||||
[this]( wxCommandEvent ){
|
||||
m_frame->ExportHotkeyConfigToFile( m_hotkeys, m_nickname );
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
auto btnPanel = new BUTTON_ROW_PANEL( this, l_btn_defs, r_btn_defs );
|
||||
|
||||
aSizer->Add( btnPanel, 0, wxEXPAND | wxTOP, widget_margins );
|
||||
}
|
||||
|
||||
|
||||
|
@ -60,28 +155,6 @@ bool PANEL_HOTKEYS_EDITOR::TransferDataFromWindow()
|
|||
}
|
||||
|
||||
|
||||
void PANEL_HOTKEYS_EDITOR::ResetClicked( wxCommandEvent& aEvent )
|
||||
{
|
||||
m_hotkeyListCtrl->ResetAllHotkeys( false );
|
||||
}
|
||||
|
||||
void PANEL_HOTKEYS_EDITOR::DefaultsClicked( wxCommandEvent& aEvent )
|
||||
{
|
||||
m_hotkeyListCtrl->ResetAllHotkeys( true );
|
||||
}
|
||||
|
||||
|
||||
void PANEL_HOTKEYS_EDITOR::OnExport( wxCommandEvent& aEvent )
|
||||
{
|
||||
m_frame->ExportHotkeyConfigToFile( m_hotkeys, m_nickname );
|
||||
}
|
||||
|
||||
|
||||
void PANEL_HOTKEYS_EDITOR::OnImport( wxCommandEvent& aEvent )
|
||||
{
|
||||
m_frame->ImportHotkeyConfigFromFile( m_hotkeys, m_nickname );
|
||||
}
|
||||
|
||||
void PANEL_HOTKEYS_EDITOR::OnFilterSearch( wxCommandEvent& aEvent )
|
||||
{
|
||||
const auto searchStr = aEvent.GetString();
|
||||
|
|
|
@ -1,76 +0,0 @@
|
|||
///////////////////////////////////////////////////////////////////////////
|
||||
// C++ code generated with wxFormBuilder (version Jun 18 2018)
|
||||
// http://www.wxformbuilder.org/
|
||||
//
|
||||
// PLEASE DO *NOT* EDIT THIS FILE!
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "panel_hotkeys_editor_base.h"
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
PANEL_HOTKEYS_EDITOR_BASE::PANEL_HOTKEYS_EDITOR_BASE( wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style ) : wxPanel( parent, id, pos, size, style )
|
||||
{
|
||||
m_mainSizer = new wxBoxSizer( wxHORIZONTAL );
|
||||
|
||||
wxBoxSizer* bMargins;
|
||||
bMargins = new wxBoxSizer( wxVERTICAL );
|
||||
|
||||
m_filterSearch = new wxSearchCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
|
||||
#ifndef __WXMAC__
|
||||
m_filterSearch->ShowSearchButton( false );
|
||||
#endif
|
||||
m_filterSearch->ShowCancelButton( true );
|
||||
bMargins->Add( m_filterSearch, 0, wxBOTTOM|wxEXPAND|wxTOP, 5 );
|
||||
|
||||
m_panelHotkeys = new wxPanel( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
|
||||
m_panelHotkeys->SetMinSize( wxSize( -1,350 ) );
|
||||
|
||||
bMargins->Add( m_panelHotkeys, 1, wxEXPAND|wxTOP|wxBOTTOM|wxRIGHT, 2 );
|
||||
|
||||
wxBoxSizer* b_buttonsSizer;
|
||||
b_buttonsSizer = new wxBoxSizer( wxHORIZONTAL );
|
||||
|
||||
m_resetButton = new wxButton( this, wxID_RESET, _("Reset Hotkeys"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
b_buttonsSizer->Add( m_resetButton, 0, wxEXPAND|wxTOP|wxRIGHT, 5 );
|
||||
|
||||
m_defaultButton = new wxButton( this, wxID_ANY, _("Set to Defaults"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
b_buttonsSizer->Add( m_defaultButton, 0, wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 5 );
|
||||
|
||||
|
||||
b_buttonsSizer->Add( 0, 0, 1, wxEXPAND, 5 );
|
||||
|
||||
btnImport = new wxButton( this, wxID_ANY, _("Import..."), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
b_buttonsSizer->Add( btnImport, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
|
||||
|
||||
btnExport = new wxButton( this, wxID_ANY, _("Export..."), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
b_buttonsSizer->Add( btnExport, 0, wxTOP|wxLEFT, 5 );
|
||||
|
||||
|
||||
bMargins->Add( b_buttonsSizer, 0, wxEXPAND, 5 );
|
||||
|
||||
|
||||
m_mainSizer->Add( bMargins, 1, wxEXPAND|wxRIGHT|wxLEFT, 10 );
|
||||
|
||||
|
||||
this->SetSizer( m_mainSizer );
|
||||
this->Layout();
|
||||
|
||||
// Connect Events
|
||||
m_filterSearch->Connect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( PANEL_HOTKEYS_EDITOR_BASE::OnFilterSearch ), NULL, this );
|
||||
m_resetButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_HOTKEYS_EDITOR_BASE::ResetClicked ), NULL, this );
|
||||
m_defaultButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_HOTKEYS_EDITOR_BASE::DefaultsClicked ), NULL, this );
|
||||
btnImport->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_HOTKEYS_EDITOR_BASE::OnImport ), NULL, this );
|
||||
btnExport->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_HOTKEYS_EDITOR_BASE::OnExport ), NULL, this );
|
||||
}
|
||||
|
||||
PANEL_HOTKEYS_EDITOR_BASE::~PANEL_HOTKEYS_EDITOR_BASE()
|
||||
{
|
||||
// Disconnect Events
|
||||
m_filterSearch->Disconnect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( PANEL_HOTKEYS_EDITOR_BASE::OnFilterSearch ), NULL, this );
|
||||
m_resetButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_HOTKEYS_EDITOR_BASE::ResetClicked ), NULL, this );
|
||||
m_defaultButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_HOTKEYS_EDITOR_BASE::DefaultsClicked ), NULL, this );
|
||||
btnImport->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_HOTKEYS_EDITOR_BASE::OnImport ), NULL, this );
|
||||
btnExport->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_HOTKEYS_EDITOR_BASE::OnExport ), NULL, this );
|
||||
|
||||
}
|
|
@ -1,650 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
|
||||
<wxFormBuilder_Project>
|
||||
<FileVersion major="1" minor="13" />
|
||||
<object class="Project" expanded="1">
|
||||
<property name="class_decoration"></property>
|
||||
<property name="code_generation">C++</property>
|
||||
<property name="disconnect_events">1</property>
|
||||
<property name="disconnect_mode">source_name</property>
|
||||
<property name="disconnect_php_events">0</property>
|
||||
<property name="disconnect_python_events">0</property>
|
||||
<property name="embedded_files_path">res</property>
|
||||
<property name="encoding">UTF-8</property>
|
||||
<property name="event_generation">connect</property>
|
||||
<property name="file">panel_hotkeys_editor_base</property>
|
||||
<property name="first_id">1000</property>
|
||||
<property name="help_provider">none</property>
|
||||
<property name="indent_with_spaces"></property>
|
||||
<property name="internationalize">1</property>
|
||||
<property name="name">PanelHotkeysEditorBase</property>
|
||||
<property name="namespace"></property>
|
||||
<property name="path">.</property>
|
||||
<property name="precompiled_header"></property>
|
||||
<property name="relative_path">1</property>
|
||||
<property name="skip_lua_events">1</property>
|
||||
<property name="skip_php_events">1</property>
|
||||
<property name="skip_python_events">1</property>
|
||||
<property name="ui_table">UI</property>
|
||||
<property name="use_enum">0</property>
|
||||
<property name="use_microsoft_bom">0</property>
|
||||
<object class="Panel" expanded="1">
|
||||
<property name="aui_managed">0</property>
|
||||
<property name="aui_manager_style">wxAUI_MGR_DEFAULT</property>
|
||||
<property name="bg"></property>
|
||||
<property name="context_help"></property>
|
||||
<property name="context_menu">1</property>
|
||||
<property name="enabled">1</property>
|
||||
<property name="event_handler">impl_virtual</property>
|
||||
<property name="fg"></property>
|
||||
<property name="font"></property>
|
||||
<property name="hidden">0</property>
|
||||
<property name="id">wxID_ANY</property>
|
||||
<property name="maximum_size"></property>
|
||||
<property name="minimum_size"></property>
|
||||
<property name="name">PANEL_HOTKEYS_EDITOR_BASE</property>
|
||||
<property name="pos"></property>
|
||||
<property name="size">500,300</property>
|
||||
<property name="subclass">; forward_declare</property>
|
||||
<property name="tooltip"></property>
|
||||
<property name="window_extra_style"></property>
|
||||
<property name="window_name"></property>
|
||||
<property name="window_style">wxTAB_TRAVERSAL</property>
|
||||
<event name="OnAuiFindManager"></event>
|
||||
<event name="OnAuiPaneButton"></event>
|
||||
<event name="OnAuiPaneClose"></event>
|
||||
<event name="OnAuiPaneMaximize"></event>
|
||||
<event name="OnAuiPaneRestore"></event>
|
||||
<event name="OnAuiRender"></event>
|
||||
<event name="OnChar"></event>
|
||||
<event name="OnEnterWindow"></event>
|
||||
<event name="OnEraseBackground"></event>
|
||||
<event name="OnInitDialog"></event>
|
||||
<event name="OnKeyDown"></event>
|
||||
<event name="OnKeyUp"></event>
|
||||
<event name="OnKillFocus"></event>
|
||||
<event name="OnLeaveWindow"></event>
|
||||
<event name="OnLeftDClick"></event>
|
||||
<event name="OnLeftDown"></event>
|
||||
<event name="OnLeftUp"></event>
|
||||
<event name="OnMiddleDClick"></event>
|
||||
<event name="OnMiddleDown"></event>
|
||||
<event name="OnMiddleUp"></event>
|
||||
<event name="OnMotion"></event>
|
||||
<event name="OnMouseEvents"></event>
|
||||
<event name="OnMouseWheel"></event>
|
||||
<event name="OnPaint"></event>
|
||||
<event name="OnRightDClick"></event>
|
||||
<event name="OnRightDown"></event>
|
||||
<event name="OnRightUp"></event>
|
||||
<event name="OnSetFocus"></event>
|
||||
<event name="OnSize"></event>
|
||||
<event name="OnUpdateUI"></event>
|
||||
<object class="wxBoxSizer" expanded="1">
|
||||
<property name="minimum_size"></property>
|
||||
<property name="name">m_mainSizer</property>
|
||||
<property name="orient">wxHORIZONTAL</property>
|
||||
<property name="permission">protected</property>
|
||||
<object class="sizeritem" expanded="1">
|
||||
<property name="border">10</property>
|
||||
<property name="flag">wxEXPAND|wxRIGHT|wxLEFT</property>
|
||||
<property name="proportion">1</property>
|
||||
<object class="wxBoxSizer" expanded="1">
|
||||
<property name="minimum_size"></property>
|
||||
<property name="name">bMargins</property>
|
||||
<property name="orient">wxVERTICAL</property>
|
||||
<property name="permission">none</property>
|
||||
<object class="sizeritem" expanded="1">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxBOTTOM|wxEXPAND|wxTOP</property>
|
||||
<property name="proportion">0</property>
|
||||
<object class="wxSearchCtrl" expanded="1">
|
||||
<property name="BottomDockable">1</property>
|
||||
<property name="LeftDockable">1</property>
|
||||
<property name="RightDockable">1</property>
|
||||
<property name="TopDockable">1</property>
|
||||
<property name="aui_layer"></property>
|
||||
<property name="aui_name"></property>
|
||||
<property name="aui_position"></property>
|
||||
<property name="aui_row"></property>
|
||||
<property name="best_size"></property>
|
||||
<property name="bg"></property>
|
||||
<property name="cancel_button">1</property>
|
||||
<property name="caption"></property>
|
||||
<property name="caption_visible">1</property>
|
||||
<property name="center_pane">0</property>
|
||||
<property name="close_button">1</property>
|
||||
<property name="context_help"></property>
|
||||
<property name="context_menu">1</property>
|
||||
<property name="default_pane">0</property>
|
||||
<property name="dock">Dock</property>
|
||||
<property name="dock_fixed">0</property>
|
||||
<property name="docking">Left</property>
|
||||
<property name="enabled">1</property>
|
||||
<property name="fg"></property>
|
||||
<property name="floatable">1</property>
|
||||
<property name="font"></property>
|
||||
<property name="gripper">0</property>
|
||||
<property name="hidden">0</property>
|
||||
<property name="id">wxID_ANY</property>
|
||||
<property name="max_size"></property>
|
||||
<property name="maximize_button">0</property>
|
||||
<property name="maximum_size"></property>
|
||||
<property name="min_size"></property>
|
||||
<property name="minimize_button">0</property>
|
||||
<property name="minimum_size"></property>
|
||||
<property name="moveable">1</property>
|
||||
<property name="name">m_filterSearch</property>
|
||||
<property name="pane_border">1</property>
|
||||
<property name="pane_position"></property>
|
||||
<property name="pane_size"></property>
|
||||
<property name="permission">protected</property>
|
||||
<property name="pin_button">1</property>
|
||||
<property name="pos"></property>
|
||||
<property name="resize">Resizable</property>
|
||||
<property name="search_button">0</property>
|
||||
<property name="show">1</property>
|
||||
<property name="size"></property>
|
||||
<property name="style"></property>
|
||||
<property name="subclass">; forward_declare</property>
|
||||
<property name="toolbar_pane">0</property>
|
||||
<property name="tooltip"></property>
|
||||
<property name="validator_data_type"></property>
|
||||
<property name="validator_style">wxFILTER_NONE</property>
|
||||
<property name="validator_type">wxDefaultValidator</property>
|
||||
<property name="validator_variable"></property>
|
||||
<property name="value"></property>
|
||||
<property name="window_extra_style"></property>
|
||||
<property name="window_name"></property>
|
||||
<property name="window_style"></property>
|
||||
<event name="OnCancelButton"></event>
|
||||
<event name="OnChar"></event>
|
||||
<event name="OnEnterWindow"></event>
|
||||
<event name="OnEraseBackground"></event>
|
||||
<event name="OnKeyDown"></event>
|
||||
<event name="OnKeyUp"></event>
|
||||
<event name="OnKillFocus"></event>
|
||||
<event name="OnLeaveWindow"></event>
|
||||
<event name="OnLeftDClick"></event>
|
||||
<event name="OnLeftDown"></event>
|
||||
<event name="OnLeftUp"></event>
|
||||
<event name="OnMiddleDClick"></event>
|
||||
<event name="OnMiddleDown"></event>
|
||||
<event name="OnMiddleUp"></event>
|
||||
<event name="OnMotion"></event>
|
||||
<event name="OnMouseEvents"></event>
|
||||
<event name="OnMouseWheel"></event>
|
||||
<event name="OnPaint"></event>
|
||||
<event name="OnRightDClick"></event>
|
||||
<event name="OnRightDown"></event>
|
||||
<event name="OnRightUp"></event>
|
||||
<event name="OnSearchButton"></event>
|
||||
<event name="OnSetFocus"></event>
|
||||
<event name="OnSize"></event>
|
||||
<event name="OnText">OnFilterSearch</event>
|
||||
<event name="OnTextEnter"></event>
|
||||
<event name="OnUpdateUI"></event>
|
||||
</object>
|
||||
</object>
|
||||
<object class="sizeritem" expanded="1">
|
||||
<property name="border">2</property>
|
||||
<property name="flag">wxEXPAND|wxTOP|wxBOTTOM|wxRIGHT</property>
|
||||
<property name="proportion">1</property>
|
||||
<object class="wxPanel" expanded="1">
|
||||
<property name="BottomDockable">1</property>
|
||||
<property name="LeftDockable">1</property>
|
||||
<property name="RightDockable">1</property>
|
||||
<property name="TopDockable">1</property>
|
||||
<property name="aui_layer"></property>
|
||||
<property name="aui_name"></property>
|
||||
<property name="aui_position"></property>
|
||||
<property name="aui_row"></property>
|
||||
<property name="best_size"></property>
|
||||
<property name="bg"></property>
|
||||
<property name="caption"></property>
|
||||
<property name="caption_visible">1</property>
|
||||
<property name="center_pane">0</property>
|
||||
<property name="close_button">1</property>
|
||||
<property name="context_help"></property>
|
||||
<property name="context_menu">1</property>
|
||||
<property name="default_pane">0</property>
|
||||
<property name="dock">Dock</property>
|
||||
<property name="dock_fixed">0</property>
|
||||
<property name="docking">Left</property>
|
||||
<property name="enabled">1</property>
|
||||
<property name="fg"></property>
|
||||
<property name="floatable">1</property>
|
||||
<property name="font"></property>
|
||||
<property name="gripper">0</property>
|
||||
<property name="hidden">0</property>
|
||||
<property name="id">wxID_ANY</property>
|
||||
<property name="max_size"></property>
|
||||
<property name="maximize_button">0</property>
|
||||
<property name="maximum_size"></property>
|
||||
<property name="min_size"></property>
|
||||
<property name="minimize_button">0</property>
|
||||
<property name="minimum_size">-1,350</property>
|
||||
<property name="moveable">1</property>
|
||||
<property name="name">m_panelHotkeys</property>
|
||||
<property name="pane_border">1</property>
|
||||
<property name="pane_position"></property>
|
||||
<property name="pane_size"></property>
|
||||
<property name="permission">protected</property>
|
||||
<property name="pin_button">1</property>
|
||||
<property name="pos"></property>
|
||||
<property name="resize">Resizable</property>
|
||||
<property name="show">1</property>
|
||||
<property name="size"></property>
|
||||
<property name="subclass"></property>
|
||||
<property name="toolbar_pane">0</property>
|
||||
<property name="tooltip"></property>
|
||||
<property name="window_extra_style"></property>
|
||||
<property name="window_name"></property>
|
||||
<property name="window_style">wxTAB_TRAVERSAL</property>
|
||||
<event name="OnChar"></event>
|
||||
<event name="OnEnterWindow"></event>
|
||||
<event name="OnEraseBackground"></event>
|
||||
<event name="OnKeyDown"></event>
|
||||
<event name="OnKeyUp"></event>
|
||||
<event name="OnKillFocus"></event>
|
||||
<event name="OnLeaveWindow"></event>
|
||||
<event name="OnLeftDClick"></event>
|
||||
<event name="OnLeftDown"></event>
|
||||
<event name="OnLeftUp"></event>
|
||||
<event name="OnMiddleDClick"></event>
|
||||
<event name="OnMiddleDown"></event>
|
||||
<event name="OnMiddleUp"></event>
|
||||
<event name="OnMotion"></event>
|
||||
<event name="OnMouseEvents"></event>
|
||||
<event name="OnMouseWheel"></event>
|
||||
<event name="OnPaint"></event>
|
||||
<event name="OnRightDClick"></event>
|
||||
<event name="OnRightDown"></event>
|
||||
<event name="OnRightUp"></event>
|
||||
<event name="OnSetFocus"></event>
|
||||
<event name="OnSize"></event>
|
||||
<event name="OnUpdateUI"></event>
|
||||
</object>
|
||||
</object>
|
||||
<object class="sizeritem" expanded="1">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxEXPAND</property>
|
||||
<property name="proportion">0</property>
|
||||
<object class="wxBoxSizer" expanded="1">
|
||||
<property name="minimum_size"></property>
|
||||
<property name="name">b_buttonsSizer</property>
|
||||
<property name="orient">wxHORIZONTAL</property>
|
||||
<property name="permission">none</property>
|
||||
<object class="sizeritem" expanded="1">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxEXPAND|wxTOP|wxRIGHT</property>
|
||||
<property name="proportion">0</property>
|
||||
<object class="wxButton" expanded="1">
|
||||
<property name="BottomDockable">1</property>
|
||||
<property name="LeftDockable">1</property>
|
||||
<property name="RightDockable">1</property>
|
||||
<property name="TopDockable">1</property>
|
||||
<property name="aui_layer"></property>
|
||||
<property name="aui_name"></property>
|
||||
<property name="aui_position"></property>
|
||||
<property name="aui_row"></property>
|
||||
<property name="best_size"></property>
|
||||
<property name="bg"></property>
|
||||
<property name="caption"></property>
|
||||
<property name="caption_visible">1</property>
|
||||
<property name="center_pane">0</property>
|
||||
<property name="close_button">1</property>
|
||||
<property name="context_help"></property>
|
||||
<property name="context_menu">1</property>
|
||||
<property name="default">0</property>
|
||||
<property name="default_pane">0</property>
|
||||
<property name="dock">Dock</property>
|
||||
<property name="dock_fixed">0</property>
|
||||
<property name="docking">Left</property>
|
||||
<property name="enabled">1</property>
|
||||
<property name="fg"></property>
|
||||
<property name="floatable">1</property>
|
||||
<property name="font"></property>
|
||||
<property name="gripper">0</property>
|
||||
<property name="hidden">0</property>
|
||||
<property name="id">wxID_RESET</property>
|
||||
<property name="label">Reset Hotkeys</property>
|
||||
<property name="markup">0</property>
|
||||
<property name="max_size"></property>
|
||||
<property name="maximize_button">0</property>
|
||||
<property name="maximum_size"></property>
|
||||
<property name="min_size"></property>
|
||||
<property name="minimize_button">0</property>
|
||||
<property name="minimum_size"></property>
|
||||
<property name="moveable">1</property>
|
||||
<property name="name">m_resetButton</property>
|
||||
<property name="pane_border">1</property>
|
||||
<property name="pane_position"></property>
|
||||
<property name="pane_size"></property>
|
||||
<property name="permission">protected</property>
|
||||
<property name="pin_button">1</property>
|
||||
<property name="pos"></property>
|
||||
<property name="resize">Resizable</property>
|
||||
<property name="show">1</property>
|
||||
<property name="size"></property>
|
||||
<property name="style"></property>
|
||||
<property name="subclass"></property>
|
||||
<property name="toolbar_pane">0</property>
|
||||
<property name="tooltip"></property>
|
||||
<property name="validator_data_type"></property>
|
||||
<property name="validator_style">wxFILTER_NONE</property>
|
||||
<property name="validator_type">wxDefaultValidator</property>
|
||||
<property name="validator_variable"></property>
|
||||
<property name="window_extra_style"></property>
|
||||
<property name="window_name"></property>
|
||||
<property name="window_style"></property>
|
||||
<event name="OnButtonClick">ResetClicked</event>
|
||||
<event name="OnChar"></event>
|
||||
<event name="OnEnterWindow"></event>
|
||||
<event name="OnEraseBackground"></event>
|
||||
<event name="OnKeyDown"></event>
|
||||
<event name="OnKeyUp"></event>
|
||||
<event name="OnKillFocus"></event>
|
||||
<event name="OnLeaveWindow"></event>
|
||||
<event name="OnLeftDClick"></event>
|
||||
<event name="OnLeftDown"></event>
|
||||
<event name="OnLeftUp"></event>
|
||||
<event name="OnMiddleDClick"></event>
|
||||
<event name="OnMiddleDown"></event>
|
||||
<event name="OnMiddleUp"></event>
|
||||
<event name="OnMotion"></event>
|
||||
<event name="OnMouseEvents"></event>
|
||||
<event name="OnMouseWheel"></event>
|
||||
<event name="OnPaint"></event>
|
||||
<event name="OnRightDClick"></event>
|
||||
<event name="OnRightDown"></event>
|
||||
<event name="OnRightUp"></event>
|
||||
<event name="OnSetFocus"></event>
|
||||
<event name="OnSize"></event>
|
||||
<event name="OnUpdateUI"></event>
|
||||
</object>
|
||||
</object>
|
||||
<object class="sizeritem" expanded="1">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxEXPAND|wxTOP|wxRIGHT|wxLEFT</property>
|
||||
<property name="proportion">0</property>
|
||||
<object class="wxButton" expanded="1">
|
||||
<property name="BottomDockable">1</property>
|
||||
<property name="LeftDockable">1</property>
|
||||
<property name="RightDockable">1</property>
|
||||
<property name="TopDockable">1</property>
|
||||
<property name="aui_layer"></property>
|
||||
<property name="aui_name"></property>
|
||||
<property name="aui_position"></property>
|
||||
<property name="aui_row"></property>
|
||||
<property name="best_size"></property>
|
||||
<property name="bg"></property>
|
||||
<property name="caption"></property>
|
||||
<property name="caption_visible">1</property>
|
||||
<property name="center_pane">0</property>
|
||||
<property name="close_button">1</property>
|
||||
<property name="context_help"></property>
|
||||
<property name="context_menu">1</property>
|
||||
<property name="default">0</property>
|
||||
<property name="default_pane">0</property>
|
||||
<property name="dock">Dock</property>
|
||||
<property name="dock_fixed">0</property>
|
||||
<property name="docking">Left</property>
|
||||
<property name="enabled">1</property>
|
||||
<property name="fg"></property>
|
||||
<property name="floatable">1</property>
|
||||
<property name="font"></property>
|
||||
<property name="gripper">0</property>
|
||||
<property name="hidden">0</property>
|
||||
<property name="id">wxID_ANY</property>
|
||||
<property name="label">Set to Defaults</property>
|
||||
<property name="markup">0</property>
|
||||
<property name="max_size"></property>
|
||||
<property name="maximize_button">0</property>
|
||||
<property name="maximum_size"></property>
|
||||
<property name="min_size"></property>
|
||||
<property name="minimize_button">0</property>
|
||||
<property name="minimum_size"></property>
|
||||
<property name="moveable">1</property>
|
||||
<property name="name">m_defaultButton</property>
|
||||
<property name="pane_border">1</property>
|
||||
<property name="pane_position"></property>
|
||||
<property name="pane_size"></property>
|
||||
<property name="permission">protected</property>
|
||||
<property name="pin_button">1</property>
|
||||
<property name="pos"></property>
|
||||
<property name="resize">Resizable</property>
|
||||
<property name="show">1</property>
|
||||
<property name="size"></property>
|
||||
<property name="style"></property>
|
||||
<property name="subclass"></property>
|
||||
<property name="toolbar_pane">0</property>
|
||||
<property name="tooltip"></property>
|
||||
<property name="validator_data_type"></property>
|
||||
<property name="validator_style">wxFILTER_NONE</property>
|
||||
<property name="validator_type">wxDefaultValidator</property>
|
||||
<property name="validator_variable"></property>
|
||||
<property name="window_extra_style"></property>
|
||||
<property name="window_name"></property>
|
||||
<property name="window_style"></property>
|
||||
<event name="OnButtonClick">DefaultsClicked</event>
|
||||
<event name="OnChar"></event>
|
||||
<event name="OnEnterWindow"></event>
|
||||
<event name="OnEraseBackground"></event>
|
||||
<event name="OnKeyDown"></event>
|
||||
<event name="OnKeyUp"></event>
|
||||
<event name="OnKillFocus"></event>
|
||||
<event name="OnLeaveWindow"></event>
|
||||
<event name="OnLeftDClick"></event>
|
||||
<event name="OnLeftDown"></event>
|
||||
<event name="OnLeftUp"></event>
|
||||
<event name="OnMiddleDClick"></event>
|
||||
<event name="OnMiddleDown"></event>
|
||||
<event name="OnMiddleUp"></event>
|
||||
<event name="OnMotion"></event>
|
||||
<event name="OnMouseEvents"></event>
|
||||
<event name="OnMouseWheel"></event>
|
||||
<event name="OnPaint"></event>
|
||||
<event name="OnRightDClick"></event>
|
||||
<event name="OnRightDown"></event>
|
||||
<event name="OnRightUp"></event>
|
||||
<event name="OnSetFocus"></event>
|
||||
<event name="OnSize"></event>
|
||||
<event name="OnUpdateUI"></event>
|
||||
</object>
|
||||
</object>
|
||||
<object class="sizeritem" expanded="1">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxEXPAND</property>
|
||||
<property name="proportion">1</property>
|
||||
<object class="spacer" expanded="1">
|
||||
<property name="height">0</property>
|
||||
<property name="permission">protected</property>
|
||||
<property name="width">0</property>
|
||||
</object>
|
||||
</object>
|
||||
<object class="sizeritem" expanded="1">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxTOP|wxRIGHT|wxLEFT</property>
|
||||
<property name="proportion">0</property>
|
||||
<object class="wxButton" expanded="1">
|
||||
<property name="BottomDockable">1</property>
|
||||
<property name="LeftDockable">1</property>
|
||||
<property name="RightDockable">1</property>
|
||||
<property name="TopDockable">1</property>
|
||||
<property name="aui_layer"></property>
|
||||
<property name="aui_name"></property>
|
||||
<property name="aui_position"></property>
|
||||
<property name="aui_row"></property>
|
||||
<property name="best_size"></property>
|
||||
<property name="bg"></property>
|
||||
<property name="caption"></property>
|
||||
<property name="caption_visible">1</property>
|
||||
<property name="center_pane">0</property>
|
||||
<property name="close_button">1</property>
|
||||
<property name="context_help"></property>
|
||||
<property name="context_menu">1</property>
|
||||
<property name="default">0</property>
|
||||
<property name="default_pane">0</property>
|
||||
<property name="dock">Dock</property>
|
||||
<property name="dock_fixed">0</property>
|
||||
<property name="docking">Left</property>
|
||||
<property name="enabled">1</property>
|
||||
<property name="fg"></property>
|
||||
<property name="floatable">1</property>
|
||||
<property name="font"></property>
|
||||
<property name="gripper">0</property>
|
||||
<property name="hidden">0</property>
|
||||
<property name="id">wxID_ANY</property>
|
||||
<property name="label">Import...</property>
|
||||
<property name="markup">0</property>
|
||||
<property name="max_size"></property>
|
||||
<property name="maximize_button">0</property>
|
||||
<property name="maximum_size"></property>
|
||||
<property name="min_size"></property>
|
||||
<property name="minimize_button">0</property>
|
||||
<property name="minimum_size"></property>
|
||||
<property name="moveable">1</property>
|
||||
<property name="name">btnImport</property>
|
||||
<property name="pane_border">1</property>
|
||||
<property name="pane_position"></property>
|
||||
<property name="pane_size"></property>
|
||||
<property name="permission">protected</property>
|
||||
<property name="pin_button">1</property>
|
||||
<property name="pos"></property>
|
||||
<property name="resize">Resizable</property>
|
||||
<property name="show">1</property>
|
||||
<property name="size"></property>
|
||||
<property name="style"></property>
|
||||
<property name="subclass">; forward_declare</property>
|
||||
<property name="toolbar_pane">0</property>
|
||||
<property name="tooltip"></property>
|
||||
<property name="validator_data_type"></property>
|
||||
<property name="validator_style">wxFILTER_NONE</property>
|
||||
<property name="validator_type">wxDefaultValidator</property>
|
||||
<property name="validator_variable"></property>
|
||||
<property name="window_extra_style"></property>
|
||||
<property name="window_name"></property>
|
||||
<property name="window_style"></property>
|
||||
<event name="OnButtonClick">OnImport</event>
|
||||
<event name="OnChar"></event>
|
||||
<event name="OnEnterWindow"></event>
|
||||
<event name="OnEraseBackground"></event>
|
||||
<event name="OnKeyDown"></event>
|
||||
<event name="OnKeyUp"></event>
|
||||
<event name="OnKillFocus"></event>
|
||||
<event name="OnLeaveWindow"></event>
|
||||
<event name="OnLeftDClick"></event>
|
||||
<event name="OnLeftDown"></event>
|
||||
<event name="OnLeftUp"></event>
|
||||
<event name="OnMiddleDClick"></event>
|
||||
<event name="OnMiddleDown"></event>
|
||||
<event name="OnMiddleUp"></event>
|
||||
<event name="OnMotion"></event>
|
||||
<event name="OnMouseEvents"></event>
|
||||
<event name="OnMouseWheel"></event>
|
||||
<event name="OnPaint"></event>
|
||||
<event name="OnRightDClick"></event>
|
||||
<event name="OnRightDown"></event>
|
||||
<event name="OnRightUp"></event>
|
||||
<event name="OnSetFocus"></event>
|
||||
<event name="OnSize"></event>
|
||||
<event name="OnUpdateUI"></event>
|
||||
</object>
|
||||
</object>
|
||||
<object class="sizeritem" expanded="1">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxTOP|wxLEFT</property>
|
||||
<property name="proportion">0</property>
|
||||
<object class="wxButton" expanded="1">
|
||||
<property name="BottomDockable">1</property>
|
||||
<property name="LeftDockable">1</property>
|
||||
<property name="RightDockable">1</property>
|
||||
<property name="TopDockable">1</property>
|
||||
<property name="aui_layer"></property>
|
||||
<property name="aui_name"></property>
|
||||
<property name="aui_position"></property>
|
||||
<property name="aui_row"></property>
|
||||
<property name="best_size"></property>
|
||||
<property name="bg"></property>
|
||||
<property name="caption"></property>
|
||||
<property name="caption_visible">1</property>
|
||||
<property name="center_pane">0</property>
|
||||
<property name="close_button">1</property>
|
||||
<property name="context_help"></property>
|
||||
<property name="context_menu">1</property>
|
||||
<property name="default">0</property>
|
||||
<property name="default_pane">0</property>
|
||||
<property name="dock">Dock</property>
|
||||
<property name="dock_fixed">0</property>
|
||||
<property name="docking">Left</property>
|
||||
<property name="enabled">1</property>
|
||||
<property name="fg"></property>
|
||||
<property name="floatable">1</property>
|
||||
<property name="font"></property>
|
||||
<property name="gripper">0</property>
|
||||
<property name="hidden">0</property>
|
||||
<property name="id">wxID_ANY</property>
|
||||
<property name="label">Export...</property>
|
||||
<property name="markup">0</property>
|
||||
<property name="max_size"></property>
|
||||
<property name="maximize_button">0</property>
|
||||
<property name="maximum_size"></property>
|
||||
<property name="min_size"></property>
|
||||
<property name="minimize_button">0</property>
|
||||
<property name="minimum_size"></property>
|
||||
<property name="moveable">1</property>
|
||||
<property name="name">btnExport</property>
|
||||
<property name="pane_border">1</property>
|
||||
<property name="pane_position"></property>
|
||||
<property name="pane_size"></property>
|
||||
<property name="permission">protected</property>
|
||||
<property name="pin_button">1</property>
|
||||
<property name="pos"></property>
|
||||
<property name="resize">Resizable</property>
|
||||
<property name="show">1</property>
|
||||
<property name="size"></property>
|
||||
<property name="style"></property>
|
||||
<property name="subclass">; forward_declare</property>
|
||||
<property name="toolbar_pane">0</property>
|
||||
<property name="tooltip"></property>
|
||||
<property name="validator_data_type"></property>
|
||||
<property name="validator_style">wxFILTER_NONE</property>
|
||||
<property name="validator_type">wxDefaultValidator</property>
|
||||
<property name="validator_variable"></property>
|
||||
<property name="window_extra_style"></property>
|
||||
<property name="window_name"></property>
|
||||
<property name="window_style"></property>
|
||||
<event name="OnButtonClick">OnExport</event>
|
||||
<event name="OnChar"></event>
|
||||
<event name="OnEnterWindow"></event>
|
||||
<event name="OnEraseBackground"></event>
|
||||
<event name="OnKeyDown"></event>
|
||||
<event name="OnKeyUp"></event>
|
||||
<event name="OnKillFocus"></event>
|
||||
<event name="OnLeaveWindow"></event>
|
||||
<event name="OnLeftDClick"></event>
|
||||
<event name="OnLeftDown"></event>
|
||||
<event name="OnLeftUp"></event>
|
||||
<event name="OnMiddleDClick"></event>
|
||||
<event name="OnMiddleDown"></event>
|
||||
<event name="OnMiddleUp"></event>
|
||||
<event name="OnMotion"></event>
|
||||
<event name="OnMouseEvents"></event>
|
||||
<event name="OnMouseWheel"></event>
|
||||
<event name="OnPaint"></event>
|
||||
<event name="OnRightDClick"></event>
|
||||
<event name="OnRightDown"></event>
|
||||
<event name="OnRightUp"></event>
|
||||
<event name="OnSetFocus"></event>
|
||||
<event name="OnSize"></event>
|
||||
<event name="OnUpdateUI"></event>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
</wxFormBuilder_Project>
|
|
@ -1,58 +0,0 @@
|
|||
///////////////////////////////////////////////////////////////////////////
|
||||
// C++ code generated with wxFormBuilder (version Jun 18 2018)
|
||||
// http://www.wxformbuilder.org/
|
||||
//
|
||||
// PLEASE DO *NOT* EDIT THIS FILE!
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef __PANEL_HOTKEYS_EDITOR_BASE_H__
|
||||
#define __PANEL_HOTKEYS_EDITOR_BASE_H__
|
||||
|
||||
#include <wx/artprov.h>
|
||||
#include <wx/xrc/xmlres.h>
|
||||
#include <wx/intl.h>
|
||||
#include <wx/string.h>
|
||||
#include <wx/srchctrl.h>
|
||||
#include <wx/gdicmn.h>
|
||||
#include <wx/font.h>
|
||||
#include <wx/colour.h>
|
||||
#include <wx/settings.h>
|
||||
#include <wx/panel.h>
|
||||
#include <wx/button.h>
|
||||
#include <wx/sizer.h>
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
/// Class PANEL_HOTKEYS_EDITOR_BASE
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
class PANEL_HOTKEYS_EDITOR_BASE : public wxPanel
|
||||
{
|
||||
private:
|
||||
|
||||
protected:
|
||||
wxBoxSizer* m_mainSizer;
|
||||
wxSearchCtrl* m_filterSearch;
|
||||
wxPanel* m_panelHotkeys;
|
||||
wxButton* m_resetButton;
|
||||
wxButton* m_defaultButton;
|
||||
wxButton* btnImport;
|
||||
wxButton* btnExport;
|
||||
|
||||
// Virtual event handlers, overide them in your derived class
|
||||
virtual void OnFilterSearch( wxCommandEvent& event ) { event.Skip(); }
|
||||
virtual void ResetClicked( wxCommandEvent& event ) { event.Skip(); }
|
||||
virtual void DefaultsClicked( wxCommandEvent& event ) { event.Skip(); }
|
||||
virtual void OnImport( wxCommandEvent& event ) { event.Skip(); }
|
||||
virtual void OnExport( wxCommandEvent& event ) { event.Skip(); }
|
||||
|
||||
|
||||
public:
|
||||
|
||||
PANEL_HOTKEYS_EDITOR_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 500,300 ), long style = wxTAB_TRAVERSAL );
|
||||
~PANEL_HOTKEYS_EDITOR_BASE();
|
||||
|
||||
};
|
||||
|
||||
#endif //__PANEL_HOTKEYS_EDITOR_BASE_H__
|
|
@ -0,0 +1,75 @@
|
|||
/*
|
||||
* This program source code file is part of KICAD, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 1992-2018 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
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, you may find one here:
|
||||
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||
* or you may search the http://www.gnu.org website for the version 2 license,
|
||||
* or you may write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#include <widgets/button_row_panel.h>
|
||||
|
||||
#include <wx/button.h>
|
||||
#include <wx/sizer.h>
|
||||
|
||||
|
||||
BUTTON_ROW_PANEL::BUTTON_ROW_PANEL( wxWindow* aWindow,
|
||||
const BTN_DEF_LIST& aLeftBtns,
|
||||
const BTN_DEF_LIST& aRightBtns ):
|
||||
wxPanel( aWindow, wxID_ANY )
|
||||
{
|
||||
m_sizer = new wxBoxSizer( wxHORIZONTAL );
|
||||
|
||||
addButtons( true, aLeftBtns );
|
||||
|
||||
// add the spacer
|
||||
m_sizer->Add( 0, 0, 1, wxEXPAND, 5 );
|
||||
|
||||
addButtons( false, aRightBtns );
|
||||
|
||||
this->SetSizer( m_sizer );
|
||||
this->Layout();
|
||||
}
|
||||
|
||||
|
||||
void BUTTON_ROW_PANEL::addButtons( bool aLeft, const BTN_DEF_LIST& aDefs )
|
||||
{
|
||||
// The "normal" KiCad margin magic number
|
||||
// TODO: Get this from somewhere
|
||||
const int btn_margin = 5;
|
||||
// No button expands to fill horizontally
|
||||
const int btn_proportion = 0;
|
||||
|
||||
for( size_t i = 0; i < aDefs.size(); ++i )
|
||||
{
|
||||
const auto& def = aDefs[i];
|
||||
wxButton* btn = new wxButton( this, def.m_id, def.m_text );
|
||||
|
||||
// Buttons expand to fill the size vertically
|
||||
long this_style = wxEXPAND;
|
||||
|
||||
if( ( aLeft && i > 0 ) || ( !aLeft ) )
|
||||
this_style |= wxLEFT;
|
||||
|
||||
if( ( aLeft ) || ( !aLeft && i < aDefs.size() - 1 ) )
|
||||
this_style |= wxRIGHT;
|
||||
|
||||
m_sizer->Add( btn, btn_proportion, this_style, btn_margin );
|
||||
|
||||
btn->Bind( wxEVT_COMMAND_BUTTON_CLICKED, def.m_callback );
|
||||
}
|
||||
}
|
|
@ -51,9 +51,6 @@ enum ID_WHKL_MENU_IDS
|
|||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Class WIDGET_HOTKEY_CLIENT_DATA
|
||||
* Stores the hotkey change data associated with each row. To change a
|
||||
|
@ -524,15 +521,6 @@ WIDGET_HOTKEY_LIST::WIDGET_HOTKEY_LIST( wxWindow* aParent, HOTKEY_STORE& aHotkey
|
|||
}
|
||||
|
||||
|
||||
void WIDGET_HOTKEY_LIST::InstallOnPanel( wxPanel* aPanel )
|
||||
{
|
||||
wxBoxSizer* sizer = new wxBoxSizer( wxVERTICAL );
|
||||
|
||||
sizer->Add( this, 1, wxALL | wxEXPAND, 0 );
|
||||
aPanel->SetSizer( sizer );
|
||||
}
|
||||
|
||||
|
||||
void WIDGET_HOTKEY_LIST::ApplyFilterString( const wxString& aFilterStr )
|
||||
{
|
||||
updateShownItems( aFilterStr );
|
||||
|
|
|
@ -27,11 +27,16 @@
|
|||
#include <hotkeys_basic.h>
|
||||
#include <hotkey_store.h>
|
||||
|
||||
#include "../common/dialogs/panel_hotkeys_editor_base.h"
|
||||
#include <widgets/widget_hotkey_list.h>
|
||||
|
||||
#include "wx/panel.h"
|
||||
|
||||
class PANEL_HOTKEYS_EDITOR : public PANEL_HOTKEYS_EDITOR_BASE
|
||||
|
||||
class wxPanel;
|
||||
class wxSizer;
|
||||
|
||||
|
||||
class PANEL_HOTKEYS_EDITOR : public wxPanel
|
||||
{
|
||||
protected:
|
||||
EDA_BASE_FRAME* m_frame;
|
||||
|
@ -50,28 +55,13 @@ public:
|
|||
EDA_HOTKEY_CONFIG* aHotkeys, EDA_HOTKEY_CONFIG* aShowHotkeys,
|
||||
const wxString& aNickname );
|
||||
|
||||
~PANEL_HOTKEYS_EDITOR() {};
|
||||
|
||||
private:
|
||||
|
||||
/**
|
||||
* Function ResetClicked
|
||||
* Reinit the hotkeys to the initial state (removes all pending changes)
|
||||
*
|
||||
* @param aEvent is the button press event, unused
|
||||
* Install the button panel (global reset/default, import/export)
|
||||
* @param aSizer the dialog to install on
|
||||
*/
|
||||
void ResetClicked( wxCommandEvent& aEvent ) override;
|
||||
|
||||
/**
|
||||
* Function DefaultsClicked
|
||||
* Set the hotkeys to the default values (values after installation)
|
||||
*
|
||||
* @param aEvent is the button press event, unused
|
||||
*/
|
||||
void DefaultsClicked( wxCommandEvent& aEvent ) override;
|
||||
|
||||
void OnExport( wxCommandEvent& aEvent ) override;
|
||||
void OnImport( wxCommandEvent& aEvent ) override;
|
||||
void installButtons( wxSizer* aSizer );
|
||||
|
||||
/**
|
||||
* Function OnFilterSearch
|
||||
|
@ -79,7 +69,7 @@ private:
|
|||
*
|
||||
* @param aEvent: the search event, used to get the search query
|
||||
*/
|
||||
void OnFilterSearch( wxCommandEvent& aEvent ) override;
|
||||
void OnFilterSearch( wxCommandEvent& aEvent );
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -0,0 +1,102 @@
|
|||
/*
|
||||
* This program source code file is part of KICAD, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 1992-2018 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
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, you may find one here:
|
||||
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||
* or you may search the http://www.gnu.org website for the version 2 license,
|
||||
* or you may write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#ifndef SIMPLE_BUTTON_PANEL_H
|
||||
#define SIMPLE_BUTTON_PANEL_H
|
||||
|
||||
#include "wx/panel.h"
|
||||
|
||||
#include <vector>
|
||||
#include <functional>
|
||||
|
||||
|
||||
// Forward defs for private-only classes
|
||||
class wxBoxSizer;
|
||||
|
||||
|
||||
/**
|
||||
* A panel that contains buttons, arranged on the left and/or right sides.
|
||||
*/
|
||||
class BUTTON_ROW_PANEL: public wxPanel
|
||||
{
|
||||
public:
|
||||
|
||||
/**
|
||||
* Callback function definition. A callback of this type can be registered
|
||||
* to handle the button click event.
|
||||
*/
|
||||
using BTN_CALLBACK = std::function< void( wxCommandEvent& ) >;
|
||||
|
||||
/**
|
||||
* The information needed to instantiate a button on a BUTTON_ROW_PANEL.
|
||||
*/
|
||||
struct BTN_DEF
|
||||
{
|
||||
/**
|
||||
* The button ID. Can be wxID_ANY, but should be unique if you
|
||||
* want to work out which button this was from an event handler.
|
||||
*/
|
||||
wxWindowID m_id;
|
||||
|
||||
/**
|
||||
* The button display text.
|
||||
*/
|
||||
wxString m_text;
|
||||
|
||||
/**
|
||||
* The callback fired when the button is clicked. Can be nullptr,
|
||||
* but then the button is useless.
|
||||
*/
|
||||
BTN_CALLBACK m_callback;
|
||||
};
|
||||
|
||||
/**
|
||||
* A list of BTN_DEFs, used to group buttons into the left/right groups.
|
||||
*/
|
||||
using BTN_DEF_LIST = std::vector<BTN_DEF>;
|
||||
|
||||
/**
|
||||
* Construct a SIMPLE_BUTTON_PANEL with a set of buttons on each side.
|
||||
*
|
||||
* @param aLeftBtns: buttons on the left side, from left to right
|
||||
* @param aRightBtns: buttons on the right side, from left to right
|
||||
*/
|
||||
BUTTON_ROW_PANEL( wxWindow* aWindow,
|
||||
const BTN_DEF_LIST& aLeftBtns,
|
||||
const BTN_DEF_LIST& aRightBtns );
|
||||
|
||||
private:
|
||||
|
||||
/**
|
||||
* Add a set of buttons to one side of the panel.
|
||||
*
|
||||
* @param aSizer the sizer to add them to
|
||||
* @param aLeft place on the left (false for right)
|
||||
* @param aDefs list of button defs, from left to right
|
||||
*/
|
||||
void addButtons( bool aLeft, const BTN_DEF_LIST& aDefs );
|
||||
|
||||
wxBoxSizer* m_sizer;
|
||||
};
|
||||
|
||||
#endif // SIMPLE_BUTTON_PANEL_H
|
|
@ -166,14 +166,6 @@ public:
|
|||
*/
|
||||
WIDGET_HOTKEY_LIST( wxWindow* aParent, HOTKEY_STORE& aHotkeyStore );
|
||||
|
||||
/**
|
||||
* Method InstallOnPanel
|
||||
* Install this WIDGET_HOTKEY_LIST onto an empty panel. This is useful
|
||||
* when combining with wxFormBuilder, as an empty panel can be left as a
|
||||
* placeholder in the layout.
|
||||
*/
|
||||
void InstallOnPanel( wxPanel* aPanel );
|
||||
|
||||
/**
|
||||
* Method ApplyFilterString
|
||||
* Apply a filter string to the hotkey list, selecting which hotkeys
|
||||
|
|
Loading…
Reference in New Issue