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

sev at users.sourceforge.net sev at users.sourceforge.net
Thu May 18 13:54:02 CEST 2006


Revision: 22525
Author:   sev
Date:     2006-05-18 13:53:28 -0700 (Thu, 18 May 2006)
ViewCVS:  http://svn.sourceforge.net/scummvm/?rev=22525&view=rev

Log Message:
-----------
- Fix spelling in theme config
- Introduce embossing shadow
- Less round corners in popup widget
- Custom border in editable text widget
- Matched color in popup widget and editable text widget with mock-ups
- Less round corners in editable text widget
- Text padding in editable text widget

Modified Paths:
--------------
    scummvm/trunk/gui/EditTextWidget.cpp
    scummvm/trunk/gui/EditTextWidget.h
    scummvm/trunk/gui/ThemeNew.cpp
    scummvm/trunk/gui/theme.h
    scummvm/trunk/gui/themes/modern.ini
Modified: scummvm/trunk/gui/EditTextWidget.cpp
===================================================================
--- scummvm/trunk/gui/EditTextWidget.cpp	2006-05-18 19:38:54 UTC (rev 22524)
+++ scummvm/trunk/gui/EditTextWidget.cpp	2006-05-18 20:53:28 UTC (rev 22525)
@@ -22,6 +22,7 @@
 #include "common/stdafx.h"
 #include "gui/EditTextWidget.h"
 #include "gui/dialog.h"
+#include "gui/eval.h"
 #include "gui/newgui.h"
 
 namespace GUI {
@@ -32,14 +33,19 @@
 	_type = kEditTextWidget;
 
 	setEditString(text);
+
+	handleScreenChanged();
 }
 
 EditTextWidget::EditTextWidget(GuiObject *boss, String name, const String &text)
 	: EditableWidget(boss, name) {
 	_flags = WIDGET_ENABLED | WIDGET_CLEARBG | WIDGET_RETAIN_FOCUS | WIDGET_WANT_TICKLE;
 	_type = kEditTextWidget;
+	_hints |= THEME_HINT_USE_SHADOW;
 
 	setEditString(text);
+
+	handleScreenChanged();
 }
 
 void EditTextWidget::setEditString(const String &str) {
@@ -47,6 +53,12 @@
 	_backupString = str;
 }
 
