Unify settings reset buttons into one location
This commit is contained in:
parent
b428364a98
commit
af729d578f
|
@ -61,7 +61,7 @@ void PANEL_COLOR_SETTINGS::OnBtnOpenThemeFolderClicked( wxCommandEvent& event )
|
|||
}
|
||||
|
||||
|
||||
void PANEL_COLOR_SETTINGS::OnBtnResetClicked( wxCommandEvent& event )
|
||||
void PANEL_COLOR_SETTINGS::ResetPanel()
|
||||
{
|
||||
if( !m_currentSettings )
|
||||
return;
|
||||
|
|
|
@ -43,11 +43,16 @@ public:
|
|||
ID_REVERT
|
||||
};
|
||||
|
||||
virtual void ResetPanel() override;
|
||||
|
||||
virtual wxString GetResetTooltip() override
|
||||
{
|
||||
return _( "Reset all colors in this theme to the KiCad defaults" );
|
||||
}
|
||||
|
||||
protected:
|
||||
void OnBtnOpenThemeFolderClicked( wxCommandEvent& event ) override;
|
||||
|
||||
void OnBtnResetClicked( wxCommandEvent& aEvent ) override;
|
||||
|
||||
void OnLeftDownTheme( wxMouseEvent& event ) override;
|
||||
void OnThemeChanged( wxCommandEvent& aEvent ) override;
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
PANEL_COLOR_SETTINGS_BASE::PANEL_COLOR_SETTINGS_BASE( wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style, const wxString& name ) : wxPanel( parent, id, pos, size, style, name )
|
||||
PANEL_COLOR_SETTINGS_BASE::PANEL_COLOR_SETTINGS_BASE( wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style, const wxString& name ) : RESETTABLE_PANEL( parent, id, pos, size, style, name )
|
||||
{
|
||||
m_mainSizer = new wxBoxSizer( wxVERTICAL );
|
||||
|
||||
|
@ -39,11 +39,6 @@ PANEL_COLOR_SETTINGS_BASE::PANEL_COLOR_SETTINGS_BASE( wxWindow* parent, wxWindow
|
|||
|
||||
bControlSizer->Add( 0, 0, 1, wxEXPAND, 5 );
|
||||
|
||||
m_btnReset = new wxButton( this, wxID_ANY, _("&Reset to Defaults"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_btnReset->SetToolTip( _("Reset all colors in this theme to the KiCad defaults") );
|
||||
|
||||
bControlSizer->Add( m_btnReset, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 );
|
||||
|
||||
m_btnOpenFolder = new wxButton( this, wxID_ANY, _("Open Theme Folder"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_btnOpenFolder->SetToolTip( _("Open the folder containing color themes") );
|
||||
|
||||
|
@ -92,7 +87,6 @@ PANEL_COLOR_SETTINGS_BASE::PANEL_COLOR_SETTINGS_BASE( wxWindow* parent, wxWindow
|
|||
m_cbTheme->Connect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( PANEL_COLOR_SETTINGS_BASE::OnThemeChanged ), NULL, this );
|
||||
m_cbTheme->Connect( wxEVT_LEFT_DOWN, wxMouseEventHandler( PANEL_COLOR_SETTINGS_BASE::OnLeftDownTheme ), NULL, this );
|
||||
m_optOverrideColors->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( PANEL_COLOR_SETTINGS_BASE::OnOverrideItemColorsClicked ), NULL, this );
|
||||
m_btnReset->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_COLOR_SETTINGS_BASE::OnBtnResetClicked ), NULL, this );
|
||||
m_btnOpenFolder->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_COLOR_SETTINGS_BASE::OnBtnOpenThemeFolderClicked ), NULL, this );
|
||||
}
|
||||
|
||||
|
@ -103,7 +97,6 @@ PANEL_COLOR_SETTINGS_BASE::~PANEL_COLOR_SETTINGS_BASE()
|
|||
m_cbTheme->Disconnect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( PANEL_COLOR_SETTINGS_BASE::OnThemeChanged ), NULL, this );
|
||||
m_cbTheme->Disconnect( wxEVT_LEFT_DOWN, wxMouseEventHandler( PANEL_COLOR_SETTINGS_BASE::OnLeftDownTheme ), NULL, this );
|
||||
m_optOverrideColors->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( PANEL_COLOR_SETTINGS_BASE::OnOverrideItemColorsClicked ), NULL, this );
|
||||
m_btnReset->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_COLOR_SETTINGS_BASE::OnBtnResetClicked ), NULL, this );
|
||||
m_btnOpenFolder->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_COLOR_SETTINGS_BASE::OnBtnOpenThemeFolderClicked ), NULL, this );
|
||||
|
||||
}
|
||||
|
|
|
@ -44,7 +44,7 @@
|
|||
<property name="name">PANEL_COLOR_SETTINGS_BASE</property>
|
||||
<property name="pos"></property>
|
||||
<property name="size">826,300</property>
|
||||
<property name="subclass">; ; forward_declare</property>
|
||||
<property name="subclass">RESETTABLE_PANEL; widgets/resettable_panel.h; Not forward_declare</property>
|
||||
<property name="tooltip"></property>
|
||||
<property name="window_extra_style"></property>
|
||||
<property name="window_name"></property>
|
||||
|
@ -276,79 +276,6 @@
|
|||
<property name="width">0</property>
|
||||
</object>
|
||||
</object>
|
||||
<object class="sizeritem" expanded="1">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxALIGN_CENTER_VERTICAL|wxALL</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="bitmap"></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="current"></property>
|
||||
<property name="default">0</property>
|
||||
<property name="default_pane">0</property>
|
||||
<property name="disabled"></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="focus"></property>
|
||||
<property name="font"></property>
|
||||
<property name="gripper">0</property>
|
||||
<property name="hidden">0</property>
|
||||
<property name="id">wxID_ANY</property>
|
||||
<property name="label">&Reset to Defaults</property>
|
||||
<property name="margins"></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_btnReset</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="position"></property>
|
||||
<property name="pressed"></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">Reset all colors in this theme to the KiCad defaults</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">OnBtnResetClicked</event>
|
||||
</object>
|
||||
</object>
|
||||
<object class="sizeritem" expanded="1">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxALIGN_CENTER_VERTICAL|wxALL</property>
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
#include <wx/artprov.h>
|
||||
#include <wx/xrc/xmlres.h>
|
||||
#include <wx/intl.h>
|
||||
#include "widgets/resettable_panel.h"
|
||||
#include <wx/string.h>
|
||||
#include <wx/stattext.h>
|
||||
#include <wx/gdicmn.h>
|
||||
|
@ -32,7 +33,7 @@
|
|||
///////////////////////////////////////////////////////////////////////////////
|
||||
/// Class PANEL_COLOR_SETTINGS_BASE
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
class PANEL_COLOR_SETTINGS_BASE : public wxPanel
|
||||
class PANEL_COLOR_SETTINGS_BASE : public RESETTABLE_PANEL
|
||||
{
|
||||
private:
|
||||
|
||||
|
@ -40,7 +41,6 @@ class PANEL_COLOR_SETTINGS_BASE : public wxPanel
|
|||
wxBoxSizer* m_mainSizer;
|
||||
wxStaticText* m_staticText9;
|
||||
wxChoice* m_cbTheme;
|
||||
wxButton* m_btnReset;
|
||||
wxButton* m_btnOpenFolder;
|
||||
wxStaticLine* m_staticline2;
|
||||
wxBoxSizer* m_colorsMainSizer;
|
||||
|
@ -52,7 +52,6 @@ class PANEL_COLOR_SETTINGS_BASE : public wxPanel
|
|||
virtual void OnThemeChanged( wxCommandEvent& event ) { event.Skip(); }
|
||||
virtual void OnLeftDownTheme( wxMouseEvent& event ) { event.Skip(); }
|
||||
virtual void OnOverrideItemColorsClicked( wxCommandEvent& event ) { event.Skip(); }
|
||||
virtual void OnBtnResetClicked( wxCommandEvent& event ) { event.Skip(); }
|
||||
virtual void OnBtnOpenThemeFolderClicked( wxCommandEvent& event ) { event.Skip(); }
|
||||
|
||||
|
||||
|
|
|
@ -58,7 +58,7 @@ static wxSearchCtrl* CreateTextFilterBox( wxWindow* aParent, const wxString& aDe
|
|||
|
||||
PANEL_HOTKEYS_EDITOR::PANEL_HOTKEYS_EDITOR( EDA_BASE_FRAME* aFrame, wxWindow* aWindow,
|
||||
bool aReadOnly ) :
|
||||
wxPanel( aWindow, wxID_ANY, wxDefaultPosition, default_dialog_size ),
|
||||
RESETTABLE_PANEL( aWindow, wxID_ANY, wxDefaultPosition, default_dialog_size ),
|
||||
m_frame( aFrame ),
|
||||
m_readOnly( aReadOnly ),
|
||||
m_hotkeyStore()
|
||||
|
@ -102,6 +102,12 @@ void PANEL_HOTKEYS_EDITOR::AddHotKeys( TOOL_MANAGER* aToolMgr )
|
|||
}
|
||||
|
||||
|
||||
void PANEL_HOTKEYS_EDITOR::ResetPanel()
|
||||
{
|
||||
m_hotkeyListCtrl->ResetAllHotkeys( true );
|
||||
}
|
||||
|
||||
|
||||
void PANEL_HOTKEYS_EDITOR::installButtons( wxSizer* aSizer )
|
||||
{
|
||||
const BUTTON_ROW_PANEL::BTN_DEF_LIST l_btn_defs = {
|
||||
|
@ -113,14 +119,6 @@ void PANEL_HOTKEYS_EDITOR::installButtons( wxSizer* aSizer )
|
|||
m_hotkeyListCtrl->ResetAllHotkeys( false );
|
||||
}
|
||||
},
|
||||
{
|
||||
wxID_ANY,
|
||||
_( "Restore All to Defaults" ),
|
||||
_( "Set all hotkeys to the built-in KiCad defaults" ),
|
||||
[this]( wxCommandEvent& ){
|
||||
m_hotkeyListCtrl->ResetAllHotkeys( true );
|
||||
}
|
||||
},
|
||||
{
|
||||
wxID_ANY,
|
||||
_( "Import Hotkeys..." ),
|
||||
|
|
|
@ -665,7 +665,7 @@ void EDA_BASE_FRAME::OnKicadAbout( wxCommandEvent& event )
|
|||
|
||||
void EDA_BASE_FRAME::OnPreferences( wxCommandEvent& event )
|
||||
{
|
||||
PAGED_DIALOG dlg( this, _( "Preferences" ) );
|
||||
PAGED_DIALOG dlg( this, _( "Preferences" ), true );
|
||||
wxTreebook* book = dlg.GetTreebook();
|
||||
|
||||
book->AddPage( new PANEL_COMMON_SETTINGS( &dlg, book ), _( "Common" ) );
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
*/
|
||||
|
||||
#include <confirm.h>
|
||||
#include <widgets/resettable_panel.h>
|
||||
#include <wx/treebook.h>
|
||||
#include <wx/treectrl.h>
|
||||
#include <wx/grid.h>
|
||||
|
@ -34,7 +35,7 @@ std::map<wxString, wxString> g_lastPage;
|
|||
std::map<wxString, wxString> g_lastParentPage;
|
||||
|
||||
|
||||
PAGED_DIALOG::PAGED_DIALOG( wxWindow* aParent, const wxString& aTitle,
|
||||
PAGED_DIALOG::PAGED_DIALOG( wxWindow* aParent, const wxString& aTitle, bool aUseReset,
|
||||
const wxString& aAuxiliaryAction ) :
|
||||
DIALOG_SHIM( aParent, wxID_ANY, aTitle, wxDefaultPosition, wxDefaultSize,
|
||||
wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER ),
|
||||
|
@ -55,20 +56,28 @@ PAGED_DIALOG::PAGED_DIALOG( wxWindow* aParent, const wxString& aTitle,
|
|||
|
||||
auto buttonsSizer = new wxBoxSizer( wxHORIZONTAL );
|
||||
|
||||
if( aUseReset )
|
||||
{
|
||||
m_resetButton = new wxButton( this, wxID_ANY, _( "Reset to Defaults" ) );
|
||||
buttonsSizer->Add( m_resetButton, 0, wxRIGHT | wxLEFT, 5 );
|
||||
}
|
||||
|
||||
if( !aAuxiliaryAction.IsEmpty() )
|
||||
{
|
||||
m_auxiliaryButton = new wxButton( this, wxID_ANY, aAuxiliaryAction );
|
||||
buttonsSizer->Add( m_auxiliaryButton, 0, wxEXPAND|wxRIGHT|wxLEFT, 10 );
|
||||
}
|
||||
|
||||
buttonsSizer->AddStretchSpacer();
|
||||
|
||||
auto sdbSizer = new wxStdDialogButtonSizer();
|
||||
auto sdbSizerOK = new wxButton( this, wxID_OK );
|
||||
wxButton* sdbSizerOK = new wxButton( this, wxID_OK );
|
||||
sdbSizer->AddButton( sdbSizerOK );
|
||||
auto sdbSizerCancel = new wxButton( this, wxID_CANCEL );
|
||||
wxButton* sdbSizerCancel = new wxButton( this, wxID_CANCEL );
|
||||
sdbSizer->AddButton( sdbSizerCancel );
|
||||
sdbSizer->Realize();
|
||||
|
||||
buttonsSizer->Add( sdbSizer, 1, wxEXPAND, 5 );
|
||||
buttonsSizer->Add( sdbSizer, 1, 0, 5 );
|
||||
mainSizer->Add( buttonsSizer, 0, wxALL|wxEXPAND, 5 );
|
||||
|
||||
sdbSizerOK->SetDefault();
|
||||
|
@ -81,6 +90,9 @@ PAGED_DIALOG::PAGED_DIALOG( wxWindow* aParent, const wxString& aTitle,
|
|||
if( m_auxiliaryButton )
|
||||
m_auxiliaryButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PAGED_DIALOG::OnAuxiliaryAction ), nullptr, this );
|
||||
|
||||
if( m_resetButton )
|
||||
m_resetButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PAGED_DIALOG::OnResetButton ), nullptr, this );
|
||||
|
||||
m_treebook->Connect( wxEVT_TREEBOOK_PAGE_CHANGED, wxBookCtrlEventHandler( PAGED_DIALOG::OnPageChange ), NULL, this );
|
||||
Connect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( PAGED_DIALOG::OnUpdateUI ), nullptr, this );
|
||||
}
|
||||
|
@ -141,8 +153,10 @@ PAGED_DIALOG::~PAGED_DIALOG()
|
|||
if( m_auxiliaryButton )
|
||||
m_auxiliaryButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PAGED_DIALOG::OnAuxiliaryAction ), nullptr, this );
|
||||
|
||||
m_treebook->Disconnect( wxEVT_TREEBOOK_PAGE_CHANGED, wxBookCtrlEventHandler( PAGED_DIALOG::OnPageChange ), NULL, this );
|
||||
if( m_resetButton )
|
||||
m_resetButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PAGED_DIALOG::OnResetButton ), nullptr, this );
|
||||
|
||||
m_treebook->Disconnect( wxEVT_TREEBOOK_PAGE_CHANGED, wxBookCtrlEventHandler( PAGED_DIALOG::OnPageChange ), NULL, this );
|
||||
Disconnect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( PAGED_DIALOG::OnUpdateUI ), nullptr, this );
|
||||
}
|
||||
|
||||
|
@ -299,11 +313,27 @@ void PAGED_DIALOG::OnUpdateUI( wxUpdateUIEvent& event )
|
|||
|
||||
void PAGED_DIALOG::OnPageChange( wxBookCtrlEvent& event )
|
||||
{
|
||||
#ifdef __WXMAC__
|
||||
// Work around an OSX bug where the wxGrid children don't get placed correctly until
|
||||
// the first resize event
|
||||
int page = event.GetSelection();
|
||||
|
||||
// Enable the reset button only if the page is resettable
|
||||
if( m_resetButton )
|
||||
{
|
||||
if( auto panel = dynamic_cast<RESETTABLE_PANEL*>( m_treebook->GetPage( page ) ) )
|
||||
{
|
||||
m_resetButton->SetToolTip( panel->GetResetTooltip() );
|
||||
m_resetButton->Enable( true );
|
||||
}
|
||||
else
|
||||
{
|
||||
m_resetButton->SetToolTip( wxString() );
|
||||
m_resetButton->Enable( false );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Work around an OSX bug where the wxGrid children don't get placed correctly until
|
||||
// the first resize event
|
||||
#ifdef __WXMAC__
|
||||
if( page + 1 <= m_macHack.size() && m_macHack[ page ] )
|
||||
{
|
||||
wxSize pageSize = m_treebook->GetPage( page )->GetSize();
|
||||
|
@ -314,6 +344,20 @@ void PAGED_DIALOG::OnPageChange( wxBookCtrlEvent& event )
|
|||
m_macHack[ page ] = false;
|
||||
}
|
||||
#endif
|
||||
|
||||
Layout();
|
||||
}
|
||||
|
||||
|
||||
void PAGED_DIALOG::OnResetButton( wxCommandEvent& aEvent )
|
||||
{
|
||||
int sel = m_treebook->GetSelection();
|
||||
|
||||
if( sel == wxNOT_FOUND )
|
||||
return;
|
||||
|
||||
RESETTABLE_PANEL* panel = dynamic_cast<RESETTABLE_PANEL*>( m_treebook->GetPage( sel ) );
|
||||
|
||||
if( panel )
|
||||
panel->ResetPanel();
|
||||
}
|
||||
|
|
|
@ -36,7 +36,7 @@
|
|||
|
||||
|
||||
DIALOG_SCHEMATIC_SETUP::DIALOG_SCHEMATIC_SETUP( SCH_EDIT_FRAME* aFrame ) :
|
||||
PAGED_DIALOG( aFrame, _( "Schematic Setup" ),
|
||||
PAGED_DIALOG( aFrame, _( "Schematic Setup" ), true,
|
||||
_( "Import Settings from Another Project..." ) ),
|
||||
m_frame( aFrame ),
|
||||
m_severities( nullptr )
|
||||
|
@ -96,11 +96,26 @@ DIALOG_SCHEMATIC_SETUP::~DIALOG_SCHEMATIC_SETUP()
|
|||
|
||||
void DIALOG_SCHEMATIC_SETUP::OnPageChange( wxBookCtrlEvent& event )
|
||||
{
|
||||
#ifdef __WXMAC__
|
||||
// Work around an OSX bug where the wxGrid children don't get placed correctly until
|
||||
// the first resize event
|
||||
int page = event.GetSelection();
|
||||
|
||||
// Enable the reset button only if the page is resettable
|
||||
if( m_resetButton )
|
||||
{
|
||||
if( auto panel = dynamic_cast<RESETTABLE_PANEL*>( m_treebook->GetPage( page ) ) )
|
||||
{
|
||||
m_resetButton->SetToolTip( panel->GetResetTooltip() );
|
||||
m_resetButton->Enable( true );
|
||||
}
|
||||
else
|
||||
{
|
||||
m_resetButton->SetToolTip( wxString() );
|
||||
m_resetButton->Enable( false );
|
||||
}
|
||||
}
|
||||
|
||||
// Work around an OSX bug where the wxGrid children don't get placed correctly until
|
||||
// the first resize event
|
||||
#ifdef __WXMAC__
|
||||
if( m_macHack[ page ] )
|
||||
{
|
||||
wxSize pageSize = m_treebook->GetPage( page )->GetSize();
|
||||
|
@ -111,6 +126,8 @@ void DIALOG_SCHEMATIC_SETUP::OnPageChange( wxBookCtrlEvent& event )
|
|||
m_macHack[ page ] = false;
|
||||
}
|
||||
#endif
|
||||
|
||||
Layout();
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -345,9 +345,9 @@ void PANEL_EESCHEMA_COLOR_SETTINGS::onColorChanged()
|
|||
}
|
||||
|
||||
|
||||
void PANEL_EESCHEMA_COLOR_SETTINGS::OnBtnResetClicked( wxCommandEvent& event )
|
||||
void PANEL_EESCHEMA_COLOR_SETTINGS::ResetPanel()
|
||||
{
|
||||
PANEL_COLOR_SETTINGS::OnBtnResetClicked( event );
|
||||
PANEL_COLOR_SETTINGS::ResetPanel();
|
||||
updatePreview();
|
||||
}
|
||||
|
||||
|
|
|
@ -44,6 +44,8 @@ public:
|
|||
|
||||
~PANEL_EESCHEMA_COLOR_SETTINGS() override;
|
||||
|
||||
void ResetPanel() override;
|
||||
|
||||
protected:
|
||||
bool TransferDataFromWindow() override;
|
||||
|
||||
|
@ -53,8 +55,6 @@ protected:
|
|||
|
||||
void OnSize( wxSizeEvent& aEvent ) override;
|
||||
|
||||
void OnBtnResetClicked( wxCommandEvent& event ) override;
|
||||
|
||||
bool validateSave( bool aQuiet = false ) override;
|
||||
|
||||
bool saveCurrentTheme( bool aValidate ) override;
|
||||
|
|
|
@ -66,7 +66,7 @@ PANEL_SETUP_PINMAP::PANEL_SETUP_PINMAP( wxWindow* aWindow, SCH_EDIT_FRAME* paren
|
|||
}
|
||||
|
||||
|
||||
void PANEL_SETUP_PINMAP::OnResetMatrixClick( wxCommandEvent& aEvent )
|
||||
void PANEL_SETUP_PINMAP::ResetPanel()
|
||||
{
|
||||
m_schematic->ErcSettings().ResetPinMap();
|
||||
reBuildMatrixPanel();
|
||||
|
|
|
@ -51,9 +51,9 @@ public:
|
|||
bool Show( bool show ) override;
|
||||
void ImportSettingsFrom( PIN_ERROR aPinMap[][ELECTRICAL_PINTYPES_TOTAL] );
|
||||
|
||||
private:
|
||||
void OnResetMatrixClick( wxCommandEvent& aEvent ) override;
|
||||
void ResetPanel() override;
|
||||
|
||||
private:
|
||||
void changeErrorLevel( wxCommandEvent& event );
|
||||
void reBuildMatrixPanel();
|
||||
void setDRCMatrixButtonState( wxBitmapButton *aButton, PIN_ERROR aState );
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
PANEL_SETUP_PINMAP_BASE::PANEL_SETUP_PINMAP_BASE( wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style, const wxString& name ) : wxPanel( parent, id, pos, size, style, name )
|
||||
PANEL_SETUP_PINMAP_BASE::PANEL_SETUP_PINMAP_BASE( wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style, const wxString& name ) : RESETTABLE_PANEL( parent, id, pos, size, style, name )
|
||||
{
|
||||
wxBoxSizer* bSizer2;
|
||||
bSizer2 = new wxBoxSizer( wxHORIZONTAL );
|
||||
|
@ -26,13 +26,7 @@ PANEL_SETUP_PINMAP_BASE::PANEL_SETUP_PINMAP_BASE( wxWindow* parent, wxWindowID i
|
|||
sbSizer3->Add( m_matrixPanel, 1, wxEXPAND | wxALL, 5 );
|
||||
|
||||
|
||||
m_panelMatrixSizer->Add( sbSizer3, 1, wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 10 );
|
||||
|
||||
|
||||
m_panelMatrixSizer->Add( 0, 0, 0, wxEXPAND|wxTOP, 5 );
|
||||
|
||||
m_ResetOptButton = new wxButton( this, ID_RESET_MATRIX, _("Reset to Defaults"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_panelMatrixSizer->Add( m_ResetOptButton, 0, wxRIGHT|wxLEFT, 10 );
|
||||
m_panelMatrixSizer->Add( sbSizer3, 1, wxALL|wxEXPAND, 10 );
|
||||
|
||||
|
||||
bSizer2->Add( m_panelMatrixSizer, 1, wxEXPAND|wxLEFT, 10 );
|
||||
|
@ -41,14 +35,8 @@ PANEL_SETUP_PINMAP_BASE::PANEL_SETUP_PINMAP_BASE( wxWindow* parent, wxWindowID i
|
|||
this->SetSizer( bSizer2 );
|
||||
this->Layout();
|
||||
bSizer2->Fit( this );
|
||||
|
||||
// Connect Events
|
||||
m_ResetOptButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_SETUP_PINMAP_BASE::OnResetMatrixClick ), NULL, this );
|
||||
}
|
||||
|
||||
PANEL_SETUP_PINMAP_BASE::~PANEL_SETUP_PINMAP_BASE()
|
||||
{
|
||||
// Disconnect Events
|
||||
m_ResetOptButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_SETUP_PINMAP_BASE::OnResetMatrixClick ), NULL, this );
|
||||
|
||||
}
|
||||
|
|
|
@ -44,7 +44,7 @@
|
|||
<property name="name">PANEL_SETUP_PINMAP_BASE</property>
|
||||
<property name="pos"></property>
|
||||
<property name="size">-1,-1</property>
|
||||
<property name="subclass">; forward_declare</property>
|
||||
<property name="subclass">RESETTABLE_PANEL; widgets/resettable_panel.h; Not forward_declare</property>
|
||||
<property name="tooltip"></property>
|
||||
<property name="window_extra_style"></property>
|
||||
<property name="window_name"></property>
|
||||
|
@ -65,7 +65,7 @@
|
|||
<property name="permission">none</property>
|
||||
<object class="sizeritem" expanded="1">
|
||||
<property name="border">10</property>
|
||||
<property name="flag">wxEXPAND|wxTOP|wxRIGHT|wxLEFT</property>
|
||||
<property name="flag">wxALL|wxEXPAND</property>
|
||||
<property name="proportion">1</property>
|
||||
<object class="wxStaticBoxSizer" expanded="1">
|
||||
<property name="id">wxID_ANY</property>
|
||||
|
@ -134,89 +134,6 @@
|
|||
</object>
|
||||
</object>
|
||||
</object>
|
||||
<object class="sizeritem" expanded="1">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxEXPAND|wxTOP</property>
|
||||
<property name="proportion">0</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">10</property>
|
||||
<property name="flag">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="bitmap"></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="current"></property>
|
||||
<property name="default">0</property>
|
||||
<property name="default_pane">0</property>
|
||||
<property name="disabled"></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="focus"></property>
|
||||
<property name="font"></property>
|
||||
<property name="gripper">0</property>
|
||||
<property name="hidden">0</property>
|
||||
<property name="id">ID_RESET_MATRIX</property>
|
||||
<property name="label">Reset to Defaults</property>
|
||||
<property name="margins"></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_ResetOptButton</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="position"></property>
|
||||
<property name="pressed"></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">OnResetMatrixClick</event>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
#include <wx/artprov.h>
|
||||
#include <wx/xrc/xmlres.h>
|
||||
#include <wx/intl.h>
|
||||
#include "widgets/resettable_panel.h"
|
||||
#include <wx/panel.h>
|
||||
#include <wx/gdicmn.h>
|
||||
#include <wx/font.h>
|
||||
|
@ -18,32 +19,18 @@
|
|||
#include <wx/string.h>
|
||||
#include <wx/sizer.h>
|
||||
#include <wx/statbox.h>
|
||||
#include <wx/bitmap.h>
|
||||
#include <wx/image.h>
|
||||
#include <wx/icon.h>
|
||||
#include <wx/button.h>
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
/// Class PANEL_SETUP_PINMAP_BASE
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
class PANEL_SETUP_PINMAP_BASE : public wxPanel
|
||||
class PANEL_SETUP_PINMAP_BASE : public RESETTABLE_PANEL
|
||||
{
|
||||
private:
|
||||
|
||||
protected:
|
||||
enum
|
||||
{
|
||||
ID_RESET_MATRIX = 1000
|
||||
};
|
||||
|
||||
wxPanel* m_matrixPanel;
|
||||
wxButton* m_ResetOptButton;
|
||||
|
||||
// Virtual event handlers, overide them in your derived class
|
||||
virtual void OnResetMatrixClick( wxCommandEvent& event ) { event.Skip(); }
|
||||
|
||||
|
||||
public:
|
||||
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
#include <hotkeys_basic.h>
|
||||
#include <hotkey_store.h>
|
||||
|
||||
#include <widgets/resettable_panel.h>
|
||||
#include <widgets/widget_hotkey_list.h>
|
||||
|
||||
#include "wx/panel.h"
|
||||
|
@ -37,12 +38,12 @@ class wxSizer;
|
|||
class TOOL_MANAGER;
|
||||
|
||||
|
||||
class PANEL_HOTKEYS_EDITOR : public wxPanel
|
||||
class PANEL_HOTKEYS_EDITOR : public RESETTABLE_PANEL
|
||||
{
|
||||
protected:
|
||||
EDA_BASE_FRAME* m_frame;
|
||||
bool m_readOnly;
|
||||
|
||||
|
||||
std::vector<TOOL_MANAGER*> m_toolManagers;
|
||||
HOTKEY_STORE m_hotkeyStore;
|
||||
WIDGET_HOTKEY_LIST* m_hotkeyListCtrl;
|
||||
|
@ -51,10 +52,17 @@ public:
|
|||
PANEL_HOTKEYS_EDITOR( EDA_BASE_FRAME* aFrame, wxWindow* aWindow, bool aReadOnly );
|
||||
|
||||
void AddHotKeys( TOOL_MANAGER* aToolMgr );
|
||||
|
||||
|
||||
bool TransferDataToWindow() override;
|
||||
bool TransferDataFromWindow() override;
|
||||
|
||||
void ResetPanel() override;
|
||||
|
||||
wxString GetResetTooltip() override
|
||||
{
|
||||
return _( "Reset all hotkeys to the built-in KiCad defaults" );
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
/**
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2017-2018 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
* Copyright (C) 2017-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 as published by the
|
||||
|
@ -38,7 +38,7 @@ private:
|
|||
std::vector<bool> m_macHack;
|
||||
|
||||
public:
|
||||
PAGED_DIALOG( wxWindow* aParent, const wxString& aTitle,
|
||||
PAGED_DIALOG( wxWindow* aParent, const wxString& aTitle, bool aUseReset = false,
|
||||
const wxString& aAuxiliaryAction = wxEmptyString );
|
||||
~PAGED_DIALOG() override;
|
||||
|
||||
|
@ -59,11 +59,13 @@ protected:
|
|||
bool TransferDataFromWindow() override;
|
||||
|
||||
virtual void OnAuxiliaryAction( wxCommandEvent& event ) { event.Skip(); }
|
||||
void OnResetButton( wxCommandEvent& aEvent );
|
||||
void OnUpdateUI( wxUpdateUIEvent& event );
|
||||
void OnPageChange( wxBookCtrlEvent& event );
|
||||
|
||||
wxTreebook* m_treebook;
|
||||
wxButton* m_auxiliaryButton;
|
||||
wxButton* m_resetButton;
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -0,0 +1,58 @@
|
|||
/*
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 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 as published by the
|
||||
* Free Software Foundation, either version 3 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, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef RESETTABLE_PANEL_H_
|
||||
#define RESETTABLE_PANEL_H_
|
||||
|
||||
#include <wx/wx.h>
|
||||
|
||||
class PAGED_DIALOG;
|
||||
|
||||
/**
|
||||
* A wxPanel that is designed to be reset in a standard manor.
|
||||
*/
|
||||
class RESETTABLE_PANEL : public wxPanel
|
||||
{
|
||||
public:
|
||||
RESETTABLE_PANEL( wxWindow* aParent, wxWindowID aId = wxID_ANY,
|
||||
const wxPoint& aPos = wxDefaultPosition,
|
||||
const wxSize& aSize = wxSize( -1,-1 ),
|
||||
long aStyle = wxTAB_TRAVERSAL,
|
||||
const wxString& aName = wxEmptyString )
|
||||
: wxPanel( aParent, aId, aPos, aSize, aStyle, aName )
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Reset the contents of this panel.
|
||||
*/
|
||||
virtual void ResetPanel() = 0;
|
||||
|
||||
/**
|
||||
* Get the tooltip the reset button should display when showing this panel.
|
||||
*
|
||||
* @return the tooltip
|
||||
*/
|
||||
virtual wxString GetResetTooltip()
|
||||
{
|
||||
return _( "Reset all settings on this page to their default" );
|
||||
}
|
||||
};
|
||||
|
||||
#endif
|
|
@ -41,7 +41,7 @@
|
|||
#include "panel_setup_rules.h"
|
||||
|
||||
DIALOG_BOARD_SETUP::DIALOG_BOARD_SETUP( PCB_EDIT_FRAME* aFrame ) :
|
||||
PAGED_DIALOG( aFrame, _( "Board Setup" ), _( "Import Settings from Another Board..." ) ),
|
||||
PAGED_DIALOG( aFrame, _( "Board Setup" ), false, _( "Import Settings from Another Board..." ) ),
|
||||
m_frame( aFrame )
|
||||
{
|
||||
BOARD* board = aFrame->GetBoard();
|
||||
|
|
Loading…
Reference in New Issue