diff --git a/common/dialogs/panel_hotkeys_editor.cpp b/common/dialogs/panel_hotkeys_editor.cpp index f4ce3d75ed..00e3d9dc88 100644 --- a/common/dialogs/panel_hotkeys_editor.cpp +++ b/common/dialogs/panel_hotkeys_editor.cpp @@ -140,7 +140,7 @@ void PANEL_HOTKEYS_EDITOR::installButtons( wxSizer* aSizer ) bool PANEL_HOTKEYS_EDITOR::TransferDataToWindow() { - m_hotkeyStore.Init( m_toolManagers ); + m_hotkeyStore.Init( m_toolManagers, m_readOnly ); return m_hotkeyListCtrl->TransferDataToControl(); } @@ -150,6 +150,9 @@ bool PANEL_HOTKEYS_EDITOR::TransferDataFromWindow() if( !m_hotkeyListCtrl->TransferDataFromControl() ) return false; + if( m_readOnly ) + return true; + // save the hotkeys for( TOOL_MANAGER* toolMgr : m_toolManagers ) WriteHotKeyConfig( toolMgr->GetActions() ); diff --git a/common/hotkey_store.cpp b/common/hotkey_store.cpp index 9e060ba2ee..cea9b3c089 100644 --- a/common/hotkey_store.cpp +++ b/common/hotkey_store.cpp @@ -84,7 +84,7 @@ HOTKEY_STORE::HOTKEY_STORE() } -void HOTKEY_STORE::Init( std::vector aToolManagerList ) +void HOTKEY_STORE::Init( std::vector aToolManagerList, bool aIncludeGestures ) { m_toolManagers = std::move( aToolManagerList ); @@ -125,12 +125,15 @@ void HOTKEY_STORE::Init( std::vector aToolManagerList ) currentSection->m_HotKeys.emplace_back( HOTKEY( entry.second ) ); } - m_hk_sections.emplace_back( HOTKEY_SECTION() ); - currentSection = &m_hk_sections.back(); - currentSection->m_SectionName = _( "Gestures" ); + if( aIncludeGestures ) + { + m_hk_sections.emplace_back( HOTKEY_SECTION() ); + currentSection = &m_hk_sections.back(); + currentSection->m_SectionName = _( "Gestures" ); - for( TOOL_ACTION* gesture : g_gesturePseudoActions ) - currentSection->m_HotKeys.emplace_back( HOTKEY( gesture ) ); + for( TOOL_ACTION* gesture : g_gesturePseudoActions ) + currentSection->m_HotKeys.emplace_back( HOTKEY( gesture ) ); + } } diff --git a/include/hotkey_store.h b/include/hotkey_store.h index df3c2a1a5d..a082a80f80 100644 --- a/include/hotkey_store.h +++ b/include/hotkey_store.h @@ -69,7 +69,7 @@ public: */ HOTKEY_STORE(); - void Init( std::vector aToolManagerList ); + void Init( std::vector aToolManagerList, bool aIncludeGestures ); static wxString GetAppName( TOOL_ACTION* aAction ); static wxString GetSectionName( TOOL_ACTION* aAction );