+void EditTextWidget::handleScreenChanged() {
+	_leftPadding = g_gui.evaluator()->getVar("EditTextWidget.leftPadding", 0);
+	_rightPadding = g_gui.evaluator()->getVar("EditTextWidget.rightPadding", 0);
+}
+
+
 void EditTextWidget::handleMouseDown(int x, int y, int button, int clickCount) {
 	// First remove caret
 	if (_caretVisible)
@@ -68,15 +80,15 @@
 
 
 void EditTextWidget::drawWidget(bool hilite) {
-	g_gui.theme()->drawWidgetBackground(Common::Rect(_x, _y, _x+_w, _y+_h), _hints, Theme::kWidgetBackgroundBorderSmall);
+	g_gui.theme()->drawWidgetBackground(Common::Rect(_x, _y, _x+_w, _y+_h), _hints, Theme::kWidgetBackgroundEditText);
 
 	// Draw the text
 	adjustOffset();
-	g_gui.theme()->drawText(Common::Rect(_x+2,_y+2, _x+getEditRect().width()-2, _y+_h-2), _editString, Theme::kStateEnabled, Theme::kTextAlignLeft, false, -_editScrollOffset, false, Theme::kFontStyleNormal);
+	g_gui.theme()->drawText(Common::Rect(_x+2 + _leftPadding,_y+2, _x+getEditRect().width()-2, _y+_h-2), _editString, Theme::kStateEnabled, Theme::kTextAlignLeft, false, -_editScrollOffset, false, Theme::kFontStyleNormal);
 }
 
 Common::Rect EditTextWidget::getEditRect() const {
-	Common::Rect r(2, 1, _w - 2, _h);
+	Common::Rect r(2 + _leftPadding, 1, _w - 2 - _leftPadding, _h);
 
 	return r;
 }

Modified: scummvm/trunk/gui/EditTextWidget.h
===================================================================
--- scummvm/trunk/gui/EditTextWidget.h	2006-05-18 19:38:54 UTC (rev 22524)
+++ scummvm/trunk/gui/EditTextWidget.h	2006-05-18 20:53:28 UTC (rev 22525)
@@ -34,6 +34,9 @@
 
 	String		_backupString;
 
+	int				_leftPadding;
+	int				_rightPadding;
+
 public:
 	EditTextWidget(GuiObject *boss, int x, int y, int w, int h, const String &text, WidgetSize ws = kNormalWidgetSize);
 	EditTextWidget(GuiObject *boss, String name, const String &text);
@@ -44,6 +47,8 @@
 
 	virtual bool wantsFocus() { return true; }
 
+	virtual void handleScreenChanged();
+
 protected:
 	void drawWidget(bool hilite);
 	void receivedFocusWidget();

Modified: scummvm/trunk/gui/ThemeNew.cpp
===================================================================
--- scummvm/trunk/gui/ThemeNew.cpp	2006-05-18 19:38:54 UTC (rev 22524)
+++ scummvm/trunk/gui/ThemeNew.cpp	2006-05-18 20:53:28 UTC (rev 22525)
@@ -37,8 +37,9 @@
 #define kShadowTr2 32
 #define kShadowTr3 64
 #define kShadowTr4 128
+#define kShadowTr5 192
 
-#define THEME_VERSION 11
+#define THEME_VERSION 12
 
 using Graphics::Surface;
 
@@ -218,6 +219,11 @@
 	_configFile.getKey("popupwidget_left", "pixmaps", imageHandlesTable[kPopUpWidgetBkgdLeft]);
 	_configFile.getKey("popupwidget_bkgd", "pixmaps", imageHandlesTable[kPopUpWidgetBkgd]);
 
+	_configFile.getKey("edittext_bkgd_corner", "pixmaps", imageHandlesTable[kEditTextBkgdCorner]);
+	_configFile.getKey("edittext_bkgd_top", "pixmaps", imageHandlesTable[kEditTextBkgdTop]);
+	_configFile.getKey("edittext_bkgd_left", "pixmaps", imageHandlesTable[kEditTextBkgdLeft]);
+	_configFile.getKey("edittext_bkgd", "pixmaps", imageHandlesTable[kEditTextBkgd]);
+
 	_configFile.getKey("cursor_image", "pixmaps", imageHandlesTable[kGUICursor]);
 	
 	// load the gradient factors from the config file
@@ -239,6 +245,8 @@
 	getFactorFromConfig(_configFile, "scrollbar_background", _gradientFactors[kScrollbarBkgdFactor]);
 
 	getFactorFromConfig(_configFile, "popupwidget", _gradientFactors[kPopUpWidgetFactor]);
+
+	getFactorFromConfig(_configFile, "edittext", _gradientFactors[kEditTextFactor]);
 	
 	// load values with default values from the config file
 	getExtraValueFromConfig(_configFile, "shadow_left_width", _shadowLeftWidth, 2);
@@ -508,33 +516,56 @@
 		restoreBackground((hints & THEME_HINT_USE_SHADOW) ? r2 : r);
 		return;
 	}
