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

fingolfin at users.sourceforge.net fingolfin at users.sourceforge.net
Sat Jun 3 15:34:01 CEST 2006


Revision: 22873
Author:   fingolfin
Date:     2006-06-03 06:33:39 -0700 (Sat, 03 Jun 2006)
ViewCVS:  http://svn.sourceforge.net/scummvm/?rev=22873&view=rev

Log Message:
-----------
*Loads* of Common::String related optimizations. Woa, *tons* of methods were copying strings needlessly

Modified Paths:
--------------
    scummvm/trunk/gui/EditTextWidget.cpp
    scummvm/trunk/gui/EditTextWidget.h
    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/ThemeNew.cpp
    scummvm/trunk/gui/dialog.cpp
    scummvm/trunk/gui/dialog.h
    scummvm/trunk/gui/editable.cpp
    scummvm/trunk/gui/editable.h
    scummvm/trunk/gui/eval.cpp
    scummvm/trunk/gui/eval.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/theme-config.cpp
    scummvm/trunk/gui/theme.h
    scummvm/trunk/gui/widget.cpp
    scummvm/trunk/gui/widget.h
Modified: scummvm/trunk/gui/EditTextWidget.cpp
===================================================================
--- scummvm/trunk/gui/EditTextWidget.cpp	2006-06-03 13:33:05 UTC (rev 22872)
+++ scummvm/trunk/gui/EditTextWidget.cpp	2006-06-03 13:33:39 UTC (rev 22873)
@@ -36,7 +36,7 @@
 	setEditString(text);
 }
 
