diff --git a/aegisub/libaegisub/common/hotkey.cpp b/aegisub/libaegisub/common/hotkey.cpp index 797817c97..d6614e27e 100644 --- a/aegisub/libaegisub/common/hotkey.cpp +++ b/aegisub/libaegisub/common/hotkey.cpp @@ -127,14 +127,14 @@ void Hotkey::BuildHotkey(std::string const& context, const json::Object& object) } // for index } -bool Hotkey::Scan(const std::string &context, const std::string &str, std::string &cmd) const { +bool Hotkey::Scan(const std::string &context, const std::string &str, bool always, std::string &cmd) const { std::string local, dfault; HotkeyMap::const_iterator index, end; for (std::tr1::tie(index, end) = str_map.equal_range(str); index != end; ++index) { std::string const& ctext = index->second.Context(); - if (ctext == "Always") { + if (always && ctext == "Always") { cmd = index->second.CmdName(); LOG_D("agi/hotkey/found") << "Found: " << str << " Context (req/found): " << context << "/Always Command: " << cmd; return 0; diff --git a/aegisub/libaegisub/include/libaegisub/hotkey.h b/aegisub/libaegisub/include/libaegisub/hotkey.h index d740f0616..8bd4e0d4d 100644 --- a/aegisub/libaegisub/include/libaegisub/hotkey.h +++ b/aegisub/libaegisub/include/libaegisub/hotkey.h @@ -97,8 +97,9 @@ public: /// Scan for a matching key. /// @param context Context requested. /// @param str Hyphen separated key sequence. + /// @param always Enable the "Always" override context /// @param[out] cmd Command found. - bool Scan(const std::string &context, const std::string &str, std::string &cmd) const; + bool Scan(const std::string &context, const std::string &str, bool always, std::string &cmd) const; /// Get the string representation of the hotkeys for the given command /// @param context Context requested diff --git a/aegisub/src/hotkey.cpp b/aegisub/src/hotkey.cpp index 3aef24069..db0d75adb 100644 --- a/aegisub/src/hotkey.cpp +++ b/aegisub/src/hotkey.cpp @@ -69,7 +69,7 @@ bool check(std::string const& context, int key_code, wchar_t key_char, int modif if (combo.empty()) return false; std::string command; - if (agi::hotkey::hotkey->Scan(context, combo, command) == 0) { + if (agi::hotkey::hotkey->Scan(context, combo, OPT_GET("Audio/Medusa Timing Hotkeys")->GetBool(), command) == 0) { /// The bottom line should be removed after all the hotkey commands are fixed. /// This is to avoid pointless exceptions. if (command.find("/") != std::string::npos) {