From 26d481f3850ded5a20e183260eced4c32c9b7a84 Mon Sep 17 00:00:00 2001 From: angela Date: Tue, 10 Nov 2009 22:49:25 +0800 Subject: (EXT-2343) Preference > Chat > ColorSwatch 's LLUIColorTable is not working --- indra/newview/llfloaterpreference.cpp | 69 +++++++---------------------------- 1 file changed, 14 insertions(+), 55 deletions(-) (limited to 'indra/newview/llfloaterpreference.cpp') diff --git a/indra/newview/llfloaterpreference.cpp b/indra/newview/llfloaterpreference.cpp index 2af1313db4..7bd1311815 100644 --- a/indra/newview/llfloaterpreference.cpp +++ b/indra/newview/llfloaterpreference.cpp @@ -348,6 +348,8 @@ LLFloaterPreference::LLFloaterPreference(const LLSD& key) mCommitCallbackRegistrar.add("Pref.AutoDetectAspect", boost::bind(&LLFloaterPreference::onCommitAutoDetectAspect, this)); mCommitCallbackRegistrar.add("Pref.onSelectAspectRatio", boost::bind(&LLFloaterPreference::onKeystrokeAspectRatio, this)); mCommitCallbackRegistrar.add("Pref.QualityPerformance", boost::bind(&LLFloaterPreference::onChangeQuality, this, _2)); + mCommitCallbackRegistrar.add("Pref.applyUIColor", boost::bind(&LLFloaterPreference::applyUIColor, this ,_1, _2)); + mCommitCallbackRegistrar.add("Pref.getUIColor", boost::bind(&LLFloaterPreference::getUIColor, this ,_1, _2)); sSkin = gSavedSettings.getString("SkinCurrent"); @@ -1356,18 +1358,24 @@ void LLFloaterPreference::initWindowSizeControls(LLPanel* panelp) } +void LLFloaterPreference::applyUIColor(LLUICtrl* ctrl, const LLSD& param) +{ + LLUIColorTable::instance().setColor(param.asString(), LLColor4(ctrl->getValue())); +} + +void LLFloaterPreference::getUIColor(LLUICtrl* ctrl, const LLSD& param) +{ + LLColorSwatchCtrl* color_swatch = (LLColorSwatchCtrl*) ctrl; + color_swatch->setOriginal(LLUIColorTable::instance().getColor(param.asString())); +} + //---------------------------------------------------------------------------- static LLRegisterPanelClassWrapper t_places("panel_preference"); LLPanelPreference::LLPanelPreference() : LLPanel() { - mCommitCallbackRegistrar.add("Pref.setControlFalse", boost::bind(&LLPanelPreference::setControlFalse,this, _2)); -} - -static void applyUIColor(const std::string& color_name, LLUICtrl* ctrl, const LLSD& param) -{ - LLUIColorTable::instance().setColor(color_name, LLColor4(param)); + mCommitCallbackRegistrar.add("Pref.setControlFalse", boost::bind(&LLPanelPreference::setControlFalse,this, _2)); } //virtual @@ -1496,55 +1504,6 @@ BOOL LLPanelPreference::postBuild() refresh(); } - - if(hasChild("user") && hasChild("agent") && hasChild("im") - && hasChild("system") && hasChild("script_error") && hasChild("objects") - && hasChild("owner") && hasChild("background") && hasChild("links")) - { - LLColorSwatchCtrl* color_swatch = getChild("user"); - color_swatch->setCommitCallback(boost::bind(&applyUIColor, "UserChatColor", _1, _2)); - color_swatch->setOriginal(LLUIColorTable::instance().getColor("UserChatColor")); - - color_swatch = getChild("agent"); - color_swatch->setCommitCallback(boost::bind(&applyUIColor, "AgentChatColor", _1, _2)); - color_swatch->setOriginal(LLUIColorTable::instance().getColor("AgentChatColor")); - - color_swatch = getChild("im"); - color_swatch->setCommitCallback(boost::bind(&applyUIColor, "IMChatColor", _1, _2)); - color_swatch->setOriginal(LLUIColorTable::instance().getColor("IMChatColor")); - - color_swatch = getChild("system"); - color_swatch->setCommitCallback(boost::bind(&applyUIColor, "SystemChatColor", _1, _2)); - color_swatch->setOriginal(LLUIColorTable::instance().getColor("SystemChatColor")); - - color_swatch = getChild("script_error"); - color_swatch->setCommitCallback(boost::bind(&applyUIColor, "ScriptErrorColor", _1, _2)); - color_swatch->setOriginal(LLUIColorTable::instance().getColor("ScriptErrorColor")); - - color_swatch = getChild("objects"); - color_swatch->setCommitCallback(boost::bind(&applyUIColor, "ObjectChatColor", _1, _2)); - color_swatch->setOriginal(LLUIColorTable::instance().getColor("ObjectChatColor")); - - color_swatch = getChild("owner"); - color_swatch->setCommitCallback(boost::bind(&applyUIColor, "llOwnerSayChatColor", _1, _2)); - color_swatch->setOriginal(LLUIColorTable::instance().getColor("llOwnerSayChatColor")); - - color_swatch = getChild("background"); - color_swatch->setCommitCallback(boost::bind(&applyUIColor, "BackgroundChatColor", _1, _2)); - color_swatch->setOriginal(LLUIColorTable::instance().getColor("BackgroundChatColor")); - - color_swatch = getChild("links"); - color_swatch->setCommitCallback(boost::bind(&applyUIColor, "HTMLLinkColor", _1, _2)); - color_swatch->setOriginal(LLUIColorTable::instance().getColor("HTMLLinkColor")); - } - - if(hasChild("effect_color_swatch")) - { - LLColorSwatchCtrl* color_swatch = getChild("effect_color_swatch"); - color_swatch->setCommitCallback(boost::bind(&applyUIColor, "EffectColor", _1, _2)); - color_swatch->setOriginal(LLUIColorTable::instance().getColor("EffectColor")); - } - apply(); return true; } -- cgit v1.2.3 From 0f6242d9fd948cda1abf18885eef320b22d310c5 Mon Sep 17 00:00:00 2001 From: James Cook Date: Tue, 10 Nov 2009 14:00:38 -0800 Subject: Sanitize naming of getWindowRect (scaled vs. raw pixels) and getWorldViewRect (scaled vs. raw) Reduces chance of future UI bugs related to UI size. Discussed with Richard. --- indra/newview/llfloaterpreference.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'indra/newview/llfloaterpreference.cpp') diff --git a/indra/newview/llfloaterpreference.cpp b/indra/newview/llfloaterpreference.cpp index 2af1313db4..f07f9412a2 100644 --- a/indra/newview/llfloaterpreference.cpp +++ b/indra/newview/llfloaterpreference.cpp @@ -1332,8 +1332,8 @@ void LLFloaterPreference::initWindowSizeControls(LLPanel* panelp) // Look to see if current window size matches existing window sizes, if so then // just set the selection value... - const U32 height = gViewerWindow->getWindowDisplayHeight(); - const U32 width = gViewerWindow->getWindowDisplayWidth(); + const U32 height = gViewerWindow->getWindowHeightRaw(); + const U32 width = gViewerWindow->getWindowWidthRaw(); for (S32 i=0; i < ctrl_window_size->getItemCount(); i++) { U32 height_test = 0; -- cgit v1.2.3