-	
-	if (background == kWidgetBackgroundBorderSmall) {
-		if ((hints & THEME_HINT_USE_SHADOW)) {
-			r2 = shadowRect(r, kShadowSmall);
-			restoreBackground(r2);
-			// shadow
-			drawShadow(r, surface(kWidgetSmallBkgdCorner), surface(kWidgetSmallBkgdTop), surface(kWidgetSmallBkgdLeft),
-						surface(kWidgetSmallBkgd), kShadowSmall);
-		}
 
-		drawRectMasked(r, surface(kWidgetSmallBkgdCorner), surface(kWidgetSmallBkgdTop), surface(kWidgetSmallBkgdLeft), surface(kWidgetSmallBkgd),
-						(state == kStateDisabled) ? -30 : 256, _colors[kWidgetBackgroundSmallStart], _colors[kWidgetBackgroundSmallEnd],
-						_gradientFactors[kWidgetSmallFactor]);
-	} else {
-		if ((hints & THEME_HINT_USE_SHADOW)) {
-			r2 = shadowRect(r, kShadowFull);
-			restoreBackground(r2);
-			// shadow
-			drawShadow(r, surface(kWidgetBkgdCorner), surface(kWidgetBkgdTop), surface(kWidgetBkgdLeft), surface(kWidgetBkgd),
-						kShadowFull);
-		}
+	kImageHandles corner, top, left, bkgd;
+	kShadowStyles shadow;
+	kColorHandles start, end;
+	kGradientFactors factor;
 
-		drawRectMasked(r, surface(kWidgetBkgdCorner), surface(kWidgetBkgdTop), surface(kWidgetBkgdLeft), surface(kWidgetBkgd),
-						(state == kStateDisabled) ? -30 : 256, _colors[kWidgetBackgroundStart], _colors[kWidgetBackgroundEnd],
-						_gradientFactors[kWidgetFactor]);
+	switch (background) {
+	case kWidgetBackgroundBorderSmall:
+		corner = kWidgetSmallBkgdCorner;
+		top = kWidgetSmallBkgdTop;
+		left = kWidgetSmallBkgdLeft;
+		bkgd = kWidgetSmallBkgd;
+		shadow = kShadowSmall;
+		start = kWidgetBackgroundSmallStart;
+		end = kWidgetBackgroundSmallEnd;
+		factor = kWidgetSmallFactor;
+		break;
+	case kWidgetBackgroundEditText:
+		corner = kEditTextBkgdCorner;
+		top = kEditTextBkgdTop;
+		left = kEditTextBkgdLeft;
+		bkgd = kEditTextBkgd;
+		shadow = kShadowEmboss;
+		start = kEditTextBackgroundStart;
+		end = kEditTextBackgroundEnd;
+		factor = kEditTextFactor;
+		break;
+	default:
+		corner = kWidgetBkgdCorner;
+		top = kWidgetBkgdTop;
+		left = kWidgetBkgdLeft;
+		bkgd = kWidgetBkgd;
+		shadow = kShadowFull;
+		start = kWidgetBackgroundStart;
+		end = kWidgetBackgroundEnd;
+		factor = kWidgetFactor;
+		break;
 	}
 
+	if ((hints & THEME_HINT_USE_SHADOW)) {
+		r2 = shadowRect(r, shadow);
+		restoreBackground(r2);
+		// shadow
+		drawShadow(r, surface(corner), surface(top), surface(left), surface(bkgd), shadow);
+	}
+
+	drawRectMasked(r, surface(corner), surface(top), surface(left), surface(bkgd),
+				   (state == kStateDisabled) ? -30 : 256, _colors[start], _colors[end],
+				   _gradientFactors[factor]);
+
 	addDirtyRect((hints & THEME_HINT_USE_SHADOW) ? r2 : r, (hints & THEME_HINT_SAVE_BACKGROUND) != 0);
 }
 
@@ -1047,6 +1078,14 @@
 		drawShadowRect(r4, r, corner, top, left, fill, kShadowTr3, skipLastRow);
 		};
 
+	case kShadowEmboss: {
+		Common::Rect r2(r.left - _shadowLeftWidth/2, r.top - _shadowTopHeight/2, r.right, r.bottom);
+		Common::Rect r4(r.left - _shadowLeftWidth/2+1, r.top - _shadowTopHeight/2+1, r.right + _shadowRightWidth/2, r.bottom + _shadowBottomHeight/2);
+
+		drawShadowRect(r2, r, corner, top, left, fill, kShadowTr5, skipLastRow);
+		drawShadowRect(r4, r, corner, top, left, fill, kShadowTr1, skipLastRow);
+		};
+
 	default:
 		break;
 	}
@@ -1307,9 +1346,12 @@
 	getColorFromConfig(_configFile, "caret_color", _colors[kCaretColor]);
 
 	getColorFromConfig(_configFile, "popupwidget_start", _colors[kPopUpWidgetStart]);
