mirror of
https://github.com/aseprite/aseprite.git
synced 2025-03-10 01:13:49 +00:00
Don't access to KeyboardShortcuts singleton from SelectAccelerator
This commit is contained in:
parent
7740f6a710
commit
c5fda62173
@ -192,7 +192,9 @@ private:
|
||||
void onChangeAccel(int index) {
|
||||
LockButtons lock(this);
|
||||
Accelerator origAccel = m_key->accels()[index];
|
||||
SelectAccelerator window(origAccel, m_key->keycontext());
|
||||
SelectAccelerator window(origAccel,
|
||||
m_key->keycontext(),
|
||||
KeyboardShortcuts::instance()->keys());
|
||||
window.openWindowInForeground();
|
||||
|
||||
if (window.isModified()) {
|
||||
@ -225,7 +227,9 @@ private:
|
||||
void onAddAccel() {
|
||||
LockButtons lock(this);
|
||||
ui::Accelerator accel;
|
||||
SelectAccelerator window(accel, m_key ? m_key->keycontext(): KeyContext::Any);
|
||||
SelectAccelerator window(accel,
|
||||
m_key ? m_key->keycontext(): KeyContext::Any,
|
||||
KeyboardShortcuts::instance()->keys());
|
||||
window.openWindowInForeground();
|
||||
|
||||
if ((window.isModified()) ||
|
||||
|
@ -24,6 +24,8 @@ namespace app {
|
||||
static KeyboardShortcuts* instance();
|
||||
~KeyboardShortcuts();
|
||||
|
||||
const Keys& keys() const { return m_keys; }
|
||||
|
||||
iterator begin() { return m_keys.begin(); }
|
||||
iterator end() { return m_keys.end(); }
|
||||
const_iterator begin() const { return m_keys.begin(); }
|
||||
|
@ -10,7 +10,7 @@
|
||||
|
||||
#include "app/ui/select_accelerator.h"
|
||||
|
||||
#include "app/ui/keyboard_shortcuts.h"
|
||||
#include "app/ui/key.h"
|
||||
#include "base/bind.h"
|
||||
#include "obs/signal.h"
|
||||
#include "ui/entry.h"
|
||||
@ -85,9 +85,12 @@ protected:
|
||||
Accelerator m_accel;
|
||||
};
|
||||
|
||||
SelectAccelerator::SelectAccelerator(const ui::Accelerator& accel, KeyContext keyContext)
|
||||
SelectAccelerator::SelectAccelerator(const ui::Accelerator& accel,
|
||||
const KeyContext keyContext,
|
||||
const Keys& currentKeys)
|
||||
: m_keyField(new KeyField(accel))
|
||||
, m_keyContext(keyContext)
|
||||
, m_currentKeys(currentKeys)
|
||||
, m_accel(accel)
|
||||
, m_ok(false)
|
||||
, m_modified(false)
|
||||
@ -183,7 +186,7 @@ void SelectAccelerator::updateAssignedTo()
|
||||
{
|
||||
std::string res = "None";
|
||||
|
||||
for (const KeyPtr& key : *KeyboardShortcuts::instance()) {
|
||||
for (const KeyPtr& key : m_currentKeys) {
|
||||
if (key->keycontext() == m_keyContext &&
|
||||
key->hasAccel(m_accel)) {
|
||||
res = key->triggerString();
|
||||
|
@ -18,7 +18,9 @@ namespace app {
|
||||
|
||||
class SelectAccelerator : public app::gen::SelectAccelerator {
|
||||
public:
|
||||
SelectAccelerator(const ui::Accelerator& accelerator, KeyContext keyContext);
|
||||
SelectAccelerator(const ui::Accelerator& accelerator,
|
||||
const KeyContext keyContext,
|
||||
const Keys& currentKeys);
|
||||
|
||||
bool isOK() const { return m_ok; }
|
||||
bool isModified() const { return m_modified; }
|
||||
@ -38,6 +40,7 @@ namespace app {
|
||||
ui::TooltipManager m_tooltipManager;
|
||||
KeyField* m_keyField;
|
||||
KeyContext m_keyContext;
|
||||
const Keys& m_currentKeys;
|
||||
ui::Accelerator m_origAccel;
|
||||
ui::Accelerator m_accel;
|
||||
bool m_ok;
|
||||
|
Loading…
x
Reference in New Issue
Block a user