Move import/export button back into menu

This commit is contained in:
Chris Pavlina 2016-01-15 21:06:41 -05:00 committed by Chris Pavlina
parent 80fae7161e
commit 2ed78cf84b
6 changed files with 36 additions and 172 deletions

View File

@ -36,17 +36,6 @@
#include <wx/settings.h>
/**
* Menu IDs for the import/export menu.
*/
enum IMP_EXP_MENU_IDS
{
ID_IMPORT_PREFS = 2001,
ID_EXPORT_PREFS,
ID_IMPORT_HOTKEYS,
ID_EXPORT_HOTKEYS
};
DIALOG_EESCHEMA_OPTIONS::DIALOG_EESCHEMA_OPTIONS( SCH_EDIT_FRAME* parent ) :
DIALOG_EESCHEMA_OPTIONS_BASE( parent )
@ -70,9 +59,6 @@ DIALOG_EESCHEMA_OPTIONS::DIALOG_EESCHEMA_OPTIONS( SCH_EDIT_FRAME* parent ) :
m_hotkeyListCtrl = new WIDGET_HOTKEY_LIST( m_panelHotkeys, sections );
m_hotkeyListCtrl->InstallOnPanel( m_panelHotkeys );
// Bind event for the import/export menu
Bind( wxEVT_MENU, &DIALOG_EESCHEMA_OPTIONS::OnMenu, this );
// Make sure we select the first tab of the options tab page
m_notebook->SetSelection( 0 );
@ -94,53 +80,6 @@ SCH_EDIT_FRAME* DIALOG_EESCHEMA_OPTIONS::GetParent()
}
void DIALOG_EESCHEMA_OPTIONS::OnImpExpClick( wxCommandEvent& aEvent )
{
wxMenu menu;
menu.Append( ID_IMPORT_PREFS, _( "Import Preferences" ) );
menu.Append( ID_EXPORT_PREFS, _( "Export Preferences" ) );
menu.Append( wxID_SEPARATOR );
menu.Append( ID_IMPORT_HOTKEYS, _( "Import Hotkeys" ) );
menu.Append( ID_EXPORT_HOTKEYS, _( "Export Hotkeys" ) );
int btnw, btnh;
m_btnImpExp->GetSize( &btnw, &btnh );
m_btnImpExp->PopupMenu( &menu, wxPoint( 0, btnh ) );
}
void DIALOG_EESCHEMA_OPTIONS::OnMenu( wxCommandEvent& aEvent )
{
switch( aEvent.GetId() )
{
case ID_IMPORT_PREFS:
aEvent.SetId( ID_CONFIG_READ );
GetParent()->Process_Config( aEvent );
break;
case ID_EXPORT_PREFS:
aEvent.SetId( ID_CONFIG_SAVE );
GetParent()->Process_Config( aEvent );
break;
case ID_IMPORT_HOTKEYS:
aEvent.SetId( ID_PREFERENCES_HOTKEY_IMPORT_CONFIG );
GetParent()->Process_Config( aEvent );
break;
case ID_EXPORT_HOTKEYS:
aEvent.SetId( ID_PREFERENCES_HOTKEY_EXPORT_CONFIG );
GetParent()->Process_Config( aEvent );
break;
default:
wxFAIL_MSG( "Unexpected menu ID" );
}
}
void DIALOG_EESCHEMA_OPTIONS::SetUnits( const wxArrayString& units, int select )
{
wxASSERT( units.GetCount() > 0

View File

@ -45,18 +45,6 @@ protected:
/** @brief The template fieldnames for this dialog */
TEMPLATE_FIELDNAMES templateFields;
/**
* Function OnImpExpClick
* Display the settings import/export menu.
*/
void OnImpExpClick( wxCommandEvent& aEvent );
/**
* Function OnMenu
* Handle menu clicks (for import/export)
*/
void OnMenu( wxCommandEvent& aEvent );
/**
* Function OnAddButtonClick
* Process the wxWidgets @a event produced when the user presses the Add buton for the

View File

@ -15,7 +15,6 @@ BEGIN_EVENT_TABLE( DIALOG_EESCHEMA_OPTIONS_BASE, DIALOG_SHIM )
EVT_CHECKBOX( xwID_ANY, DIALOG_EESCHEMA_OPTIONS_BASE::_wxFB_OnMiddleBtnPanEnbl )
EVT_BUTTON( wxID_ADD_FIELD, DIALOG_EESCHEMA_OPTIONS_BASE::_wxFB_OnAddButtonClick )
EVT_BUTTON( wxID_DELETE_FIELD, DIALOG_EESCHEMA_OPTIONS_BASE::_wxFB_OnDeleteButtonClick )
EVT_BUTTON( ID_IMP_EXP, DIALOG_EESCHEMA_OPTIONS_BASE::_wxFB_OnImpExpClick )
END_EVENT_TABLE()
DIALOG_EESCHEMA_OPTIONS_BASE::DIALOG_EESCHEMA_OPTIONS_BASE( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : DIALOG_SHIM( parent, id, title, pos, size, style )
@ -366,9 +365,6 @@ DIALOG_EESCHEMA_OPTIONS_BASE::DIALOG_EESCHEMA_OPTIONS_BASE( wxWindow* parent, wx
wxBoxSizer* bSizer12;
bSizer12 = new wxBoxSizer( wxHORIZONTAL );
m_btnImpExp = new wxButton( this, ID_IMP_EXP, _("Import/Export..."), wxDefaultPosition, wxDefaultSize, 0 );
bSizer12->Add( m_btnImpExp, 0, wxALL, 5 );
m_sdbSizer = new wxStdDialogButtonSizer();
m_sdbSizerOK = new wxButton( this, wxID_OK );
m_sdbSizer->AddButton( m_sdbSizerOK );
@ -379,7 +375,7 @@ DIALOG_EESCHEMA_OPTIONS_BASE::DIALOG_EESCHEMA_OPTIONS_BASE( wxWindow* parent, wx
bSizer12->Add( m_sdbSizer, 1, wxALL|wxEXPAND, 5 );
bOptionsSizer->Add( bSizer12, 0, wxEXPAND, 5 );
bOptionsSizer->Add( bSizer12, 0, wxBOTTOM|wxEXPAND, 5 );
mainSizer->Add( bOptionsSizer, 1, wxEXPAND, 12 );

View File

@ -4932,101 +4932,13 @@
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxEXPAND</property>
<property name="flag">wxBOTTOM|wxEXPAND</property>
<property name="proportion">0</property>
<object class="wxBoxSizer" expanded="1">
<property name="minimum_size"></property>
<property name="name">bSizer12</property>
<property name="orient">wxHORIZONTAL</property>
<property name="permission">none</property>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">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="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">ID_IMP_EXP</property>
<property name="label">Import/Export...</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_btnImpExp</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">OnImpExpClick</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="0">
<property name="border">5</property>
<property name="flag">wxALL|wxEXPAND</property>

View File

@ -50,7 +50,6 @@ class DIALOG_EESCHEMA_OPTIONS_BASE : public DIALOG_SHIM
void _wxFB_OnMiddleBtnPanEnbl( wxCommandEvent& event ){ OnMiddleBtnPanEnbl( event ); }
void _wxFB_OnAddButtonClick( wxCommandEvent& event ){ OnAddButtonClick( event ); }
void _wxFB_OnDeleteButtonClick( wxCommandEvent& event ){ OnDeleteButtonClick( event ); }
void _wxFB_OnImpExpClick( wxCommandEvent& event ){ OnImpExpClick( event ); }
protected:
@ -59,8 +58,7 @@ class DIALOG_EESCHEMA_OPTIONS_BASE : public DIALOG_SHIM
ID_M_SPINAUTOSAVEINTERVAL = 1000,
xwID_ANY,
wxID_ADD_FIELD,
wxID_DELETE_FIELD,
ID_IMP_EXP
wxID_DELETE_FIELD
};
wxNotebook* m_notebook;
@ -118,7 +116,6 @@ class DIALOG_EESCHEMA_OPTIONS_BASE : public DIALOG_SHIM
wxGrid* m_fieldGrid;
wxButton* addFieldButton;
wxButton* deleteFieldButton;
wxButton* m_btnImpExp;
wxStdDialogButtonSizer* m_sdbSizer;
wxButton* m_sdbSizerOK;
wxButton* m_sdbSizerCancel;
@ -129,7 +126,6 @@ class DIALOG_EESCHEMA_OPTIONS_BASE : public DIALOG_SHIM
virtual void OnMiddleBtnPanEnbl( wxCommandEvent& event ) { event.Skip(); }
virtual void OnAddButtonClick( wxCommandEvent& event ) { event.Skip(); }
virtual void OnDeleteButtonClick( wxCommandEvent& event ) { event.Skip(); }
virtual void OnImpExpClick( wxCommandEvent& event ) { event.Skip(); }
public:

View File

@ -398,6 +398,39 @@ void SCH_EDIT_FRAME::ReCreateMenuBar()
// Language submenu
Pgm().AddMenuLanguageList( preferencesMenu );
// Import/export
wxMenu* importExportSubmenu = new wxMenu();
AddMenuItem( importExportSubmenu,
ID_CONFIG_SAVE,
_( "&Save Preferences" ),
_( "Save application preferences" ),
wxNullBitmap );
AddMenuItem( importExportSubmenu,
ID_CONFIG_READ,
_( "Load Prefe&rences" ),
_( "Load application preferences" ),
wxNullBitmap );
AddMenuItem( importExportSubmenu,
ID_PREFERENCES_HOTKEY_EXPORT_CONFIG,
_( "E&xport Hotkeys" ),
_( "Create a hotkey configuration file to export the current hotkeys" ),
wxNullBitmap );
AddMenuItem( importExportSubmenu,
ID_PREFERENCES_HOTKEY_IMPORT_CONFIG,
_( "&Import Hotkeys" ),
_( "Load an existing hotkey configuration file" ),
wxNullBitmap );
AddMenuItem( preferencesMenu, importExportSubmenu,
wxID_ANY,
_( "&Import and export" ),
_( "Import and export settings" ),
KiBitmap( save_setup_xpm ) );
// Menu Tools:
wxMenu* toolsMenu = new wxMenu;