diff options
author | richard <none@none> | 2009-12-15 19:33:18 -0800 |
---|---|---|
committer | richard <none@none> | 2009-12-15 19:33:18 -0800 |
commit | 3a02b9ec882c98009ae6c24913ee8a7a620b0f87 (patch) | |
tree | 51c3bccd75e8daf7bd10c31ee6fddbc0c823a092 /indra/llui/llui.cpp | |
parent | cda1598fd6e17e0c0b641c73c540d8c898f2798f (diff) |
added setBlockFromValue so setting a LLRect param in code will set the individual left, right, top, bottom values, for example
don't call setupParams when creating widgets from code
moved Multiple param constraints into BaseBlock to remove extra scoping
Diffstat (limited to 'indra/llui/llui.cpp')
-rw-r--r-- | indra/llui/llui.cpp | 79 |
1 files changed, 54 insertions, 25 deletions
diff --git a/indra/llui/llui.cpp b/indra/llui/llui.cpp index 6603887905..67d3ed408b 100644 --- a/indra/llui/llui.cpp +++ b/indra/llui/llui.cpp @@ -1896,17 +1896,26 @@ namespace LLInitParam control("") {} - LLUIColor TypedParam<LLUIColor>::getValueFromBlock() const + void TypedParam<LLUIColor>::setValueFromBlock() const { if (control.isProvided()) { - return LLUIColorTable::instance().getColor(control); + mData.mValue = LLUIColorTable::instance().getColor(control); } else { - return LLColor4(red, green, blue, alpha); + mData.mValue = 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() { @@ -1932,28 +1941,32 @@ namespace LLInitParam addSynonym(name, ""); } - const LLFontGL* TypedParam<const LLFontGL*>::getValueFromBlock() const + void TypedParam<const LLFontGL*>::setValueFromBlock() const { - if (name.isProvided()) + const LLFontGL* res_fontp = LLFontGL::getFontByName(name); + if (res_fontp) { - const LLFontGL* res_fontp = LLFontGL::getFontByName(name); - if (res_fontp) - { - return res_fontp; - } + mData.mValue = res_fontp; + } - U8 fontstyle = 0; - fontstyle = LLFontGL::getStyleFromString(style()); - LLFontDescriptor desc(name(), size(), fontstyle); - const LLFontGL* fontp = LLFontGL::getFont(desc); - if (fontp) - { - return 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()); } - - // 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) @@ -1966,7 +1979,7 @@ namespace LLInitParam height("height") {} - LLRect TypedParam<LLRect>::getValueFromBlock() const + void TypedParam<LLRect>::setValueFromBlock() const { LLRect rect; @@ -2027,7 +2040,17 @@ namespace LLInitParam rect.mBottom = bottom; rect.mTop = top; } - return rect; + 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); } TypedParam<LLCoordGL>::TypedParam(BlockDescriptor& descriptor, const char* name, LLCoordGL value, ParamDescriptor::validation_func_t func, S32 min_count, S32 max_count) @@ -2037,9 +2060,15 @@ namespace LLInitParam { } - LLCoordGL TypedParam<LLCoordGL>::getValueFromBlock() const + void TypedParam<LLCoordGL>::setValueFromBlock() const + { + mData.mValue.set(x, y); + } + + void TypedParam<LLCoordGL>::setBlockFromValue() { - return LLCoordGL(x, y); + x = mData.mValue.mX; + y = mData.mValue.mY; } |