[Scummvm-cvs-logs] SF.net SVN: scummvm: [22017] scummvm/trunk/gui

lordhoto at users.sourceforge.net lordhoto at users.sourceforge.net
Tue Apr 18 18:06:03 CEST 2006


Revision: 22017
Author:   lordhoto
Date:     2006-04-18 18:05:28 -0700 (Tue, 18 Apr 2006)
ViewCVS:  http://svn.sourceforge.net/scummvm/?rev=22017&view=rev

Log Message:
-----------
Started to prepare the gui for runtime resolution switches.
(some little things could be missing yet though)

Modified Paths:
--------------
    scummvm/trunk/gui/ListWidget.cpp
    scummvm/trunk/gui/ListWidget.h
    scummvm/trunk/gui/PopUpWidget.cpp
    scummvm/trunk/gui/PopUpWidget.h
    scummvm/trunk/gui/TabWidget.cpp
    scummvm/trunk/gui/TabWidget.h
    scummvm/trunk/gui/ThemeClassic.cpp
    scummvm/trunk/gui/ThemeNew.cpp
    scummvm/trunk/gui/about.cpp
    scummvm/trunk/gui/about.h
    scummvm/trunk/gui/dialog.cpp
    scummvm/trunk/gui/dialog.h
    scummvm/trunk/gui/launcher.cpp
    scummvm/trunk/gui/newgui.cpp
    scummvm/trunk/gui/object.h
    scummvm/trunk/gui/options.cpp
    scummvm/trunk/gui/options.h
    scummvm/trunk/gui/themes/modern.ini
    scummvm/trunk/gui/widget.cpp
    scummvm/trunk/gui/widget.h
Modified: scummvm/trunk/gui/ListWidget.cpp
===================================================================
--- scummvm/trunk/gui/ListWidget.cpp	2006-04-18 23:08:41 UTC (rev 22016)
+++ scummvm/trunk/gui/ListWidget.cpp	2006-04-19 01:05:28 UTC (rev 22017)
@@ -31,7 +31,7 @@
 
 ListWidget::ListWidget(GuiObject *boss, String name)
 	: EditableWidget(boss, name), CommandSender(boss) {
-	int w = g_gui.evaluator()->getVar(name + ".w");
+	int w = g_gui.evaluator()->getVar(_name + ".w");
 
 	WidgetSize ws = g_gui.getWidgetSize();
 
@@ -47,6 +47,9 @@
 	} else {
 		_w = w - kNormalScrollBarWidth;
 	}
+	
+	_scrollBar = new ScrollBarWidget(boss, _x + _w, _y, (ws == kBigWidgetSize ? kBigScrollBarWidth : kNormalScrollBarWidth), _h);
+	_scrollBar->setTarget(this);
 
 	_flags = WIDGET_ENABLED | WIDGET_CLEARBG | WIDGET_RETAIN_FOCUS | WIDGET_WANT_TICKLE;
 	setHints(THEME_HINT_SAVE_BACKGROUND);
@@ -56,8 +59,6 @@
 	_entriesPerPage = (_h - _topPadding - _bottomPadding) / kLineHeight;
 	_currentPos = 0;
 	_selectedItem = -1;
-	_scrollBar = new ScrollBarWidget(boss, _x + _w, _y, (ws == kBigWidgetSize ? kBigScrollBarWidth : kNormalScrollBarWidth), _h);
-	_scrollBar->setTarget(this);
 	_currentKeyDown = 0;
 
 	_quickSelectTime = 0;
@@ -436,4 +437,36 @@
 	g_system->setFeatureState(OSystem::kFeatureVirtualKeyboard, false);
 }
 
