aboutsummaryrefslogtreecommitdiff
path: root/gui
diff options
context:
space:
mode:
authorMax Horn2006-09-16 17:29:43 +0000
committerMax Horn2006-09-16 17:29:43 +0000
commit6c2671296060f445c30d8a553ee90e6f20b101db (patch)
treebb778cbce45d71718743f62b4d595dac7f6bdab3 /gui
parent8df3ca9e6577c4aa337256616a5cfbef3aa19cd4 (diff)
downloadscummvm-rg350-6c2671296060f445c30d8a553ee90e6f20b101db.tar.gz
scummvm-rg350-6c2671296060f445c30d8a553ee90e6f20b101db.tar.bz2
scummvm-rg350-6c2671296060f445c30d8a553ee90e6f20b101db.zip
Added GUI::ConsoleDialoggetCharsPerLine() method, and added a big FIXME comment to gui/console.h
svn-id: r23892
Diffstat (limited to 'gui')
-rw-r--r--gui/console.h38
-rw-r--r--gui/debugger.cpp5
-rw-r--r--gui/debugger.h4
3 files changed, 41 insertions, 6 deletions
diff --git a/gui/console.h b/gui/console.h
index 8079e2620b..70f3d7c6f1 100644
--- a/gui/console.h
+++ b/gui/console.h
@@ -31,11 +31,44 @@ namespace GUI {
class ScrollBarWidget;
+/*
+ FIXME #1: The console dialog code has some fundamental problems.
+ First of, note the conflict between the (constant) value kCharsPerLine, and the
+ (variable) value _pageWidth. Look a bit at the code get familiar with them,
+ then return...
+ Now, why don't we just drop kCharsPerLine? Because of the problem of resizing!
+ When the user changes the scaler, the console will get resized. If the dialog
+ becomes smaller because of this, we may have to rewrap text. If the resolution
+ is then increased again, we'd end up with garbled content.
+
+ One can now either ignore this problem (and modify our code accordingly to
+ implement this simple rewrapping -- we currently don't do that at all!).
+
+ Or, one can go and implement a more complete console, by replacing the
+ _buffer by a real line buffer -- an arrach of char* pointers.
+ This will allow one to implement resizing perfectly, but has the drawback
+ of making things like scrolling, drawing etc. more complicated.
+
+ Either way, the current situation is bad, and we should resolve it one way
+ or the other (and if you can think of a thirds, feel free to suggest it).
+
+
+
+ FIXME #2: Another problem is that apparently _pageWidth isn't computed quite
+ correctly. The current line ends well before reaching the right side of the
+ console dialog. That's irritating and should be fixed.
+
+
+ FIXME #3: The scroll bar is not shown initially, but the area it would
+ occupy is not used for anything else. As a result, the gap described above
+ becomes even wider and thus even more irritating.
+*/
class ConsoleDialog : public Dialog {
public:
typedef bool (*InputCallbackProc)(ConsoleDialog *console, const char *input, void *refCon);
typedef bool (*CompletionCallbackProc)(ConsoleDialog* console, const char *input, char*& completion, void *refCon);
+protected:
enum {
kBufferSize = 32768,
kCharsPerLine = 128,
@@ -44,7 +77,6 @@ public:
kHistorySize = 20
};
-protected:
const Graphics::Font *_font;
char _buffer[kBufferSize];
@@ -123,6 +155,10 @@ public:
_completionCallbackProc = proc;
_completionCallbackRefCon = refCon;
}
+
+ int getCharsPerLine() {
+ return _pageWidth;
+ }
protected:
inline char &buffer(int idx) {
diff --git a/gui/debugger.cpp b/gui/debugger.cpp
index cde8b22a03..e31d7fc771 100644
--- a/gui/debugger.cpp
+++ b/gui/debugger.cpp
@@ -366,6 +366,7 @@ bool Debugger::Cmd_Exit(int argc, const char **argv) {
// nicely word-wrapped.
bool Debugger::Cmd_Help(int argc, const char **argv) {
+ const int charsPerLine = _debuggerDialog->getCharsPerLine();
int width, size, i;
DebugPrintf("Commands are:\n");
@@ -373,7 +374,7 @@ bool Debugger::Cmd_Help(int argc, const char **argv) {
for (i = 0; i < _dcmd_count; i++) {
size = strlen(_dcmds[i].name) + 1;
- if ((width + size) >= GUI::ConsoleDialog::kCharsPerLine) {
+ if ((width + size) >= charsPerLine) {
DebugPrintf("\n");
width = size;
} else
@@ -390,7 +391,7 @@ bool Debugger::Cmd_Help(int argc, const char **argv) {
for (i = 0; i < _dvar_count; i++) {
size = strlen(_dvars[i].name) + 1;
- if ((width + size) >= GUI::ConsoleDialog::kCharsPerLine) {
+ if ((width + size) >= charsPerLine) {
DebugPrintf("\n");
width = size;
} else
diff --git a/gui/debugger.h b/gui/debugger.h
index 7b07b1bca3..568c4e3bc9 100644
--- a/gui/debugger.h
+++ b/gui/debugger.h
@@ -101,15 +101,14 @@ protected:
int _frame_countdown;
bool _detach_now;
+private:
// TODO: Consider replacing the following two arrays by a Hashmap
-
int _dvar_count;
DVar _dvars[256];
int _dcmd_count;
DCmd _dcmds[256];
-private:
bool _isAttached;
char *_errStr;
bool _firstTime;
@@ -129,7 +128,6 @@ protected:
private:
-//protected:
void detach();
void enter();