mirror of https://github.com/odrling/Aegisub
Only enable the 'Always' hotkey context when medusa mode is on
Originally committed to SVN as r5505.
This commit is contained in:
parent
7deebf759b
commit
ffe8c7a5d6
|
@ -127,14 +127,14 @@ void Hotkey::BuildHotkey(std::string const& context, const json::Object& object)
|
||||||
} // for index
|
} // 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;
|
std::string local, dfault;
|
||||||
|
|
||||||
HotkeyMap::const_iterator index, end;
|
HotkeyMap::const_iterator index, end;
|
||||||
for (std::tr1::tie(index, end) = str_map.equal_range(str); index != end; ++index) {
|
for (std::tr1::tie(index, end) = str_map.equal_range(str); index != end; ++index) {
|
||||||
std::string const& ctext = index->second.Context();
|
std::string const& ctext = index->second.Context();
|
||||||
|
|
||||||
if (ctext == "Always") {
|
if (always && ctext == "Always") {
|
||||||
cmd = index->second.CmdName();
|
cmd = index->second.CmdName();
|
||||||
LOG_D("agi/hotkey/found") << "Found: " << str << " Context (req/found): " << context << "/Always Command: " << cmd;
|
LOG_D("agi/hotkey/found") << "Found: " << str << " Context (req/found): " << context << "/Always Command: " << cmd;
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -97,8 +97,9 @@ public:
|
||||||
/// Scan for a matching key.
|
/// Scan for a matching key.
|
||||||
/// @param context Context requested.
|
/// @param context Context requested.
|
||||||
/// @param str Hyphen separated key sequence.
|
/// @param str Hyphen separated key sequence.
|
||||||
|
/// @param always Enable the "Always" override context
|
||||||
/// @param[out] cmd Command found.
|
/// @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
|
/// Get the string representation of the hotkeys for the given command
|
||||||
/// @param context Context requested
|
/// @param context Context requested
|
||||||
|
|
|
@ -69,7 +69,7 @@ bool check(std::string const& context, int key_code, wchar_t key_char, int modif
|
||||||
if (combo.empty()) return false;
|
if (combo.empty()) return false;
|
||||||
|
|
||||||
std::string command;
|
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.
|
/// The bottom line should be removed after all the hotkey commands are fixed.
|
||||||
/// This is to avoid pointless exceptions.
|
/// This is to avoid pointless exceptions.
|
||||||
if (command.find("/") != std::string::npos) {
|
if (command.find("/") != std::string::npos) {
|
||||||
|
|
Loading…
Reference in New Issue