+void ListWidget::handleScreenChanged() {
+	Widget::handleScreenChanged();
+
+	int w = g_gui.evaluator()->getVar(_name + ".w");
+
+	WidgetSize ws = g_gui.getWidgetSize();
+
+	_leftPadding = g_gui.evaluator()->getVar("ListWidget.leftPadding", 0);
+	_rightPadding = g_gui.evaluator()->getVar("ListWidget.rightPadding", 0);
+	_topPadding = g_gui.evaluator()->getVar("ListWidget.topPadding", 0);
+	_bottomPadding = g_gui.evaluator()->getVar("ListWidget.bottomPadding", 0);
+	_hlLeftPadding = g_gui.evaluator()->getVar("ListWidget.hlLeftPadding", 0);
+	_hlRightPadding = g_gui.evaluator()->getVar("ListWidget.hlRightPadding", 0);
+
+	if (ws == kBigWidgetSize) {
+		_w = w - kBigScrollBarWidth;
+	} else {
+		_w = w - kNormalScrollBarWidth;
+	}
+
+	_entriesPerPage = (_h - _topPadding - _bottomPadding) / kLineHeight;
+
+	delete [] _textWidth;
+	_textWidth = new int[_entriesPerPage];
+
+	for (int i = 0; i < _entriesPerPage; i++)
+		_textWidth[i] = 0;
+
+	_scrollBar->resize(_x + _w, _y, (ws == kBigWidgetSize ? kBigScrollBarWidth : kNormalScrollBarWidth), _h);
+	scrollBarRecalc();
+}
+
 } // End of namespace GUI

Modified: scummvm/trunk/gui/ListWidget.h
===================================================================
--- scummvm/trunk/gui/ListWidget.h	2006-04-18 23:08:41 UTC (rev 22016)
+++ scummvm/trunk/gui/ListWidget.h	2006-04-19 01:05:28 UTC (rev 22017)
@@ -90,6 +90,8 @@
 	virtual bool handleKeyUp(uint16 ascii, int keycode, int modifiers);
 	virtual void handleCommand(CommandSender *sender, uint32 cmd, uint32 data);
 
+	virtual void handleScreenChanged();
+
 	virtual bool wantsFocus() { return true; }
 
 	// Made startEditMode for SCUMM's SaveLoadChooser

Modified: scummvm/trunk/gui/PopUpWidget.cpp
===================================================================
--- scummvm/trunk/gui/PopUpWidget.cpp	2006-04-18 23:08:41 UTC (rev 22016)
+++ scummvm/trunk/gui/PopUpWidget.cpp	2006-04-19 01:05:28 UTC (rev 22017)
@@ -344,11 +344,8 @@
 
 PopUpWidget::PopUpWidget(GuiObject *boss, String name, const String &label, uint labelWidth)
 	: Widget(boss, name), CommandSender(boss), _label(label), _labelWidth(labelWidth) {
-	_ws = g_gui.getWidgetSize();
+	handleScreenChanged();
 
-	_leftPadding = g_gui.evaluator()->getVar("PopUpWidget.leftPadding", 0);
-	_rightPadding = g_gui.evaluator()->getVar("PopUpWidget.rightPadding", 0);
-
 	_flags = WIDGET_ENABLED | WIDGET_CLEARBG | WIDGET_RETAIN_FOCUS;
 	setHints(THEME_HINT_SAVE_BACKGROUND);
 	_type = kPopUpWidget;
@@ -371,6 +368,15 @@
 	}
 }
 
+void PopUpWidget::handleScreenChanged() {
+	_ws = g_gui.getWidgetSize();
+
+	_leftPadding = g_gui.evaluator()->getVar("PopUpWidget.leftPadding", 0);
+	_rightPadding = g_gui.evaluator()->getVar("PopUpWidget.rightPadding", 0);
+
+	Widget::handleScreenChanged();
+}
+
 void PopUpWidget::appendEntry(const String &entry, uint32 tag) {
 	Entry e;
 	e.name = entry;

Modified: scummvm/trunk/gui/PopUpWidget.h
===================================================================
--- scummvm/trunk/gui/PopUpWidget.h	2006-04-18 23:08:41 UTC (rev 22016)
+++ scummvm/trunk/gui/PopUpWidget.h	2006-04-19 01:05:28 UTC (rev 22017)
@@ -62,6 +62,8 @@
 public:
 	PopUpWidget(GuiObject *boss, String name, const String &label, uint labelWidth = 0);
 
+	void changeLabelWidth(uint newWidth) { _labelWidth = newWidth; }
+
 	void handleMouseDown(int x, int y, int button, int clickCount);
 
 	void appendEntry(const String &entry, uint32 tag = (uint32)-1);
@@ -79,6 +81,8 @@
 
 	void handleMouseEntered(int button)	{ setFlags(WIDGET_HILITED); draw(); }
 	void handleMouseLeft(int button)	{ clearFlags(WIDGET_HILITED); draw(); }
+
+	virtual void handleScreenChanged();
 protected:
 	void drawWidget(bool hilite);
 };

