Make the hotkeys for the visual typesetting modes customizable. Closes #992

Originally committed to SVN as r3402.
This commit is contained in:
Thomas Goyne 2009-08-13 22:07:43 +00:00
parent 7634ce2d4e
commit 696e76379e
2 changed files with 24 additions and 10 deletions

View File

@ -352,7 +352,7 @@ void HotkeyManager::Load() {
/// @brief Load defaults /// @brief Set all hotkeys to the default values
/// ///
void HotkeyManager::LoadDefaults() { void HotkeyManager::LoadDefaults() {
modified = true; modified = true;
@ -490,6 +490,14 @@ void HotkeyManager::LoadDefaults() {
SetHotkey(_("Styling Assistant Prev"),_T("PgUp")); SetHotkey(_("Styling Assistant Prev"),_T("PgUp"));
SetHotkey(_("Styling Assistant Accept"),_T("Enter")); SetHotkey(_("Styling Assistant Accept"),_T("Enter"));
SetHotkey(_("Styling Assistant Preview"),_T("F8")); SetHotkey(_("Styling Assistant Preview"),_T("F8"));
SetHotkey(_("Visual Tool Default"), _T("A"));
SetHotkey(_("Visual Tool Drag"), _T("S"));
SetHotkey(_("Visual Tool Rotate Z"), _T("D"));
SetHotkey(_("Visual Tool Rotate X/Y"), _T("F"));
SetHotkey(_("Visual Tool Scale"), _T("G"));
SetHotkey(_("Visual Tool Rectangular Clip"), _T("H"));
SetHotkey(_("Visual Tool Vector Clip"), _T("J"));
} }

View File

@ -78,6 +78,7 @@
#include "visual_tool_clip.h" #include "visual_tool_clip.h"
#include "visual_tool_vector_clip.h" #include "visual_tool_vector_clip.h"
#include "visual_tool_drag.h" #include "visual_tool_drag.h"
#include "hotkeys.h"
/////// ///////
@ -557,15 +558,20 @@ void VideoDisplay::OnMouseEvent(wxMouseEvent& event) {
/// @param event /// @param event
/// ///
void VideoDisplay::OnKey(wxKeyEvent &event) { void VideoDisplay::OnKey(wxKeyEvent &event) {
// FIXME: should these be configurable? int key = event.GetKeyCode();
// Think of the frenchmen and other people not using qwerty layout #ifdef __APPLE__
if (event.GetKeyCode() == 'A') SetVisualMode(0); Hotkeys.SetPressed(key,event.m_metaDown,event.m_altDown,event.m_shiftDown);
if (event.GetKeyCode() == 'S') SetVisualMode(1); #else
if (event.GetKeyCode() == 'D') SetVisualMode(2); Hotkeys.SetPressed(key,event.m_controlDown,event.m_altDown,event.m_shiftDown);
if (event.GetKeyCode() == 'F') SetVisualMode(3); #endif
if (event.GetKeyCode() == 'G') SetVisualMode(4);
if (event.GetKeyCode() == 'H') SetVisualMode(5); if (Hotkeys.IsPressed(_T("Visual Tool Default"))) SetVisualMode(0);
if (event.GetKeyCode() == 'J') SetVisualMode(6); else if (Hotkeys.IsPressed(_T("Visual Tool Drag"))) SetVisualMode(1);
else if (Hotkeys.IsPressed(_T("Visual Tool Rotate Z"))) SetVisualMode(2);
else if (Hotkeys.IsPressed(_T("Visual Tool Rotate X/Y"))) SetVisualMode(3);
else if (Hotkeys.IsPressed(_T("Visual Tool Scale"))) SetVisualMode(4);
else if (Hotkeys.IsPressed(_T("Visual Tool Rectangular Clip"))) SetVisualMode(5);
else if (Hotkeys.IsPressed(_T("Visual Tool Vector Clip"))) SetVisualMode(6);
event.Skip(); event.Skip();
} }