kicad-developers team mailing list archive
-
kicad-developers team
-
Mailing list archive
-
Message #23891
[PATCH 2/3] Introduce m_DefaultKeyCode storage and ResetKeyCodeToDefault method in the EDA_HOTKEY class
---
common/hotkeys_basic.cpp | 6 ++++--
include/hotkeys_basic.h | 3 +++
2 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/common/hotkeys_basic.cpp b/common/hotkeys_basic.cpp
index 04dfd7f..40e7a82 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/include/hotkeys_basic.h b/include/hotkeys_basic.h
index 089fcce..b08311b 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; }
};
--
1.9.1
References