Modified: scummvm/trunk/gui/TabWidget.cpp
===================================================================
--- scummvm/trunk/gui/TabWidget.cpp	2006-04-18 23:08:41 UTC (rev 22016)
+++ scummvm/trunk/gui/TabWidget.cpp	2006-04-19 01:05:28 UTC (rev 22017)
@@ -137,6 +137,17 @@
 	return Widget::handleKeyDown(ascii, keycode, modifiers);
 }
 
+void TabWidget::handleScreenChanged() {
+	for (uint i = 0; i < _tabs.size(); ++i) {
+		Widget *w = _tabs[i].firstWidget;
+		while (w) {
+			w->handleScreenChanged();
+			w = w->next();
+		}
+	}
+	Widget::handleScreenChanged();
+}
+
 void TabWidget::drawWidget(bool hilite) {
 	Common::Array<Common::String> tabs;
 	for (int i = 0; i < (int)_tabs.size(); ++i) {

Modified: scummvm/trunk/gui/TabWidget.h
===================================================================
--- scummvm/trunk/gui/TabWidget.h	2006-04-18 23:08:41 UTC (rev 22016)
+++ scummvm/trunk/gui/TabWidget.h	2006-04-19 01:05:28 UTC (rev 22017)
@@ -69,6 +69,8 @@
 	virtual void handleMouseDown(int x, int y, int button, int clickCount);
 	virtual bool handleKeyDown(uint16 ascii, int keycode, int modifiers);
 
+	virtual void handleScreenChanged();
+
 protected:
 	virtual void drawWidget(bool hilite);
 

Modified: scummvm/trunk/gui/ThemeClassic.cpp
===================================================================
--- scummvm/trunk/gui/ThemeClassic.cpp	2006-04-18 23:08:41 UTC (rev 22016)
+++ scummvm/trunk/gui/ThemeClassic.cpp	2006-04-19 01:05:28 UTC (rev 22017)
@@ -55,6 +55,7 @@
 		} else {
 			_font = FontMan.getFontByUsage(Graphics::FontManager::kGUIFont);
 		}
+		resetDrawArea();
 	}
 
 	if (isThemeLoadingRequired())

Modified: scummvm/trunk/gui/ThemeNew.cpp
===================================================================
--- scummvm/trunk/gui/ThemeNew.cpp	2006-04-18 23:08:41 UTC (rev 22016)
+++ scummvm/trunk/gui/ThemeNew.cpp	2006-04-19 01:05:28 UTC (rev 22017)
@@ -322,6 +322,7 @@
 		_initOk = true;
 		clearAll();
 		setupFonts();
+		resetDrawArea();
 	}
 
 	if (isThemeLoadingRequired()) {

Modified: scummvm/trunk/gui/about.cpp
===================================================================
--- scummvm/trunk/gui/about.cpp	2006-04-18 23:08:41 UTC (rev 22016)
+++ scummvm/trunk/gui/about.cpp	2006-04-19 01:05:28 UTC (rev 22017)
@@ -84,9 +84,9 @@
 	const int screenW = g_system->getOverlayWidth();
 	const int screenH = g_system->getOverlayHeight();
 
-	xOff = g_gui.evaluator()->getVar("aboutXOff");;
-	yOff = g_gui.evaluator()->getVar("aboutYOff");;
-	int outerBorder = g_gui.evaluator()->getVar("aboutOuterBorder");;
+	xOff = g_gui.evaluator()->getVar("aboutXOff");
+	yOff = g_gui.evaluator()->getVar("aboutYOff");
+	int outerBorder = g_gui.evaluator()->getVar("aboutOuterBorder");
 
 	_w = screenW - 2 * outerBorder;
 	_h = screenH - 2 * outerBorder;
@@ -289,4 +289,35 @@
 		close();
 }
 
+void AboutDialog::handleScreenChanged() {
+	Dialog::handleScreenChanged();
+	const int screenW = g_system->getOverlayWidth();
+	const int screenH = g_system->getOverlayHeight();
+
+	xOff = g_gui.evaluator()->getVar("aboutXOff");
+	yOff = g_gui.evaluator()->getVar("aboutYOff");
+	int outerBorder = g_gui.evaluator()->getVar("aboutOuterBorder");
+
+	_w = screenW - 2 * outerBorder;
+	_h = screenH - 2 * outerBorder;
+
+	_lineHeight = g_gui.getFontHeight() + 3;
+
+	// Heuristic to compute 'optimal' dialog width
+	int maxW = _w - 2*xOff;
+	_w = 0;
+	for (int i = 0; i < ARRAYSIZE(credits); i++) {
+		int tmp = g_gui.getStringWidth(credits[i] + 5);
+		if ( _w < tmp && tmp <= maxW) {
+			_w = tmp;
+		}
+	}
+	_w += 2*xOff;
+
+	_lineHeight = g_gui.getFontHeight() + 3;
+
+	_x = (screenW - _w) / 2;
+	_y = (screenH - _h) / 2;
+}
+
 } // End of namespace GUI

