summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorangela <angela@lindenlab.com>2009-11-10 22:49:25 +0800
committerangela <angela@lindenlab.com>2009-11-10 22:49:25 +0800
commit26d481f3850ded5a20e183260eced4c32c9b7a84 (patch)
treeeddc6989f25aaa3429b23cfdb971dd73cf2edf36
parent63195e76cae04f4eb98a3ce3230caae17fa79eca (diff)
(EXT-2343) Preference > Chat > ColorSwatch 's LLUIColorTable is not working
-rw-r--r--indra/llui/lluicolortable.cpp13
-rw-r--r--indra/newview/llfloaterpreference.cpp69
-rw-r--r--indra/newview/llfloaterpreference.h5
-rw-r--r--indra/newview/skins/default/xui/en/panel_preferences_chat.xml82
4 files changed, 93 insertions, 76 deletions
diff --git a/indra/llui/lluicolortable.cpp b/indra/llui/lluicolortable.cpp
index 851091f0ca..f1e3000547 100644
--- a/indra/llui/lluicolortable.cpp
+++ b/indra/llui/lluicolortable.cpp
@@ -69,7 +69,14 @@ void LLUIColorTable::insertFromParams(const Params& p)
ColorEntryParams color_entry = *it;
if(color_entry.color.value.isChosen())
{
- setColor(color_entry.name, color_entry.color.value, mLoadedColors);
+ if(mUserSetColors.find(color_entry.name)!=mUserSetColors.end())
+ {
+ setColor(color_entry.name, color_entry.color.value);
+ }
+ else
+ {
+ setColor(color_entry.name, color_entry.color.value, mLoadedColors);
+ }
}
else
{
@@ -213,7 +220,7 @@ bool LLUIColorTable::loadFromSettings()
result |= loadFromFilename(current_filename);
}
- std::string user_filename = gDirUtilp->getExpandedFilename(LL_PATH_USER_SKIN, "colors.xml");
+ std::string user_filename = gDirUtilp->getExpandedFilename(LL_PATH_USER_SETTINGS, "colors.xml");
loadFromFilename(user_filename);
return result;
@@ -239,7 +246,7 @@ void LLUIColorTable::saveUserSettings() const
if(!output_node->isNull())
{
- const std::string& filename = gDirUtilp->getExpandedFilename(LL_PATH_USER_SKIN, "colors.xml");
+ const std::string& filename = gDirUtilp->getExpandedFilename(LL_PATH_USER_SETTINGS, "colors.xml");
LLFILE *fp = LLFile::fopen(filename, "w");
if(fp != NULL)
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<LLPanelPreference> 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<LLColorSwatchCtrl>("user");
- color_swatch->setCommitCallback(boost::bind(&applyUIColor, "UserChatColor", _1, _2));
- color_swatch->setOriginal(LLUIColorTable::instance().getColor("UserChatColor"));
-
- color_swatch = getChild<LLColorSwatchCtrl>("agent");
- color_swatch->setCommitCallback(boost::bind(&applyUIColor, "AgentChatColor", _1, _2));
- color_swatch->setOriginal(LLUIColorTable::instance().getColor("AgentChatColor"));
-
- color_swatch = getChild<LLColorSwatchCtrl>("im");
- color_swatch->setCommitCallback(boost::bind(&applyUIColor, "IMChatColor", _1, _2));
- color_swatch->setOriginal(LLUIColorTable::instance().getColor("IMChatColor"));
-
- color_swatch = getChild<LLColorSwatchCtrl>("system");
- color_swatch->setCommitCallback(boost::bind(&applyUIColor, "SystemChatColor", _1, _2));
- color_swatch->setOriginal(LLUIColorTable::instance().getColor("SystemChatColor"));
-
- color_swatch = getChild<LLColorSwatchCtrl>("script_error");
- color_swatch->setCommitCallback(boost::bind(&applyUIColor, "ScriptErrorColor", _1, _2));
- color_swatch->setOriginal(LLUIColorTable::instance().getColor("ScriptErrorColor"));
-
- color_swatch = getChild<LLColorSwatchCtrl>("objects");
- color_swatch->setCommitCallback(boost::bind(&applyUIColor, "ObjectChatColor", _1, _2));
- color_swatch->setOriginal(LLUIColorTable::instance().getColor("ObjectChatColor"));
-
- color_swatch = getChild<LLColorSwatchCtrl>("owner");
- color_swatch->setCommitCallback(boost::bind(&applyUIColor, "llOwnerSayChatColor", _1, _2));
- color_swatch->setOriginal(LLUIColorTable::instance().getColor("llOwnerSayChatColor"));
-
- color_swatch = getChild<LLColorSwatchCtrl>("background");
- color_swatch->setCommitCallback(boost::bind(&applyUIColor, "BackgroundChatColor", _1, _2));
- color_swatch->setOriginal(LLUIColorTable::instance().getColor("BackgroundChatColor"));
-
- color_swatch = getChild<LLColorSwatchCtrl>("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<LLColorSwatchCtrl>("effect_color_swatch");
- color_swatch->setCommitCallback(boost::bind(&applyUIColor, "EffectColor", _1, _2));
- color_swatch->setOriginal(LLUIColorTable::instance().getColor("EffectColor"));
- }
-
apply();
return true;
}
diff --git a/indra/newview/llfloaterpreference.h b/indra/newview/llfloaterpreference.h
index b1ad0348c0..10f39e46f1 100644
--- a/indra/newview/llfloaterpreference.h
+++ b/indra/newview/llfloaterpreference.h
@@ -133,7 +133,9 @@ public:
void onCommitAutoDetectAspect();
void applyResolution();
void applyWindowSize();
-
+ void applyUIColor(LLUICtrl* ctrl, const LLSD& param);
+ void getUIColor(LLUICtrl* ctrl, const LLSD& param);
+
static void initWindowSizeControls(LLPanel* panelp);
static void buildLists(void* data);
@@ -159,6 +161,7 @@ public:
virtual void apply();
virtual void cancel();
void setControlFalse(const LLSD& user_data);
+
private:
typedef std::map<LLControlVariable*, LLSD> control_values_map_t;
control_values_map_t mSavedValues;
diff --git a/indra/newview/skins/default/xui/en/panel_preferences_chat.xml b/indra/newview/skins/default/xui/en/panel_preferences_chat.xml
index 645863e7a4..5a4b0a3892 100644
--- a/indra/newview/skins/default/xui/en/panel_preferences_chat.xml
+++ b/indra/newview/skins/default/xui/en/panel_preferences_chat.xml
@@ -45,14 +45,20 @@
<color_swatch
border_color="0.45098 0.517647 0.607843 1"
can_apply_immediately="true"
- control_name="UserChatColor"
follows="left|top"
height="47"
layout="topleft"
left="30"
name="user"
top_pad="10"
- width="44" />
+ width="44" >
+ <color_swatch.init_callback
+ function="Pref.getUIColor"
+ parameter="UserChatColor" />
+ <color_swatch.commit_callback
+ function="Pref.applyUIColor"
+ parameter="UserChatColor" />
+ </color_swatch>
<text
type="string"
length="1"
@@ -69,14 +75,20 @@
<color_swatch
border_color="0.45098 0.517647 0.607843 1"
can_apply_immediately="true"
- control_name="AgentChatColor"
follows="left|top"
height="47"
layout="topleft"
left="180"
name="agent"
top_pad="-17"
- width="44" />
+ width="44" >
+ <color_swatch.init_callback
+ function="Pref.getUIColor"
+ parameter="AgentChatColor" />
+ <color_swatch.commit_callback
+ function="Pref.applyUIColor"
+ parameter="AgentChatColor" />
+ </color_swatch>
<text
type="string"
length="1"
@@ -94,7 +106,6 @@
border_color="0.45098 0.517647 0.607843 1"
can_apply_immediately="true"
color="0.6 0.6 1 1"
- control_name="IMChatColor"
follows="left|top"
height="47"
label_width="60"
@@ -102,8 +113,15 @@
left="350"
name="im"
top_pad="-17"
- width="44" />
- <text
+ width="44">
+ <color_swatch.init_callback
+ function="Pref.getUIColor"
+ parameter="IMChatColor" />
+ <color_swatch.commit_callback
+ function="Pref.applyUIColor"
+ parameter="IMChatColor" />
+ </color_swatch>
+ <text
type="string"
length="1"
follows="left|top"
@@ -120,7 +138,6 @@
border_color="0.45098 0.517647 0.607843 1"
can_apply_immediately="true"
color="0.8 1 1 1"
- control_name="SystemChatColor"
follows="left|top"
height="47"
label_width="44"
@@ -128,7 +145,14 @@
left="30"
name="system"
top_pad="40"
- width="44" />
+ width="44" >
+ <color_swatch.init_callback
+ function="Pref.getUIColor"
+ parameter="SystemChatColor" />
+ <color_swatch.commit_callback
+ function="Pref.applyUIColor"
+ parameter="SystemChatColor" />
+ </color_swatch>
<text
type="string"
length="1"
@@ -146,14 +170,20 @@
border_color="0.45098 0.517647 0.607843 1"
can_apply_immediately="true"
color="0.82 0.82 0.99 1"
- control_name="ScriptErrorColor"
follows="left|top"
height="47"
layout="topleft"
left="180"
name="script_error"
top_pad="-17"
- width="44" />
+ width="44">
+ <color_swatch.init_callback
+ function="Pref.getUIColor"
+ parameter="ScriptErrorColor" />
+ <color_swatch.commit_callback
+ function="Pref.applyUIColor"
+ parameter="ScriptErrorColor" />
+ </color_swatch>
<text
type="string"
length="1"
@@ -171,14 +201,20 @@
border_color="0.45098 0.517647 0.607843 1"
can_apply_immediately="true"
color="0.7 0.9 0.7 1"
- control_name="ObjectChatColor"
follows="left|top"
height="47"
layout="topleft"
left="350"
name="objects"
top_pad="-17"
- width="44" />
+ width="44" >
+ <color_swatch.init_callback
+ function="Pref.getUIColor"
+ parameter="ObjectChatColor" />
+ <color_swatch.commit_callback
+ function="Pref.applyUIColor"
+ parameter="ObjectChatColor" />
+ </color_swatch>
<text
type="string"
length="1"
@@ -196,14 +232,20 @@
border_color="0.45098 0.517647 0.607843 1"
can_apply_immediately="true"
color="0.7 0.9 0.7 1"
- control_name="llOwnerSayChatColor"
follows="left|top"
height="47"
layout="topleft"
left="30"
name="owner"
top_pad="40"
- width="44" />
+ width="44" >
+ <color_swatch.init_callback
+ function="Pref.getUIColor"
+ parameter="llOwnerSayChatColor" />
+ <color_swatch.commit_callback
+ function="Pref.applyUIColor"
+ parameter="llOwnerSayChatColor" />
+ </color_swatch>
<text
type="string"
length="1"
@@ -221,14 +263,20 @@
border_color="0.45098 0.517647 0.607843 1"
can_apply_immediately="true"
color="0.6 0.6 1 1"
- control_name="HTMLLinkColor"
follows="left|top"
height="47"
layout="topleft"
left="180"
name="links"
top_pad="-17"
- width="44" />
+ width="44" >
+ <color_swatch.init_callback
+ function="Pref.getUIColor"
+ parameter="HTMLLinkColor" />
+ <color_swatch.commit_callback
+ function="Pref.applyUIColor"
+ parameter="HTMLLinkColor" />
+ </color_swatch>
<text
type="string"
length="1"