summaryrefslogtreecommitdiff
path: root/src/input
diff options
context:
space:
mode:
Diffstat (limited to 'src/input')
-rw-r--r--src/input/inputmanager.cpp10
-rw-r--r--src/input/inputmanager.h6
-rw-r--r--src/input/keyboardconfig.cpp4
-rw-r--r--src/input/keyboardconfig.h6
-rw-r--r--src/input/keyboarddata.h37
-rw-r--r--src/input/keydata.h5
6 files changed, 54 insertions, 14 deletions
diff --git a/src/input/inputmanager.cpp b/src/input/inputmanager.cpp
index 090629aea..cc37001cc 100644
--- a/src/input/inputmanager.cpp
+++ b/src/input/inputmanager.cpp
@@ -44,7 +44,7 @@
#include "gui/windows/npcdialog.h"
#include "gui/windows/npcpostdialog.h"
#include "gui/windows/selldialog.h"
-#include "gui/windows/setup.h"
+#include "gui/windows/setupwindow.h"
#include "gui/windows/textdialog.h"
#include "gui/windows/tradewindow.h"
#include "gui/windows/quitdialog.h"
@@ -102,7 +102,7 @@ void InputManager::init()
update();
}
-void InputManager::update() const
+void InputManager::update()
{
keyboard.update();
if (joystick)
@@ -347,7 +347,7 @@ bool InputManager::isActionActive(const int index) const
return true;
}
-bool InputManager::isActionActive0(const int index) const
+bool InputManager::isActionActive0(const int index)
{
if (keyboard.isActionActive(index))
return true;
@@ -497,7 +497,7 @@ void InputManager::setNewKey(const SDL_Event &event, const int type)
{
int val = -1;
if (type == INPUT_KEYBOARD)
- val = keyboard.getKeyValueFromEvent(event);
+ val = KeyboardConfig::getKeyValueFromEvent(event);
else if (type == INPUT_JOYSTICK && joystick)
val = joystick->getButtonFromEvent(event);
@@ -651,7 +651,7 @@ bool InputManager::handleEvent(const SDL_Event &event)
return false;
}
-void InputManager::handleRepeat() const
+void InputManager::handleRepeat()
{
const int time = tick_time;
keyboard.handleRepeat(time);
diff --git a/src/input/inputmanager.h b/src/input/inputmanager.h
index ce662611a..630b52948 100644
--- a/src/input/inputmanager.h
+++ b/src/input/inputmanager.h
@@ -164,14 +164,14 @@ class InputManager final
bool handleAssignKey(const SDL_Event &event, const int type);
- void handleRepeat() const;
+ static void handleRepeat();
bool triggerAction(const KeysVector *const ptrs);
int getKeyIndex(const int value, const int grp,
const int type) const A_WARN_UNUSED;
- void update() const;
+ static void update();
void updateConditionMask();
@@ -180,7 +180,7 @@ class InputManager final
void executeAction(const int keyNum);
protected:
- bool isActionActive0(const int index) const A_WARN_UNUSED;
+ static bool isActionActive0(const int index) A_WARN_UNUSED;
Setup_Input *mSetupInput; /**< Reference to setup window */
diff --git a/src/input/keyboardconfig.cpp b/src/input/keyboardconfig.cpp
index 6cf524842..3756e27fb 100644
--- a/src/input/keyboardconfig.cpp
+++ b/src/input/keyboardconfig.cpp
@@ -59,7 +59,7 @@ void KeyboardConfig::deinit()
mActiveKeys2 = nullptr;
}
-int KeyboardConfig::getKeyValueFromEvent(const SDL_Event &event) const
+int KeyboardConfig::getKeyValueFromEvent(const SDL_Event &event)
{
#ifdef USE_SDL2
return event.key.keysym.scancode;
@@ -72,7 +72,7 @@ int KeyboardConfig::getKeyValueFromEvent(const SDL_Event &event) const
return 0;
}
-int KeyboardConfig::getKeyIndex(const SDL_Event &event, const int grp) const
+int KeyboardConfig::getKeyIndex(const SDL_Event &event, const int grp)
{
const int keyValue = getKeyValueFromEvent(event);
return inputManager.getKeyIndex(keyValue, grp, INPUT_KEYBOARD);
diff --git a/src/input/keyboardconfig.h b/src/input/keyboardconfig.h
index 5e8232508..7f7102964 100644
--- a/src/input/keyboardconfig.h
+++ b/src/input/keyboardconfig.h
@@ -56,8 +56,8 @@ class KeyboardConfig final
/**
* Get the key function index by providing the keys value.
*/
- int getKeyIndex(const SDL_Event &event,
- const int grp = 1) const A_WARN_UNUSED;
+ static int getKeyIndex(const SDL_Event &event,
+ const int grp = 1) A_WARN_UNUSED;
/**
* Set the enable flag, which will stop the user from doing actions.
@@ -75,7 +75,7 @@ class KeyboardConfig final
static SDLKey getKeyFromEvent(const SDL_Event &event) A_WARN_UNUSED;
- int getKeyValueFromEvent(const SDL_Event &event) const A_WARN_UNUSED;
+ static int getKeyValueFromEvent(const SDL_Event &event) A_WARN_UNUSED;
KeysVector *getActionVector(const SDL_Event &event) A_WARN_UNUSED;
diff --git a/src/input/keyboarddata.h b/src/input/keyboarddata.h
index c250b759e..e6bafb61b 100644
--- a/src/input/keyboarddata.h
+++ b/src/input/keyboarddata.h
@@ -2051,7 +2051,42 @@ static const KeyData keyData[Input::KEY_TOTAL] = {
Input::GRP_GUICHAN,
nullptr,
Input::KEY_NO_VALUE, 50,
- COND_DEFAULT}
+ COND_DEFAULT},
+ {"keyShortcutsPrevTab",
+ INPUT_UNKNOWN, Input::KEY_NO_VALUE,
+ INPUT_UNKNOWN, Input::KEY_NO_VALUE,
+ Input::GRP_DEFAULT | Input::GRP_GUI,
+ &ActionManager::prevShortcutsTab,
+ Input::KEY_NO_VALUE, 50,
+ COND_NOINPUT | COND_INGAME},
+ {"keyShortcutsNextTab",
+ INPUT_UNKNOWN, Input::KEY_NO_VALUE,
+ INPUT_UNKNOWN, Input::KEY_NO_VALUE,
+ Input::GRP_DEFAULT | Input::GRP_GUI,
+ &ActionManager::nextShortcutsTab,
+ Input::KEY_NO_VALUE, 50,
+ COND_NOINPUT | COND_INGAME},
+ {"keyCommandsPrevTab",
+ INPUT_UNKNOWN, Input::KEY_NO_VALUE,
+ INPUT_UNKNOWN, Input::KEY_NO_VALUE,
+ Input::GRP_DEFAULT | Input::GRP_GUI,
+ &ActionManager::prevCommandsTab,
+ Input::KEY_NO_VALUE, 50,
+ COND_NOINPUT | COND_INGAME},
+ {"keyCommandsNextTab",
+ INPUT_UNKNOWN, Input::KEY_NO_VALUE,
+ INPUT_UNKNOWN, Input::KEY_NO_VALUE,
+ Input::GRP_DEFAULT | Input::GRP_GUI,
+ &ActionManager::nextCommandsTab,
+ Input::KEY_NO_VALUE, 50,
+ COND_NOINPUT | COND_INGAME},
+ {"keyOpenTrade",
+ INPUT_UNKNOWN, Input::KEY_NO_VALUE,
+ INPUT_UNKNOWN, Input::KEY_NO_VALUE,
+ Input::GRP_DEFAULT,
+ &ActionManager::openTrade,
+ Input::KEY_NO_VALUE, 50,
+ COND_GAME | COND_NOTARGET},
};
#endif // INPUT_KEYBOARDDATA_H
diff --git a/src/input/keydata.h b/src/input/keydata.h
index a0fb8341b..2ceb957c5 100644
--- a/src/input/keydata.h
+++ b/src/input/keydata.h
@@ -353,6 +353,11 @@ namespace Input
KEY_GUI_U,
KEY_GUI_V,
KEY_GUI_W,
+ KEY_PREV_SHORTCUTS_TAB,
+ KEY_NEXT_SHORTCUTS_TAB,
+ KEY_PREV_COMMANDS_TAB,
+ KEY_NEXT_COMMANDS_TAB,
+ KEY_OPEN_TRADE,
KEY_TOTAL
};
} // namespace Input