Modified: scummvm/trunk/gui/about.h
===================================================================
--- scummvm/trunk/gui/about.h	2006-04-18 23:08:41 UTC (rev 22016)
+++ scummvm/trunk/gui/about.h	2006-04-19 01:05:28 UTC (rev 22017)
@@ -52,6 +52,8 @@
 	void handleMouseUp(int x, int y, int button, int clickCount);
 	void handleKeyDown(uint16 ascii, int keycode, int modifiers);
 	void handleKeyUp(uint16 ascii, int keycode, int modifiers);
+
+	void handleScreenChanged();
 };
 
 } // End of namespace GUI

Modified: scummvm/trunk/gui/dialog.cpp
===================================================================
--- scummvm/trunk/gui/dialog.cpp	2006-04-18 23:08:41 UTC (rev 22016)
+++ scummvm/trunk/gui/dialog.cpp	2006-04-19 01:05:28 UTC (rev 22017)
@@ -106,9 +106,12 @@
 	_drawingHints |= THEME_HINT_FIRST_DRAW; 
 	Widget *w = _firstWidget;
 	while (w) {
+		w->handleScreenChanged();
 		w->setHints(THEME_HINT_FIRST_DRAW);
 		w = w->_next;
 	}
+
+	GuiObject::handleScreenChanged();
 }
 
 void Dialog::releaseFocus() {
@@ -304,6 +307,28 @@
 	return Widget::findWidgetInChain(_firstWidget, x, y);
 }
 
