aboutsummaryrefslogtreecommitdiff
path: root/gui
diff options
context:
space:
mode:
authorMax Horn2005-04-17 12:03:03 +0000
committerMax Horn2005-04-17 12:03:03 +0000
commit2141a2648cba0451aec05c8ef2a8ad5dd724ef16 (patch)
treee160db9527dd3063807bdabe6b0c563edfb7eec4 /gui
parent1cce2fd366e2fdb31afc7b98f9621b7ba4c93a35 (diff)
downloadscummvm-rg350-2141a2648cba0451aec05c8ef2a8ad5dd724ef16.tar.gz
scummvm-rg350-2141a2648cba0451aec05c8ef2a8ad5dd724ef16.tar.bz2
scummvm-rg350-2141a2648cba0451aec05c8ef2a8ad5dd724ef16.zip
Use variable width scrollbar in the console dialog
svn-id: r17652
Diffstat (limited to 'gui')
-rw-r--r--gui/console.cpp32
-rw-r--r--gui/console.h2
2 files changed, 14 insertions, 20 deletions
diff --git a/gui/console.cpp b/gui/console.cpp
index badbce2cee..a079a976d3 100644
--- a/gui/console.cpp
+++ b/gui/console.cpp
@@ -57,9 +57,21 @@ ConsoleDialog::ConsoleDialog(float widthPercent, float heightPercent)
: Dialog(0, 0, 1, 1),
_widthPercent(widthPercent), _heightPercent(heightPercent) {
- // Setup basic layout/dialog size
- reflowLayout();
+ // Calculate the real width/height (rounded to char/line multiples)
+ _w = (uint16)(_widthPercent * g_system->getOverlayWidth());
+ _h = (uint16)((_heightPercent * g_system->getOverlayHeight() - 2) / kConsoleLineHeight);
+ _h = _h * kConsoleLineHeight + 2;
+ // Add scrollbar
+ int scrollBarWidth = kDefaultScrollBarWidth;
+ if (g_system->getOverlayWidth() >= 640)
+ scrollBarWidth = 14;
+ _scrollBar = new ScrollBarWidget(this, _w - scrollBarWidth - 1, 0, scrollBarWidth, _h);
+ _scrollBar->setTarget(this);
+
+ // Reset the line buffer
+ _lineWidth = (_w - scrollBarWidth - 2) / kConsoleCharWidth;
+ _linesPerPage = (_h - 2) / kConsoleLineHeight;
memset(_buffer, ' ', kBufferSize);
_linesInBuffer = kBufferSize / _lineWidth;
@@ -73,9 +85,6 @@ ConsoleDialog::ConsoleDialog(float widthPercent, float heightPercent)
_slideMode = kNoSlideMode;
_slideTime = 0;
- // Add scrollbar
- _scrollBar = new ScrollBarWidget(this, _w - kDefaultScrollBarWidth - 1, 0, kDefaultScrollBarWidth, _h);
- _scrollBar->setTarget(this);
// Init callback
_callbackProc = 0;
@@ -95,19 +104,6 @@ ConsoleDialog::ConsoleDialog(float widthPercent, float heightPercent)
print("\nConsole is ready\n");
}
-void ConsoleDialog::reflowLayout() {
- // Calculate the real width/height (rounded to char/line multiples)
- _w = (uint16)(_widthPercent * g_system->getOverlayWidth());
-// _w = (_widthPercent * g_system->getOverlayWidth() - kDefaultScrollBarWidth - 2) / kConsoleCharWidth;
-// _w = _w * kConsoleCharWidth + kDefaultScrollBarWidth + 2;
- _h = (uint16)((_heightPercent * g_system->getOverlayHeight() - 2) / kConsoleLineHeight);
- _h = _h * kConsoleLineHeight + 2;
-
- // Calculate depending values
- _lineWidth = (_w - kDefaultScrollBarWidth - 2) / kConsoleCharWidth;
- _linesPerPage = (_h - 2) / kConsoleLineHeight;
-}
-
void ConsoleDialog::slideUpAndClose() {
if (_slideMode == kNoSlideMode) {
_slideTime = g_system->getMillis();
diff --git a/gui/console.h b/gui/console.h
index af68a82355..8b74d7917d 100644
--- a/gui/console.h
+++ b/gui/console.h
@@ -86,8 +86,6 @@ protected:
float _widthPercent, _heightPercent;
- void reflowLayout();
-
void slideUpAndClose();
public: