aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Gilbert2018-10-20 22:06:18 -0700
committerPaul Gilbert2018-12-08 19:05:59 -0800
commit0bc3da9e800b928ac31663180427cd048748814d (patch)
treed05057645c39aae90c82b173cabd1b933d8fbc04
parentbbd744ad4731784e13c8e92048a75531300e3fe4 (diff)
downloadscummvm-rg350-0bc3da9e800b928ac31663180427cd048748814d.tar.gz
scummvm-rg350-0bc3da9e800b928ac31663180427cd048748814d.tar.bz2
scummvm-rg350-0bc3da9e800b928ac31663180427cd048748814d.zip
GLK: Remove duplicated Windows fields that are now in Conf
-rw-r--r--engines/gargoyle/conf.cpp4
-rw-r--r--engines/gargoyle/conf.h3
-rw-r--r--engines/gargoyle/gargoyle.cpp1
-rw-r--r--engines/gargoyle/streams.h2
-rw-r--r--engines/gargoyle/windows.cpp110
-rw-r--r--engines/gargoyle/windows.h27
6 files changed, 50 insertions, 97 deletions
diff --git a/engines/gargoyle/conf.cpp b/engines/gargoyle/conf.cpp
index 0b8eda8bff..4e8b823dab 100644
--- a/engines/gargoyle/conf.cpp
+++ b/engines/gargoyle/conf.cpp
@@ -25,6 +25,7 @@
#include "gargoyle/string.h"
#include "gargoyle/windows.h"
#include "common/config-manager.h"
+#include "common/system.h"
namespace Gargoyle {
@@ -65,6 +66,9 @@ Conf *g_conf;
Conf::Conf() {
g_conf = this;
+ _imageW = g_system->getWidth();
+ _imageH = g_system->getHeight();
+ _cellW = _cellH = 8;
get("moreprompt", _morePrompt, "\207 more \207");
get("morecolor", _moreColor);
diff --git a/engines/gargoyle/conf.h b/engines/gargoyle/conf.h
index c63cdc025a..5c4446a5a4 100644
--- a/engines/gargoyle/conf.h
+++ b/engines/gargoyle/conf.h
@@ -113,6 +113,9 @@ public:
WindowStyle _gStyles[style_NUMSTYLES];
WindowStyle _tStylesDefault[style_NUMSTYLES];
WindowStyle _gStylesDefault[style_NUMSTYLES];
+
+ int _imageW, _imageH;
+ int _cellW, _cellH;
public:
/**
* Constructor
diff --git a/engines/gargoyle/gargoyle.cpp b/engines/gargoyle/gargoyle.cpp
index d3dd35bca0..a7b819c6b6 100644
--- a/engines/gargoyle/gargoyle.cpp
+++ b/engines/gargoyle/gargoyle.cpp
@@ -58,6 +58,7 @@ void GargoyleEngine::initialize() {
initGraphics(640, 480, false);
_screen = new Graphics::Screen();
+ _conf = new Conf();
_events = new Events();
_streams = new Streams(this);
_windows = new Windows(this, _screen);
diff --git a/engines/gargoyle/streams.h b/engines/gargoyle/streams.h
index 3a80366c0f..e45bcc491a 100644
--- a/engines/gargoyle/streams.h
+++ b/engines/gargoyle/streams.h
@@ -104,7 +104,7 @@ public:
* Constructor
*/
WindowStream(Streams *streams, Window *window, uint32 rock = 0, bool unicode = true) :
- Stream(streams, true, false, rock, unicode), _window(window) {}
+ Stream(streams, false, true, rock, unicode), _window(window) {}
/**
* Close the stream
diff --git a/engines/gargoyle/windows.cpp b/engines/gargoyle/windows.cpp
index edea1abb5d..e39e5422ab 100644
--- a/engines/gargoyle/windows.cpp
+++ b/engines/gargoyle/windows.cpp
@@ -32,27 +32,6 @@ namespace Gargoyle {
#define MAGIC_WINDOW_NUM (9876)
#define GLI_SUBPIX 8
-bool Windows::_confLockCols;
-bool Windows::_confLockRows;
-int Windows::_wMarginx;
-int Windows::_wMarginy;
-int Windows::_wPaddingx;
-int Windows::_wPaddingy;
-int Windows::_wBorderx;
-int Windows::_wBordery;
-int Windows::_tMarginx;
-int Windows::_tMarginy;
-int Windows::_wMarginXsave;
-int Windows::_wMarginYsave;
-int Windows::_cols;
-int Windows::_rows;
-int Windows::_imageW;
-int Windows::_imageH;
-int Windows::_cellW;
-int Windows::_cellH;
-int Windows::_baseLine;
-int Windows::_leading;
-int Windows::_scrollWidth;
bool Windows::_overrideReverse;
bool Windows::_overrideFgSet;
bool Windows::_overrideBgSet;
@@ -66,26 +45,6 @@ Windows::Windows(GargoyleEngine *engine, Graphics::Screen *screen) :
_engine(engine), _screen(screen), _forceRedraw(true), _moreFocus(false),
_windowList(nullptr), _rootWin(nullptr), _focusWin(nullptr), _mask(nullptr),
_claimSelect(0) {
- _imageW = _screen->w;
- _imageH = _screen->h;
- _cellW = _cellH = 8;
- _confLockCols = false;
- _confLockRows = false;
- _wMarginx = 15;
- _wMarginy = 15;
- _wPaddingx = 0;
- _wPaddingy = 0;
- _wBorderx = 1;
- _wBordery = 1;
- _tMarginx = 7;
- _tMarginy = 7;
- _wMarginXsave = 15;
- _wMarginYsave = 15;
- _cols = 60;
- _rows = 25;
- _baseLine = 15;
- _leading = 20;
- _scrollWidth = 0;
_overrideReverse = false;
_overrideFgSet = false;
_overrideBgSet = false;
@@ -218,26 +177,26 @@ void Windows::rearrange() {
if (_rootWin) {
Common::Rect box;
- if (_confLockCols) {
- int desired_width = _wMarginXsave * 2 + _cellW * _cols;
- if (desired_width > _imageW)
- _wMarginx = _wMarginXsave;
+ if (g_conf->_lockCols) {
+ int desired_width = g_conf->_wMarginSaveX * 2 + g_conf->_cellW * g_conf->_cols;
+ if (desired_width > g_conf->_imageW)
+ g_conf->_wMarginX = g_conf->_wMarginSaveX;
else
- _wMarginx = (_imageW - _cellW * _cols) / 2;
+ g_conf->_wMarginX = (g_conf->_imageW - g_conf->_cellW * g_conf->_cols) / 2;
}
- if (_confLockRows) {
- int desired_height = _wMarginYsave * 2 + _cellH * _rows;
- if (desired_height > _imageH)
- _wMarginy = _wMarginYsave;
+ if (g_conf->_lockRows) {
+ int desired_height = g_conf->_wMarginSaveY * 2 + g_conf->_cellH * g_conf->_rows;
+ if (desired_height > g_conf->_imageH)
+ g_conf->_wMarginY = g_conf->_wMarginSaveY;
else
- _wMarginy = (_imageH - _cellH * _rows) / 2;
+ g_conf->_wMarginY = (g_conf->_imageH - g_conf->_cellH * g_conf->_rows) / 2;
}
- box.left = _wMarginx;
- box.top = _wMarginy;
- box.right = _imageW - _wMarginx;
- box.bottom = _imageH - _wMarginy;
+ box.left = g_conf->_wMarginX;
+ box.top = g_conf->_wMarginY;
+ box.right = g_conf->_imageW - g_conf->_wMarginX;
+ box.bottom = g_conf->_imageH - g_conf->_wMarginY;
_rootWin->rearrange(box);
}
@@ -310,8 +269,8 @@ void TextGridWindow::rearrange(const Common::Rect &box) {
Window::rearrange(box);
int newwid, newhgt;
- newwid = box.width() / Windows::_cellW;
- newhgt = box.height() / Windows::_cellH;
+ newwid = box.width() / g_conf->_cellW;
+ newhgt = box.height() / g_conf->_cellH;
if (newwid == width && newhgt == height)
return;
@@ -328,9 +287,14 @@ void TextGridWindow::rearrange(const Common::Rect &box) {
}
void TextGridWindow::touch(int line) {
- int y = bbox.top + line * Windows::_leading;
+ int y = bbox.top + line * g_conf->_leading;
lines[line].dirty = true;
- _windows->repaint(Common::Rect(bbox.left, y, bbox.right, y + Windows::_leading));
+ _windows->repaint(Common::Rect(bbox.left, y, bbox.right, y + g_conf->_leading));
+}
+
+glui32 TextGridWindow::getSplit(glui32 size, bool vertical) const {
+ return vertical ? size * g_conf->_cellW + g_conf->_tMarginX * 2 :
+ size * g_conf->_cellH + g_conf->_tMarginY * 2;
}
/*--------------------------------------------------------------------------*/
@@ -362,11 +326,11 @@ void TextBufferWindow::rearrange(const Common::Rect &box) {
int newwid, newhgt;
int rnd;
- newwid = (box.width() - Windows::_tMarginx * 2 - Windows::_scrollWidth) / Windows::_cellW;
- newhgt = (box.height() - Windows::_tMarginy * 2) / Windows::_cellH;
+ newwid = (box.width() - g_conf->_tMarginX * 2 - g_conf->_scrollWidth) / g_conf->_cellW;
+ newhgt = (box.height() - g_conf->_tMarginY * 2) / g_conf->_cellH;
/* align text with bottom */
- rnd = newhgt * Windows::_cellH + Windows::_tMarginy * 2;
+ rnd = newhgt * g_conf->_cellH + g_conf->_tMarginY * 2;
yadj = (box.height() - rnd);
bbox.top += (box.height() - rnd);
@@ -576,8 +540,8 @@ bool TextBufferWindow::putPicture(Picture *pic, glui32 align, glui32 linkval) {
if (lines[0].rpic || numchars)
return false;
- radjw = (pic->w + Windows::_tMarginx) * GLI_SUBPIX;
- radjn = (pic->h + Windows::_cellH - 1) / Windows::_cellH;
+ radjw = (pic->w + g_conf->_tMarginX) * GLI_SUBPIX;
+ radjn = (pic->h + g_conf->_cellH - 1) / g_conf->_cellH;
lines[0].rpic = pic;
lines[0].rm = radjw;
lines[0].rhyper = linkval;
@@ -588,8 +552,8 @@ bool TextBufferWindow::putPicture(Picture *pic, glui32 align, glui32 linkval) {
if (lines[0].lpic || numchars)
return false;
- ladjw = (pic->w + Windows::_tMarginx) * GLI_SUBPIX;
- ladjn = (pic->h + Windows::_cellH - 1) / Windows::_cellH;
+ ladjw = (pic->w + g_conf->_tMarginX) * GLI_SUBPIX;
+ ladjn = (pic->h + g_conf->_cellH - 1) / g_conf->_cellH;
lines[0].lpic = pic;
lines[0].lm = ladjw;
lines[0].lhyper = linkval;
@@ -614,7 +578,7 @@ void TextBufferWindow::putCharUni(glui32 ch) {
gli_tts_speak(&ch, 1);
- pw = (bbox.right - bbox.left - Windows::_tMarginx * 2 - gli_scroll_width) * GLI_SUBPIX;
+ pw = (bbox.right - bbox.left - g_conf->_tMarginX * 2 - gli_scroll_width) * GLI_SUBPIX;
pw = pw - 2 * SLOP - radjw - ladjw;
color = gli_override_bg_set ? gli_window_color : bgcolor;
@@ -760,10 +724,14 @@ void TextBufferWindow::flowBreak() {
}
void TextBufferWindow::touch(int line) {
- int y = bbox.top + Windows::_tMarginy + (height - line - 1) * Windows::_leading;
+ int y = bbox.top + g_conf->_tMarginY + (height - line - 1) * g_conf->_leading;
lines[line].dirty = 1;
_windows->clearSelection();
- _windows->repaint(Common::Rect(bbox.left, y - 2, bbox.right, y + Windows::_leading + 2));
+ _windows->repaint(Common::Rect(bbox.left, y - 2, bbox.right, y + g_conf->_leading + 2));
+}
+
+glui32 TextBufferWindow::getSplit(glui32 size, bool vertical) const {
+ return (vertical) ? size * g_conf->_cellW : size * g_conf->_cellH;
}
/*--------------------------------------------------------------------------*/
@@ -867,9 +835,9 @@ void PairWindow::rearrange(const Common::Rect &box) {
// We now figure split.
if (_vertical)
- splitwid = Windows::_wPaddingx; // want border?
+ splitwid = g_conf->_wPaddingX; // want border?
else
- splitwid = Windows::_wPaddingy; // want border?
+ splitwid = g_conf->_wPaddingY; // want border?
switch (_division) {
case winmethod_Proportional:
diff --git a/engines/gargoyle/windows.h b/engines/gargoyle/windows.h
index 0eb508894a..6f7a016379 100644
--- a/engines/gargoyle/windows.h
+++ b/engines/gargoyle/windows.h
@@ -74,24 +74,6 @@ private:
*/
void rearrange();
public:
- static bool _confLockCols, _confLockRows;
- static int _wMarginx;
- static int _wMarginy;
- static int _wPaddingx;
- static int _wPaddingy;
- static int _wBorderx;
- static int _wBordery;
- static int _tMarginx;
- static int _tMarginy;
- static int _wMarginXsave;
- static int _wMarginYsave;
- static int _cols;
- static int _rows;
- static int _imageW, _imageH;
- static int _cellW, _cellH;
- static int _baseLine;
- static int _leading;
- static int _scrollWidth;
static bool _overrideReverse;
static bool _overrideFgSet;
static bool _overrideBgSet;
@@ -296,10 +278,7 @@ public:
/**
* Get window split size within parent pair window
*/
- virtual glui32 getSplit(glui32 size, bool vertical) const override {
- return vertical ? size * Windows::_cellW + Windows::_tMarginx * 2 :
- size * Windows::_cellH + Windows::_tMarginy * 2;
- }
+ virtual glui32 getSplit(glui32 size, bool vertical) const override;
};
/**
@@ -400,9 +379,7 @@ public:
/**
* Get window split size within parent pair window
*/
- virtual glui32 getSplit(glui32 size, bool vertical) const override {
- return (vertical) ? size * Windows::_cellW : size * Windows::_cellH;
- }
+ virtual glui32 getSplit(glui32 size, bool vertical) const override;
/**
* Clear the window