+Widget *Dialog::findWidget(const char *name) {
+	return Widget::findWidgetInChain(_firstWidget, name);
+}
+
+void Dialog::deleteWidget(Widget *del) {
+	Widget *w = _firstWidget;
+
+	if (del == _firstWidget) {
+		_firstWidget = _firstWidget->_next;
+		return;
+	}
+
+	w = _firstWidget;
+	while (w) {
+		if (w->_next == del) {
+			w->_next = w->_next->_next;
+			return;
+		}
+		w = w->_next;
+	}
+}
+
 ButtonWidget *Dialog::addButton(GuiObject *boss, int x, int y, const Common::String &label, uint32 cmd, char hotkey, WidgetSize ws) {
 	int w = kButtonWidth;
 	int h = kButtonHeight;

Modified: scummvm/trunk/gui/dialog.h
===================================================================
--- scummvm/trunk/gui/dialog.h	2006-04-18 23:08:41 UTC (rev 22016)
+++ scummvm/trunk/gui/dialog.h	2006-04-19 01:05:28 UTC (rev 22017)
@@ -62,6 +62,8 @@
 
 	void	releaseFocus();
 
+	virtual void handleScreenChanged();
+
 protected:
 	virtual void open();
 	virtual void close();
@@ -77,9 +79,10 @@
 	virtual void handleKeyUp(uint16 ascii, int keycode, int modifiers);
 	virtual void handleMouseMoved(int x, int y, int button);
 	virtual void handleCommand(CommandSender *sender, uint32 cmd, uint32 data);
-	virtual void handleScreenChanged();
 
 	Widget *findWidget(int x, int y); // Find the widget at pos x,y if any
+	Widget *findWidget(const char *name);
+	void deleteWidget(Widget *widget);
 
 	ButtonWidget *addButton(GuiObject *boss, int x, int y, const Common::String &label, uint32 cmd, char hotkey, WidgetSize ws = kDefaultWidgetSize);
 

Modified: scummvm/trunk/gui/launcher.cpp
===================================================================
--- scummvm/trunk/gui/launcher.cpp	2006-04-18 23:08:41 UTC (rev 22016)
+++ scummvm/trunk/gui/launcher.cpp	2006-04-19 01:05:28 UTC (rev 22017)
@@ -767,6 +767,11 @@
 void LauncherDialog::handleScreenChanged() {
 #ifndef DISABLE_FANCY_THEMES
 	if (g_gui.evaluator()->getVar("launcher_logo.visible") == 1) {
+		StaticTextWidget *ver = (StaticTextWidget*)findWidget("launcher_version");
+		if (ver) {
+			ver->setLabel(gScummVMVersionDate);
+		}
+
 		if (!_logo)
 			_logo = new GraphicsWidget(this, "launcher_logo");
 		ThemeNew *th = (ThemeNew *)g_gui.theme();
@@ -774,9 +779,23 @@
 
 		_logo->setGfx(th->getImageSurface(th->kThemeLogo));
 	} else {
-		delete _logo;
+		StaticTextWidget *ver = (StaticTextWidget*)findWidget("launcher_version");
+		if (ver) {
+			ver->setLabel(gScummVMFullVersion);
+		}
+
+		if (_logo) {
+			deleteWidget(_logo);
+			_logo->setNext(0);
+			delete _logo;
+			_logo = 0;
+		}
 	}
 #endif
+
+	_w = g_system->getOverlayWidth();
+	_h = g_system->getOverlayHeight();
+
 	Dialog::handleScreenChanged();
 }
 

Modified: scummvm/trunk/gui/newgui.cpp
===================================================================
--- scummvm/trunk/gui/newgui.cpp	2006-04-18 23:08:41 UTC (rev 22016)
+++ scummvm/trunk/gui/newgui.cpp	2006-04-19 01:05:28 UTC (rev 22017)
@@ -59,29 +59,33 @@
 
 // HACK. FIXME. This doesn't belong here. But otherwise it creates compulation problems
 GuiObject::GuiObject(Common::String name) : _firstWidget(0) {
-	if ((_x = g_gui.evaluator()->getVar(name + ".x")) == EVAL_UNDEF_VAR)
-		error("Undefined variable %s.x", name.c_str());
-	if ((_y = g_gui.evaluator()->getVar(name + ".y")) == EVAL_UNDEF_VAR)
-		error("Undefined variable %s.y", name.c_str());
-	_w = g_gui.evaluator()->getVar(name + ".w");
-	_h = g_gui.evaluator()->getVar(name + ".h");
-
-	if(_x < 0)
-		error("Widget <%s> has x < 0", name.c_str());
-	if(_x >= g_system->getOverlayWidth())
-		error("Widget <%s> has x > %d", name.c_str(), g_system->getOverlayWidth());
-	if(_x + _w > g_system->getOverlayWidth())
-		error("Widget <%s> has x + w > %d (%d)", name.c_str(), g_system->getOverlayWidth(), _x + _w);
-	if(_y < 0)
-		error("Widget <%s> has y < 0", name.c_str());
-	if(_y >= g_system->getOverlayWidth())
-		error("Widget <%s> has y > %d", name.c_str(), g_system->getOverlayHeight());
-	if(_y + _h > g_system->getOverlayWidth())
-		error("Widget <%s> has y + h > %d (%d)", name.c_str(), g_system->getOverlayHeight(), _y + _h);
-
 	_name = name;
+	handleScreenChanged();
 }
 
+void GuiObject::handleScreenChanged() {
+	if (_name != "") {
+		if ((_x = g_gui.evaluator()->getVar(_name + ".x")) == EVAL_UNDEF_VAR)
+			error("Undefined variable %s.x", _name.c_str());
+		if ((_y = g_gui.evaluator()->getVar(_name + ".y")) == EVAL_UNDEF_VAR)
+			error("Undefined variable %s.y", _name.c_str());
+		_w = g_gui.evaluator()->getVar(_name + ".w");
+		_h = g_gui.evaluator()->getVar(_name + ".h");
+	
+		if(_x < 0)
+			error("Widget <%s> has x < 0", _name.c_str());
+		if(_x >= g_system->getOverlayWidth())
+			error("Widget <%s> has x > %d", _name.c_str(), g_system->getOverlayWidth());
+		if(_x + _w > g_system->getOverlayWidth())
+			error("Widget <%s> has x + w > %d (%d)", _name.c_str(), g_system->getOverlayWidth(), _x + _w);
+		if(_y < 0)
+			error("Widget <%s> has y < 0", _name.c_str());
+		if(_y >= g_system->getOverlayWidth())
+			error("Widget <%s> has y > %d", _name.c_str(), g_system->getOverlayHeight());
+		if(_y + _h > g_system->getOverlayWidth())
+			error("Widget <%s> has y + h > %d (%d)", _name.c_str(), g_system->getOverlayHeight(), _y + _h);
+	}
+}
 
 // Constructor
 NewGui::NewGui() : _needRedraw(false),
@@ -235,7 +239,7 @@
 				_needRedraw = true;
 				// refresh all dialogs
 				for (i = 0; i < _dialogStack.size(); ++i) {
-					activeDialog->handleScreenChanged();
+					_dialogStack[i]->handleScreenChanged();
 				}
 				break;
 			}

