diff --git a/common/dialogs/dialog_hotkeys_editor.cpp b/common/dialogs/dialog_hotkeys_editor.cpp
index 96a8d3b5d1..eed8f1ad36 100644
--- a/common/dialogs/dialog_hotkeys_editor.cpp
+++ b/common/dialogs/dialog_hotkeys_editor.cpp
@@ -84,3 +84,8 @@ void HOTKEYS_EDITOR_DIALOG::ResetClicked( wxCommandEvent& aEvent )
{
m_hotkeyListCtrl->TransferDataToControl();
}
+
+void HOTKEYS_EDITOR_DIALOG::DefaultsClicked( wxCommandEvent& aEvent )
+{
+ m_hotkeyListCtrl->TransferDefaultsToControl();
+}
diff --git a/common/dialogs/dialog_hotkeys_editor_base.cpp b/common/dialogs/dialog_hotkeys_editor_base.cpp
index 5373ac504a..4fc60f4b95 100644
--- a/common/dialogs/dialog_hotkeys_editor_base.cpp
+++ b/common/dialogs/dialog_hotkeys_editor_base.cpp
@@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////
-// C++ code generated with wxFormBuilder (version Dec 28 2015)
+// C++ code generated with wxFormBuilder (version Jun 17 2015)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
@@ -28,6 +28,9 @@ HOTKEYS_EDITOR_DIALOG_BASE::HOTKEYS_EDITOR_DIALOG_BASE( wxWindow* parent, wxWind
m_resetButton = new wxButton( this, wxID_RESET, _("Reset"), wxDefaultPosition, wxDefaultSize, 0 );
b_buttonsSizer->Add( m_resetButton, 0, wxALL|wxEXPAND, 5 );
+ m_defaultButton = new wxButton( this, wxID_ANY, _("Defaults"), wxDefaultPosition, wxDefaultSize, 0 );
+ b_buttonsSizer->Add( m_defaultButton, 0, wxALL|wxEXPAND, 5 );
+
b_buttonsSizer->Add( 0, 0, 1, wxEXPAND, 5 );
@@ -49,11 +52,13 @@ HOTKEYS_EDITOR_DIALOG_BASE::HOTKEYS_EDITOR_DIALOG_BASE( wxWindow* parent, wxWind
// Connect Events
m_resetButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( HOTKEYS_EDITOR_DIALOG_BASE::ResetClicked ), NULL, this );
+ m_defaultButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( HOTKEYS_EDITOR_DIALOG_BASE::DefaultsClicked ), NULL, this );
}
HOTKEYS_EDITOR_DIALOG_BASE::~HOTKEYS_EDITOR_DIALOG_BASE()
{
// Disconnect Events
m_resetButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( HOTKEYS_EDITOR_DIALOG_BASE::ResetClicked ), NULL, this );
+ m_defaultButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( HOTKEYS_EDITOR_DIALOG_BASE::DefaultsClicked ), NULL, this );
}
diff --git a/common/dialogs/dialog_hotkeys_editor_base.fbp b/common/dialogs/dialog_hotkeys_editor_base.fbp
index 6a096faede..3c66e1bc4a 100644
--- a/common/dialogs/dialog_hotkeys_editor_base.fbp
+++ b/common/dialogs/dialog_hotkeys_editor_base.fbp
@@ -353,6 +353,94 @@
+
5
wxEXPAND
diff --git a/common/dialogs/dialog_hotkeys_editor_base.h b/common/dialogs/dialog_hotkeys_editor_base.h
index a59f560d4f..3d4a8808bb 100644
--- a/common/dialogs/dialog_hotkeys_editor_base.h
+++ b/common/dialogs/dialog_hotkeys_editor_base.h
@@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////
-// C++ code generated with wxFormBuilder (version Dec 28 2015)
+// C++ code generated with wxFormBuilder (version Jun 17 2015)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
@@ -40,12 +40,14 @@ class HOTKEYS_EDITOR_DIALOG_BASE : public DIALOG_SHIM
wxStaticText* m_staticText1;
wxPanel* m_panelHotkeys;
wxButton* m_resetButton;
+ wxButton* m_defaultButton;
wxStdDialogButtonSizer* m_sdbSizer;
wxButton* m_sdbSizerOK;
wxButton* m_sdbSizerCancel;
// Virtual event handlers, overide them in your derived class
virtual void ResetClicked( wxCommandEvent& event ) { event.Skip(); }
+ virtual void DefaultsClicked( wxCommandEvent& event ) { event.Skip(); }
public:
diff --git a/common/hotkeys_basic.cpp b/common/hotkeys_basic.cpp
index 04dfd7fbb5..40e7a8247f 100644
--- a/common/hotkeys_basic.cpp
+++ b/common/hotkeys_basic.cpp
@@ -55,7 +55,8 @@ wxString g_CommonSectionTag( wxT( "[common]" ) );
* file.
*/
-EDA_HOTKEY::EDA_HOTKEY( const wxChar* infomsg, int idcommand, int keycode, int idmenuevent )
+EDA_HOTKEY::EDA_HOTKEY( const wxChar* infomsg, int idcommand, int keycode, int idmenuevent ) :
+ m_DefaultKeyCode( keycode ) // initialize DefaultKeyCode
{
m_KeyCode = keycode; // Key code (ascii value for ascii keys
@@ -69,7 +70,8 @@ EDA_HOTKEY::EDA_HOTKEY( const wxChar* infomsg, int idcommand, int keycode, int i
}
-EDA_HOTKEY::EDA_HOTKEY( const EDA_HOTKEY* base )
+EDA_HOTKEY::EDA_HOTKEY( const EDA_HOTKEY* base ) :
+ m_DefaultKeyCode( base->m_DefaultKeyCode ) // initialize DefaultKeyCode
{
m_KeyCode = base->m_KeyCode;
m_InfoMsg = base->m_InfoMsg;
diff --git a/common/widgets/widget_hotkey_list.cpp b/common/widgets/widget_hotkey_list.cpp
index ebab4f52f4..d5c1517ed6 100644
--- a/common/widgets/widget_hotkey_list.cpp
+++ b/common/widgets/widget_hotkey_list.cpp
@@ -575,6 +575,26 @@ void WIDGET_HOTKEY_LIST::InstallOnPanel( wxPanel* aPanel )
}
+bool WIDGET_HOTKEY_LIST::TransferDefaultsToControl()
+{
+ Freeze();
+
+ for( wxTreeListItem item = GetFirstItem(); item.IsOk(); item = GetNextItem( item ) )
+ {
+ WIDGET_HOTKEY_CLIENT_DATA* hkdata = GetHKClientData( item );
+ if( hkdata == NULL)
+ continue;
+
+ hkdata->GetHotkey().ResetKeyCodeToDefault();
+ }
+
+ UpdateFromClientData();
+ Thaw();
+
+ return true;
+}
+
+
bool WIDGET_HOTKEY_LIST::TransferDataToControl()
{
Freeze();
diff --git a/include/dialog_hotkeys_editor.h b/include/dialog_hotkeys_editor.h
index 801bea9aea..3107b6113f 100644
--- a/include/dialog_hotkeys_editor.h
+++ b/include/dialog_hotkeys_editor.h
@@ -66,6 +66,14 @@ private:
* @param aEvent is the button press event, unused
*/
void ResetClicked( wxCommandEvent& aEvent );
+
+ /**
+ * Function DefaultsClicked
+ * Set the hotkeys to the default values (values after installation)
+ *
+ * @param aEvent is the button press event, unused
+ */
+ void DefaultsClicked( wxCommandEvent& aEvent );
};
/**
diff --git a/include/hotkeys_basic.h b/include/hotkeys_basic.h
index 089fcce479..b08311ba65 100644
--- a/include/hotkeys_basic.h
+++ b/include/hotkeys_basic.h
@@ -56,6 +56,8 @@ extern wxString g_CommonSectionTag;
*/
class EDA_HOTKEY
{
+private:
+ const int m_DefaultKeyCode; // Key code assigned upon object construction, to be used as default value
public:
int m_KeyCode; // Key code (ascii value for ascii keys or wxWidgets code for function key
wxString m_InfoMsg; // info message.
@@ -65,6 +67,7 @@ public:
public:
EDA_HOTKEY( const wxChar* infomsg, int idcommand, int keycode, int idmenuevent = 0 );
EDA_HOTKEY( const EDA_HOTKEY* base);
+ void ResetKeyCodeToDefault() { m_KeyCode = m_DefaultKeyCode; }
};
diff --git a/include/widgets/widget_hotkey_list.h b/include/widgets/widget_hotkey_list.h
index bfaf010b63..60e78fb77f 100644
--- a/include/widgets/widget_hotkey_list.h
+++ b/include/widgets/widget_hotkey_list.h
@@ -177,6 +177,13 @@ public:
*/
void InstallOnPanel( wxPanel* aPanel );
+ /**
+ * Method TransferDefaultsToControl
+ * Set hotkeys in the control to default values.
+ * @return true iff the operation was successful
+ */
+ bool TransferDefaultsToControl();
+
/**
* Method TransferDataToControl
* Load the hotkey data into the control. It is safe to call this multiple times,