diff options
author | Max Horn | 2006-09-16 17:29:43 +0000 |
---|---|---|
committer | Max Horn | 2006-09-16 17:29:43 +0000 |
commit | 6c2671296060f445c30d8a553ee90e6f20b101db (patch) | |
tree | bb778cbce45d71718743f62b4d595dac7f6bdab3 /gui/console.h | |
parent | 8df3ca9e6577c4aa337256616a5cfbef3aa19cd4 (diff) | |
download | scummvm-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/console.h')
-rw-r--r-- | gui/console.h | 38 |
1 files changed, 37 insertions, 1 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) { |