From 9b9ac319dc7dcca3da3ae52afaafba28ef668178 Mon Sep 17 00:00:00 2001 From: David Capello Date: Wed, 20 May 2015 15:02:31 -0300 Subject: [PATCH] Rename checkFromAllegroKeyArray() members to isPressed() --- src/app/ui/document_view.cpp | 2 +- src/app/ui/keyboard_shortcuts.cpp | 10 +++++----- src/app/ui/keyboard_shortcuts.h | 2 +- src/ui/accelerator.cpp | 4 ++-- src/ui/accelerator.h | 4 ++-- 5 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/app/ui/document_view.cpp b/src/app/ui/document_view.cpp index 0373e6504..37c009dff 100644 --- a/src/app/ui/document_view.cpp +++ b/src/app/ui/document_view.cpp @@ -172,7 +172,7 @@ private: bool isKeyActionPressed(KeyAction action) { if (Key* key = KeyboardShortcuts::instance()->action(action)) - return key->checkFromAllegroKeyArray(); + return key->isPressed(); else return false; } diff --git a/src/app/ui/keyboard_shortcuts.cpp b/src/app/ui/keyboard_shortcuts.cpp index 7694d7232..8bd7ed357 100644 --- a/src/app/ui/keyboard_shortcuts.cpp +++ b/src/app/ui/keyboard_shortcuts.cpp @@ -194,7 +194,7 @@ bool Key::isPressed(Message* msg) const ASSERT(dynamic_cast(msg) != NULL); for (const Accelerator& accel : accels()) { - if (accel.check(msg->keyModifiers(), + if (accel.isPressed(msg->keyModifiers(), static_cast(msg)->scancode(), static_cast(msg)->unicodeChar()) && (m_keycontext == KeyContext::Any || @@ -206,10 +206,10 @@ bool Key::isPressed(Message* msg) const return false; } -bool Key::checkFromAllegroKeyArray() +bool Key::isPressed() const { for (const Accelerator& accel : this->accels()) { - if (accel.checkFromAllegroKeyArray()) + if (accel.isPressed()) return true; } return false; @@ -658,7 +658,7 @@ tools::Tool* KeyboardShortcuts::getCurrentQuicktool(tools::Tool* currentTool) { if (currentTool && currentTool->getInk(0)->isSelection()) { Key* key = action(KeyAction::CopySelection); - if (key && key->checkFromAllegroKeyArray()) + if (key && key->isPressed()) return NULL; } @@ -669,7 +669,7 @@ tools::Tool* KeyboardShortcuts::getCurrentQuicktool(tools::Tool* currentTool) Key* key = quicktool(tool); // Collect all tools with the pressed keyboard-shortcut - if (key && key->checkFromAllegroKeyArray()) { + if (key && key->isPressed()) { return tool; } } diff --git a/src/app/ui/keyboard_shortcuts.h b/src/app/ui/keyboard_shortcuts.h index 72ebd2694..8fdc242cb 100644 --- a/src/app/ui/keyboard_shortcuts.h +++ b/src/app/ui/keyboard_shortcuts.h @@ -80,7 +80,7 @@ namespace app { void add(const ui::Accelerator& accel, KeySource source); bool isPressed(ui::Message* msg) const; - bool checkFromAllegroKeyArray(); + bool isPressed() const; bool hasAccel(const ui::Accelerator& accel) const; void disableAccel(const ui::Accelerator& accel); diff --git a/src/ui/accelerator.cpp b/src/ui/accelerator.cpp index 3a9c886ba..0be2b31c8 100644 --- a/src/ui/accelerator.cpp +++ b/src/ui/accelerator.cpp @@ -349,7 +349,7 @@ std::string Accelerator::toString() const return buf; } -bool Accelerator::check(KeyModifiers modifiers, KeyScancode scancode, int unicodeChar) const +bool Accelerator::isPressed(KeyModifiers modifiers, KeyScancode scancode, int unicodeChar) const { // Preprocess the character to be compared with the accelerator #ifdef PREPROCESS_KEYS @@ -428,7 +428,7 @@ bool Accelerator::check(KeyModifiers modifiers, KeyScancode scancode, int unicod return false; } -bool Accelerator::checkFromAllegroKeyArray() const +bool Accelerator::isPressed() const { KeyModifiers modifiers = kKeyNoneModifier; diff --git a/src/ui/accelerator.h b/src/ui/accelerator.h index 126cc9f92..e0ac5e5c7 100644 --- a/src/ui/accelerator.h +++ b/src/ui/accelerator.h @@ -25,8 +25,8 @@ namespace ui { bool isEmpty() const; std::string toString() const; - bool check(KeyModifiers modifiers, KeyScancode scancode, int unicodeChar) const; - bool checkFromAllegroKeyArray() const; + bool isPressed(KeyModifiers modifiers, KeyScancode scancode, int unicodeChar) const; + bool isPressed() const; bool operator==(const Accelerator& other) const; bool operator!=(const Accelerator& other) const {