diff options
-rw-r--r-- | src/game.cpp | 11 | ||||
-rw-r--r-- | src/gui/chat.cpp | 22 | ||||
-rw-r--r-- | src/gui/chat.h | 10 | ||||
-rw-r--r-- | src/keyboardconfig.cpp | 2 | ||||
-rw-r--r-- | src/keyboardconfig.h | 2 |
5 files changed, 47 insertions, 0 deletions
diff --git a/src/game.cpp b/src/game.cpp index ba756df3..2dc62b05 100644 --- a/src/game.cpp +++ b/src/game.cpp @@ -722,6 +722,17 @@ void Game::handleInput() used = true; } + if (keyboard.isKeyActive(keyboard.KEY_PREV_CHAT_TAB)) + { + chatWindow->prevTab(); + return; + } + else if (keyboard.isKeyActive(keyboard.KEY_NEXT_CHAT_TAB)) + { + chatWindow->nextTab(); + return; + } + const int tKey = keyboard.getKeyIndex(event.key.keysym.sym); switch (tKey) { diff --git a/src/gui/chat.cpp b/src/gui/chat.cpp index 987de11e..398b5792 100644 --- a/src/gui/chat.cpp +++ b/src/gui/chat.cpp @@ -159,6 +159,28 @@ void ChatWindow::clearTab() clearTab(getFocused()); } +void ChatWindow::prevTab() +{ + int tab = mChatTabs->getSelectedTabIndex(); + + if (tab == 0) + tab = mChatTabs->getNumberOfTabs(); + tab--; + + mChatTabs->setSelectedTab(tab); +} + +void ChatWindow::nextTab() +{ + int tab = mChatTabs->getSelectedTabIndex(); + + tab++; + if (tab == mChatTabs->getNumberOfTabs()) + tab = 0; + + mChatTabs->setSelectedTab(tab); +} + void ChatWindow::action(const gcn::ActionEvent &event) { if (event.getId() == "chatinput") diff --git a/src/gui/chat.h b/src/gui/chat.h index 54270055..3a2f7fdb 100644 --- a/src/gui/chat.h +++ b/src/gui/chat.h @@ -103,6 +103,16 @@ class ChatWindow : public Window, void clearTab(); /** + * Switch to the previous tab in order + */ + void prevTab(); + + /** + * Switch to the next tab in order + */ + void nextTab(); + + /** * Performs action. */ void action(const gcn::ActionEvent &event); diff --git a/src/keyboardconfig.cpp b/src/keyboardconfig.cpp index 06ce4ac7..e13af147 100644 --- a/src/keyboardconfig.cpp +++ b/src/keyboardconfig.cpp @@ -94,6 +94,8 @@ static KeyData const keyData[KeyboardConfig::KEY_TOTAL] = { {"keyChat", SDLK_RETURN, _("Toggle Chat")}, {"keyChatScrollUp", SDLK_PAGEUP, _("Scroll Chat Up")}, {"keyChatScrollDown", SDLK_PAGEDOWN, _("Scroll Chat Down")}, + {"keyChatPrevTab", SDLK_LEFTBRACKET, _("Previous Chat Tab")}, + {"keyChatNextTab", SDLK_RIGHTBRACKET, _("Next Chat Tab")}, {"keyOK", SDLK_RETURN, _("Select OK")}, {"keyQuit", SDLK_ESCAPE, _("Quit")}, {"keyIgnoreInput1", SDLK_LSUPER, _("Ignore input 1")}, diff --git a/src/keyboardconfig.h b/src/keyboardconfig.h index f7750b30..ecbe5de5 100644 --- a/src/keyboardconfig.h +++ b/src/keyboardconfig.h @@ -205,6 +205,8 @@ class KeyboardConfig KEY_TOGGLE_CHAT, KEY_SCROLL_CHAT_UP, KEY_SCROLL_CHAT_DOWN, + KEY_PREV_CHAT_TAB, + KEY_NEXT_CHAT_TAB, KEY_OK, KEY_QUIT, KEY_IGNORE_INPUT_1, |