-	getColorFromConfig(_configFile, "pupupwidget_end", _colors[kPopUpWidgetEnd]);
+	getColorFromConfig(_configFile, "popupwidget_end", _colors[kPopUpWidgetEnd]);
 	getColorFromConfig(_configFile, "popupwidget_highlight_start", _colors[kPopUpWidgetHighlightStart]);
 	getColorFromConfig(_configFile, "popupwidget_highlight_end", _colors[kPopUpWidgetHighlightEnd]);
+
+	getColorFromConfig(_configFile, "edittext_background_start", _colors[kEditTextBackgroundStart]);
+	getColorFromConfig(_configFile, "edittext_background_end", _colors[kEditTextBackgroundEnd]);
 }
 
 #define FONT_NAME_NORMAL "newgui_normal"

Modified: scummvm/trunk/gui/theme.h
===================================================================
--- scummvm/trunk/gui/theme.h	2006-05-18 19:38:54 UTC (rev 22524)
+++ scummvm/trunk/gui/theme.h	2006-05-18 20:53:28 UTC (rev 22525)
@@ -77,7 +77,8 @@
 		kWidgetBackgroundNo,
 		kWidgetBackgroundPlain,
 		kWidgetBackgroundBorder,
-		kWidgetBackgroundBorderSmall
+		kWidgetBackgroundBorderSmall,
+		kWidgetBackgroundEditText
 	};
 
 	enum kState {
@@ -337,7 +338,8 @@
 		kShadowFull = 0,
 		kShadowSmall = 1,
 		kShadowButton = 2,
-		kShadowSlider = 3
+		kShadowSlider = 3,
+		kShadowEmboss = 4
 	};
 
 	Common::Rect shadowRect(const Common::Rect &r, uint32 shadowStyle);
@@ -436,7 +438,12 @@
 		kPopUpWidgetBkgdLeft = 42,
 		kPopUpWidgetBkgd = 43,
 
-		kGUICursor = 44,
+		kEditTextBkgdCorner = 44,
+		kEditTextBkgdTop = 45,
+		kEditTextBkgdLeft = 46,
+		kEditTextBkgd = 47,
+
+		kGUICursor = 48,
 		
 		kImageHandlesMax
 	};
@@ -524,6 +531,9 @@
 		kPopUpWidgetHighlightStart = 42,
 		kPopUpWidgetHighlightEnd = 43,
 		
+		kEditTextBackgroundStart = 44,
+		kEditTextBackgroundEnd = 45,
+
 		kColorHandlesMax
 	};
 	
@@ -549,6 +559,8 @@
 
 		kPopUpWidgetFactor = 10,
 		
+		kEditTextFactor = 11,
+		
 		kMaxGradientFactors
 	};
 	

Modified: scummvm/trunk/gui/themes/modern.ini
===================================================================
--- scummvm/trunk/gui/themes/modern.ini	2006-05-18 19:38:54 UTC (rev 22524)
+++ scummvm/trunk/gui/themes/modern.ini	2006-05-18 20:53:28 UTC (rev 22525)
@@ -1,7 +1,7 @@
 # $URL$
 # $Id$
 [theme]
-version=11
+version=12
 
 [pixmaps]
 dialog_corner=dialog_bkgd_corner.bmp
@@ -54,11 +54,16 @@
 button_left=button_bkgd_left.bmp
 button_bkgd=button_bkgd.bmp
 
-popupwidget_corner=widget_small_bkgd_corner.bmp
-popupwidget_top=widget_small_bkgd_top.bmp
-popupwidget_left=widget_small_bkgd_left.bmp
-popupwidget_bkgd=widget_small_bkgd.bmp
+popupwidget_corner=button_bkgd_corner.bmp
+popupwidget_top=button_bkgd_top.bmp
+popupwidget_left=button_bkgd_left.bmp
+popupwidget_bkgd=button_bkgd.bmp
 