Modified: scummvm/trunk/gui/object.h
===================================================================
--- scummvm/trunk/gui/object.h	2006-04-18 23:08:41 UTC (rev 22016)
+++ scummvm/trunk/gui/object.h	2006-04-19 01:05:28 UTC (rev 22017)
@@ -78,6 +78,8 @@
 
 	virtual void	draw() = 0;
 
+	virtual void	handleScreenChanged();
+
 protected:
 	virtual void	releaseFocus() = 0;
 

Modified: scummvm/trunk/gui/options.cpp
===================================================================
--- scummvm/trunk/gui/options.cpp	2006-04-18 23:08:41 UTC (rev 22016)
+++ scummvm/trunk/gui/options.cpp	2006-04-19 01:05:28 UTC (rev 22017)
@@ -446,6 +446,19 @@
 	_enableVolumeSettings = true;
 }
 
+void OptionsDialog::handleScreenChanged() {
+	Dialog::handleScreenChanged();
+
+	int labelWidth = g_gui.evaluator()->getVar("tabPopupsLabelW");
+
+	if (_midiPopUp)
+		_midiPopUp->changeLabelWidth(labelWidth);
+	if (_gfxPopUp)
+		_gfxPopUp->changeLabelWidth(labelWidth);
+	if (_renderModePopUp)
+		_renderModePopUp->changeLabelWidth(labelWidth);
+}
+
 #pragma mark -
 
 

Modified: scummvm/trunk/gui/options.h
===================================================================
--- scummvm/trunk/gui/options.h	2006-04-18 23:08:41 UTC (rev 22016)
+++ scummvm/trunk/gui/options.h	2006-04-19 01:05:28 UTC (rev 22017)
@@ -49,6 +49,8 @@
 	void close();
 	void handleCommand(CommandSender *sender, uint32 cmd, uint32 data);
 
+	virtual void handleScreenChanged();
+
 	enum {
 		kOKCmd					= 'ok  '
 	};

Modified: scummvm/trunk/gui/themes/modern.ini
===================================================================
--- scummvm/trunk/gui/themes/modern.ini	2006-04-18 23:08:41 UTC (rev 22016)
+++ scummvm/trunk/gui/themes/modern.ini	2006-04-19 01:05:28 UTC (rev 22017)
@@ -148,6 +148,7 @@
 fontfile_normal=helvr12-l1.bdf
 
 [640xY]
+def_launcherX=23
 def_widgetSize=kBigWidgetSize
 def_buttonWidth=120
 def_buttonHeight=25
@@ -155,7 +156,7 @@
 def_sliderHeight=kBigSliderHeight
 def_kLineHeight=16
 def_kFontHeight=14
-def_globOptionsW=466
+def_globOptionsW=(w - buttonWidth - 17 * 2 - launcherX)
 def_gameOptionsH=(h - 2 * 40)
 def_gameOptionsLabelWidth=90
 def_tabPopupsLabelW=110
@@ -197,13 +198,13 @@
 browser_choose=(prev.x2 + 10) prev.y prev.w prev.h
 
 ##### launcher
-launcher_version=85 21 247 kLineHeight
+launcher_version=(w / 2 - 283 / 2 - 90) 21 247 kLineHeight
 launcher_version.align=kTextAlignRight
-launcher_logo=180 5 283 80
+launcher_logo=(w / 2 - 283 / 2) 5 283 80
 launcher_logo.visible=true
 space1=20
 space2=5
-launcher_list=23 94 466 (h - 23 - self.y)
+launcher_list=launcherX 94 (w - buttonWidth - 17 * 2 - self.x) (h - 23 - self.y)
 launcher_start_button=(prev.x2 + 17) prev.y buttonWidth buttonHeight
 launcher_addGame_button=prev.x (prev.y2 + space1) prev.w prev.h
 launcher_editGame_button=prev.x (prev.y2 + space2) prev.w prev.h
