aboutsummaryrefslogtreecommitdiff
path: root/gui
diff options
context:
space:
mode:
Diffstat (limited to 'gui')
-rw-r--r--gui/Actions.cpp4
-rw-r--r--gui/Actions.h4
-rw-r--r--gui/EventRecorder.cpp4
-rw-r--r--gui/EventRecorder.h4
-rw-r--r--gui/Key.cpp4
-rw-r--r--gui/Key.h4
-rw-r--r--gui/KeysDialog.cpp4
-rw-r--r--gui/KeysDialog.h4
-rw-r--r--gui/ThemeEngine.cpp17
-rw-r--r--gui/Tooltip.cpp1
-rw-r--r--gui/Tooltip.h1
-rw-r--r--gui/about.cpp3
-rw-r--r--gui/about.h1
-rw-r--r--gui/browser.cpp1
-rw-r--r--gui/browser.h1
-rw-r--r--gui/chooser.cpp1
-rw-r--r--gui/chooser.h1
-rw-r--r--gui/console.cpp24
-rw-r--r--gui/console.h7
-rw-r--r--gui/credits.h37
-rw-r--r--gui/debugger.cpp195
-rw-r--r--gui/debugger.h56
-rw-r--r--gui/dialog.cpp14
-rw-r--r--gui/dialog.h1
-rw-r--r--gui/editrecorddialog.cpp4
-rw-r--r--gui/editrecorddialog.h4
-rw-r--r--gui/error.cpp4
-rw-r--r--gui/error.h4
-rw-r--r--gui/fluidsynth-dialog.cpp1
-rw-r--r--gui/fluidsynth-dialog.h1
-rw-r--r--gui/gui-manager.cpp14
-rw-r--r--gui/gui-manager.h1
-rw-r--r--gui/launcher.cpp1
-rw-r--r--gui/launcher.h1
-rw-r--r--gui/massadd.cpp1
-rw-r--r--gui/massadd.h1
-rw-r--r--gui/message.cpp1
-rw-r--r--gui/message.h1
-rw-r--r--gui/object.cpp1
-rw-r--r--gui/object.h1
-rw-r--r--gui/onscreendialog.cpp4
-rw-r--r--gui/onscreendialog.h4
-rw-r--r--gui/options.cpp1
-rw-r--r--gui/options.h1
-rw-r--r--gui/predictivedialog.cpp7
-rw-r--r--gui/predictivedialog.h1
-rw-r--r--gui/recorderdialog.cpp1
-rw-r--r--gui/recorderdialog.h1
-rw-r--r--gui/saveload-dialog.cpp1
-rw-r--r--gui/saveload-dialog.h1
-rw-r--r--gui/saveload.cpp1
-rw-r--r--gui/saveload.h1
-rw-r--r--gui/themebrowser.cpp1
-rw-r--r--gui/themebrowser.h1
-rw-r--r--gui/themes/default.inc9
-rw-r--r--gui/themes/scummclassic.zipbin113348 -> 110107 bytes
-rw-r--r--gui/themes/scummclassic/classic_layout_lowres.stx77
-rwxr-xr-xgui/themes/scummtheme.py8
-rw-r--r--gui/themes/translations.datbin441486 -> 430660 bytes
-rw-r--r--gui/widget.cpp1
-rw-r--r--gui/widget.h1
-rw-r--r--gui/widgets/editable.cpp37
-rw-r--r--gui/widgets/editable.h6
-rw-r--r--gui/widgets/edittext.cpp3
-rw-r--r--gui/widgets/edittext.h1
-rw-r--r--gui/widgets/list.cpp3
-rw-r--r--gui/widgets/list.h1
-rw-r--r--gui/widgets/popup.cpp1
-rw-r--r--gui/widgets/popup.h1
-rw-r--r--gui/widgets/scrollbar.cpp1
-rw-r--r--gui/widgets/scrollbar.h1
-rw-r--r--gui/widgets/tab.cpp30
-rw-r--r--gui/widgets/tab.h8
73 files changed, 435 insertions, 214 deletions
diff --git a/gui/Actions.cpp b/gui/Actions.cpp
index 0c80844ff9..b25f75e4af 100644
--- a/gui/Actions.cpp
+++ b/gui/Actions.cpp
@@ -8,12 +8,12 @@
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
-
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
-
+ *
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
diff --git a/gui/Actions.h b/gui/Actions.h
index 039fb9019c..ac7bd39093 100644
--- a/gui/Actions.h
+++ b/gui/Actions.h
@@ -8,12 +8,12 @@
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
-
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
-
+ *
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
diff --git a/gui/EventRecorder.cpp b/gui/EventRecorder.cpp
index 71f66911e9..ab284aaa6e 100644
--- a/gui/EventRecorder.cpp
+++ b/gui/EventRecorder.cpp
@@ -8,12 +8,12 @@
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
-
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
-
+ *
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
diff --git a/gui/EventRecorder.h b/gui/EventRecorder.h
index b2a549ece8..5f016b0c33 100644
--- a/gui/EventRecorder.h
+++ b/gui/EventRecorder.h
@@ -8,12 +8,12 @@
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
-
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
-
+ *
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
diff --git a/gui/Key.cpp b/gui/Key.cpp
index fa29971e12..cec48ffb65 100644
--- a/gui/Key.cpp
+++ b/gui/Key.cpp
@@ -8,12 +8,12 @@
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
-
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
-
+ *
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
diff --git a/gui/Key.h b/gui/Key.h
index f8f8983c97..8bbbc4fdaa 100644
--- a/gui/Key.h
+++ b/gui/Key.h
@@ -8,12 +8,12 @@
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
-
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
-
+ *
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
diff --git a/gui/KeysDialog.cpp b/gui/KeysDialog.cpp
index f28b039763..7adb20a379 100644
--- a/gui/KeysDialog.cpp
+++ b/gui/KeysDialog.cpp
@@ -8,12 +8,12 @@
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
-
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
-
+ *
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
diff --git a/gui/KeysDialog.h b/gui/KeysDialog.h
index 2dd6076a02..e0cf025583 100644
--- a/gui/KeysDialog.h
+++ b/gui/KeysDialog.h
@@ -8,12 +8,12 @@
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
-
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
-
+ *
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
diff --git a/gui/ThemeEngine.cpp b/gui/ThemeEngine.cpp
index 688654d208..ed01204180 100644
--- a/gui/ThemeEngine.cpp
+++ b/gui/ThemeEngine.cpp
@@ -34,7 +34,8 @@
#include "graphics/VectorRenderer.h"
#include "graphics/fonts/bdf.h"
#include "graphics/fonts/ttf.h"
-#include "graphics/decoders/bmp.h"
+
+#include "image/bmp.h"
#include "gui/widget.h"
#include "gui/ThemeEngine.h"
@@ -638,7 +639,7 @@ bool ThemeEngine::addBitmap(const Common::String &filename) {
return true;
// If not, try to load the bitmap via the BitmapDecoder class.
- Graphics::BitmapDecoder bitmapDecoder;
+ Image::BitmapDecoder bitmapDecoder;
const Graphics::Surface *srcSurface = 0;
Common::ArchiveMemberList members;
_themeFiles.listMatchingMembers(members, filename);
@@ -1360,17 +1361,17 @@ bool ThemeEngine::createCursor(const Common::String &filename, int hotspotX, int
// If there is no entry yet for this color in the palette: Add one
if (!colorToIndex.contains(col)) {
+ if (colorsFound >= MAX_CURS_COLORS) {
+ warning("Cursor contains too many colors (%d, but only %d are allowed)", colorsFound, MAX_CURS_COLORS);
+ return false;
+ }
+
const int index = colorsFound++;
colorToIndex[col] = index;
_cursorPal[index * 3 + 0] = r;
_cursorPal[index * 3 + 1] = g;
_cursorPal[index * 3 + 2] = b;
-
- if (colorsFound > MAX_CURS_COLORS) {
- warning("Cursor contains too many colors (%d, but only %d are allowed)", colorsFound, MAX_CURS_COLORS);
- return false;
- }
}
// Copy pixel from the 16 bit source surface to the 8bit target surface
@@ -1445,7 +1446,7 @@ const Graphics::Font *ThemeEngine::loadScalableFont(const Common::String &filena
for (Common::ArchiveMemberList::const_iterator i = members.begin(), end = members.end(); i != end; ++i) {
Common::SeekableReadStream *stream = (*i)->createReadStream();
if (stream) {
- font = Graphics::loadTTFFont(*stream, pointsize, 0, false,
+ font = Graphics::loadTTFFont(*stream, pointsize, 0, Graphics::kTTFRenderModeLight,
#ifdef USE_TRANSLATION
TransMan.getCharsetMapping()
#else
diff --git a/gui/Tooltip.cpp b/gui/Tooltip.cpp
index 88124e782b..e5f06bcafe 100644
--- a/gui/Tooltip.cpp
+++ b/gui/Tooltip.cpp
@@ -17,6 +17,7 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
*/
#include "common/util.h"
diff --git a/gui/Tooltip.h b/gui/Tooltip.h
index 9ab536b349..f83fc40966 100644
--- a/gui/Tooltip.h
+++ b/gui/Tooltip.h
@@ -17,6 +17,7 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
*/
#ifndef GUI_TOOLTIP_H
diff --git a/gui/about.cpp b/gui/about.cpp
index 3bb1934e28..fe726df750 100644
--- a/gui/about.cpp
+++ b/gui/about.cpp
@@ -17,6 +17,7 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
*/
#include "engines/metaengine.h"
@@ -56,7 +57,7 @@ enum {
static const char *copyright_text[] = {
"",
-"C0""Copyright (C) 2001-2013 The ScummVM project",
+"C0""Copyright (C) 2001-2014 The ScummVM Team",
"C0""http://www.scummvm.org",
"",
"C0""ScummVM is the legal property of its developers, whose names are too numerous to list here. Please refer to the COPYRIGHT file distributed with this binary.",
diff --git a/gui/about.h b/gui/about.h
index 65062ab79d..9eeb3071f3 100644
--- a/gui/about.h
+++ b/gui/about.h
@@ -17,6 +17,7 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
*/
#ifndef ABOUT_DIALOG_H
diff --git a/gui/browser.cpp b/gui/browser.cpp
index 84f2d0f747..83e240a5bc 100644
--- a/gui/browser.cpp
+++ b/gui/browser.cpp
@@ -17,6 +17,7 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
*/
#include "gui/browser.h"
diff --git a/gui/browser.h b/gui/browser.h
index b82fe516f9..b77907bad2 100644
--- a/gui/browser.h
+++ b/gui/browser.h
@@ -17,6 +17,7 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
*/
#ifndef BROWSER_DIALOG_H
diff --git a/gui/chooser.cpp b/gui/chooser.cpp
index c195e94c9b..61af3de407 100644
--- a/gui/chooser.cpp
+++ b/gui/chooser.cpp
@@ -17,6 +17,7 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
*/
#include "common/translation.h"
diff --git a/gui/chooser.h b/gui/chooser.h
index d7e795b344..47b34b7233 100644
--- a/gui/chooser.h
+++ b/gui/chooser.h
@@ -17,6 +17,7 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
*/
#ifndef CHOOSER_DIALOG_H
diff --git a/gui/console.cpp b/gui/console.cpp
index 49e2fccd98..4cdad41f5f 100644
--- a/gui/console.cpp
+++ b/gui/console.cpp
@@ -17,6 +17,7 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
*/
#include "gui/console.h"
@@ -82,8 +83,6 @@ ConsoleDialog::ConsoleDialog(float widthPercent, float heightPercent)
_historyIndex = 0;
_historyLine = 0;
_historySize = 0;
- for (int i = 0; i < kHistorySize; i++)
- _history[i][0] = '\0';
// Display greetings & prompt
print(gScummVMFullVersion);
@@ -274,24 +273,19 @@ void ConsoleDialog::handleKeyDown(Common::KeyState state) {
if (len > 0) {
- // We have to allocate the string buffer with new, since VC++ sadly does not
- // comply to the C++ standard, so we can't use a dynamic sized stack array.
- char *str = new char[len + 1];
+ Common::String str;
// Copy the user input to str
for (i = 0; i < len; i++)
- str[i] = buffer(_promptStartPos + i);
- str[len] = '\0';
+ str.insertChar(buffer(_promptStartPos + i), i);
// Add the input to the history
addToHistory(str);
// Pass it to the input callback, if any
if (_callbackProc)
- keepRunning = (*_callbackProc)(this, str, _callbackRefCon);
+ keepRunning = (*_callbackProc)(this, str.c_str(), _callbackRefCon);
- // Get rid of the string buffer
- delete[] str;
}
print(PROMPT);
@@ -575,8 +569,8 @@ void ConsoleDialog::killLastWord() {
}
}
-void ConsoleDialog::addToHistory(const char *str) {
- strcpy(_history[_historyIndex], str);
+void ConsoleDialog::addToHistory(const Common::String &str) {
+ _history[_historyIndex] = str;
_historyIndex = (_historyIndex + 1) % kHistorySize;
_historyLine = 0;
if (_historySize < kHistorySize)
@@ -590,8 +584,7 @@ void ConsoleDialog::historyScroll(int direction) {
if (_historyLine == 0 && direction > 0) {
int i;
for (i = 0; i < _promptEndPos - _promptStartPos; i++)
- _history[_historyIndex][i] = buffer(_promptStartPos + i);
- _history[_historyIndex][i] = '\0';
+ _history[_historyIndex].insertChar(buffer(_promptStartPos + i), i);
}
// Advance to the next line in the history
@@ -617,7 +610,8 @@ void ConsoleDialog::historyScroll(int direction) {
idx = (_historyIndex - _historyLine + _historySize) % _historySize;
else
idx = _historyIndex;
- for (int i = 0; i < kLineBufferSize && _history[idx][i] != '\0'; i++)
+ int length = _history[idx].size();
+ for (int i = 0; i < length; i++)
printCharIntern(_history[idx][i]);
_promptEndPos = _currentPos;
diff --git a/gui/console.h b/gui/console.h
index 50a00a1ad1..430d5b9434 100644
--- a/gui/console.h
+++ b/gui/console.h
@@ -17,12 +17,14 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
*/
#ifndef CONSOLE_DIALOG_H
#define CONSOLE_DIALOG_H
#include "gui/dialog.h"
+#include "common/str.h"
namespace GUI {
@@ -69,7 +71,6 @@ protected:
enum {
kBufferSize = 32768,
kCharsPerLine = 128,
- kLineBufferSize = 256,
kHistorySize = 20
};
@@ -112,7 +113,7 @@ protected:
CompletionCallbackProc _completionCallbackProc;
void *_completionCallbackRefCon;
- char _history[kHistorySize][kLineBufferSize];
+ Common::String _history[kHistorySize];
int _historySize;
int _historyIndex;
int _historyLine;
@@ -184,7 +185,7 @@ protected:
void killLastWord();
// History
- void addToHistory(const char *str);
+ void addToHistory(const Common::String &str);
void historyScroll(int direction);
};
diff --git a/gui/credits.h b/gui/credits.h
index aca3745631..d5c12515d3 100644
--- a/gui/credits.h
+++ b/gui/credits.h
@@ -77,7 +77,7 @@ static const char *credits[] = {
"C0""Ludvig Strigeus",
"C2""(retired)",
"",
-"C1""AVALANCHE",
+"C1""Avalanche",
"A0""Peter Bozso",
"C0""Peter Bozs\363",
"A0""Arnaud Boutonne",
@@ -168,6 +168,12 @@ static const char *credits[] = {
"C0""Benjamin Haisch",
"C0""Filippos Karapetis",
"",
+"C1""MADS",
+"A0""Arnaud Boutonne",
+"C0""Arnaud Boutonn\351",
+"C0""Paul Gilbert",
+"C0""Filippos Karapetis",
+"",
"C1""Mohawk",
"C0""Bastien Bouclet",
"C0""Matthew Hoops",
@@ -299,6 +305,11 @@ static const char *credits[] = {
"C0""Gregory Montoir",
"C2""(retired)",
"",
+"C1""Voyeur",
+"A0""Arnaud Boutonne",
+"C0""Arnaud Boutonn\351",
+"C0""Paul Gilbert",
+"",
"C1""Wintermute",
"A0""Einar Johan T. Somaaen",
"C0""Einar Johan T. S\370m\345en",
@@ -522,7 +533,7 @@ static const char *credits[] = {
"C0""Johannes Schickel",
"",
"",
-"C1""Translations",
+"C1""GUI Translations",
"C0""Thierry Crozat",
"C2""Translation Lead",
"C1""Basque",
@@ -592,6 +603,28 @@ static const char *credits[] = {
"C0""Lubomyr Lisen",
"",
"",
+"C1""Game Translations",
+"C1""CGE",
+"C0""Dan Serban",
+"C2""Soltys English translation",
+"A0""Victor Gonzalez",
+"C0""V\355ctor Gonz\341lez",
+"C2""Soltys Spanish translation",
+"A0""Alejandro Gomez de la Munoza",
+"C0""Alejandro G\363mez de la Mu\361oza",
+"C2""Soltys Spanish translation",
+"",
+"C1""Drascula",
+"C0""Thierry Crozat",
+"C2""Improve French translation",
+"",
+"C1""Mortevielle",
+"C0""Hugo Labrande",
+"C2""Improve English translation",
+"C0""Thierry Crozat",
+"C2""Improve English translation",
+"",
+"",
"C1""Websites (design)",
"A0""Dobo Balazs",
"C0""Dob\363 Bal\341zs",
diff --git a/gui/debugger.cpp b/gui/debugger.cpp
index 35627dd584..dcdc18d7b9 100644
--- a/gui/debugger.cpp
+++ b/gui/debugger.cpp
@@ -8,12 +8,12 @@
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
-
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
-
+ *
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
@@ -23,6 +23,7 @@
// NB: This is really only necessary if USE_READLINE is defined
#define FORBIDDEN_SYMBOL_ALLOW_ALL
+#include "common/debug.h"
#include "common/debug-channels.h"
#include "common/system.h"
@@ -51,19 +52,20 @@ Debugger::Debugger() {
#endif
// Register variables
- DVar_Register("debug_countdown", &_frameCountdown, DVAR_INT, 0);
+ registerVar("debug_countdown", &_frameCountdown, DVAR_INT, 0);
// Register commands
- //DCmd_Register("continue", WRAP_METHOD(Debugger, Cmd_Exit));
- DCmd_Register("exit", WRAP_METHOD(Debugger, Cmd_Exit));
- DCmd_Register("quit", WRAP_METHOD(Debugger, Cmd_Exit));
+ //registerCmd("continue", WRAP_METHOD(Debugger, cmdExit));
+ registerCmd("exit", WRAP_METHOD(Debugger, cmdExit));
+ registerCmd("quit", WRAP_METHOD(Debugger, cmdExit));
- DCmd_Register("help", WRAP_METHOD(Debugger, Cmd_Help));
- DCmd_Register("openlog", WRAP_METHOD(Debugger, Cmd_OpenLog));
+ registerCmd("help", WRAP_METHOD(Debugger, cmdHelp));
+ registerCmd("openlog", WRAP_METHOD(Debugger, cmdOpenLog));
- 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));
+ registerCmd("debuglevel", WRAP_METHOD(Debugger, cmdDebugLevel));
+ registerCmd("debugflag_list", WRAP_METHOD(Debugger, cmdDebugFlagsList));
+ registerCmd("debugflag_enable", WRAP_METHOD(Debugger, cmdDebugFlagEnable));
+ registerCmd("debugflag_disable", WRAP_METHOD(Debugger, cmdDebugFlagDisable));
}
Debugger::~Debugger() {
@@ -74,7 +76,7 @@ Debugger::~Debugger() {
// Initialisation Functions
-int Debugger::DebugPrintf(const char *format, ...) {
+int Debugger::debugPrintf(const char *format, ...) {
va_list argptr;
va_start(argptr, format);
@@ -133,6 +135,14 @@ Debugger *g_readline_debugger;
char *readline_completionFunction(const char *text, int state) {
return g_readline_debugger->readlineComplete(text, state);
}
+
+#ifdef USE_READLINE_INT_COMPLETION
+typedef int RLCompFunc_t(const char *, int);
+#else
+typedef char *RLCompFunc_t(const char *, int);
+#endif
+
+
} // end of anonymous namespace
#endif
@@ -143,13 +153,13 @@ void Debugger::enter() {
#ifndef USE_TEXT_CONSOLE_FOR_DEBUGGER
if (_firstTime) {
- DebugPrintf("Debugger started, type 'exit' to return to the game.\n");
- DebugPrintf("Type 'help' to see a little list of commands and variables.\n");
+ debugPrintf("Debugger started, type 'exit' to return to the game.\n");
+ debugPrintf("Type 'help' to see a little list of commands and variables.\n");
_firstTime = false;
}
if (_errStr) {
- DebugPrintf("ERROR: %s\n\n", _errStr);
+ debugPrintf("ERROR: %s\n\n", _errStr);
free(_errStr);
_errStr = NULL;
}
@@ -162,7 +172,7 @@ void Debugger::enter() {
// TODO: add support for saving/loading history?
g_readline_debugger = this;
- rl_completion_entry_function = &readline_completionFunction;
+ rl_completion_entry_function = (RLCompFunc_t *)&readline_completionFunction;
char *line_read = 0;
do {
@@ -232,82 +242,82 @@ bool Debugger::parseCommand(const char *inputOrig) {
}
// It's not a command, so things get a little tricky for variables. Do fuzzy matching to ignore things like subscripts.
- for (uint i = 0; i < _dvars.size(); i++) {
- if (!strncmp(_dvars[i].name.c_str(), param[0], _dvars[i].name.size())) {
+ for (uint i = 0; i < _vars.size(); i++) {
+ if (!strncmp(_vars[i].name.c_str(), param[0], _vars[i].name.size())) {
if (num_params > 1) {
// Alright, we need to check the TYPE of the variable to deref and stuff... the array stuff is a bit ugly :)
- switch (_dvars[i].type) {
+ switch (_vars[i].type) {
// Integer
case DVAR_BYTE:
- *(byte *)_dvars[i].variable = atoi(param[1]);
- DebugPrintf("byte%s = %d\n", param[0], *(byte *)_dvars[i].variable);
+ *(byte *)_vars[i].variable = atoi(param[1]);
+ debugPrintf("byte%s = %d\n", param[0], *(byte *)_vars[i].variable);
break;
case DVAR_INT:
- *(int32 *)_dvars[i].variable = atoi(param[1]);
- DebugPrintf("(int)%s = %d\n", param[0], *(int32 *)_dvars[i].variable);
+ *(int32 *)_vars[i].variable = atoi(param[1]);
+ debugPrintf("(int)%s = %d\n", param[0], *(int32 *)_vars[i].variable);
break;
case DVAR_BOOL:
- if (Common::parseBool(param[1], *(bool *)_dvars[i].variable))
- DebugPrintf("(bool)%s = %s\n", param[0], *(bool *)_dvars[i].variable ? "true" : "false");
+ if (Common::parseBool(param[1], *(bool *)_vars[i].variable))
+ debugPrintf("(bool)%s = %s\n", param[0], *(bool *)_vars[i].variable ? "true" : "false");
else
- DebugPrintf("Invalid value for boolean variable. Valid values are \"true\", \"false\", \"1\", \"0\", \"yes\", \"no\"\n");
+ debugPrintf("Invalid value for boolean variable. Valid values are \"true\", \"false\", \"1\", \"0\", \"yes\", \"no\"\n");
break;
// Integer Array
case DVAR_INTARRAY: {
const char *chr = strchr(param[0], '[');
if (!chr) {
- DebugPrintf("You must access this array as %s[element]\n", param[0]);
+ debugPrintf("You must access this array as %s[element]\n", param[0]);
} else {
int element = atoi(chr+1);
- int32 *var = *(int32 **)_dvars[i].variable;
- if (element >= _dvars[i].arraySize) {
- DebugPrintf("%s is out of range (array is %d elements big)\n", param[0], _dvars[i].arraySize);
+ int32 *var = *(int32 **)_vars[i].variable;
+ if (element >= _vars[i].arraySize) {
+ debugPrintf("%s is out of range (array is %d elements big)\n", param[0], _vars[i].arraySize);
} else {
var[element] = atoi(param[1]);
- DebugPrintf("(int)%s = %d\n", param[0], var[element]);
+ debugPrintf("(int)%s = %d\n", param[0], var[element]);
}
}
}
break;
default:
- DebugPrintf("Failed to set variable %s to %s - unknown type\n", _dvars[i].name.c_str(), param[1]);
+ debugPrintf("Failed to set variable %s to %s - unknown type\n", _vars[i].name.c_str(), param[1]);
break;
}
} else {
// And again, type-dependent prints/defrefs. The array one is still ugly.
- switch (_dvars[i].type) {
+ switch (_vars[i].type) {
// Integer
case DVAR_BYTE:
- DebugPrintf("(byte)%s = %d\n", param[0], *(const byte *)_dvars[i].variable);
+ debugPrintf("(byte)%s = %d\n", param[0], *(const byte *)_vars[i].variable);
break;
case DVAR_INT:
- DebugPrintf("(int)%s = %d\n", param[0], *(const int32 *)_dvars[i].variable);
+ debugPrintf("(int)%s = %d\n", param[0], *(const int32 *)_vars[i].variable);
break;
case DVAR_BOOL:
- DebugPrintf("(bool)%s = %s\n", param[0], *(const bool *)_dvars[i].variable ? "true" : "false");
+ debugPrintf("(bool)%s = %s\n", param[0], *(const bool *)_vars[i].variable ? "true" : "false");
break;
// Integer array
case DVAR_INTARRAY: {
const char *chr = strchr(param[0], '[');
if (!chr) {
- DebugPrintf("You must access this array as %s[element]\n", param[0]);
+ debugPrintf("You must access this array as %s[element]\n", param[0]);
} else {
int element = atoi(chr+1);
- const int32 *var = *(const int32 **)_dvars[i].variable;
- if (element >= _dvars[i].arraySize) {
- DebugPrintf("%s is out of range (array is %d elements big)\n", param[0], _dvars[i].arraySize);
+ const int32 *var = *(const int32 **)_vars[i].variable;
+ if (element >= _vars[i].arraySize) {
+ debugPrintf("%s is out of range (array is %d elements big)\n", param[0], _vars[i].arraySize);
} else {
- DebugPrintf("(int)%s = %d\n", param[0], var[element]);
+ debugPrintf("(int)%s = %d\n", param[0], var[element]);
}
}
}
break;
// String
case DVAR_STRING:
- DebugPrintf("(string)%s = %s\n", param[0], ((Common::String *)_dvars[i].variable)->c_str());
+ debugPrintf("(string)%s = %s\n", param[0], ((Common::String *)_vars[i].variable)->c_str());
break;
default:
- DebugPrintf("%s = (unknown type)\n", param[0]);
+ debugPrintf("%s = (unknown type)\n", param[0]);
break;
}
}
@@ -317,7 +327,7 @@ bool Debugger::parseCommand(const char *inputOrig) {
}
}
- DebugPrintf("Unknown command or variable\n");
+ debugPrintf("Unknown command or variable\n");
free(input);
return true;
}
@@ -396,36 +406,36 @@ char *Debugger::readlineComplete(const char *input, int state) {
#endif
// Variable registration function
-void Debugger::DVar_Register(const Common::String &varname, void *pointer, VarType type, int arraySize) {
+void Debugger::registerVar(const Common::String &varname, void *pointer, VarType type, int arraySize) {
// TODO: Filter out duplicates
// TODO: Sort this list? Then we can do binary search later on when doing lookups.
assert(pointer);
- DVar tmp;
+ Var tmp;
tmp.name = varname;
tmp.type = type;
tmp.variable = pointer;
tmp.arraySize = arraySize;
- _dvars.push_back(tmp);
+ _vars.push_back(tmp);
}
// Command registration function
-void Debugger::DCmd_Register(const Common::String &cmdname, Debuglet *debuglet) {
+void Debugger::registerCmd(const Common::String &cmdname, Debuglet *debuglet) {
assert(debuglet && debuglet->isValid());
_cmds[cmdname] = Common::SharedPtr<Debuglet>(debuglet);
}
// Detach ("exit") the debugger
-bool Debugger::Cmd_Exit(int argc, const char **argv) {
+bool Debugger::cmdExit(int argc, const char **argv) {
detach();
return false;
}
// Print a list of all registered commands (and variables, if any),
// nicely word-wrapped.
-bool Debugger::Cmd_Help(int argc, const char **argv) {
+bool Debugger::cmdHelp(int argc, const char **argv) {
#ifndef USE_TEXT_CONSOLE_FOR_DEBUGGER
const int charsPerLine = _debuggerDialog->getCharsPerLine();
#elif defined(USE_READLINE)
@@ -438,7 +448,7 @@ bool Debugger::Cmd_Help(int argc, const char **argv) {
int width, size;
uint i;
- DebugPrintf("Commands are:\n");
+ debugPrintf("Commands are:\n");
// Obtain a list of sorted command names
Common::Array<Common::String> cmds;
@@ -454,84 +464,109 @@ bool Debugger::Cmd_Help(int argc, const char **argv) {
size = cmds[i].size() + 1;
if ((width + size) >= charsPerLine) {
- DebugPrintf("\n");
+ debugPrintf("\n");
width = size;
} else
width += size;
- DebugPrintf("%s ", cmds[i].c_str());
+ debugPrintf("%s ", cmds[i].c_str());
}
- DebugPrintf("\n");
+ debugPrintf("\n");
- if (!_dvars.empty()) {
- DebugPrintf("\n");
- DebugPrintf("Variables are:\n");
+ if (!_vars.empty()) {
+ debugPrintf("\n");
+ debugPrintf("Variables are:\n");
width = 0;
- for (i = 0; i < _dvars.size(); i++) {
- size = _dvars[i].name.size() + 1;
+ for (i = 0; i < _vars.size(); i++) {
+ size = _vars[i].name.size() + 1;
if ((width + size) >= charsPerLine) {
- DebugPrintf("\n");
+ debugPrintf("\n");
width = size;
} else
width += size;
- DebugPrintf("%s ", _dvars[i].name.c_str());
+ debugPrintf("%s ", _vars[i].name.c_str());
}
- DebugPrintf("\n");
+ debugPrintf("\n");
}
return true;
}
-bool Debugger::Cmd_OpenLog(int argc, const char **argv) {
+bool Debugger::cmdOpenLog(int argc, const char **argv) {
if (g_system->hasFeature(OSystem::kFeatureDisplayLogFile))
g_system->displayLogFile();
else
- DebugPrintf("Opening the log file not supported on this system\n");
+ debugPrintf("Opening the log file not supported on this system\n");
return true;
}
-bool Debugger::Cmd_DebugFlagsList(int argc, const char **argv) {
+bool Debugger::cmdDebugLevel(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::cmdDebugFlagsList(int argc, const char **argv) {
const Common::DebugManager::DebugChannelList &debugLevels = DebugMan.listDebugChannels();
- DebugPrintf("Engine debug levels:\n");
- DebugPrintf("--------------------\n");
+ debugPrintf("Engine debug levels:\n");
+ debugPrintf("--------------------\n");
if (debugLevels.empty()) {
- DebugPrintf("No engine debug levels\n");
+ debugPrintf("No engine debug levels\n");
return true;
}
for (Common::DebugManager::DebugChannelList::const_iterator i = debugLevels.begin(); i != debugLevels.end(); ++i) {
- DebugPrintf("%c%s - %s (%s)\n", i->enabled ? '+' : ' ',
+ debugPrintf("%c%s - %s (%s)\n", i->enabled ? '+' : ' ',
i->name.c_str(), i->description.c_str(),
i->enabled ? "enabled" : "disabled");
}
- DebugPrintf("\n");
+ debugPrintf("\n");
return true;
}
-bool Debugger::Cmd_DebugFlagEnable(int argc, const char **argv) {
+bool Debugger::cmdDebugFlagEnable(int argc, const char **argv) {
if (argc < 2) {
- DebugPrintf("debugflag_enable <flag>\n");
+ debugPrintf("debugflag_enable [<flag> | all]\n");
} else {
- if (DebugMan.enableDebugChannel(argv[1])) {
- DebugPrintf("Enabled debug flag '%s'\n", argv[1]);
+ if (!scumm_stricmp(argv[1], "all")) {
+ debugPrintf("Enabled all debug flags\n");
+ DebugMan.enableAllDebugChannels();
+ } else if (DebugMan.enableDebugChannel(argv[1])) {
+ debugPrintf("Enabled debug flag '%s'\n", argv[1]);
} else {
- DebugPrintf("Failed to enable debug flag '%s'\n", argv[1]);
+ debugPrintf("Failed to enable debug flag '%s'\n", argv[1]);
}
}
return true;
}
-bool Debugger::Cmd_DebugFlagDisable(int argc, const char **argv) {
+bool Debugger::cmdDebugFlagDisable(int argc, const char **argv) {
if (argc < 2) {
- DebugPrintf("debugflag_disable <flag>\n");
+ debugPrintf("debugflag_disable [<flag> | all]\n");
} else {
- if (DebugMan.disableDebugChannel(argv[1])) {
- DebugPrintf("Disabled debug flag '%s'\n", argv[1]);
+ if (!scumm_stricmp(argv[1], "all")) {
+ debugPrintf("Disabled all debug flags\n");
+ DebugMan.disableAllDebugChannels();
+ } else if (DebugMan.disableDebugChannel(argv[1])) {
+ debugPrintf("Disabled debug flag '%s'\n", argv[1]);
} else {
- DebugPrintf("Failed to disable debug flag '%s'\n", argv[1]);
+ debugPrintf("Failed to disable debug flag '%s'\n", argv[1]);
}
}
return true;
diff --git a/gui/debugger.h b/gui/debugger.h
index b79e8723c1..8c7481b61f 100644
--- a/gui/debugger.h
+++ b/gui/debugger.h
@@ -17,6 +17,7 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
*/
#ifndef GUI_DEBUGGER_H
@@ -39,7 +40,7 @@ public:
Debugger();
virtual ~Debugger();
- int DebugPrintf(const char *format, ...) GCC_PRINTF(2, 3);
+ int debugPrintf(const char *format, ...) GCC_PRINTF(2, 3);
/**
* The onFrame() method should be invoked by the engine at regular
@@ -73,8 +74,8 @@ protected:
* Convenience macro that makes it easier to register a method
* of a debugger subclass as a command.
* Usage example:
- * DCmd_Register("COMMAND", WRAP_METHOD(MyDebugger, MyCmd));
- * would register the method MyDebugger::MyCmd(int, const char **)
+ * registerCmd("COMMAND", WRAP_METHOD(MyDebugger, myCmd));
+ * would register the method MyDebugger::myCmd(int, const char **)
* under the command name "COMMAND".
*/
#define WRAP_METHOD(cls, method) \
@@ -88,14 +89,14 @@ protected:
DVAR_STRING
};
- struct DVar {
+ struct Var {
Common::String name;
void *variable;
VarType type;
int arraySize;
};
-
+private:
/**
* Register a variable with the debugger. This allows the user to read and modify
* this variable.
@@ -103,11 +104,31 @@ protected:
* @param variable pointer to the actual storage of the variable
* @param type the type of the variable (byte, int, bool, ...)
* @paral arraySize for type DVAR_INTARRAY this specifies the size of the array
- *
- * @todo replace this single method by type safe variants.
*/
- void DVar_Register(const Common::String &varname, void *variable, VarType type, int arraySize);
- void DCmd_Register(const Common::String &cmdname, Debuglet *debuglet);
+ void registerVar(const Common::String &varname, void *variable, VarType type, int arraySize);
+
+protected:
+ void registerVar(const Common::String &varname, byte *variable) {
+ registerVar(varname, variable, DVAR_BYTE, 0);
+ }
+
+ void registerVar(const Common::String &varname, int *variable) {
+ registerVar(varname, variable, DVAR_INT, 0);
+ }
+
+ void registerVar(const Common::String &varname, bool *variable) {
+ registerVar(varname, variable, DVAR_BOOL, 0);
+ }
+
+ void registerVar(const Common::String &varname, int32 **variable, int arraySize) {
+ registerVar(varname, variable, DVAR_INTARRAY, arraySize);
+ }
+
+ void registerVar(const Common::String &varname, Common::String *variable) {
+ registerVar(varname, variable, DVAR_STRING, 0);
+ }
+
+ void registerCmd(const Common::String &cmdname, Debuglet *debuglet);
private:
@@ -124,7 +145,7 @@ private:
*/
uint _frameCountdown;
- Common::Array<DVar> _dvars;
+ Common::Array<Var> _vars;
typedef Common::HashMap<Common::String, Common::SharedPtr<Debuglet>, Common::IgnoreCase_Hash, Common::IgnoreCase_EqualTo> CommandsMap;
CommandsMap _cmds;
@@ -167,7 +188,7 @@ protected:
virtual void postEnter();
/**
- * Subclasses should invoke the detach() method in their Cmd_FOO methods
+ * Subclasses should invoke the detach() method in their cmdFOO methods
* if that command will resume execution of the program (as opposed to
* executing, say, a "single step through code" command).
*
@@ -189,12 +210,13 @@ private:
virtual bool handleCommand(int argc, const char **argv, bool &keepRunning);
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_DebugFlagsList(int argc, const char **argv);
- bool Cmd_DebugFlagEnable(int argc, const char **argv);
- bool Cmd_DebugFlagDisable(int argc, const char **argv);
+ bool cmdExit(int argc, const char **argv);
+ bool cmdHelp(int argc, const char **argv);
+ bool cmdOpenLog(int argc, const char **argv);
+ bool cmdDebugLevel(int argc, const char **argv);
+ bool cmdDebugFlagsList(int argc, const char **argv);
+ bool cmdDebugFlagEnable(int argc, const char **argv);
+ bool cmdDebugFlagDisable(int argc, const char **argv);
#ifndef USE_TEXT_CONSOLE_FOR_DEBUGGER
private:
diff --git a/gui/dialog.cpp b/gui/dialog.cpp
index ffca15bbc8..fa4e508494 100644
--- a/gui/dialog.cpp
+++ b/gui/dialog.cpp
@@ -17,6 +17,7 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
*/
#include "common/rect.h"
@@ -249,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/dialog.h b/gui/dialog.h
index d269a2f645..593ee13458 100644
--- a/gui/dialog.h
+++ b/gui/dialog.h
@@ -17,6 +17,7 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
*/
#ifndef GUI_DIALOG_H
diff --git a/gui/editrecorddialog.cpp b/gui/editrecorddialog.cpp
index cfcc747121..cd384baaed 100644
--- a/gui/editrecorddialog.cpp
+++ b/gui/editrecorddialog.cpp
@@ -8,12 +8,12 @@
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
-
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
-
+ *
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
diff --git a/gui/editrecorddialog.h b/gui/editrecorddialog.h
index c8da4521ca..3825f64ee1 100644
--- a/gui/editrecorddialog.h
+++ b/gui/editrecorddialog.h
@@ -8,12 +8,12 @@
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
-
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
-
+ *
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
diff --git a/gui/error.cpp b/gui/error.cpp
index 75bdab1a2a..11f591ed0e 100644
--- a/gui/error.cpp
+++ b/gui/error.cpp
@@ -8,12 +8,12 @@
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
-
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
-
+ *
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
diff --git a/gui/error.h b/gui/error.h
index f193136d74..fa517b8e48 100644
--- a/gui/error.h
+++ b/gui/error.h
@@ -8,12 +8,12 @@
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
-
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
-
+ *
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
diff --git a/gui/fluidsynth-dialog.cpp b/gui/fluidsynth-dialog.cpp
index 662518b557..af5ee6fb10 100644
--- a/gui/fluidsynth-dialog.cpp
+++ b/gui/fluidsynth-dialog.cpp
@@ -17,6 +17,7 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
*/
#include "gui/fluidsynth-dialog.h"
diff --git a/gui/fluidsynth-dialog.h b/gui/fluidsynth-dialog.h
index 4d74c9f93e..ebf6563960 100644
--- a/gui/fluidsynth-dialog.h
+++ b/gui/fluidsynth-dialog.h
@@ -17,6 +17,7 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
*/
#ifndef FLUIDSYNTH_DIALOG_H
diff --git a/gui/gui-manager.cpp b/gui/gui-manager.cpp
index 1505c8c707..80c3c2a552 100644
--- a/gui/gui-manager.cpp
+++ b/gui/gui-manager.cpp
@@ -17,6 +17,7 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
*/
#include "common/events.h"
@@ -309,6 +310,19 @@ void GuiManager::runLoop() {
Common::Event event;
while (eventMan->pollEvent(event)) {
+ // We will need to check whether the screen changed while polling
+ // for an event here. While we do send EVENT_SCREEN_CHANGED
+ // whenever this happens we still cannot be sure that we get such
+ // an event immediately. For example, we might have an mouse move
+ // event queued before an screen changed event. In some rare cases
+ // this would make the GUI redraw (with the code a few lines
+ // below) when it is not yet updated for new overlay dimensions.
+ // As a result ScummVM would crash because it tries to copy data
+ // outside the actual overlay screen.
+ if (event.type != Common::EVENT_SCREEN_CHANGED) {
+ checkScreenChange();
+ }
+
// The top dialog can change during the event loop. In that case, flush all the
// dialog-related events since they were probably generated while the old dialog
// was still visible, and therefore not intended for the new one.
diff --git a/gui/gui-manager.h b/gui/gui-manager.h
index b52d91ba08..4186a93ccb 100644
--- a/gui/gui-manager.h
+++ b/gui/gui-manager.h
@@ -17,6 +17,7 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
*/
#ifndef GUIMANAGER_H
diff --git a/gui/launcher.cpp b/gui/launcher.cpp
index 77d4cce794..9ac97a77d6 100644
--- a/gui/launcher.cpp
+++ b/gui/launcher.cpp
@@ -17,6 +17,7 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
*/
#include "base/version.h"
diff --git a/gui/launcher.h b/gui/launcher.h
index 2ab47be98d..e9c76a5320 100644
--- a/gui/launcher.h
+++ b/gui/launcher.h
@@ -17,6 +17,7 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
*/
#ifndef GUI_LAUNCHER_DIALOG_H
diff --git a/gui/massadd.cpp b/gui/massadd.cpp
index 70580e8b9c..34e1ab466e 100644
--- a/gui/massadd.cpp
+++ b/gui/massadd.cpp
@@ -17,6 +17,7 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
*/
#include "engines/metaengine.h"
diff --git a/gui/massadd.h b/gui/massadd.h
index 7350213835..116a420d79 100644
--- a/gui/massadd.h
+++ b/gui/massadd.h
@@ -17,6 +17,7 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
*/
#ifndef MASSADD_DIALOG_H
diff --git a/gui/message.cpp b/gui/message.cpp
index 6c2f489a4c..674680c4d4 100644
--- a/gui/message.cpp
+++ b/gui/message.cpp
@@ -17,6 +17,7 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
*/
#include "common/str.h"
diff --git a/gui/message.h b/gui/message.h
index 9da8417b5f..ff69780709 100644
--- a/gui/message.h
+++ b/gui/message.h
@@ -17,6 +17,7 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
*/
#ifndef MESSAGE_DIALOG_H
diff --git a/gui/object.cpp b/gui/object.cpp
index 189a286ead..ef2cc9d6e0 100644
--- a/gui/object.cpp
+++ b/gui/object.cpp
@@ -17,6 +17,7 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
*/
#include "common/textconsole.h"
diff --git a/gui/object.h b/gui/object.h
index dac3341b5a..219bf77f69 100644
--- a/gui/object.h
+++ b/gui/object.h
@@ -17,6 +17,7 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
*/
#ifndef GUI_OBJECT_H
diff --git a/gui/onscreendialog.cpp b/gui/onscreendialog.cpp
index 03a6f26ec0..0e37834136 100644
--- a/gui/onscreendialog.cpp
+++ b/gui/onscreendialog.cpp
@@ -8,12 +8,12 @@
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
-
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
-
+ *
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
diff --git a/gui/onscreendialog.h b/gui/onscreendialog.h
index 2fae14cbc6..ca95ff3743 100644
--- a/gui/onscreendialog.h
+++ b/gui/onscreendialog.h
@@ -8,12 +8,12 @@
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
-
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
-
+ *
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
diff --git a/gui/options.cpp b/gui/options.cpp
index a9fdc19274..3308cdead6 100644
--- a/gui/options.cpp
+++ b/gui/options.cpp
@@ -17,6 +17,7 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
*/
#include "gui/browser.h"
diff --git a/gui/options.h b/gui/options.h
index 081ef4fea5..1e65bfd134 100644
--- a/gui/options.h
+++ b/gui/options.h
@@ -17,6 +17,7 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
*/
#ifndef OPTIONS_DIALOG_H
diff --git a/gui/predictivedialog.cpp b/gui/predictivedialog.cpp
index ef94ec6d50..a894b02f80 100644
--- a/gui/predictivedialog.cpp
+++ b/gui/predictivedialog.cpp
@@ -8,12 +8,12 @@
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
-
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
-
+ *
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
@@ -752,7 +752,8 @@ bool PredictiveDialog::matchWord() {
char tmp[kMaxLineLen];
strncpy(tmp, _unitedDict.dictLine[line], kMaxLineLen);
tmp[kMaxLineLen - 1] = 0;
- char *tok = strtok(tmp, " ");
+ char *tok;
+ strtok(tmp, " ");
tok = strtok(NULL, " ");
_currentWord = Common::String(tok, _currentCode.size());
return true;
diff --git a/gui/predictivedialog.h b/gui/predictivedialog.h
index 0e3d2967c0..32d769d6ca 100644
--- a/gui/predictivedialog.h
+++ b/gui/predictivedialog.h
@@ -17,6 +17,7 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
*/
#ifndef GLOBAL_DIALOGS_H
diff --git a/gui/recorderdialog.cpp b/gui/recorderdialog.cpp
index 1a11dbac65..5617d2ba9a 100644
--- a/gui/recorderdialog.cpp
+++ b/gui/recorderdialog.cpp
@@ -17,6 +17,7 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
*/
#include "common/algorithm.h"
diff --git a/gui/recorderdialog.h b/gui/recorderdialog.h
index 9c5965f56d..8a229a06e4 100644
--- a/gui/recorderdialog.h
+++ b/gui/recorderdialog.h
@@ -17,6 +17,7 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
*/
#ifndef GUI_RECORDER_DIALOG_H
diff --git a/gui/saveload-dialog.cpp b/gui/saveload-dialog.cpp
index 585117fba4..f6eee3af50 100644
--- a/gui/saveload-dialog.cpp
+++ b/gui/saveload-dialog.cpp
@@ -17,6 +17,7 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
*/
#include "gui/saveload-dialog.h"
diff --git a/gui/saveload-dialog.h b/gui/saveload-dialog.h
index 6f7d95f73f..31f28f6452 100644
--- a/gui/saveload-dialog.h
+++ b/gui/saveload-dialog.h
@@ -17,6 +17,7 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
*/
#ifndef GUI_SAVELOAD_DIALOG_H
diff --git a/gui/saveload.cpp b/gui/saveload.cpp
index c2bbcd9bec..c1c1d12ec5 100644
--- a/gui/saveload.cpp
+++ b/gui/saveload.cpp
@@ -17,6 +17,7 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
*/
#include "common/config-manager.h"
diff --git a/gui/saveload.h b/gui/saveload.h
index 17fd99a31d..22c26d4c5e 100644
--- a/gui/saveload.h
+++ b/gui/saveload.h
@@ -17,6 +17,7 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
*/
#ifndef GUI_SAVELOAD_H
diff --git a/gui/themebrowser.cpp b/gui/themebrowser.cpp
index c22603b822..d8bd5d6fe8 100644
--- a/gui/themebrowser.cpp
+++ b/gui/themebrowser.cpp
@@ -17,6 +17,7 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
*/
#include "gui/themebrowser.h"
diff --git a/gui/themebrowser.h b/gui/themebrowser.h
index daea3836fc..2d94a7f423 100644
--- a/gui/themebrowser.h
+++ b/gui/themebrowser.h
@@ -17,6 +17,7 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
*/
#ifndef GUI_THEMEBROWSER_H
diff --git a/gui/themes/default.inc b/gui/themes/default.inc
index 352cc86852..e881c2d4eb 100644
--- a/gui/themes/default.inc
+++ b/gui/themes/default.inc
@@ -2506,16 +2506,16 @@
"</layout>"
"</dialog>"
"<dialog name='GlobalMenu' overlays='screen_center'>"
-"<layout type='vertical' padding='2,2,4,6' center='true' spacing='6'>"
+"<layout type='vertical' padding='2,2,2,6' center='true' spacing='0'>"
"<widget name='Title' "
"width='160' "
-"height='4' "
+"height='12' "
"/>"
"<widget name='Version' "
"width='160' "
-"height='4' "
+"height='14' "
"/>"
-"<space size='1'/>"
+"<layout type='vertical' padding='0,0,3,0' center='true' spacing='6'>"
"<widget name='Load' "
"width='120' "
"height='12' "
@@ -2551,6 +2551,7 @@
"height='12' "
"/>"
"</layout>"
+"</layout>"
"</dialog>"
"<dialog name='GlobalConfig' overlays='screen_center'>"
"<layout type='vertical' padding='8,8,8,8'>"
diff --git a/gui/themes/scummclassic.zip b/gui/themes/scummclassic.zip
index 1085aa64a4..7115849aa0 100644
--- a/gui/themes/scummclassic.zip
+++ b/gui/themes/scummclassic.zip
Binary files differ
diff --git a/gui/themes/scummclassic/classic_layout_lowres.stx b/gui/themes/scummclassic/classic_layout_lowres.stx
index 802998df3c..506657ef31 100644
--- a/gui/themes/scummclassic/classic_layout_lowres.stx
+++ b/gui/themes/scummclassic/classic_layout_lowres.stx
@@ -687,50 +687,51 @@
</dialog>
<dialog name = 'GlobalMenu' overlays = 'screen_center'>
- <layout type = 'vertical' padding = '2, 2, 4, 6' center = 'true' spacing='6'>
+ <layout type = 'vertical' padding = '2, 2, 2, 6' center = 'true' spacing='0'>
<widget name = 'Title'
width = '160'
- height = '4'
+ height = '12'
/>
<widget name = 'Version'
width = '160'
- height = '4'
- />
- <space size = '1'/>
- <widget name = 'Load'
- width = '120'
- height = '12'
- />
- <widget name = 'Save'
- width = '120'
- height = '12'
- />
- <space size = '1'/>
- <widget name = 'Options'
- width = '120'
- height = '12'
- />
- <widget name = 'Help'
- width = '120'
- height = '12'
- />
- <widget name = 'About'
- width = '120'
- height = '12'
- />
- <space size = '1'/>
- <widget name = 'Resume'
- width = '120'
- height = '12'
- />
- <widget name = 'RTL'
- width = '120'
- height = '12'
- />
- <widget name = 'Quit'
- width = '120'
- height = '12'
+ height = '14'
/>
+ <layout type = 'vertical' padding = '0, 0, 3, 0' center = 'true' spacing='6'>
+ <widget name = 'Load'
+ width = '120'
+ height = '12'
+ />
+ <widget name = 'Save'
+ width = '120'
+ height = '12'
+ />
+ <space size = '1'/>
+ <widget name = 'Options'
+ width = '120'
+ height = '12'
+ />
+ <widget name = 'Help'
+ width = '120'
+ height = '12'
+ />
+ <widget name = 'About'
+ width = '120'
+ height = '12'
+ />
+ <space size = '1'/>
+ <widget name = 'Resume'
+ width = '120'
+ height = '12'
+ />
+ <widget name = 'RTL'
+ width = '120'
+ height = '12'
+ />
+ <widget name = 'Quit'
+ width = '120'
+ height = '12'
+ />
+ </layout>
</layout>
</dialog>
diff --git a/gui/themes/scummtheme.py b/gui/themes/scummtheme.py
index 524e91468e..94dc08f1ef 100755
--- a/gui/themes/scummtheme.py
+++ b/gui/themes/scummtheme.py
@@ -19,7 +19,9 @@ def buildTheme(themeName):
zf.write('THEMERC', './THEMERC')
- for filename in os.listdir('.'):
+ filenames = os.listdir('.')
+ filenames.sort()
+ for filename in filenames:
if os.path.isfile(filename) and not filename[0] == '.' and filename.endswith(THEME_FILE_EXTENSIONS):
zf.write(filename, './' + filename)
print (" Adding file: " + filename)
@@ -65,7 +67,9 @@ def buildDefTheme(themeName):
def_file.write(""" "<?xml version = '1.0'?>"\n""")
strlitcount = 24
- for filename in os.listdir(themeName):
+ filenames = os.listdir(themeName)
+ filenames.sort()
+ for filename in filenames:
filename = os.path.join(themeName, filename)
if os.path.isfile(filename) and filename.endswith(".stx"):
theme_file = open(filename, "r")
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/widget.cpp b/gui/widget.cpp
index e96b62e359..851774fd70 100644
--- a/gui/widget.cpp
+++ b/gui/widget.cpp
@@ -17,6 +17,7 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
*/
#include "common/scummsys.h"
diff --git a/gui/widget.h b/gui/widget.h
index e3f712564f..9891f32b36 100644
--- a/gui/widget.h
+++ b/gui/widget.h
@@ -17,6 +17,7 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
*/
#ifndef GUI_WIDGET_H
diff --git a/gui/widgets/editable.cpp b/gui/widgets/editable.cpp
index 667850d6cc..af3e5e9b9a 100644
--- a/gui/widgets/editable.cpp
+++ b/gui/widgets/editable.cpp
@@ -17,6 +17,7 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
*/
#include "common/rect.h"
@@ -261,23 +262,45 @@ void EditableWidget::drawCaret(bool erase) {
int x = editRect.left;
int y = editRect.top;
- x += getCaretOffset();
+ const int caretOffset = getCaretOffset();
+ x += caretOffset;
- if (y < 0 || y + editRect.height() - 2 >= _h)
+ if (y < 0 || y + editRect.height() > _h)
return;
x += getAbsX();
y += getAbsY();
- g_gui.theme()->drawCaret(Common::Rect(x, y, x + 1, y + editRect.height() - 2), erase);
+ g_gui.theme()->drawCaret(Common::Rect(x, y, x + 1, y + editRect.height()), erase);
if (erase) {
+ GUI::EditableWidget::String character;
+ int width;
+
if ((uint)_caretPos < _editString.size()) {
- GUI::EditableWidget::String chr(_editString[_caretPos]);
- int chrWidth = g_gui.getCharWidth(_editString[_caretPos], _font);
+ const byte chr = _editString[_caretPos];
+ width = g_gui.getCharWidth(chr, _font);
+ character = chr;
+
const uint last = (_caretPos > 0) ? _editString[_caretPos - 1] : 0;
- x += g_gui.getKerningOffset(last, _editString[_caretPos], _font);
- g_gui.theme()->drawText(Common::Rect(x, y, x + chrWidth, y + editRect.height() - 2), chr, _state, Graphics::kTextAlignLeft, _inversion, 0, false, _font, ThemeEngine::kFontColorNormal, true, _textDrawableArea);
+ x += g_gui.getKerningOffset(last, chr, _font);
+ } else {
+ // We draw a fake space here to assure that removing the caret
+ // does not result in color glitches in case the edit rect is
+ // drawn with an inversion.
+ width = g_gui.getCharWidth(' ', _font);
+ character = " ";
+ }
+
+ // TODO: Right now we manually prevent text from being drawn outside
+ // the edit area here. We might want to consider to use
+ // setTextDrawableArea for this. However, it seems that only
+ // EditTextWidget uses that but not ListWidget. Thus, one should check
+ // whether we can unify the drawing in the text area first to avoid
+ // possible glitches due to different methods used.
+ width = MIN(editRect.width() - caretOffset, width);
+ if (width > 0) {
+ g_gui.theme()->drawText(Common::Rect(x, y, x + width, y + editRect.height()), character, _state, Graphics::kTextAlignLeft, _inversion, 0, false, _font, ThemeEngine::kFontColorNormal, true, _textDrawableArea);
}
}
diff --git a/gui/widgets/editable.h b/gui/widgets/editable.h
index 4a18d5e689..e3b3a2b014 100644
--- a/gui/widgets/editable.h
+++ b/gui/widgets/editable.h
@@ -17,6 +17,7 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
*/
#ifndef GUI_WIDGETS_EDITABLE_H
@@ -78,6 +79,11 @@ protected:
virtual void startEditMode() = 0;
virtual void endEditMode() = 0;
virtual void abortEditMode() = 0;
+ /**
+ * The area where text input is being made. This should exactly match the
+ * rect with which the actual edit string is drawn otherwise nasty
+ * graphics glitches when redrawing the caret can occur.
+ */
virtual Common::Rect getEditRect() const = 0;
virtual int getCaretOffset() const;
void drawCaret(bool erase);
diff --git a/gui/widgets/edittext.cpp b/gui/widgets/edittext.cpp
index 52527effd8..3e72350c99 100644
--- a/gui/widgets/edittext.cpp
+++ b/gui/widgets/edittext.cpp
@@ -17,6 +17,7 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
*/
#include "common/system.h"
@@ -101,7 +102,7 @@ void EditTextWidget::drawWidget() {
}
Common::Rect EditTextWidget::getEditRect() const {
- Common::Rect r(2 + _leftPadding, 2, _w - 2 - _leftPadding - _rightPadding, _h - 1);
+ Common::Rect r(2 + _leftPadding, 2, _w - 2 - _leftPadding - _rightPadding, _h);
return r;
}
diff --git a/gui/widgets/edittext.h b/gui/widgets/edittext.h
index a34dc4b5dd..7376ae70ff 100644
--- a/gui/widgets/edittext.h
+++ b/gui/widgets/edittext.h
@@ -17,6 +17,7 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
*/
#ifndef GUI_WIDGETS_EDITTEXT_H
diff --git a/gui/widgets/list.cpp b/gui/widgets/list.cpp
index 8ecb31311f..4b69202fdc 100644
--- a/gui/widgets/list.cpp
+++ b/gui/widgets/list.cpp
@@ -17,6 +17,7 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
*/
#include "common/system.h"
@@ -541,7 +542,7 @@ void ListWidget::drawWidget() {
}
Common::Rect ListWidget::getEditRect() const {
- Common::Rect r(_hlLeftPadding, 0, _w - _hlLeftPadding - _hlRightPadding, kLineHeight - 1);
+ Common::Rect r(_hlLeftPadding, 0, _w - _hlLeftPadding - _hlRightPadding, kLineHeight - 2);
const int offset = (_selectedItem - _currentPos) * kLineHeight + _topPadding;
r.top += offset;
r.bottom += offset;
diff --git a/gui/widgets/list.h b/gui/widgets/list.h
index d18a82dd3f..1abb2b810e 100644
--- a/gui/widgets/list.h
+++ b/gui/widgets/list.h
@@ -17,6 +17,7 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
*/
#ifndef GUI_WIDGETS_LIST_H
diff --git a/gui/widgets/popup.cpp b/gui/widgets/popup.cpp
index 829a49c53e..6186492339 100644
--- a/gui/widgets/popup.cpp
+++ b/gui/widgets/popup.cpp
@@ -17,6 +17,7 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
*/
#include "common/system.h"
diff --git a/gui/widgets/popup.h b/gui/widgets/popup.h
index 34983adbeb..102c7fd258 100644
--- a/gui/widgets/popup.h
+++ b/gui/widgets/popup.h
@@ -17,6 +17,7 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
*/
#ifndef GUI_WIDGETS_POPUP_H
diff --git a/gui/widgets/scrollbar.cpp b/gui/widgets/scrollbar.cpp
index c7c17bc908..f1306b9c4a 100644
--- a/gui/widgets/scrollbar.cpp
+++ b/gui/widgets/scrollbar.cpp
@@ -17,6 +17,7 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
*/
#include "common/rect.h"
diff --git a/gui/widgets/scrollbar.h b/gui/widgets/scrollbar.h
index 1c9f371cbc..de7c13ce03 100644
--- a/gui/widgets/scrollbar.h
+++ b/gui/widgets/scrollbar.h
@@ -17,6 +17,7 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
*/
#ifndef GUI_WIDGETS_SCROLLBAR_H
diff --git a/gui/widgets/tab.cpp b/gui/widgets/tab.cpp
index 66f33907ca..756781a04b 100644
--- a/gui/widgets/tab.cpp
+++ b/gui/widgets/tab.cpp
@@ -17,6 +17,7 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
*/
#include "common/util.h"
@@ -182,6 +183,7 @@ void TabWidget::setActiveTab(int tabID) {
}
_activeTab = tabID;
_firstWidget = _tabs[tabID].firstWidget;
+
_boss->draw();
}
}
@@ -225,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 b19036979e..a01ee2d9dc 100644
--- a/gui/widgets/tab.h
+++ b/gui/widgets/tab.h
@@ -17,6 +17,7 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
*/
#ifndef GUI_WIDGETS_TAB_H
@@ -27,6 +28,11 @@
#include "common/array.h"
namespace GUI {
+
+enum {
+ kTabForwards = 1,
+ kTabBackwards = -1
+};
class TabWidget : public Widget {
typedef Common::String String;
@@ -108,6 +114,8 @@ protected:
virtual void drawWidget();
virtual Widget *findWidget(int x, int y);
+
+ virtual void adjustTabs(int value);
};
} // End of namespace GUI