summaryrefslogtreecommitdiff
path: root/indra
diff options
context:
space:
mode:
authorLeyla Farazha <leyla@lindenlab.com>2011-07-19 17:26:12 -0700
committerLeyla Farazha <leyla@lindenlab.com>2011-07-19 17:26:12 -0700
commit15f98992fa6634d2d980d193d349ca3c5cdb6a95 (patch)
treedbfe28f95302fb6ee1ae0a7e19e4a2c44961771a /indra
parent9b1174243d3a264f296574329a73f945bf7165a7 (diff)
parent1dfa63e73e29ccd1c5442a8984e5fcf4d3db5a65 (diff)
merge
Diffstat (limited to 'indra')
-rw-r--r--indra/llui/llui.cpp54
-rw-r--r--indra/llui/llui.h8
-rw-r--r--indra/llui/lluiimage.cpp6
-rw-r--r--indra/llui/lluiimage.h4
-rw-r--r--indra/llui/tests/llurlentry_stub.cpp6
-rw-r--r--indra/llui/tests/llurlmatch_test.cpp6
-rw-r--r--indra/llxuixml/llinitparam.h39
7 files changed, 64 insertions, 59 deletions
diff --git a/indra/llui/llui.cpp b/indra/llui/llui.cpp
index 8020ca802b..bc2432f6f7 100644
--- a/indra/llui/llui.cpp
+++ b/indra/llui/llui.cpp
@@ -2082,7 +2082,7 @@ namespace LLInitParam
alpha("alpha"),
control("")
{
- updateBlockFromValue();
+ updateBlockFromValue(false);
}
void ParamValue<LLUIColor, TypeValues<LLUIColor> >::updateValueFromBlock()
@@ -2097,14 +2097,14 @@ namespace LLInitParam
}
}
- void ParamValue<LLUIColor, TypeValues<LLUIColor> >::updateBlockFromValue()
+ void ParamValue<LLUIColor, TypeValues<LLUIColor> >::updateBlockFromValue(bool make_block_authoritative)
{
LLColor4 color = getValue();
- red.set(color.mV[VRED], false);
- green.set(color.mV[VGREEN], false);
- blue.set(color.mV[VBLUE], false);
- alpha.set(color.mV[VALPHA], false);
- control.set("", false);
+ red.set(color.mV[VRED], make_block_authoritative);
+ green.set(color.mV[VGREEN], make_block_authoritative);
+ blue.set(color.mV[VBLUE], make_block_authoritative);
+ alpha.set(color.mV[VALPHA], make_block_authoritative);
+ control.set("", make_block_authoritative);
}
bool ParamCompare<const LLFontGL*, false>::equals(const LLFontGL* a, const LLFontGL* b)
@@ -2124,7 +2124,7 @@ namespace LLInitParam
updateValue(LLFontGL::getFontDefault());
}
addSynonym(name, "");
- updateBlockFromValue();
+ updateBlockFromValue(false);
}
void ParamValue<const LLFontGL*, TypeValues<const LLFontGL*> >::updateValueFromBlock()
@@ -2150,13 +2150,13 @@ namespace LLInitParam
}
}
- void ParamValue<const LLFontGL*, TypeValues<const LLFontGL*> >::updateBlockFromValue()
+ void ParamValue<const LLFontGL*, TypeValues<const LLFontGL*> >::updateBlockFromValue(bool make_block_authoritative)
{
if (getValue())
{
- name.set(LLFontGL::nameFromFont(getValue()), false);
- size.set(LLFontGL::sizeFromFont(getValue()), false);
- style.set(LLFontGL::getStringFromStyle(getValue()->getFontDesc().getStyle()), false);
+ name.set(LLFontGL::nameFromFont(getValue()), make_block_authoritative);
+ size.set(LLFontGL::sizeFromFont(getValue()), make_block_authoritative);
+ style.set(LLFontGL::getStringFromStyle(getValue()->getFontDesc().getStyle()), make_block_authoritative);
}
}
@@ -2169,7 +2169,7 @@ namespace LLInitParam
width("width"),
height("height")
{
- updateBlockFromValue();
+ updateBlockFromValue(false);
}
void ParamValue<LLRect, TypeValues<LLRect> >::updateValueFromBlock()
@@ -2236,19 +2236,19 @@ namespace LLInitParam
updateValue(rect);
}
- void ParamValue<LLRect, TypeValues<LLRect> >::updateBlockFromValue()
+ void ParamValue<LLRect, TypeValues<LLRect> >::updateBlockFromValue(bool make_block_authoritative)
{
// because of the ambiguity in specifying a rect by position and/or dimensions
- // we clear the "provided" flag so that values from xui/etc have priority
- // over those calculated from the rect object
-
+ // we use the lowest priority pairing so that any valid pairing in xui
+ // will override those calculated from the rect object
+ // in this case, that is left+width and bottom+height
LLRect& value = getValue();
- left.set(value.mLeft, false);
- right.set(value.mRight, false);
- bottom.set(value.mBottom, false);
- top.set(value.mTop, false);
- width.set(value.getWidth(), false);
- height.set(value.getHeight(), false);
+
+ left.set(value.mLeft, make_block_authoritative);
+ width.set(value.getWidth(), make_block_authoritative);
+
+ bottom.set(value.mBottom, make_block_authoritative);
+ height.set(value.getHeight(), make_block_authoritative);
}
ParamValue<LLCoordGL, TypeValues<LLCoordGL> >::ParamValue(const LLCoordGL& coord)
@@ -2256,7 +2256,7 @@ namespace LLInitParam
x("x"),
y("y")
{
- updateBlockFromValue();
+ updateBlockFromValue(false);
}
void ParamValue<LLCoordGL, TypeValues<LLCoordGL> >::updateValueFromBlock()
@@ -2264,10 +2264,10 @@ namespace LLInitParam
updateValue(LLCoordGL(x, y));
}
- void ParamValue<LLCoordGL, TypeValues<LLCoordGL> >::updateBlockFromValue()
+ void ParamValue<LLCoordGL, TypeValues<LLCoordGL> >::updateBlockFromValue(bool make_block_authoritative)
{
- x.set(getValue().mX, false);
- y.set(getValue().mY, false);
+ x.set(getValue().mX, make_block_authoritative);
+ y.set(getValue().mY, make_block_authoritative);
}
diff --git a/indra/llui/llui.h b/indra/llui/llui.h
index c583d58d5a..4e622033b3 100644
--- a/indra/llui/llui.h
+++ b/indra/llui/llui.h
@@ -408,7 +408,7 @@ namespace LLInitParam
ParamValue(const LLRect& value);
void updateValueFromBlock();
- void updateBlockFromValue();
+ void updateBlockFromValue(bool make_block_authoritative);
};
template<>
@@ -426,7 +426,7 @@ namespace LLInitParam
ParamValue(const LLUIColor& color);
void updateValueFromBlock();
- void updateBlockFromValue();
+ void updateBlockFromValue(bool make_block_authoritative);
};
template<>
@@ -441,7 +441,7 @@ namespace LLInitParam
ParamValue(const LLFontGL* value);
void updateValueFromBlock();
- void updateBlockFromValue();
+ void updateBlockFromValue(bool make_block_authoritative);
};
template<>
@@ -480,7 +480,7 @@ namespace LLInitParam
ParamValue(const LLCoordGL& val);
void updateValueFromBlock();
- void updateBlockFromValue();
+ void updateBlockFromValue(bool make_block_authoritative);
};
}
diff --git a/indra/llui/lluiimage.cpp b/indra/llui/lluiimage.cpp
index f37947a50b..1d9ce29ba9 100644
--- a/indra/llui/lluiimage.cpp
+++ b/indra/llui/lluiimage.cpp
@@ -172,15 +172,15 @@ namespace LLInitParam
}
}
- void ParamValue<LLUIImage*, TypeValues<LLUIImage*> >::updateBlockFromValue()
+ void ParamValue<LLUIImage*, TypeValues<LLUIImage*> >::updateBlockFromValue(bool make_block_authoritative)
{
if (getValue() == NULL)
{
- name.set("none", false);
+ name.set("none", make_block_authoritative);
}
else
{
- name.set(getValue()->getName(), false);
+ name.set(getValue()->getName(), make_block_authoritative);
}
}
diff --git a/indra/llui/lluiimage.h b/indra/llui/lluiimage.h
index 139d88e0ac..f07e8fa746 100644
--- a/indra/llui/lluiimage.h
+++ b/indra/llui/lluiimage.h
@@ -103,12 +103,12 @@ namespace LLInitParam
ParamValue(LLUIImage* const& image)
: super_t(image)
{
- updateBlockFromValue();
+ updateBlockFromValue(false);
addSynonym(name, "name");
}
void updateValueFromBlock();
- void updateBlockFromValue();
+ void updateBlockFromValue(bool make_block_authoritative);
};
// Need custom comparison function for our test app, which only loads
diff --git a/indra/llui/tests/llurlentry_stub.cpp b/indra/llui/tests/llurlentry_stub.cpp
index 26b3b17577..d522123260 100644
--- a/indra/llui/tests/llurlentry_stub.cpp
+++ b/indra/llui/tests/llurlentry_stub.cpp
@@ -137,7 +137,7 @@ namespace LLInitParam
void ParamValue<LLUIColor, TypeValues<LLUIColor> >::updateValueFromBlock()
{}
- void ParamValue<LLUIColor, TypeValues<LLUIColor> >::updateBlockFromValue()
+ void ParamValue<LLUIColor, TypeValues<LLUIColor> >::updateBlockFromValue(bool)
{}
bool ParamCompare<const LLFontGL*, false>::equals(const LLFontGL* a, const LLFontGL* b)
@@ -152,7 +152,7 @@ namespace LLInitParam
void ParamValue<const LLFontGL*, TypeValues<const LLFontGL*> >::updateValueFromBlock()
{}
- void ParamValue<const LLFontGL*, TypeValues<const LLFontGL*> >::updateBlockFromValue()
+ void ParamValue<const LLFontGL*, TypeValues<const LLFontGL*> >::updateBlockFromValue(bool)
{}
void TypeValues<LLFontGL::HAlign>::declareValues()
@@ -167,7 +167,7 @@ namespace LLInitParam
void ParamValue<LLUIImage*, TypeValues<LLUIImage*> >::updateValueFromBlock()
{}
- void ParamValue<LLUIImage*, TypeValues<LLUIImage*> >::updateBlockFromValue()
+ void ParamValue<LLUIImage*, TypeValues<LLUIImage*> >::updateBlockFromValue(bool)
{}
diff --git a/indra/llui/tests/llurlmatch_test.cpp b/indra/llui/tests/llurlmatch_test.cpp
index 3cd61e574e..fb6a2eabf1 100644
--- a/indra/llui/tests/llurlmatch_test.cpp
+++ b/indra/llui/tests/llurlmatch_test.cpp
@@ -111,7 +111,7 @@ namespace LLInitParam
void ParamValue<LLUIColor, TypeValues<LLUIColor> >::updateValueFromBlock()
{}
- void ParamValue<LLUIColor, TypeValues<LLUIColor> >::updateBlockFromValue()
+ void ParamValue<LLUIColor, TypeValues<LLUIColor> >::updateBlockFromValue(bool)
{}
bool ParamCompare<const LLFontGL*, false>::equals(const LLFontGL* a, const LLFontGL* b)
@@ -127,7 +127,7 @@ namespace LLInitParam
void ParamValue<const LLFontGL*, TypeValues<const LLFontGL*> >::updateValueFromBlock()
{}
- void ParamValue<const LLFontGL*, TypeValues<const LLFontGL*> >::updateBlockFromValue()
+ void ParamValue<const LLFontGL*, TypeValues<const LLFontGL*> >::updateBlockFromValue(bool)
{}
void TypeValues<LLFontGL::HAlign>::declareValues()
@@ -142,7 +142,7 @@ namespace LLInitParam
void ParamValue<LLUIImage*, TypeValues<LLUIImage*> >::updateValueFromBlock()
{}
- void ParamValue<LLUIImage*, TypeValues<LLUIImage*> >::updateBlockFromValue()
+ void ParamValue<LLUIImage*, TypeValues<LLUIImage*> >::updateBlockFromValue(bool)
{}
bool ParamCompare<LLUIImage*, false>::equals(
diff --git a/indra/llxuixml/llinitparam.h b/indra/llxuixml/llinitparam.h
index 7c4d4c8a43..194ef8af6a 100644
--- a/indra/llxuixml/llinitparam.h
+++ b/indra/llxuixml/llinitparam.h
@@ -740,7 +740,6 @@ namespace LLInitParam
if (src_typed_param.isProvided()
&& (overwrite || !dst_typed_param.isProvided()))
{
- dst_typed_param.clearValueName();
dst_typed_param.set(src_typed_param.getValue());
return true;
}
@@ -1744,33 +1743,29 @@ namespace LLInitParam
: mValue(value),
mValueAge(VALUE_AUTHORITATIVE),
mKeyVersion(0),
- mValidatedVersion(-1)
+ mValidatedVersion(-1),
+ mValidated(false)
{}
bool deserializeBlock(Parser& parser, Parser::name_stack_range_t name_stack, S32 generation)
{
derived_t& typed_param = static_cast<derived_t&>(*this);
- // type to apply parse direct value T
+ // try to parse direct value T
if (name_stack.first == name_stack.second)
{
if(parser.readValue(typed_param.mValue))
{
- typed_param.clearValueName();
typed_param.mValueAge = VALUE_AUTHORITATIVE;
- typed_param.updateBlockFromValue();
+ typed_param.updateBlockFromValue(false);
+
+ typed_param.clearValueName();
return true;
}
}
// fall back on parsing block components for T
- // if we deserialized at least one component...
- if (typed_param.BaseBlock::deserializeBlock(parser, name_stack, generation))
- {
- return true;
- }
-
- return false;
+ return typed_param.BaseBlock::deserializeBlock(parser, name_stack, generation);
}
void serializeBlock(Parser& parser, Parser::name_stack_t name_stack = Parser::name_stack_t(), const BaseBlock* diff_block = NULL) const
@@ -1801,9 +1796,20 @@ namespace LLInitParam
// be exported as <color green="1"/>, since it was probably the intent of the user to
// be specific about the RGB color values. This also fixes an issue where we distinguish
// between rect.left not being provided and rect.left being explicitly set to 0 (same as default)
- const_cast<derived_t&>(typed_param).updateBlockFromValue();
- block_t::serializeBlock(parser, name_stack, NULL);
+ if (typed_param.mValueAge == VALUE_AUTHORITATIVE)
+ {
+ // if the value is authoritative but the parser doesn't accept the value type
+ // go ahead and make a copy, and splat the value out to its component params
+ // and serialize those params
+ derived_t copy(typed_param);
+ copy.updateBlockFromValue(true);
+ copy.block_t::serializeBlock(parser, name_stack, NULL);
+ }
+ else
+ {
+ block_t::serializeBlock(parser, name_stack, NULL);
+ }
}
}
}
@@ -1852,7 +1858,7 @@ namespace LLInitParam
{
BaseBlock::paramChanged(changed_param, user_provided);
if (user_provided)
- {
+ {
// a parameter changed, so our value is out of date
mValueAge = VALUE_NEEDS_UPDATE;
}
@@ -1865,7 +1871,7 @@ namespace LLInitParam
mValueAge = VALUE_AUTHORITATIVE;
mValue = val;
typed_param.clearValueName();
- static_cast<derived_t*>(this)->updateBlockFromValue();
+ static_cast<derived_t*>(this)->updateBlockFromValue(false);
}
value_assignment_t getValue() const
@@ -1920,7 +1926,6 @@ namespace LLInitParam
mutable bool mValidated; // lazy validation flag
private:
-
mutable T mValue;
mutable EValueAge mValueAge;
};