mirror of
https://github.com/aseprite/aseprite.git
synced 2024-10-03 21:46:20 +00:00
Possibility to assign same key to several tools (fix #1460)
This commit is contained in:
parent
150b27862f
commit
b0b3818267
@ -190,7 +190,7 @@ void Key::add(const ui::Accelerator& accel, KeySource source)
|
||||
|
||||
// Remove the accelerator from other commands
|
||||
if (source == KeySource::UserDefined) {
|
||||
KeyboardShortcuts::instance()->disableAccel(accel, m_keycontext);
|
||||
KeyboardShortcuts::instance()->disableAccel(accel, m_keycontext, this);
|
||||
m_userRemoved.remove(accel);
|
||||
}
|
||||
|
||||
@ -619,11 +619,19 @@ Key* KeyboardShortcuts::action(KeyAction action)
|
||||
return key;
|
||||
}
|
||||
|
||||
void KeyboardShortcuts::disableAccel(const ui::Accelerator& accel, KeyContext keyContext)
|
||||
void KeyboardShortcuts::disableAccel(const ui::Accelerator& accel,
|
||||
const KeyContext keyContext,
|
||||
const Key* newKey)
|
||||
{
|
||||
for (Key* key : m_keys) {
|
||||
if (key->keycontext() == keyContext && key->hasAccel(accel))
|
||||
if (key->keycontext() == keyContext &&
|
||||
key->hasAccel(accel) &&
|
||||
// Tools can contain the same keyboard shortcut
|
||||
(key->type() != KeyType::Tool ||
|
||||
newKey == nullptr ||
|
||||
newKey->type() != KeyType::Tool)) {
|
||||
key->disableAccel(accel);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -148,7 +148,9 @@ namespace app {
|
||||
Key* quicktool(tools::Tool* tool);
|
||||
Key* action(KeyAction action);
|
||||
|
||||
void disableAccel(const ui::Accelerator& accel, KeyContext keyContext);
|
||||
void disableAccel(const ui::Accelerator& accel,
|
||||
const KeyContext keyContext,
|
||||
const Key* newKey);
|
||||
|
||||
KeyContext getCurrentKeyContext();
|
||||
bool getCommandFromKeyMessage(ui::Message* msg, Command** command, Params* params);
|
||||
|
Loading…
Reference in New Issue
Block a user