From 59755b5bb511c4c62b9f09c27980bd2cb21dd909 Mon Sep 17 00:00:00 2001 From: Thomas Goyne Date: Wed, 27 Jul 2011 22:59:11 +0000 Subject: [PATCH] Add command to toggle medusa mode and fix the command names for many hotkeys Originally committed to SVN as r5528. --- aegisub/src/command/app.cpp | 20 +++++++++++++++++++- aegisub/src/command/command.cpp | 1 - aegisub/src/libresrc/default_hotkey.json | 16 ++++++++-------- 3 files changed, 27 insertions(+), 10 deletions(-) diff --git a/aegisub/src/command/app.cpp b/aegisub/src/command/app.cpp index 3ad8d792c..bfd333bca 100644 --- a/aegisub/src/command/app.cpp +++ b/aegisub/src/command/app.cpp @@ -227,11 +227,28 @@ struct app_options : public Command { } }; +/// Toggle global override hotkeys (aka medusa mode). +struct app_toggle_global_hotkeys : public Command { + CMD_NAME("app/toggle/global_hotkeys") + STR_MENU("Toggle global hotkey overrides") + STR_DISP("Toggle global hotkey overrides") + STR_HELP("Toggle global hotkey overrides.") + CMD_TYPE(COMMAND_TOGGLE) + + bool IsActive(const agi::Context *c) { + return OPT_GET("Audio/Medusa Timing Hotkeys")->GetBool(); + } + + void operator()(agi::Context *c) { + agi::OptionValue *opt = OPT_SET("Audio/Medusa Timing Hotkeys"); + opt->SetBool(!opt->GetBool()); + } +}; /// Check to see if there is a new version of Aegisub available. struct app_updates : public Command { CMD_NAME("app/updates") - STR_MENU("&Check for Updates..") + STR_MENU("&Check for Updates...") STR_DISP("Check for Updates") STR_HELP("Check to see if there is a new version of Aegisub available.") @@ -255,6 +272,7 @@ namespace cmd { reg(new app_log); reg(new app_new_window); reg(new app_options); + reg(new app_toggle_global_hotkeys); reg(new app_updates); } } diff --git a/aegisub/src/command/command.cpp b/aegisub/src/command/command.cpp index 910d666d3..875d265a5 100644 --- a/aegisub/src/command/command.cpp +++ b/aegisub/src/command/command.cpp @@ -85,7 +85,6 @@ namespace cmd { void init_grid(); void init_help(); void init_keyframe(); - void init_medusa(); void init_menu(); void init_recent(); void init_subtitle(); diff --git a/aegisub/src/libresrc/default_hotkey.json b/aegisub/src/libresrc/default_hotkey.json index 2edba24b1..ae2373834 100644 --- a/aegisub/src/libresrc/default_hotkey.json +++ b/aegisub/src/libresrc/default_hotkey.json @@ -1,12 +1,12 @@ { "Always" : { - "audio play" : [ + "audio/play/selection" : [ { "modifiers" : [], "key" : "KP_5" } ], - "audio stop" : [ + "audio/stop" : [ { "modifiers" : [], "key" : "KP_8" @@ -36,31 +36,31 @@ "key" : "KP_9" } ], - "audio play before selection begin" : [ + "audio/play/selection/before" : [ { "modifiers" : [], "key" : "KP_1" } ], - "audio play after selection end" : [ + "audio/play/selection/after" : [ { "modifiers" : [], "key" : "KP_3" } ], - "timing move to prev item" : [ + "time/prev" : [ { "modifiers" : [], "key" : "KP_0" } ], - "timing move to next item" : [ + "time/next" : [ { "modifiers" : [], "key" : "KP_2" } ], - "timing commit" : [ + "audio/commit" : [ { "modifiers" : [], "key" : "KP_Enter" @@ -417,7 +417,7 @@ "key" : "Left" } ], - "toggle global timing mode" : [ + "app/toggle/global_hotkeys" : [ { "modifiers" : [ "Ctrl" ], "key" : "KP_Multiply"