diff options
author | James Cook <james@lindenlab.com> | 2009-12-16 16:04:09 -0800 |
---|---|---|
committer | James Cook <james@lindenlab.com> | 2009-12-16 16:04:09 -0800 |
commit | e8fe81c4fcbec173606b5ad635e0b774e4d8b24b (patch) | |
tree | 4ec27288a9621edaa9007f986ac1fee6232759bf /indra/llui/llui.cpp | |
parent | 3a02b9ec882c98009ae6c24913ee8a7a620b0f87 (diff) |
Backed out changeset: cfa60aef8061, added setBlockFromValue so setting a LLRect param in code will set the individua
Diffstat (limited to 'indra/llui/llui.cpp')
-rw-r--r-- | indra/llui/llui.cpp | 79 |
1 files changed, 25 insertions, 54 deletions
diff --git a/indra/llui/llui.cpp b/indra/llui/llui.cpp index 67d3ed408b..6603887905 100644 --- a/indra/llui/llui.cpp +++ b/indra/llui/llui.cpp @@ -1896,26 +1896,17 @@ namespace LLInitParam control("") {} - void TypedParam<LLUIColor>::setValueFromBlock() const + LLUIColor TypedParam<LLUIColor>::getValueFromBlock() const { if (control.isProvided()) { - mData.mValue = LLUIColorTable::instance().getColor(control); + return LLUIColorTable::instance().getColor(control); } else { - mData.mValue = LLColor4(red, green, blue, alpha); + return LLColor4(red, green, blue, alpha); } } - - void TypedParam<LLUIColor>::setBlockFromValue() - { - LLColor4 color = mData.mValue.get(); - red = color.mV[VRED]; - green = color.mV[VGREEN]; - blue = color.mV[VBLUE]; - alpha = color.mV[VALPHA]; - } void TypeValues<LLUIColor>::declareValues() { @@ -1941,32 +1932,28 @@ namespace LLInitParam addSynonym(name, ""); } - void TypedParam<const LLFontGL*>::setValueFromBlock() const + const LLFontGL* TypedParam<const LLFontGL*>::getValueFromBlock() const { - const LLFontGL* res_fontp = LLFontGL::getFontByName(name); - if (res_fontp) + if (name.isProvided()) { - mData.mValue = res_fontp; - } + const LLFontGL* res_fontp = LLFontGL::getFontByName(name); + if (res_fontp) + { + return res_fontp; + } - U8 fontstyle = 0; - fontstyle = LLFontGL::getStyleFromString(style()); - LLFontDescriptor desc(name(), size(), fontstyle); - const LLFontGL* fontp = LLFontGL::getFont(desc); - if (fontp) - { - mData.mValue = fontp; - } - } - - void TypedParam<const LLFontGL*>::setBlockFromValue() - { - if (mData.mValue) - { - name = LLFontGL::nameFromFont(mData.mValue); - size = LLFontGL::sizeFromFont(mData.mValue); - style = LLFontGL::getStringFromStyle(mData.mValue->getFontDesc().getStyle()); + U8 fontstyle = 0; + fontstyle = LLFontGL::getStyleFromString(style()); + LLFontDescriptor desc(name(), size(), fontstyle); + const LLFontGL* fontp = LLFontGL::getFont(desc); + if (fontp) + { + return fontp; + } } + + // default to current value + return mData.mValue; } TypedParam<LLRect>::TypedParam(BlockDescriptor& descriptor, const char* name, const LLRect& value, ParamDescriptor::validation_func_t func, S32 min_count, S32 max_count) @@ -1979,7 +1966,7 @@ namespace LLInitParam height("height") {} - void TypedParam<LLRect>::setValueFromBlock() const + LLRect TypedParam<LLRect>::getValueFromBlock() const { LLRect rect; @@ -2040,17 +2027,7 @@ namespace LLInitParam rect.mBottom = bottom; rect.mTop = top; } - mData.mValue = rect; - } - - void TypedParam<LLRect>::setBlockFromValue() - { - left = mData.mValue.mLeft; - right = mData.mValue.mRight; - bottom = mData.mValue.mBottom; - top = mData.mValue.mTop; - width.setProvided(false); - height.setProvided(false); + return rect; } TypedParam<LLCoordGL>::TypedParam(BlockDescriptor& descriptor, const char* name, LLCoordGL value, ParamDescriptor::validation_func_t func, S32 min_count, S32 max_count) @@ -2060,15 +2037,9 @@ namespace LLInitParam { } - void TypedParam<LLCoordGL>::setValueFromBlock() const - { - mData.mValue.set(x, y); - } - - void TypedParam<LLCoordGL>::setBlockFromValue() + LLCoordGL TypedParam<LLCoordGL>::getValueFromBlock() const { - x = mData.mValue.mX; - y = mData.mValue.mY; + return LLCoordGL(x, y); } |