-EditTextWidget::EditTextWidget(GuiObject *boss, String name, const String &text)
+EditTextWidget::EditTextWidget(GuiObject *boss, const String &name, const String &text)
 	: EditableWidget(boss, name) {
 	_flags = WIDGET_ENABLED | WIDGET_CLEARBG | WIDGET_RETAIN_FOCUS | WIDGET_WANT_TICKLE;
 	_type = kEditTextWidget;

Modified: scummvm/trunk/gui/EditTextWidget.h
===================================================================
--- scummvm/trunk/gui/EditTextWidget.h	2006-06-03 13:33:05 UTC (rev 22872)
+++ scummvm/trunk/gui/EditTextWidget.h	2006-06-03 13:33:39 UTC (rev 22873)
@@ -39,7 +39,7 @@
 
 public:
 	EditTextWidget(GuiObject *boss, int x, int y, int w, int h, const String &text);
-	EditTextWidget(GuiObject *boss, String name, const String &text);
+	EditTextWidget(GuiObject *boss, const String &name, const String &text);
 
 	void setEditString(const String &str);
 

Modified: scummvm/trunk/gui/ListWidget.cpp
===================================================================
--- scummvm/trunk/gui/ListWidget.cpp	2006-06-03 13:33:05 UTC (rev 22872)
+++ scummvm/trunk/gui/ListWidget.cpp	2006-06-03 13:33:39 UTC (rev 22873)
@@ -29,7 +29,7 @@
 
 namespace GUI {
 
-ListWidget::ListWidget(GuiObject *boss, String name)
+ListWidget::ListWidget(GuiObject *boss, const String &name)
 	: EditableWidget(boss, name), CommandSender(boss) {
 
 	_leftPadding = g_gui.evaluator()->getVar("ListWidget.leftPadding", 0);

Modified: scummvm/trunk/gui/ListWidget.h
===================================================================
--- scummvm/trunk/gui/ListWidget.h	2006-06-03 13:33:05 UTC (rev 22872)
+++ scummvm/trunk/gui/ListWidget.h	2006-06-03 13:33:39 UTC (rev 22873)
@@ -70,7 +70,7 @@
 	int				_scrollBarWidth;
 
 public:
-	ListWidget(GuiObject *boss, String name);
+	ListWidget(GuiObject *boss, const String &name);
 	virtual ~ListWidget();
 
 	virtual Widget *findWidget(int x, int y);

Modified: scummvm/trunk/gui/PopUpWidget.cpp
===================================================================
--- scummvm/trunk/gui/PopUpWidget.cpp	2006-06-03 13:33:05 UTC (rev 22872)
+++ scummvm/trunk/gui/PopUpWidget.cpp	2006-06-03 13:33:39 UTC (rev 22873)
@@ -324,7 +324,7 @@
 		w = _w - 2;
 	}
 
-	Common::String &name = _popUpBoss->_entries[entry].name;
+	Common::String &name(_popUpBoss->_entries[entry].name);
 
 	if (name.size() == 0) {
 		// Draw a separator
@@ -342,7 +342,7 @@
 // PopUpWidget
 //
 
-PopUpWidget::PopUpWidget(GuiObject *boss, String name, const String &label, uint labelWidth)
+PopUpWidget::PopUpWidget(GuiObject *boss, const String &name, const String &label, uint labelWidth)
 	: Widget(boss, name), CommandSender(boss), _label(label), _labelWidth(labelWidth) {
 	handleScreenChanged();
 
@@ -419,7 +419,7 @@
 		g_gui.theme()->drawText(Common::Rect(_x+2,_y+3,_x+2+_labelWidth, _y+3+g_gui.theme()->getFontHeight()), _label,
 								isEnabled() ? Theme::kStateEnabled : Theme::kStateDisabled, Theme::kTextAlignRight);
 
-	Common::String sel = "";
+	Common::String sel;
 	if (_selectedItem >= 0)
 		sel = _entries[_selectedItem].name;
 	g_gui.theme()->drawPopUpWidget(Common::Rect(x, _y, x+w, _y+_h), sel, _leftPadding, isEnabled() ? (hilite ? Theme::kStateHighlight : Theme::kStateEnabled) : Theme::kStateDisabled, g_gui.theme()->convertAligment(kTextAlignLeft));

Modified: scummvm/trunk/gui/PopUpWidget.h
===================================================================
--- scummvm/trunk/gui/PopUpWidget.h	2006-06-03 13:33:05 UTC (rev 22872)
+++ scummvm/trunk/gui/PopUpWidget.h	2006-06-03 13:33:39 UTC (rev 22873)
@@ -60,7 +60,7 @@
 	int				_labelSpacing;
 
 public:
-	PopUpWidget(GuiObject *boss, String name, const String &label, uint labelWidth = 0);
+	PopUpWidget(GuiObject *boss, const String &name, const String &label, uint labelWidth = 0);
 
 	void changeLabelWidth(uint newWidth) { _labelWidth = newWidth; }
 

Modified: scummvm/trunk/gui/TabWidget.cpp
===================================================================
--- scummvm/trunk/gui/TabWidget.cpp	2006-06-03 13:33:05 UTC (rev 22872)
+++ scummvm/trunk/gui/TabWidget.cpp	2006-06-03 13:33:39 UTC (rev 22873)
@@ -41,7 +41,7 @@
 	init();
 }
 
-TabWidget::TabWidget(GuiObject *boss, String name)
+TabWidget::TabWidget(GuiObject *boss, const String &name)
 	: Widget(boss, name) {
 	init();
 }

Modified: scummvm/trunk/gui/TabWidget.h
===================================================================
--- scummvm/trunk/gui/TabWidget.h	2006-06-03 13:33:05 UTC (rev 22872)
+++ scummvm/trunk/gui/TabWidget.h	2006-06-03 13:33:39 UTC (rev 22873)
@@ -43,7 +43,7 @@
 
 public:
 	TabWidget(GuiObject *boss, int x, int y, int w, int h);
-	TabWidget(GuiObject *boss, String name);
+	TabWidget(GuiObject *boss, const String &name);
 	~TabWidget();
 
 	void init();

Modified: scummvm/trunk/gui/ThemeNew.cpp
===================================================================
--- scummvm/trunk/gui/ThemeNew.cpp	2006-06-03 13:33:05 UTC (rev 22872)
+++ scummvm/trunk/gui/ThemeNew.cpp	2006-06-03 13:33:39 UTC (rev 22873)
@@ -98,7 +98,7 @@
 
 #pragma mark -
 
-ThemeNew::ThemeNew(OSystem *system, Common::String stylefile) : Theme(), _system(system), _screen(), _initOk(false),
+ThemeNew::ThemeNew(OSystem *system, const Common::String &stylefile) : Theme(), _system(system), _screen(), _initOk(false),
 _lastUsedBitMask(0), _forceRedraw(false), _fonts(), _imageHandles(0), _images(0), _colors(), _cursor(0), _gradientFactors() {
 	_stylefile = stylefile;
 	_initOk = false;
@@ -155,7 +155,7 @@
 #endif
 	}
 
-	Common::String temp = "";
+	Common::String temp;
 	_configFile.getKey("version", "theme", temp);
 	if (atoi(temp.c_str()) != THEME_VERSION) {
 		// TODO: improve this detection and handle it nicer
@@ -1407,7 +1407,7 @@
 #define FONT_NAME_FIXED_BOLD "newgui_fixed_bold"
 #define FONT_NAME_FIXED_ITALIC "newgui_fixed_italic"
 
-void ThemeNew::setupFont(String key, String name, kFontStyle style) {
+void ThemeNew::setupFont(const String &key, const String &name, kFontStyle style) {
 	if (_configFile.hasKey(key, "extra")) {
 		_fonts[style] = FontMan.getFontByName(name);
 
@@ -1534,7 +1534,7 @@
 }
 
 Common::String ThemeNew::genCacheFilename(const char *filename) {
-	Common::String cacheName = filename;
+	Common::String cacheName(filename);
 	for (int i = cacheName.size() - 1; i >= 0; --i) {
 		if (cacheName[i] == '.') {
 			while ((uint)i < cacheName.size() - 1) {

Modified: scummvm/trunk/gui/dialog.cpp
===================================================================
--- scummvm/trunk/gui/dialog.cpp	2006-06-03 13:33:05 UTC (rev 22872)
+++ scummvm/trunk/gui/dialog.cpp	2006-06-03 13:33:39 UTC (rev 22873)
@@ -46,7 +46,7 @@
 	_drawingHints = THEME_HINT_FIRST_DRAW | THEME_HINT_SAVE_BACKGROUND;
 }
 
-Dialog::Dialog(Common::String name, bool dimsInactive_)
+Dialog::Dialog(const Common::String &name, bool dimsInactive_)
 	: GuiObject(name),
 	  _mouseWidget(0), _focusedWidget(0), _dragWidget(0), _visible(false), _drawingHints(0),
 	  _dimsInactive(dimsInactive_) {

Modified: scummvm/trunk/gui/dialog.h
===================================================================
--- scummvm/trunk/gui/dialog.h	2006-06-03 13:33:05 UTC (rev 22872)
+++ scummvm/trunk/gui/dialog.h	2006-06-03 13:33:39 UTC (rev 22873)
@@ -53,7 +53,7 @@
 
 public:
 	Dialog(int x, int y, int w, int h, bool dimsInactive = true);
-	Dialog(Common::String name, bool dimsInactive = true);
+	Dialog(const Common::String &name, bool dimsInactive = true);
 	virtual ~Dialog();
 
 	virtual int runModal();

Modified: scummvm/trunk/gui/editable.cpp
===================================================================
--- scummvm/trunk/gui/editable.cpp	2006-06-03 13:33:05 UTC (rev 22872)
+++ scummvm/trunk/gui/editable.cpp	2006-06-03 13:33:39 UTC (rev 22873)
@@ -30,7 +30,7 @@
 	init();
 }
 
-EditableWidget::EditableWidget(GuiObject *boss, String name)
+EditableWidget::EditableWidget(GuiObject *boss, const String &name)
  : Widget(boss, name) {
 	init();
 }

Modified: scummvm/trunk/gui/editable.h
===================================================================
--- scummvm/trunk/gui/editable.h	2006-06-03 13:33:05 UTC (rev 22872)
+++ scummvm/trunk/gui/editable.h	2006-06-03 13:33:39 UTC (rev 22873)
@@ -51,7 +51,7 @@
 
 public:
 	EditableWidget(GuiObject *boss, int x, int y, int w, int h);
-	EditableWidget(GuiObject *boss, String name);
+	EditableWidget(GuiObject *boss, const String &name);
 	virtual ~EditableWidget();
 
 	void init();

Modified: scummvm/trunk/gui/eval.cpp
===================================================================
--- scummvm/trunk/gui/eval.cpp	2006-06-03 13:33:05 UTC (rev 22872)
+++ scummvm/trunk/gui/eval.cpp	2006-06-03 13:33:39 UTC (rev 22873)
@@ -302,11 +302,11 @@
 	return EVAL_UNDEF_VAR;
 }
 
-void Eval::setAlias(const String &section, const char *name, const String value) {
+void Eval::setAlias(const String &section, const char *name, const String &value) {
 	_aliases[name + 4] = value;
 }
 
-void Eval::setVar(const String &section, const char *name, const String value) {
+void Eval::setVar(const String &section, const char *name, const String &value) {
 	_vars[name + 4] = eval(value, section, name, 0);
 }
 

Modified: scummvm/trunk/gui/eval.h
===================================================================
--- scummvm/trunk/gui/eval.h	2006-06-03 13:33:05 UTC (rev 22872)
+++ scummvm/trunk/gui/eval.h	2006-06-03 13:33:39 UTC (rev 22873)
@@ -55,16 +55,16 @@
 	~Eval();
 
 	int eval(const String &input, const String &section, const String &name, int startpos);
-	void setAlias(const String &section, const char *name, const String value);
-	void setVar(const String &section, const char *name, const String value);
+	void setAlias(const String &section, const char *name, const String &value);
+	void setVar(const String &section, const char *name, const String &value);
 
-	void setParent(const String name);
+	void setParent(const String &name);
 
 	void setVar(const char *name, int val) { _vars[name] = val; }
-	void setAlias(const char *name, const String val) { _aliases[name] = val; }
+	void setAlias(const char *name, const String &val) { _aliases[name] = val; }
 
-	int getVar(String s) { return getVar_(s.c_str()); }
-	int getVar(String s, int def) {
+	int getVar(const String &s) { return getVar_(s.c_str()); }
+	int getVar(const String &s, int def) {
 		int val = getVar_(s.c_str());
 		return (val == EVAL_UNDEF_VAR) ? def : val;
 	};

Modified: scummvm/trunk/gui/launcher.cpp
===================================================================
--- scummvm/trunk/gui/launcher.cpp	2006-06-03 13:33:05 UTC (rev 22872)
+++ scummvm/trunk/gui/launcher.cpp	2006-06-03 13:33:39 UTC (rev 22873)
@@ -81,7 +81,7 @@
  */
 class DomainEditTextWidget : public EditTextWidget {
 public:
-	DomainEditTextWidget(GuiObject *boss, String name, const String &text)
+	DomainEditTextWidget(GuiObject *boss, const String &name, const String &text)
 		: EditTextWidget(boss, name, text) {
 	}
 
@@ -323,15 +323,15 @@
 		else
 			ConfMan.set("language", Common::getLanguageCode(lang), _domain);
 
-		String gamePath = _gamePathWidget->getLabel();
+		String gamePath(_gamePathWidget->getLabel());
 		if (!gamePath.empty())
 			ConfMan.set("path", gamePath, _domain);
 
-		String extraPath = _extraPathWidget->getLabel();
+		String extraPath(_extraPathWidget->getLabel());
 		if (!extraPath.empty() && (extraPath != "None"))
 			ConfMan.set("extrapath", extraPath, _domain);
 
-		String savePath = _savePathWidget->getLabel();
+		String savePath(_savePathWidget->getLabel());
 		if (!savePath.empty() && (savePath != "Default"))
 			ConfMan.set("savepath", savePath, _domain);
 
@@ -491,7 +491,7 @@
 	updateListing();
 
 	// Restore last selection
-	String last = ConfMan.get(String("lastselectedgame"), ConfigManager::kApplicationDomain);
+	String last(ConfMan.get("lastselectedgame", ConfigManager::kApplicationDomain));
 	selectGame(last);
 
 	// En-/disable the buttons depending on the list selection
@@ -522,9 +522,9 @@
 	// Save last selection
 	const int sel = _list->getSelected();
 	if (sel >= 0)
-		ConfMan.set(String("lastselectedgame"), _domains[sel], ConfigManager::kApplicationDomain);
+		ConfMan.set("lastselectedgame", _domains[sel], ConfigManager::kApplicationDomain);
 	else
-		ConfMan.removeKey(String("lastselectedgame"), ConfigManager::kApplicationDomain);
+		ConfMan.removeKey("lastselectedgame", ConfigManager::kApplicationDomain);
 
 	ConfMan.flushToDisk();
 	Dialog::close();

Modified: scummvm/trunk/gui/newgui.cpp
===================================================================
--- scummvm/trunk/gui/newgui.cpp	2006-06-03 13:33:05 UTC (rev 22872)
+++ scummvm/trunk/gui/newgui.cpp	2006-06-03 13:33:39 UTC (rev 22873)
@@ -60,7 +60,7 @@
 #endif
 
 // HACK. FIXME. This doesn't belong here. But otherwise it creates compulation problems
-GuiObject::GuiObject(Common::String name) : _firstWidget(0) {
+GuiObject::GuiObject(const Common::String &name) : _firstWidget(0) {
 	_name = name;
 	handleScreenChanged();
 }
@@ -103,7 +103,7 @@
 
 #ifndef DISABLE_FANCY_THEMES
 	ConfMan.registerDefault("gui_theme", "default");
-	Common::String style = ConfMan.get("gui_theme");
+	Common::String style(ConfMan.get("gui_theme"));
 	// The default theme for now is the 'modern' theme.
 	if (scumm_stricmp(style.c_str(), "default") == 0)
 		style = "modern";

Modified: scummvm/trunk/gui/object.h
===================================================================
--- scummvm/trunk/gui/object.h	2006-06-03 13:33:05 UTC (rev 22872)
+++ scummvm/trunk/gui/object.h	2006-06-03 13:33:39 UTC (rev 22873)
@@ -65,7 +65,7 @@
 
 public:
 	GuiObject(int x, int y, int w, int h) : _x(x), _y(y), _w(w), _h(h), _firstWidget(0), _name("") { }
-	GuiObject(Common::String name);
+	GuiObject(const Common::String &name);
 
 	virtual int16	getAbsX() const		{ return _x; }
 	virtual int16	getAbsY() const		{ return _y; }

Modified: scummvm/trunk/gui/options.cpp
===================================================================
--- scummvm/trunk/gui/options.cpp	2006-06-03 13:33:05 UTC (rev 22872)
+++ scummvm/trunk/gui/options.cpp	2006-06-03 13:33:39 UTC (rev 22873)
@@ -80,7 +80,7 @@
 	init();
 }
 
-OptionsDialog::OptionsDialog(const String &domain, String name)
+OptionsDialog::OptionsDialog(const String &domain, const String &name)
 	: Dialog(name), _domain(domain) {
 	init();
 }
@@ -132,7 +132,7 @@
 
 		if (ConfMan.hasKey("gfx_mode", _domain)) {
 			const OSystem::GraphicsMode *gm = g_system->getSupportedGraphicsModes();
-			String gfxMode = ConfMan.get("gfx_mode", _domain);
+			String gfxMode(ConfMan.get("gfx_mode", _domain));
 			int gfxCount = 1;
 			while (gm->name) {
 				gfxCount++;
@@ -304,7 +304,7 @@
 				ConfMan.setBool("native_mt32", _mt32Checkbox->getState(), _domain);
 				ConfMan.setBool("enable_gs", _enableGSCheckbox->getState(), _domain);
 
-				String soundFont = _soundFont->getLabel();
+				String soundFont(_soundFont->getLabel());
 				if (!soundFont.empty() && (soundFont != "None"))
 					ConfMan.set("soundfont", soundFont, _domain);
 			} else {
@@ -448,7 +448,7 @@
 	_subSpeedLabel->setEnabled(enabled);
 }
 
-void OptionsDialog::addGraphicControls(GuiObject *boss, String prefix) {
+void OptionsDialog::addGraphicControls(GuiObject *boss, const String &prefix) {
 	const OSystem::GraphicsMode *gm = g_system->getSupportedGraphicsModes();
 
 	int labelWidth = g_gui.evaluator()->getVar("tabPopupsLabelW");
@@ -487,7 +487,7 @@
 	_enableGraphicSettings = true;
 }
 
-void OptionsDialog::addAudioControls(GuiObject *boss, String prefix) {
+void OptionsDialog::addAudioControls(GuiObject *boss, const String &prefix) {
 	int labelWidth = g_gui.evaluator()->getVar("tabPopupsLabelW");
 
 	// The MIDI mode popup & a label
@@ -503,7 +503,7 @@
 	_enableAudioSettings = true;
 }
 
-void OptionsDialog::addMIDIControls(GuiObject *boss, String prefix) {
+void OptionsDialog::addMIDIControls(GuiObject *boss, const String &prefix) {
 	// SoundFont
 	_soundFontButton = new ButtonWidget(boss, prefix + "mcFontButton", "SoundFont:", kChooseSoundFontCmd, 0);
 	_soundFont = new StaticTextWidget(boss, prefix + "mcFontPath", "None");
@@ -522,7 +522,7 @@
 
 // The function has an extra slider range parameter, since both the launcher and SCUMM engine
 // make use of the widgets. The launcher range is 0-255. SCUMM's 0-9
-void OptionsDialog::addSubtitleControls(GuiObject *boss, String prefix, int maxSliderVal) {
+void OptionsDialog::addSubtitleControls(GuiObject *boss, const String &prefix, int maxSliderVal) {
 
 	_subToggleDesc = new StaticTextWidget(boss, prefix + "subToggleDesc", "Text and Speech:");
 	_subToggleButton = new ButtonWidget(boss, prefix + "subToggleButton", "", kSubtitleToggle, 0);
@@ -537,7 +537,7 @@
 	_enableSubtitleSettings = true;
 }
 
-void OptionsDialog::addVolumeControls(GuiObject *boss, String prefix) {
+void OptionsDialog::addVolumeControls(GuiObject *boss, const String &prefix) {
 
 	// Volume controllers
 	_musicVolumeDesc = new StaticTextWidget(boss, prefix + "vcMusicText", "Music volume:");
@@ -703,7 +703,7 @@
 		// Savepath
 		ConfMan.set("savepath", _savePath->getLabel(), _domain);
 
-		String extraPath = _extraPath->getLabel();
+		String extraPath(_extraPath->getLabel());
 		if (!extraPath.empty() && (extraPath != "None"))
 			ConfMan.set("extrapath", extraPath, _domain);
 	}

Modified: scummvm/trunk/gui/options.h
===================================================================
--- scummvm/trunk/gui/options.h	2006-06-03 13:33:05 UTC (rev 22872)
+++ scummvm/trunk/gui/options.h	2006-06-03 13:33:39 UTC (rev 22873)
@@ -41,7 +41,7 @@
 	typedef Common::String String;
 public:
 	OptionsDialog(const String &domain, int x, int y, int w, int h);
-	OptionsDialog(const String &domain, String name);
+	OptionsDialog(const String &domain, const String &name);
 
 	void init();
 
@@ -62,13 +62,13 @@
 	ButtonWidget *_soundFontButton;
 	StaticTextWidget *_soundFont;
 
-	void addGraphicControls(GuiObject *boss, String prefix);
-	void addAudioControls(GuiObject *boss, String prefix);
-	void addMIDIControls(GuiObject *boss, String prefix);
-	void addVolumeControls(GuiObject *boss, String prefix);
+	void addGraphicControls(GuiObject *boss, const String &prefix);
+	void addAudioControls(GuiObject *boss, const String &prefix);
+	void addMIDIControls(GuiObject *boss, const String &prefix);
+	void addVolumeControls(GuiObject *boss, const String &prefix);
 	// The default value is the launcher's non-scaled talkspeed value. When SCUMM uses the widget,
 	// it uses its own scale
-	void addSubtitleControls(GuiObject *boss, String prefix, int maxSliderVal = 255);
+	void addSubtitleControls(GuiObject *boss, const String &prefix, int maxSliderVal = 255);
 
 	void setGraphicSettingsState(bool enabled);
 	void setAudioSettingsState(bool enabled);

Modified: scummvm/trunk/gui/theme-config.cpp
===================================================================
--- scummvm/trunk/gui/theme-config.cpp	2006-06-03 13:33:05 UTC (rev 22872)
+++ scummvm/trunk/gui/theme-config.cpp	2006-06-03 13:33:39 UTC (rev 22873)
@@ -407,7 +407,7 @@
 
 using Common::String;
 
-void Theme::processSingleLine(const String &section, const String prefix, const String name, const String str) {
+void Theme::processSingleLine(const String &section, const String &prefix, const String &name, const String &str) {
 	int level = 0;
 	int start = 0;
 	uint i;
@@ -470,7 +470,7 @@
 }
 
 
-void Theme::processResSection(Common::ConfigFile &config, String name, bool skipDefs, const String prefix) {
+void Theme::processResSection(Common::ConfigFile &config, const String &name, bool skipDefs, const String &prefix) {
 	debug(3, "Reading section: [%s]", name.c_str());
 
 	const Common::ConfigFile::SectionKeyList &keys = config.getKeys(name);
@@ -509,13 +509,12 @@
 		if (iterk->key == "useWithPrefix") {
 			const char *temp = iterk->value.c_str();
             const char *pos = strrchr(temp, ' ');
-			String n, pref;
 
 			if (pos == NULL)
 				error("2 arguments required for useWithPrefix keyword");
 
-			n = String(temp, strchr(temp, ' ') - temp);
-			pref = String(pos + 1);
+			String n(temp, strchr(temp, ' ') - temp);
+			String pref(pos + 1);
 
 			if (n == name)
 				error("Theme section [%s]: cannot use itself", n.c_str());
@@ -528,16 +527,14 @@
 	}
 }
 
-void Theme::setSpecialAlias(const String alias, const String &name) {
+void Theme::setSpecialAlias(const String &alias, const String &name) {
 	const char *postfixes[] = {".x", ".y", ".w", ".h", ".x2", ".y2"};
 	int i;
 
 	for (i = 0; i < ARRAYSIZE(postfixes); i++) {
-		String from, to;
+		String from(alias + postfixes[i]);
+		String to(name + postfixes[i]);
 
-		from = alias + postfixes[i];
-		to = name + postfixes[i];
-
 		_evaluator->setAlias(from.c_str(), to);
 	}
 }

Modified: scummvm/trunk/gui/theme.h
===================================================================
--- scummvm/trunk/gui/theme.h	2006-06-03 13:33:05 UTC (rev 22872)
+++ scummvm/trunk/gui/theme.h	2006-06-03 13:33:39 UTC (rev 22873)
@@ -186,9 +186,9 @@
 		return kTextAlignCenter;
 	}
 
-	void processResSection(Common::ConfigFile &config, String name, bool skipDefs = false, const String prefix = "");
-	void processSingleLine(const String &section, const String prefix, const String name, const String str);
-	void setSpecialAlias(const String alias, const String &name);
+	void processResSection(Common::ConfigFile &config, const String &name, bool skipDefs = false, const String &prefix = "");
+	void processSingleLine(const String &section, const String &prefix, const String &name, const String &str);
+	void setSpecialAlias(const String &alias, const String &name);
 
 	bool isThemeLoadingRequired();
 	bool sectionIsSkipped(Common::ConfigFile &config, const char *name, int w, int h);
@@ -288,7 +288,7 @@
 class ThemeNew : public Theme {
 	typedef Common::String String;
 public:
-	ThemeNew(OSystem *system, String stylefile);
+	ThemeNew(OSystem *system, const String &stylefile);
 	virtual ~ThemeNew();
 
 	bool init();
@@ -390,7 +390,7 @@
 	const Graphics::Font *_fonts[kFontStyleMax];
 
 private:
-	void setupFont(String key, String name, kFontStyle style);
+	void setupFont(const String &key, const String &name, kFontStyle style);
 
 public:
 	enum kImageHandles {

Modified: scummvm/trunk/gui/widget.cpp
===================================================================
--- scummvm/trunk/gui/widget.cpp	2006-06-03 13:33:05 UTC (rev 22872)
+++ scummvm/trunk/gui/widget.cpp	2006-06-03 13:33:39 UTC (rev 22873)
@@ -35,7 +35,7 @@
 	init();
 }
 
-Widget::Widget(GuiObject *boss, String name)
+Widget::Widget(GuiObject *boss, const String &name)
 	: GuiObject(name), _type(0), _boss(boss),
 	  _id(0), _flags(0), _hints(THEME_HINT_FIRST_DRAW), _hasFocus(false) {
 	init();
@@ -148,7 +148,7 @@
 	_label = text;
 }
 
-StaticTextWidget::StaticTextWidget(GuiObject *boss, String name, const String &text)
+StaticTextWidget::StaticTextWidget(GuiObject *boss, const String &name, const String &text)
 	: Widget(boss, name) {
 	_flags = WIDGET_ENABLED;
 	_type = kStaticTextWidget;
@@ -197,7 +197,7 @@
 	_type = kButtonWidget;
 }
 
-ButtonWidget::ButtonWidget(GuiObject *boss, String name, const String &label, uint32 cmd, uint8 hotkey)
+ButtonWidget::ButtonWidget(GuiObject *boss, const String &name, const String &label, uint32 cmd, uint8 hotkey)
 	: StaticTextWidget(boss, name, label), CommandSender(boss),
 	  _cmd(cmd), _hotkey(hotkey) {
 	_flags = WIDGET_ENABLED/* | WIDGET_BORDER*/ | WIDGET_CLEARBG;
@@ -221,7 +221,7 @@
 	_type = kCheckboxWidget;
 }
 
-CheckboxWidget::CheckboxWidget(GuiObject *boss, String name, const String &label, uint32 cmd, uint8 hotkey)
+CheckboxWidget::CheckboxWidget(GuiObject *boss, const String &name, const String &label, uint32 cmd, uint8 hotkey)
 	: ButtonWidget(boss, name, label, cmd, hotkey), _state(false) {
 	_flags = WIDGET_ENABLED;
 	_type = kCheckboxWidget;
@@ -256,7 +256,7 @@
 	_type = kSliderWidget;
 }
 
-SliderWidget::SliderWidget(GuiObject *boss, String name, uint32 cmd)
+SliderWidget::SliderWidget(GuiObject *boss, const String &name, uint32 cmd)
 	: Widget(boss, name), CommandSender(boss),
 	  _cmd(cmd), _value(0), _oldValue(0), _valueMin(0), _valueMax(100), _isDragging(false) {
 	_flags = WIDGET_ENABLED | WIDGET_TRACK_MOUSE | WIDGET_CLEARBG;
@@ -318,7 +318,7 @@
 	_hints &= ~THEME_HINT_SAVE_BACKGROUND;
 }
 
-GraphicsWidget::GraphicsWidget(GuiObject *boss, String name)
+GraphicsWidget::GraphicsWidget(GuiObject *boss, const String &name)
 	: Widget(boss, name), _gfx(), _alpha(256), _transparency(false) {
 	_flags = WIDGET_ENABLED | WIDGET_CLEARBG;
 	_type = kGraphicsWidget;
@@ -375,7 +375,7 @@
 	_type = kContainerWidget;
 }
 
-ContainerWidget::ContainerWidget(GuiObject *boss, String name) : Widget(boss, name) {
+ContainerWidget::ContainerWidget(GuiObject *boss, const String &name) : Widget(boss, name) {
 	_flags = WIDGET_ENABLED | WIDGET_CLEARBG;
 	_type = kContainerWidget;
 }

Modified: scummvm/trunk/gui/widget.h
===================================================================
--- scummvm/trunk/gui/widget.h	2006-06-03 13:33:05 UTC (rev 22872)
+++ scummvm/trunk/gui/widget.h	2006-06-03 13:33:39 UTC (rev 22873)
@@ -103,7 +103,7 @@
 
 public:
 	Widget(GuiObject *boss, int x, int y, int w, int h);
-	Widget(GuiObject *boss, Common::String name);
+	Widget(GuiObject *boss, const Common::String &name);
 	virtual ~Widget();
 
 	void init();
@@ -171,7 +171,7 @@
 	TextAlignment			_align;
 public:
 	StaticTextWidget(GuiObject *boss, int x, int y, int w, int h, const String &text, TextAlignment align);
-	StaticTextWidget(GuiObject *boss, String name, const String &text);
+	StaticTextWidget(GuiObject *boss, const String &name, const String &text);
 	void setValue(int value);
 	void setLabel(const String &label);
 	const String &getLabel() const		{ return _label; }
@@ -190,7 +190,7 @@
 	uint8	_hotkey;
 public:
 	ButtonWidget(GuiObject *boss, int x, int y, int w, int h, const String &label, uint32 cmd = 0, uint8 hotkey = 0);
-	ButtonWidget(GuiObject *boss, String name, const String &label, uint32 cmd = 0, uint8 hotkey = 0);
+	ButtonWidget(GuiObject *boss, const String &name, const String &label, uint32 cmd = 0, uint8 hotkey = 0);
 
 	void setCmd(uint32 cmd)				{ _cmd = cmd; }
 	uint32 getCmd() const				{ return _cmd; }
@@ -209,7 +209,7 @@
 	bool	_state;
 public:
 	CheckboxWidget(GuiObject *boss, int x, int y, int w, int h, const String &label, uint32 cmd = 0, uint8 hotkey = 0);
-	CheckboxWidget(GuiObject *boss, String name, const String &label, uint32 cmd = 0, uint8 hotkey = 0);
+	CheckboxWidget(GuiObject *boss, const String &name, const String &label, uint32 cmd = 0, uint8 hotkey = 0);
 
 	void handleMouseUp(int x, int y, int button, int clickCount);
 	virtual void handleMouseEntered(int button)	{ setFlags(WIDGET_HILITED); draw(); }
@@ -233,7 +233,7 @@
 	uint	_labelWidth;
 public:
 	SliderWidget(GuiObject *boss, int x, int y, int w, int h, uint32 cmd = 0);
-	SliderWidget(GuiObject *boss, Common::String name, uint32 cmd = 0);
+	SliderWidget(GuiObject *boss, const Common::String &name, uint32 cmd = 0);
 
 	void setCmd(uint32 cmd)		{ _cmd = cmd; }
 	uint32 getCmd() const		{ return _cmd; }
@@ -263,7 +263,7 @@
 class GraphicsWidget : public Widget {
 public:
 	GraphicsWidget(GuiObject *boss, int x, int y, int w, int h);
-	GraphicsWidget(GuiObject *boss, Common::String name);
+	GraphicsWidget(GuiObject *boss, const Common::String &name);
 	~GraphicsWidget();
 
 	void setGfx(const Graphics::Surface *gfx);
@@ -284,7 +284,7 @@
 class ContainerWidget : public Widget {
 public:
 	ContainerWidget(GuiObject *boss, int x, int y, int w, int h);
-	ContainerWidget(GuiObject *boss, Common::String name);
+	ContainerWidget(GuiObject *boss, const Common::String &name);
 
 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