+edittext_bkgd_corner=button_bkgd_corner.bmp
+edittext_bkgd_top=button_bkgd_top.bmp
+edittext_bkgd_left=button_bkgd_left.bmp
+edittext_bkgd=button_bkgd.bmp
+
 theme_logo=logo.bmp
 
 cursor_image=cursor.bmp
@@ -113,11 +118,15 @@
 scrollbar_slider_highlight_start=255 210 200
 scrollbar_slider_highlight_end=200 70 50
 
-popupwidget_start=246 224 139
-pupupwidget_end=251 241 206
+popupwidget_start=251 241 206
+popupwidget_end=251 241 206
 popupwidget_highlight_start=246 224 139
 popupwidget_highlight_end=251 241 206
 
+edittext_background_start=247 228 166
+edittext_background_end=247 228 166
+
+
 caret_color=0 0 0
 
 [gradients]
@@ -138,8 +147,10 @@
 scrollbar=1
 scrollbar_background=1
 
-popupwidget=3
+popupwidget=1
 
+edittext=1
+
 [extra]
 shadow_left_width=2
 shadow_right_width=4
@@ -161,6 +172,7 @@
 def_sliderHeight=kBigSliderHeight
 def_kLineHeight=16
 def_kFontHeight=14
+def_kPopUpHeight=(kLineHeight + 3)
 def_insetX=23
 def_insetY=94
 def_insetW=(w - buttonWidth - 17 * 2 - insetX)
@@ -186,6 +198,8 @@
 ListWidget.hlRightPadding=0
 PopUpWidget.leftPadding=7
 PopUpWidget.rightPadding=7
+EditTextWidget.leftPadding=7
+EditTextWidget.rightPadding=7
 
 ###### chooser
 opHeight=insetH
@@ -268,13 +282,13 @@
 opYoffset=vBorder
 gameoptions_id=gox (opYoffset + 2) gameOptionsLabelWidth kLineHeight
 gameoptions_id.align=kTextAlignRight
-gameoptions_domain=prev.x2 (prev.y - 1) (gow - prev.w) (prev.h + 2)
-opYoffset=(opYoffset + kLineHeight + 8)
+gameoptions_domain=prev.x2 (prev.y - 1) (gow - prev.w) kPopUpHeight
+opYoffset=(opYoffset + kLineHeight + 10)
 gameoptions_name=gox (opYoffset + 2) gameOptionsLabelWidth kLineHeight
 gameoptions_name.align=kTextAlignRight
-gameoptions_desc=prev.x2 (prev.y - 1) (gow - prev.w) (prev.h + 2)
+gameoptions_desc=prev.x2 (prev.y - 1) (gow - prev.w) kPopUpHeight
 opYoffset=(opYoffset + kLineHeight + 12)
-gameoptions_lang=gox (opYoffset - 1) gow (kLineHeight + 2)
+gameoptions_lang=gox (opYoffset - 1) gow kPopUpHeight
 opYoffset=(opYoffset + kLineHeight + 8)
 gameoptions_platform=prev.x opYoffset prev.w prev.h
 opYoffset=(opYoffset + kLineHeight + 8)
@@ -397,7 +411,7 @@
 [graphicsControls]
 gcx=(opXoffset + 10)
 gcw=(parent.w - gcx - 25)
-grModePopup=(gcx - 5) (opYoffset - 1) (gcw + 5) (kLineHeight + 2)
+grModePopup=(gcx - 5) (opYoffset - 1) (gcw + 5) kPopUpHeight
 opYoffset=(opYoffset + kLineHeight + 8)
 grRenderPopup=prev.x (opYoffset - 1) prev.w prev.h
 opYoffset=(opYoffset + kLineHeight + 12)
@@ -409,7 +423,7 @@
 [audioControls]
 aux=(opXoffset + 10)
 auw=(parent.w - aux - 30)
-auMidiPopup=(aux) (opYoffset - 1) (auw + 5) (kLineHeight + 2)
+auMidiPopup=(aux) (opYoffset - 1) (auw + 5) kPopUpHeight
 opYoffset=(opYoffset + buttonHeight + 4)
 
 [volumeControls]


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