@@ -461,3 +462,28 @@
 smH=(smY + buttonHeight + scummmainHOffset)
 smW=(buttonWidth + 2 * scummmainHOffset)
 scummmain=((w - smW) / 2) ((h - smH) / 2) smW smH
+
+## 960xY modes
+[960xY]
+def_launcherX=23
+def_widgetSize=kBigWidgetSize
+def_buttonWidth=120
+def_buttonHeight=25
+def_sliderWidth=kBigSliderWidth
+def_sliderHeight=kBigSliderHeight
+def_kLineHeight=16
+def_kFontHeight=14
+def_globOptionsW=(w - buttonWidth - 17 * 2 - launcherX)
+def_gameOptionsH=(h - 2 * 40)
+def_gameOptionsLabelWidth=90
+def_tabPopupsLabelW=110
+def_aboutXOff=8
+def_aboutYOff=5
+def_aboutOuterBorder=80
+def_scummmainHOffset=12
+def_scummmainVSpace=15
+def_scummmainVAddOff=5
+def_scummhelpW=370
+def_scummhelpX=((w - scummhelpW) / 2)
+def_midiControlsSpacing=4
+use=640xY

Modified: scummvm/trunk/gui/widget.cpp
===================================================================
--- scummvm/trunk/gui/widget.cpp	2006-04-18 23:08:41 UTC (rev 22016)
+++ scummvm/trunk/gui/widget.cpp	2006-04-19 01:05:28 UTC (rev 22017)
@@ -49,6 +49,13 @@
 	_hints = THEME_HINT_FIRST_DRAW | THEME_HINT_SAVE_BACKGROUND;
 }
 
+void Widget::resize(int x, int y, int w, int h) {
+	_x = x;
+	_y = y;
+	_w = w;
+	_h = h;
+}
+
 Widget::~Widget() {
 	delete _next;
 }
@@ -114,6 +121,16 @@
 	return w;
 }
 
+Widget *Widget::findWidgetInChain(Widget *w, const char *name) {
+	while (w) {
+		if (w->_name == name) {
+			return w;
+		}
+		w = w->_next;
+	}
+	return 0;
+}
+
 bool Widget::isVisible() const {
 	if (g_gui.evaluator()->getVar(_name + ".visible") == 0)
 		return false;
@@ -173,6 +190,11 @@
 							g_gui.theme()->convertAligment(_align));
 }
 
+void StaticTextWidget::handleScreenChanged() {
+	Widget::handleScreenChanged();
+	_ws = g_gui.getWidgetSize();
+}
+
 #pragma mark -
 
 ButtonWidget::ButtonWidget(GuiObject *boss, int x, int y, int w, int h, const String &label, uint32 cmd, uint8 hotkey, WidgetSize ws)

Modified: scummvm/trunk/gui/widget.h
===================================================================
--- scummvm/trunk/gui/widget.h	2006-04-18 23:08:41 UTC (rev 22016)
+++ scummvm/trunk/gui/widget.h	2006-04-19 01:05:28 UTC (rev 22017)
@@ -98,6 +98,7 @@
 
 public:
 	static Widget *findWidgetInChain(Widget *start, int x, int y);
+	static Widget *findWidgetInChain(Widget *start, const char *name);
 
 public:
 	Widget(GuiObject *boss, int x, int y, int w, int h);
@@ -105,7 +106,11 @@
 	virtual ~Widget();
 
 	void init();
+	void resize(int x, int y, int w, int h);
 
+	void setNext(Widget *w) { _next = w; }
+	Widget *next() { return _next; }
+
 	virtual int16	getAbsX() const	{ return _x + _boss->getChildX(); }
 	virtual int16	getAbsY() const	{ return _y + _boss->getChildY(); }
 
@@ -122,6 +127,8 @@
 	virtual bool handleKeyUp(uint16 ascii, int keycode, int modifiers) { return false; }	// Return true if the event was handled
 	virtual void handleTickle() {}
 
+	virtual void handleScreenChanged() { GuiObject::handleScreenChanged(); }
+
 	void draw();
 	void receivedFocus() { _hasFocus = true; receivedFocusWidget(); }
 	void lostFocus() { _hasFocus = false; lostFocusWidget(); }
@@ -171,6 +178,8 @@
 	void setAlign(TextAlignment align);
 	TextAlignment getAlign() const		{ return _align; }
 
+	virtual void handleScreenChanged();
+
 protected:
 	void drawWidget(bool hilite);
 };


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.





More information about the Scummvm-git-logs mailing list