diff options
Diffstat (limited to 'engines')
25 files changed, 198 insertions, 131 deletions
diff --git a/engines/gargoyle/conf.cpp b/engines/gargoyle/conf.cpp index e2b8d04bda..a684889a7b 100644 --- a/engines/gargoyle/conf.cpp +++ b/engines/gargoyle/conf.cpp @@ -22,7 +22,7 @@  #include "gargoyle/conf.h"  #include "gargoyle/fonts.h" -#include "gargoyle/unicode.h" +#include "gargoyle/utils.h"  #include "gargoyle/windows.h"  #include "common/config-manager.h"  #include "common/system.h" diff --git a/engines/gargoyle/events.cpp b/engines/gargoyle/events.cpp index bba9df1c56..6836faf07d 100644 --- a/engines/gargoyle/events.cpp +++ b/engines/gargoyle/events.cpp @@ -169,7 +169,7 @@ void Events::handleScroll(bool wheelUp) {  	g_vm->_windows->inputHandleKey(wheelUp ? keycode_MouseWheelUp : keycode_MouseWheelDown);  } -void Events::handleMouseMove(const Common::Point &pos) { +void Events::handleMouseMove(const Point &pos) {  	// hyperlinks and selection  	// TODO: Properly handle commented out lines  	if (g_vm->_copySelect) { @@ -184,14 +184,14 @@ void Events::handleMouseMove(const Common::Point &pos) {  	}  } -void Events::handleButtonDown(bool isLeft, const Common::Point &pos) { +void Events::handleButtonDown(bool isLeft, const Point &pos) {  	if (isLeft)  		g_vm->_windows->inputHandleClick(pos);  	else  		g_vm->_clipboard->receive(PRIMARY);  } -void Events::handleButtonUp(bool isLeft, const Common::Point &pos) { +void Events::handleButtonUp(bool isLeft, const Point &pos) {  	if (isLeft) {  		g_vm->_copySelect = false;  		//gdk_window_set_cursor((GTK_WIDGET(widget)->window), NULL); diff --git a/engines/gargoyle/events.h b/engines/gargoyle/events.h index 544b524d51..f49ef35ac5 100644 --- a/engines/gargoyle/events.h +++ b/engines/gargoyle/events.h @@ -24,6 +24,7 @@  #define GARGOYLE_EVENTS_H  #include "common/events.h" +#include "gargoyle/utils.h"  namespace Gargoyle { @@ -171,17 +172,17 @@ private:  	/**  	 * Handle mouse move events  	 */ -	void handleMouseMove(const Common::Point &pos); +	void handleMouseMove(const Point &pos);  	/**  	 * Handle mouse down events  	 */ -	void handleButtonDown(bool isLeft, const Common::Point &pos); +	void handleButtonDown(bool isLeft, const Point &pos);  	/**  	 * Handle mouse up events  	 */ -	void handleButtonUp(bool isLeft, const Common::Point &pos); +	void handleButtonUp(bool isLeft, const Point &pos);  public:  	bool _forceClick;  public: diff --git a/engines/gargoyle/fonts.cpp b/engines/gargoyle/fonts.cpp index 45f8671157..bcb129ccc7 100644 --- a/engines/gargoyle/fonts.cpp +++ b/engines/gargoyle/fonts.cpp @@ -103,14 +103,14 @@ Graphics::Font *Fonts::loadFont(FACES face, double size, double aspect, int styl  	return Graphics::loadTTFFont(f, size, Graphics::kTTFSizeModeCharacter);  } -int Fonts::drawString(const Common::Point &pos, int fontIdx, const byte *rgb, const Common::String &text, int spw) { +int Fonts::drawString(const Point &pos, int fontIdx, const byte *rgb, const Common::String &text, int spw) {  	Graphics::Font *font = _fontTable[fontIdx];  	const uint32 color = _surface->format.RGBToColor(rgb[0], rgb[1], rgb[2]);  	font->drawString(_surface, text, pos.x, pos.y, _surface->w - pos.x, color);  	return font->getBoundingBox(text, pos.x, pos.y, _surface->w - pos.x).right;  } -int Fonts::drawStringUni(const Common::Point &pos, int fontIdx, const byte *rgb, const Common::U32String &text, int spw) { +int Fonts::drawStringUni(const Point &pos, int fontIdx, const byte *rgb, const Common::U32String &text, int spw) {  	Graphics::Font *font = _fontTable[fontIdx];  	const uint32 color = _surface->format.RGBToColor(rgb[0], rgb[1], rgb[2]);  	font->drawString(_surface, text, pos.x, pos.y, _surface->w - pos.x, color); diff --git a/engines/gargoyle/fonts.h b/engines/gargoyle/fonts.h index a486a01154..4472025239 100644 --- a/engines/gargoyle/fonts.h +++ b/engines/gargoyle/fonts.h @@ -24,6 +24,7 @@  #define GARGOYLE_FONTS_H  #include "gargoyle/glk_types.h" +#include "gargoyle/utils.h"  #include "common/str.h"  #include "common/ustr.h"  #include "graphics/font.h" @@ -58,9 +59,9 @@ public:  	 */  	virtual ~Fonts(); -	int drawString(const Common::Point &pos, int fontIdx, const byte *rgb, const Common::String &text, int spw = 0); +	int drawString(const Point &pos, int fontIdx, const byte *rgb, const Common::String &text, int spw = 0); -	int drawStringUni(const Common::Point &pos, int fontIdx, const byte *rgb, const Common::U32String &text, int spw = 0); +	int drawStringUni(const Point &pos, int fontIdx, const byte *rgb, const Common::U32String &text, int spw = 0);  	size_t stringWidth(int fontIdx, const Common::String &text, int spw = -1); diff --git a/engines/gargoyle/glk.cpp b/engines/gargoyle/glk.cpp index 736ed3e010..abc4d2c2df 100644 --- a/engines/gargoyle/glk.cpp +++ b/engines/gargoyle/glk.cpp @@ -295,7 +295,7 @@ void Glk::glk_window_move_cursor(winid_t win, glui32 xpos, glui32 ypos) {  	if (!win) {  		warning("window_move_cursor: invalid ref");  	} else { -		win->moveCursor(Common::Point(xpos, ypos)); +		win->moveCursor(Point(xpos, ypos));  	}  } @@ -770,7 +770,7 @@ void Glk::glk_window_erase_rect(winid_t win, glsi32 left, glsi32 top, glui32 wid  	if (!win) {  		warning("window_erase_rect: invalid ref");  	} else { -		win->eraseRect(false, Common::Rect(left, top, left + width, top + height)); +		win->eraseRect(false, Rect(left, top, left + width, top + height));  	}  } @@ -779,7 +779,7 @@ void Glk::glk_window_fill_rect(winid_t win, glui32 color, glsi32 left, glsi32 to  	if (!win) {  		warning("window_fill_rect: invalid ref");  	} else { -		win->eraseRect(color, Common::Rect(left, top, left + width, top + height)); +		win->eraseRect(color, Rect(left, top, left + width, top + height));  	}  } diff --git a/engines/gargoyle/module.mk b/engines/gargoyle/module.mk index a45608fc02..f4422b0b31 100644 --- a/engines/gargoyle/module.mk +++ b/engines/gargoyle/module.mk @@ -14,6 +14,7 @@ MODULE_OBJS := \  	time.o \  	unicode.o \  	unicode_gen.o \ +	utils.o \  	windows.o \  	window_mask.o \  	window_graphics.o \ diff --git a/engines/gargoyle/screen.cpp b/engines/gargoyle/screen.cpp index f541b760cf..f500b86f73 100644 --- a/engines/gargoyle/screen.cpp +++ b/engines/gargoyle/screen.cpp @@ -29,12 +29,12 @@ void Screen::fill(const byte *rgb) {  	clear(color);  } -void Screen::fillRect(uint x, uint y, uint w, uint h, const byte *rgb) { +void Screen::fillRect(const Rect &box, const byte *rgb) {  	uint color = format.RGBToColor(rgb[0], rgb[1], rgb[2]); -	Graphics::Screen::fillRect(Common::Rect(x, y, x + w, y + h), color); +	Graphics::Screen::fillRect(box, color);  } -void Screen::drawCaret(const Common::Point &pos) { +void Screen::drawCaret(const Point &pos) {  	// TODO  } diff --git a/engines/gargoyle/screen.h b/engines/gargoyle/screen.h index 8cdf988777..3974096dfa 100644 --- a/engines/gargoyle/screen.h +++ b/engines/gargoyle/screen.h @@ -43,9 +43,9 @@ public:  	/**  	 * Fill a given area of the screen with an rgb color  	 */ -	void fillRect(uint x, uint y, uint w, uint h, const byte *rgb); +	void fillRect(const Rect &box, const byte *rgb); -	void drawCaret(const Common::Point &pos); +	void drawCaret(const Point &pos);  };  } // End of namespace Gargoyle diff --git a/engines/gargoyle/unicode.cpp b/engines/gargoyle/unicode.cpp index 601d8f0e79..c547d2bcb8 100644 --- a/engines/gargoyle/unicode.cpp +++ b/engines/gargoyle/unicode.cpp @@ -33,22 +33,6 @@ size_t strlen_uni(const uint32 *s) {  	return len;  } -int strToInt(const char *s) { -	if (!*s) -		// No string at all -		return 0; -	else if (toupper(s[strlen(s) - 1]) != 'H') -		// Standard decimal string -		return atoi(s); - -	// Hexadecimal string -	uint tmp = 0; -	int read = sscanf(s, "%xh", &tmp); -	if (read < 1) -		error("strToInt failed on string \"%s\"", s); -	return (int)tmp; -} -  glui32 bufferChangeCase(glui32 *buf, glui32 len, glui32 numchars, BufferChangeCase destcase,  		BufferChangeCond cond, int changerest) {  	glui32 ix, jx; diff --git a/engines/gargoyle/unicode.h b/engines/gargoyle/unicode.h index 806a63f1ff..2392c1afa1 100644 --- a/engines/gargoyle/unicode.h +++ b/engines/gargoyle/unicode.h @@ -46,11 +46,6 @@ size_t strlen_uni(const uint32 *s);  extern glui32 bufferChangeCase(glui32 *buf, glui32 len,  	glui32 numchars, BufferChangeCase destcase, BufferChangeCond cond, int changerest); -/** - * Converts a decimal or hexadecimal string into a number - */ -int strToInt(const char *s); -  } // End of namespace Gargoyle  #endif diff --git a/engines/gargoyle/utils.cpp b/engines/gargoyle/utils.cpp new file mode 100644 index 0000000000..6857301bb7 --- /dev/null +++ b/engines/gargoyle/utils.cpp @@ -0,0 +1,44 @@ +/* ScummVM - Graphic Adventure Engine + * + * 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 source distribution. + * + * This program is free software; you can redistribute it and/or + * 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. + * + */ + +#include "gargoyle/utils.h" +#include "common/textconsole.h" + +namespace Gargoyle { + +int strToInt(const char *s) { +	if (!*s) +		// No string at all +		return 0; +	else if (toupper(s[strlen(s) - 1]) != 'H') +		// Standard decimal string +		return atoi(s); + +	// Hexadecimal string +	uint tmp = 0; +	int read = sscanf(s, "%xh", &tmp); +	if (read < 1) +		error("strToInt failed on string \"%s\"", s); +	return (int)tmp; +} + +} // End of namespace Gargoyle diff --git a/engines/gargoyle/utils.h b/engines/gargoyle/utils.h new file mode 100644 index 0000000000..b8a8e027ee --- /dev/null +++ b/engines/gargoyle/utils.h @@ -0,0 +1,51 @@ +/* ScummVM - Graphic Adventure Engine + * + * 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 source distribution. + * + * This program is free software; you can redistribute it and/or + * 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. + * + */ + +#ifndef GARGOYLE_UTILS_H +#define GARGOYLE_UTILS_H + +#include "common/rect.h" +#include "gargoyle/glk_types.h" + +namespace Gargoyle { + +typedef Common::Point Point; + +struct Rect : public Common::Rect { +public: +	static Rect fromXYWH(int x, int y, int w, int h) { +		return Rect(x, y, x + w, y + h); +	} + +	Rect() : Common::Rect() {} +	Rect(int16 w, int16 h) : Common::Rect(w, h) {} +	Rect(int16 x1, int16 y1, int16 x2, int16 y2) : Common::Rect(x1, y1, x2, y2) {} +}; + +/** + * Converts a decimal or hexadecimal string into a number + */ +int strToInt(const char *s); + +} // End of namespace Gargoyle + +#endif diff --git a/engines/gargoyle/window_graphics.cpp b/engines/gargoyle/window_graphics.cpp index 0ea587616e..6609f0aa2a 100644 --- a/engines/gargoyle/window_graphics.cpp +++ b/engines/gargoyle/window_graphics.cpp @@ -36,7 +36,7 @@ GraphicsWindow::~GraphicsWindow() {  	delete _surface;  } -void GraphicsWindow::rearrange(const Common::Rect &box) { +void GraphicsWindow::rearrange(const Rect &box) {  	int newwid, newhgt;  	int bothwid, bothhgt;  	int oldw, oldh; @@ -92,7 +92,7 @@ void GraphicsWindow::redraw() {  		_dirty = 0;  		if (_surface) -			screen.blitFrom(*_surface, Common::Point(_bbox.left, _bbox.top)); +			screen.blitFrom(*_surface, Point(_bbox.left, _bbox.top));  	}  } @@ -120,7 +120,7 @@ glui32 GraphicsWindow::drawPicture(glui32 image, glsi32 xpos, glsi32 ypos, int s  	return true;  } -void GraphicsWindow::eraseRect(bool whole, const Common::Rect &box) { +void GraphicsWindow::eraseRect(bool whole, const Rect &box) {  	int x0 = box.left, y0 = box.top, x1 = box.right, y1 = box.bottom;  	int hx0, hx1, hy0, hy1; @@ -148,11 +148,11 @@ void GraphicsWindow::eraseRect(bool whole, const Common::Rect &box) {  	/* zero out hyperlinks for these coordinates */  	g_vm->_windowMask->putHyperlink(0, hx0, hy0, hx1, hy1); -	_surface->fillRect(Common::Rect(x0, y0, x1, y1), MKTAG(_bgnd[0], _bgnd[1], _bgnd[2], 0)); +	_surface->fillRect(Rect(x0, y0, x1, y1), MKTAG(_bgnd[0], _bgnd[1], _bgnd[2], 0));  	touch();  } -void GraphicsWindow::fillRect(glui32 color, const Common::Rect &box) { +void GraphicsWindow::fillRect(glui32 color, const Rect &box) {  	unsigned char col[3];  	int x0 = box.left, y0 = box.top, x1 = box.right, y1 = box.bottom;  	int hx0, hx1, hy0, hy1; @@ -178,7 +178,7 @@ void GraphicsWindow::fillRect(glui32 color, const Common::Rect &box) {  	/* zero out hyperlinks for these coordinates */  	g_vm->_windowMask->putHyperlink(0, hx0, hy0, hx1, hy1); -	_surface->fillRect(Common::Rect(x0, y0, x1, y1), MKTAG(col[0], col[1], col[2], 0)); +	_surface->fillRect(Rect(x0, y0, x1, y1), MKTAG(col[0], col[1], col[2], 0));  	touch();  } @@ -233,7 +233,7 @@ void GraphicsWindow::drawPicture(Picture *src,  int x0, int y0, int width, int h  	w = sx1 - sx0;  	h = sy1 - sy0; -	_surface->blitFrom(*g_vm->_screen, Common::Rect(sx0, sy0, sx0 + w, sy0 + h), Common::Point(0, 0)); +	_surface->blitFrom(*g_vm->_screen, Rect(sx0, sy0, sx0 + w, sy0 + h), Point(0, 0));  }  void GraphicsWindow::getSize(glui32 *width, glui32 *height) const { diff --git a/engines/gargoyle/window_graphics.h b/engines/gargoyle/window_graphics.h index 8c2724e2ec..f2714442f3 100644 --- a/engines/gargoyle/window_graphics.h +++ b/engines/gargoyle/window_graphics.h @@ -58,7 +58,7 @@ public:  	/**  	 * Rearranges the window  	 */ -	virtual void rearrange(const Common::Rect &box) override; +	virtual void rearrange(const Rect &box) override;  	/**  	 * Get window split size within parent pair window @@ -86,9 +86,9 @@ public:  	 */  	virtual void redraw() override; -	virtual void eraseRect(bool whole, const Common::Rect &box) override; +	virtual void eraseRect(bool whole, const Rect &box) override; -	virtual void fillRect(glui32 color, const Common::Rect &box) override; +	virtual void fillRect(glui32 color, const Rect &box) override;  	virtual void getSize(glui32 *width, glui32 *height) const override; diff --git a/engines/gargoyle/window_mask.cpp b/engines/gargoyle/window_mask.cpp index fe1d463eb7..b3b629b50f 100644 --- a/engines/gargoyle/window_mask.cpp +++ b/engines/gargoyle/window_mask.cpp @@ -94,7 +94,7 @@ void WindowMask::putHyperlink(glui32 linkval, uint x0, uint y0, uint x1, uint y1  	}  } -glui32 WindowMask::getHyperlink(const Common::Point &pos) { +glui32 WindowMask::getHyperlink(const Point &pos) {  	if (!_hor || !_ver) {  		warning("getHyperlink: struct not initialized");  		return 0; @@ -110,7 +110,7 @@ glui32 WindowMask::getHyperlink(const Common::Point &pos) {  	return _links[pos.x][pos.y];  } -void WindowMask::startSelection(const Common::Point &pos) { +void WindowMask::startSelection(const Point &pos) {  	int tx, ty;  	if (!_hor || !_ver) { @@ -129,7 +129,7 @@ void WindowMask::startSelection(const Common::Point &pos) {  	g_vm->_windows->selectionChanged();  } -void WindowMask::moveSelection(const Common::Point &pos) { +void WindowMask::moveSelection(const Point &pos) {  	int tx, ty;  	if (ABS(pos.x - _lastX) < 5 && abs(pos.y - _lastY) < 5) diff --git a/engines/gargoyle/window_mask.h b/engines/gargoyle/window_mask.h index 9dc5826916..e9030a23df 100644 --- a/engines/gargoyle/window_mask.h +++ b/engines/gargoyle/window_mask.h @@ -25,6 +25,7 @@  #include "common/rect.h"  #include "gargoyle/glk_types.h" +#include "gargoyle/utils.h"  namespace Gargoyle { @@ -34,7 +35,7 @@ class WindowMask {  public:  	size_t _hor, _ver;  	glui32 **_links; -	Common::Rect _select; +	Rect _select;  	static int _lastX, _lastY;  public: @@ -50,11 +51,11 @@ public:  	void putHyperlink(glui32 linkval, uint x0, uint y0, uint x1, uint y1); -	glui32 getHyperlink(const Common::Point &pos); +	glui32 getHyperlink(const Point &pos); -	void startSelection(const Common::Point &pos); +	void startSelection(const Point &pos); -	void moveSelection(const Common::Point &pos); +	void moveSelection(const Point &pos);  	void clearSelection(); diff --git a/engines/gargoyle/window_pair.cpp b/engines/gargoyle/window_pair.cpp index b8d593e02e..3f0f294afa 100644 --- a/engines/gargoyle/window_pair.cpp +++ b/engines/gargoyle/window_pair.cpp @@ -36,8 +36,8 @@ PairWindow::PairWindow(Windows *windows, glui32 method, Window *key, glui32 size  	_type = wintype_Pair;  } -void PairWindow::rearrange(const Common::Rect &box) { -	Common::Rect box1, box2; +void PairWindow::rearrange(const Rect &box) { +	Rect box1, box2;  	int min, diff, split, splitwid, max;  	Window *ch1, *ch2; diff --git a/engines/gargoyle/window_pair.h b/engines/gargoyle/window_pair.h index 8e80f79f59..2037b3dece 100644 --- a/engines/gargoyle/window_pair.h +++ b/engines/gargoyle/window_pair.h @@ -51,7 +51,7 @@ public:  	/**  	 * Rearranges the window  	 */ -	virtual void rearrange(const Common::Rect &box) override; +	virtual void rearrange(const Rect &box) override;  	/**  	 * Redraw the window diff --git a/engines/gargoyle/window_text_buffer.cpp b/engines/gargoyle/window_text_buffer.cpp index ebce9c3679..3946771017 100644 --- a/engines/gargoyle/window_text_buffer.cpp +++ b/engines/gargoyle/window_text_buffer.cpp @@ -70,7 +70,7 @@ TextBufferWindow::~TextBufferWindow() {  	}  } -void TextBufferWindow::rearrange(const Common::Rect &box) { +void TextBufferWindow::rearrange(const Rect &box) {  	Window::rearrange(box);  	int newwid, newhgt;  	int rnd; @@ -371,7 +371,7 @@ void TextBufferWindow::touch(int line) {  	int y = _bbox.top + g_conf->_tMarginY + (_height - line - 1) * g_conf->_leading;  	_lines[line]._dirty = 1;  	g_vm->_windowMask->clearSelection(); -	_windows->repaint(Common::Rect(_bbox.left, y - 2, _bbox.right, y + g_conf->_leading + 2)); +	_windows->repaint(Rect(_bbox.left, y - 2, _bbox.right, y + g_conf->_leading + 2));  }  glui32 TextBufferWindow::getSplit(glui32 size, bool vertical) const { @@ -567,7 +567,7 @@ void TextBufferWindow::clear() {  		touch(i);  } -void TextBufferWindow::click(const Common::Point &newPos) { +void TextBufferWindow::click(const Point &newPos) {  	int gh = false;  	int gs = false; @@ -843,7 +843,7 @@ void TextBufferWindow::redraw() {          /* repaint previously selected lines if needed */          if (ln->_repaint && !Windows::_forceRedraw) -            _windows->redrawRect(Common::Rect(x0 / GLI_SUBPIX, y, +            _windows->redrawRect(Rect(x0 / GLI_SUBPIX, y,  				x1/GLI_SUBPIX, y + g_conf->_leading));          /* keep selected line dirty and flag for repaint */ @@ -954,8 +954,7 @@ void TextBufferWindow::redraw() {           * fill in background colors           */          color = Windows::_overrideBgSet ? g_conf->_windowColor : _bgColor; -        screen.fillRect(x0/GLI_SUBPIX, y, -                (x1-x0) / GLI_SUBPIX, g_conf->_leading, +        screen.fillRect(Rect::fromXYWH(x0 / GLI_SUBPIX, y, (x1-x0) / GLI_SUBPIX, g_conf->_leading),                  color);          x = x0 + SLOP + ln->_lm; @@ -967,13 +966,11 @@ void TextBufferWindow::redraw() {                  font = ln->_attrs[a].attrFont(_styles);                  color = ln->_attrs[a].attrBg(_styles);                  w = screen.stringWidthUni(font, Common::U32String(ln->_chars + a, b - a), spw); -                screen.fillRect(x/GLI_SUBPIX, y, -                        w/GLI_SUBPIX, g_conf->_leading, +                screen.fillRect(Rect::fromXYWH(x / GLI_SUBPIX, y, w / GLI_SUBPIX, g_conf->_leading),                          color);                  if (link) { -                    screen.fillRect(x/GLI_SUBPIX + 1, y + g_conf->_baseLine + 1, -                            w/GLI_SUBPIX + 1, g_conf->_linkStyle, -                            g_conf->_linkColor); +                    screen.fillRect(Rect::fromXYWH(x / GLI_SUBPIX + 1, y + g_conf->_baseLine + 1, +						w / GLI_SUBPIX + 1, g_conf->_linkStyle), g_conf->_linkColor);                      g_vm->_windowMask->putHyperlink(link, x/GLI_SUBPIX, y,                              x/GLI_SUBPIX + w/GLI_SUBPIX,                              y + g_conf->_leading); @@ -986,22 +983,18 @@ void TextBufferWindow::redraw() {          font = ln->_attrs[a].attrFont(_styles);          color = ln->_attrs[a].attrBg(_styles);          w = screen.stringWidthUni(font, Common::U32String(ln->_chars + a, b - a), spw); -        screen.fillRect(x/GLI_SUBPIX, y, w/GLI_SUBPIX, -                g_conf->_leading, color); +        screen.fillRect(Rect::fromXYWH(x / GLI_SUBPIX, y, w / GLI_SUBPIX, g_conf->_leading), color);          if (link) { -            screen.fillRect(x/GLI_SUBPIX + 1, y + g_conf->_baseLine + 1, -                    w/GLI_SUBPIX + 1, g_conf->_linkStyle, -                    g_conf->_linkColor); -            g_vm->_windowMask->putHyperlink(link, x/GLI_SUBPIX, y, -                    x/GLI_SUBPIX + w/GLI_SUBPIX, +            screen.fillRect(Rect::fromXYWH(x / GLI_SUBPIX + 1, y + g_conf->_baseLine + 1, +                    w/GLI_SUBPIX + 1, g_conf->_linkStyle), g_conf->_linkColor); +            g_vm->_windowMask->putHyperlink(link, x / GLI_SUBPIX, y, +                    x / GLI_SUBPIX + w / GLI_SUBPIX,                      y + g_conf->_leading);          }          x += w;          color = Windows::_overrideBgSet ? g_conf->_windowColor : _bgColor; -        screen.fillRect(x/GLI_SUBPIX, y, -                x1/GLI_SUBPIX - x/GLI_SUBPIX, g_conf->_leading, -                color); +        screen.fillRect(Rect::fromXYWH(x / GLI_SUBPIX, y, x1/GLI_SUBPIX - x/GLI_SUBPIX, g_conf->_leading), color);          /*           * draw caret @@ -1010,7 +1003,7 @@ void TextBufferWindow::redraw() {          if (_windows->getFocusWindow() == this && i == 0 && (_lineRequest || _lineRequestUni)) {              w = calcWidth(_chars, _attrs, 0, _inCurs, spw);              if (w < pw - g_conf->_caretShape * 2 * GLI_SUBPIX) -                screen.drawCaret(Common::Point(x0 + SLOP + ln->_lm + w, y + g_conf->_baseLine)); +                screen.drawCaret(Point(x0 + SLOP + ln->_lm + w, y + g_conf->_baseLine));          }          /* @@ -1025,7 +1018,7 @@ void TextBufferWindow::redraw() {                  link = ln->_attrs[a].hyper;                  font = ln->_attrs[a].attrFont(_styles);                  color = link ? g_conf->_linkColor : ln->_attrs[a].attrFg(_styles); -                x = screen.drawStringUni(Common::Point(x, y + g_conf->_baseLine), +                x = screen.drawStringUni(Point(x, y + g_conf->_baseLine),                          font, color, Common::U32String(ln->_chars + a, b - a), spw);                  a = b;              } @@ -1033,7 +1026,7 @@ void TextBufferWindow::redraw() {          link = ln->_attrs[a].hyper;          font = ln->_attrs[a].attrFont(_styles);          color = link ? g_conf->_linkColor : ln->_attrs[a].attrFg(_styles); -        screen.drawStringUni(Common::Point(x, y + g_conf->_baseLine), +        screen.drawStringUni(Point(x, y + g_conf->_baseLine),                  font, color, Common::U32String(ln->_chars + a, linelen - a), spw);      } @@ -1049,9 +1042,7 @@ void TextBufferWindow::redraw() {                  x1/GLI_SUBPIX, y + g_conf->_leading);          color = Windows::_overrideBgSet ? g_conf->_windowColor : _bgColor; -        screen.fillRect(x/GLI_SUBPIX, y, -                x1/GLI_SUBPIX - x/GLI_SUBPIX, g_conf->_leading, -                color); +        screen.fillRect(Rect::fromXYWH(x / GLI_SUBPIX, y, x1 / GLI_SUBPIX - x / GLI_SUBPIX, g_conf->_leading), color);          w = screen.stringWidth(g_conf->_moreFont, g_conf->_morePrompt); @@ -1061,7 +1052,7 @@ void TextBufferWindow::redraw() {              x = x1 - SLOP - w;          color = Windows::_overrideFgSet ? g_conf->_moreColor : _fgColor; -		screen.drawString(Common::Point(x, y + g_conf->_baseLine), +		screen.drawString(Point(x, y + g_conf->_baseLine),                  g_conf->_moreFont, color, g_conf->_morePrompt);          y1 = y; /* don't want pictures overdrawing "[more]" */ @@ -1141,16 +1132,14 @@ void TextBufferWindow::redraw() {              t0 = t1 = y0;          } -        screen.fillRect(x0+1, y0, x1-x0-2, y1-y0, g_conf->_scrollBg); -        screen.fillRect(x0+1, t0, x1-x0-2, t1-t0, g_conf->_scrollFg); +        screen.fillRect(Rect::fromXYWH(x0 + 1, y0, x1-x0 - 2, y1 - y0), g_conf->_scrollBg); +        screen.fillRect(Rect::fromXYWH(x0 + 1, t0, x1-x0 - 2, t1 - t0), g_conf->_scrollFg);          for (i = 0; i < g_conf->_scrollWidth / 2 + 1; i++) { -            screen.fillRect(x0+g_conf->_scrollWidth/2-i, -                    y0 - g_conf->_scrollWidth/2 + i, -                    i*2, 1, g_conf->_scrollFg); -            screen.fillRect(x0+g_conf->_scrollWidth/2-i, -                    y1 + g_conf->_scrollWidth/2 - i, -                    i*2, 1, g_conf->_scrollFg); +            screen.fillRect(Rect::fromXYWH(x0 + g_conf->_scrollWidth / 2 - i, +				y0 - g_conf->_scrollWidth/2 + i, i * 2, 1), g_conf->_scrollFg); +            screen.fillRect(Rect::fromXYWH(x0 + g_conf->_scrollWidth / 2 - i, +                    y1 + g_conf->_scrollWidth / 2 - i, i * 2, 1), g_conf->_scrollFg);          }      } diff --git a/engines/gargoyle/window_text_buffer.h b/engines/gargoyle/window_text_buffer.h index 61b30e266d..ab7890a9ff 100644 --- a/engines/gargoyle/window_text_buffer.h +++ b/engines/gargoyle/window_text_buffer.h @@ -147,7 +147,7 @@ public:  	/**  	 * Rearranges the window  	 */ -	virtual void rearrange(const Common::Rect &box) override; +	virtual void rearrange(const Rect &box) override;  	/**  	 * Get window split size within parent pair window @@ -172,7 +172,7 @@ public:  	/**  	 * Click the window  	 */ -	virtual void click(const Common::Point &newPos) override; +	virtual void click(const Point &newPos) override;  	/**  	 * Prepare for inputing a line diff --git a/engines/gargoyle/window_text_grid.cpp b/engines/gargoyle/window_text_grid.cpp index 7b349a5e48..b1effc4d6b 100644 --- a/engines/gargoyle/window_text_grid.cpp +++ b/engines/gargoyle/window_text_grid.cpp @@ -52,7 +52,7 @@ TextGridWindow::~TextGridWindow() {  	delete[] _lineTerminators;  } -void TextGridWindow::rearrange(const Common::Rect &box) { +void TextGridWindow::rearrange(const Rect &box) {  	Window::rearrange(box);  	int newwid, newhgt; @@ -76,7 +76,7 @@ void TextGridWindow::rearrange(const Common::Rect &box) {  void TextGridWindow::touch(int line) {  	int y = _bbox.top + line * g_conf->_leading;  	_lines[line].dirty = true; -	_windows->repaint(Common::Rect(_bbox.left, y, _bbox.right, y + g_conf->_leading)); +	_windows->repaint(Rect(_bbox.left, y, _bbox.right, y + g_conf->_leading));  }  glui32 TextGridWindow::getSplit(glui32 size, bool vertical) const { @@ -161,7 +161,7 @@ bool TextGridWindow::unputCharUni(uint32 ch) {  	}  } -void TextGridWindow::moveCursor(const Common::Point &pos) { +void TextGridWindow::moveCursor(const Point &pos) {  	// If the values are negative, they're really huge positive numbers --  	// remember that they were cast from glui32. So set them huge and  	// let canonicalization take its course. @@ -189,7 +189,7 @@ void TextGridWindow::clear() {  	_curY = 0;  } -void TextGridWindow::click(const Common::Point &newPos) { +void TextGridWindow::click(const Point &newPos) {  	int x = newPos.x - _bbox.left;  	int y = newPos.y - _bbox.top; @@ -603,17 +603,17 @@ void TextGridWindow::redraw() {  					fgcolor = link ? g_conf->_linkColor : ln->_attrs[a].attrFg(styles);  					bgcolor = ln->_attrs[a].attrBg(styles);  					w = (b - a) * g_conf->_cellW; -					screen.fillRect(x, y, w, g_conf->_leading, bgcolor); +					screen.fillRect(Rect::fromXYWH(x, y, w, g_conf->_leading), bgcolor);  					o = x;  					for (k = a; k < b; k++) { -						screen.drawStringUni(Common::Point(o * GLI_SUBPIX, y + g_conf->_baseLine), +						screen.drawStringUni(Point(o * GLI_SUBPIX, y + g_conf->_baseLine),  							font, fgcolor, Common::U32String(&ln->_chars[k], 1), -1);  						o += g_conf->_cellW;  					}  					if (link) { -						screen.fillRect(x, y + g_conf->_baseLine + 1, w, -							g_conf->_linkStyle, g_conf->_linkColor); +						screen.fillRect(Rect::fromXYWH(x, y + g_conf->_baseLine + 1, w, +							g_conf->_linkStyle), g_conf->_linkColor);  						g_vm->_windowMask->putHyperlink(link, x, y, x + w, y + g_conf->_leading);  					}  					x += w; @@ -626,17 +626,17 @@ void TextGridWindow::redraw() {  			bgcolor = ln->_attrs[a].attrBg(styles);  			w = (b - a) * g_conf->_cellW;  			w += _bbox.right - (x + w); -			screen.fillRect(x, y, w, g_conf->_leading, bgcolor); +			screen.fillRect(Rect::fromXYWH(x, y, w, g_conf->_leading), bgcolor);  			o = x;  			for (k = a; k < b; k++) { -				screen.drawStringUni(Common::Point(o * GLI_SUBPIX, y + g_conf->_baseLine), +				screen.drawStringUni(Point(o * GLI_SUBPIX, y + g_conf->_baseLine),  					font, fgcolor, Common::U32String(&ln->_chars[k], 1));  				o += g_conf->_cellW;  			}  			if (link) { -				screen.fillRect(x, y + g_conf->_baseLine + 1, w, -					g_conf->_linkStyle, g_conf->_linkColor); +				screen.fillRect(Rect::fromXYWH(x, y + g_conf->_baseLine + 1, w, g_conf->_linkStyle), +					g_conf->_linkColor);  				g_vm->_windowMask->putHyperlink(link, x, y, x + w, y + g_conf->_leading);  			}  		} diff --git a/engines/gargoyle/window_text_grid.h b/engines/gargoyle/window_text_grid.h index 9ff588b82e..1fba707356 100644 --- a/engines/gargoyle/window_text_grid.h +++ b/engines/gargoyle/window_text_grid.h @@ -90,7 +90,7 @@ public:  	/**  	 * Rearranges the window  	 */ -	virtual void rearrange(const Common::Rect &box) override; +	virtual void rearrange(const Rect &box) override;  	/**  	 * Get window split size within parent pair window @@ -110,7 +110,7 @@ public:  	/**  	 * Move the cursor  	 */ -	virtual void moveCursor(const Common::Point &newPos) override; +	virtual void moveCursor(const Point &newPos) override;  	/**  	 * Clear the window @@ -120,7 +120,7 @@ public:  	/**  	 * Click the window  	 */ -	virtual void click(const Common::Point &newPos) override; +	virtual void click(const Point &newPos) override;  	/**  	 * Cancel a hyperlink event diff --git a/engines/gargoyle/windows.cpp b/engines/gargoyle/windows.cpp index 0f1c9eb69c..22c2701879 100644 --- a/engines/gargoyle/windows.cpp +++ b/engines/gargoyle/windows.cpp @@ -249,7 +249,7 @@ PairWindow *Windows::newPairWindow(glui32 method, Window *key, glui32 size) {  void Windows::rearrange() {  	if (_rootWin) { -		Common::Rect box; +		Rect box;  		if (g_conf->_lockCols) {  			int desired_width = g_conf->_wMarginSaveX * 2 + g_conf->_cellW * g_conf->_cols; @@ -384,7 +384,7 @@ void Windows::inputHandleKey(glui32 key) {  		g_vm->quitGame();  } -void Windows::inputHandleClick(const Common::Point &pos) { +void Windows::inputHandleClick(const Point &pos) {  	if (_rootWin)  		_rootWin->click(pos);  } @@ -399,7 +399,7 @@ void Windows::redraw() {  	_claimSelect = false;  	if (_forceRedraw) { -		repaint(Common::Rect(0, 0, g_conf->_imageW, g_conf->_imageH)); +		repaint(Rect(0, 0, g_conf->_imageW, g_conf->_imageH));  		g_vm->_screen->fill(g_conf->_windowColor);  	} @@ -412,12 +412,12 @@ void Windows::redraw() {  	_forceRedraw = 0;  } -void Windows::redrawRect(const Common::Rect &r) { +void Windows::redrawRect(const Rect &r) {  	_drawSelect = true;  	repaint(r);  } -void Windows::repaint(const Common::Rect &box) { +void Windows::repaint(const Rect &box) {  	// No implementation  } @@ -556,7 +556,7 @@ void Window::cancelLineEvent(Event *ev) {  	ev->clear();  } -void Window::moveCursor(const Common::Point &newPos) { +void Window::moveCursor(const Point &newPos) {  	warning("moveCursor: not a TextGrid window");  } @@ -572,7 +572,7 @@ void Window::redraw() {  	if (Windows::_forceRedraw) {  		unsigned char *color = Windows::_overrideBgSet ? g_conf->_windowColor : _bgColor;  		int y0 = _yAdj ? _bbox.top - _yAdj : _bbox.top; -		g_vm->_screen->fillRect(_bbox.left, y0, _bbox.width(), _bbox.bottom - y0, color); +		g_vm->_screen->fillRect(Rect(_bbox.left, y0, _bbox.right, _bbox.bottom), color);  	}  } @@ -604,11 +604,11 @@ void Window::flowBreak() {  	warning("flowBreak: not a text buffer window");  } -void Window::eraseRect(bool whole, const Common::Rect &box) { +void Window::eraseRect(bool whole, const Rect &box) {  	warning("eraseRect: not a graphics window");  } -void Window::fillRect(glui32 color, const Common::Rect &box) { +void Window::fillRect(glui32 color, const Rect &box) {  	warning("fillRect: not a graphics window");  } diff --git a/engines/gargoyle/windows.h b/engines/gargoyle/windows.h index 643fecf5ab..231ed67de6 100644 --- a/engines/gargoyle/windows.h +++ b/engines/gargoyle/windows.h @@ -179,7 +179,7 @@ public:  	/**  	 * Handle mouse clicks  	 */ -	void inputHandleClick(const Common::Point &pos); +	void inputHandleClick(const Point &pos);  	void selectionChanged(); @@ -192,12 +192,12 @@ public:  	void redraw(); -	void redrawRect(const Common::Rect &r); +	void redrawRect(const Rect &r);  	/**  	 * Repaint an area of the windows  	 */ -	void repaint(const Common::Rect &box); +	void repaint(const Rect &box);  	/**  	 * Get an iterator that will move over the tree @@ -282,7 +282,7 @@ public:  	Window *_parent;       ///< pair window which contains this one  	Window *_next, *_prev; ///< in the big linked list of windows -	Common::Rect _bbox; +	Rect _bbox;  	int _yAdj;  	Stream *_stream;       ///< the window stream. @@ -328,7 +328,7 @@ public:  	/**  	 * Rearranges the window  	 */ -	virtual void rearrange(const Common::Rect &box) { _bbox = box; } +	virtual void rearrange(const Rect &box) { _bbox = box; }  	/**  	 * Get window split size within parent pair window @@ -348,7 +348,7 @@ public:  	/**  	 * Move the cursor  	 */ -	virtual void moveCursor(const Common::Point &newPos); +	virtual void moveCursor(const Point &newPos);  	/**  	 * Clear the window @@ -358,7 +358,7 @@ public:  	/**  	 * Click the window  	 */ -	virtual void click(const Common::Point &newPos) {} +	virtual void click(const Point &newPos) {}  	/**  	 * Prepare for inputing a line @@ -423,9 +423,9 @@ public:  	virtual void flowBreak(); -	virtual void eraseRect(bool whole, const Common::Rect &box); +	virtual void eraseRect(bool whole, const Rect &box); -	virtual void fillRect(glui32 color, const Common::Rect &box); +	virtual void fillRect(glui32 color, const Rect &box);  	virtual void setBackgroundColor(glui32 color);  };  | 
