aboutsummaryrefslogtreecommitdiff
path: root/gui
diff options
context:
space:
mode:
Diffstat (limited to 'gui')
-rw-r--r--gui/debugger.cpp20
-rw-r--r--gui/debugger.h1
-rw-r--r--gui/dialog.cpp13
-rw-r--r--gui/themes/translations.datbin441486 -> 430660 bytes
-rw-r--r--gui/widgets/tab.cpp29
-rw-r--r--gui/widgets/tab.h7
6 files changed, 66 insertions, 4 deletions
diff --git a/gui/debugger.cpp b/gui/debugger.cpp
index 2ec9937fdb..3cfa9f9803 100644
--- a/gui/debugger.cpp
+++ b/gui/debugger.cpp
@@ -61,6 +61,7 @@ Debugger::Debugger() {
DCmd_Register("help", WRAP_METHOD(Debugger, Cmd_Help));
DCmd_Register("openlog", WRAP_METHOD(Debugger, Cmd_OpenLog));
+ DCmd_Register("debuglevel", WRAP_METHOD(Debugger, Cmd_DebugLevel));
DCmd_Register("debugflag_list", WRAP_METHOD(Debugger, Cmd_DebugFlagsList));
DCmd_Register("debugflag_enable", WRAP_METHOD(Debugger, Cmd_DebugFlagEnable));
DCmd_Register("debugflag_disable", WRAP_METHOD(Debugger, Cmd_DebugFlagDisable));
@@ -501,6 +502,25 @@ bool Debugger::Cmd_OpenLog(int argc, const char **argv) {
}
+bool Debugger::Cmd_DebugLevel(int argc, const char **argv) {
+ if (argc == 1) { // print level
+ DebugPrintf("Debugging is currently %s (set at level %d)\n", (gDebugLevel >= 0) ? "enabled" : "disabled", gDebugLevel);
+ DebugPrintf("Usage: %s <n> where n is 0 to 10 or -1 to disable debugging\n", argv[0]);
+ } else { // set level
+ gDebugLevel = atoi(argv[1]);
+ if (gDebugLevel >= 0 && gDebugLevel < 11) {
+ DebugPrintf("Debug level set to level %d\n", gDebugLevel);
+ } else if (gDebugLevel < 0) {
+ DebugPrintf("Debugging is now disabled\n");
+ } else {
+ DebugPrintf("Invalid debug level value\n");
+ DebugPrintf("Usage: %s <n> where n is 0 to 10 or -1 to disable debugging\n", argv[0]);
+ }
+ }
+
+ return true;
+}
+
bool Debugger::Cmd_DebugFlagsList(int argc, const char **argv) {
const Common::DebugManager::DebugChannelList &debugLevels = DebugMan.listDebugChannels();
diff --git a/gui/debugger.h b/gui/debugger.h
index 4ce5481fbb..7481f89df2 100644
--- a/gui/debugger.h
+++ b/gui/debugger.h
@@ -193,6 +193,7 @@ protected:
bool Cmd_Exit(int argc, const char **argv);
bool Cmd_Help(int argc, const char **argv);
bool Cmd_OpenLog(int argc, const char **argv);
+ bool Cmd_DebugLevel(int argc, const char **argv);
bool Cmd_DebugFlagsList(int argc, const char **argv);
bool Cmd_DebugFlagEnable(int argc, const char **argv);
bool Cmd_DebugFlagDisable(int argc, const char **argv);
diff --git a/gui/dialog.cpp b/gui/dialog.cpp
index ec392a877a..fa4e508494 100644
--- a/gui/dialog.cpp
+++ b/gui/dialog.cpp
@@ -250,7 +250,18 @@ void Dialog::handleKeyDown(Common::KeyState state) {
close();
}
- // TODO: tab/shift-tab should focus the next/previous focusable widget
+ if (state.keycode == Common::KEYCODE_TAB) {
+ // TODO: Maybe add Tab behaviours for all widgets too.
+ // searches through widgets on screen for tab widget
+ Widget *w = _firstWidget;
+ while (w) {
+ if (w->_type == kTabWidget)
+ if (w->handleKeyDown(state))
+ return;
+
+ w = w->_next;
+ }
+ }
}
void Dialog::handleKeyUp(Common::KeyState state) {
diff --git a/gui/themes/translations.dat b/gui/themes/translations.dat
index 7bd1316208..1a7b49852d 100644
--- a/gui/themes/translations.dat
+++ b/gui/themes/translations.dat
Binary files differ
diff --git a/gui/widgets/tab.cpp b/gui/widgets/tab.cpp
index a8b3f5450d..756781a04b 100644
--- a/gui/widgets/tab.cpp
+++ b/gui/widgets/tab.cpp
@@ -183,6 +183,7 @@ void TabWidget::setActiveTab(int tabID) {
}
_activeTab = tabID;
_firstWidget = _tabs[tabID].firstWidget;
+
_boss->draw();
}
}
@@ -226,12 +227,34 @@ void TabWidget::handleMouseDown(int x, int y, int button, int clickCount) {
}
bool TabWidget::handleKeyDown(Common::KeyState state) {
- // TODO: maybe there should be a way to switch between tabs
- // using the keyboard? E.g. Alt-Shift-Left/Right-Arrow or something
- // like that.
+ if (state.hasFlags(Common::KBD_SHIFT) && state.keycode == Common::KEYCODE_TAB)
+ adjustTabs(kTabBackwards);
+ else if (state.keycode == Common::KEYCODE_TAB)
+ adjustTabs(kTabForwards);
+
return Widget::handleKeyDown(state);
}
+void TabWidget::adjustTabs(int value) {
+ // Determine which tab is next
+ int tabID = _activeTab + value;
+ if (tabID >= (int)_tabs.size())
+ tabID = 0;
+ else if (tabID < 0)
+ tabID = ((int)_tabs.size() - 1);
+
+ // Slides _firstVisibleTab forward to the correct tab
+ int maxTabsOnScreen = (_w / _tabWidth);
+ if (tabID >= maxTabsOnScreen && (_firstVisibleTab + maxTabsOnScreen) < (int)_tabs.size())
+ _firstVisibleTab++;
+
+ // Slides _firstVisibleTab backwards to the correct tab
+ while (tabID < _firstVisibleTab)
+ _firstVisibleTab--;
+
+ setActiveTab(tabID);
+}
+
void TabWidget::reflowLayout() {
Widget::reflowLayout();
diff --git a/gui/widgets/tab.h b/gui/widgets/tab.h
index 38aa089eb5..a01ee2d9dc 100644
--- a/gui/widgets/tab.h
+++ b/gui/widgets/tab.h
@@ -28,6 +28,11 @@
#include "common/array.h"
namespace GUI {
+
+enum {
+ kTabForwards = 1,
+ kTabBackwards = -1
+};
class TabWidget : public Widget {
typedef Common::String String;
@@ -109,6 +114,8 @@ protected:
virtual void drawWidget();
virtual Widget *findWidget(int x, int y);
+
+ virtual void adjustTabs(int value);
};
} // End of namespace GUI