From 1dedd3de05503067b36096007eeb0bb6a6204587 Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Tue, 19 Apr 2011 16:16:54 -0700 Subject: EXP-648 FIX As a developer, I want to be able to specify param blocks that use Multiple for a sequence of images Factored out param block data classes so that specialized param block types, such as LLUIImage, LLFontGL, LLRect, etc. can be stored in a Multiple context Converted loading_indicator to take image sequence from XUI deprecated name-value pairs for LLUIColor values, and put them in colors.xml --- indra/llui/llui.cpp | 103 ++++++++++++++++++++++++++-------------------------- 1 file changed, 51 insertions(+), 52 deletions(-) (limited to 'indra/llui/llui.cpp') diff --git a/indra/llui/llui.cpp b/indra/llui/llui.cpp index 87669574c2..8020ca802b 100644 --- a/indra/llui/llui.cpp +++ b/indra/llui/llui.cpp @@ -1626,8 +1626,8 @@ void LLUI::cleanupClass() { if(sImageProvider) { - sImageProvider->cleanUp(); - } + sImageProvider->cleanUp(); +} } void LLUI::setPopupFuncs(const add_popup_t& add_popup, const remove_popup_t& remove_popup, const clear_popups_t& clear_popups) @@ -2074,32 +2074,32 @@ const LLView* LLUI::resolvePath(const LLView* context, const std::string& path) namespace LLInitParam { - TypedParam::TypedParam(BlockDescriptor& descriptor, const char* name, const LLUIColor& value, ParamDescriptor::validation_func_t func, S32 min_count, S32 max_count) - : super_t(descriptor, name, value, func, min_count, max_count), + ParamValue >::ParamValue(const LLUIColor& color) + : super_t(color), red("red"), green("green"), blue("blue"), alpha("alpha"), control("") { - setBlockFromValue(); + updateBlockFromValue(); } - void TypedParam::setValueFromBlock() const + void ParamValue >::updateValueFromBlock() { if (control.isProvided()) { - mData.mValue = LLUIColorTable::instance().getColor(control); + updateValue(LLUIColorTable::instance().getColor(control)); } else { - mData.mValue = LLColor4(red, green, blue, alpha); + updateValue(LLColor4(red, green, blue, alpha)); } } - void TypedParam::setBlockFromValue() + void ParamValue >::updateBlockFromValue() { - LLColor4 color = mData.mValue.get(); + LLColor4 color = getValue(); red.set(color.mV[VRED], false); green.set(color.mV[VGREEN], false); blue.set(color.mV[VBLUE], false); @@ -2107,38 +2107,32 @@ namespace LLInitParam control.set("", false); } - void TypeValues::declareValues() - { - declare("white", LLColor4::white); - declare("black", LLColor4::black); - declare("red", LLColor4::red); - declare("green", LLColor4::green); - declare("blue", LLColor4::blue); - } - bool ParamCompare::equals(const LLFontGL* a, const LLFontGL* b) { return !(a->getFontDesc() < b->getFontDesc()) && !(b->getFontDesc() < a->getFontDesc()); } - TypedParam::TypedParam(BlockDescriptor& descriptor, const char* _name, const LLFontGL*const value, ParamDescriptor::validation_func_t func, S32 min_count, S32 max_count) - : super_t(descriptor, _name, value, func, min_count, max_count), + ParamValue >::ParamValue(const LLFontGL* fontp) + : super_t(fontp), name("name"), size("size"), style("style") { - setBlockFromValue(); + if (!fontp) + { + updateValue(LLFontGL::getFontDefault()); + } addSynonym(name, ""); - setBlockFromValue(); + updateBlockFromValue(); } - void TypedParam::setValueFromBlock() const + void ParamValue >::updateValueFromBlock() { const LLFontGL* res_fontp = LLFontGL::getFontByName(name); if (res_fontp) { - mData.mValue = res_fontp; + updateValue(res_fontp); return; } @@ -2148,22 +2142,26 @@ namespace LLInitParam const LLFontGL* fontp = LLFontGL::getFont(desc); if (fontp) { - mData.mValue = fontp; - } + updateValue(fontp); + } + else + { + updateValue(LLFontGL::getFontDefault()); + } } - void TypedParam::setBlockFromValue() + void ParamValue >::updateBlockFromValue() { - if (mData.mValue) + if (getValue()) { - name.set(LLFontGL::nameFromFont(mData.mValue), false); - size.set(LLFontGL::sizeFromFont(mData.mValue), false); - style.set(LLFontGL::getStringFromStyle(mData.mValue->getFontDesc().getStyle()), false); + name.set(LLFontGL::nameFromFont(getValue()), false); + size.set(LLFontGL::sizeFromFont(getValue()), false); + style.set(LLFontGL::getStringFromStyle(getValue()->getFontDesc().getStyle()), false); } } - TypedParam::TypedParam(BlockDescriptor& descriptor, const char* name, const LLRect& value, ParamDescriptor::validation_func_t func, S32 min_count, S32 max_count) - : super_t(descriptor, name, value, func, min_count, max_count), + ParamValue >::ParamValue(const LLRect& rect) + : super_t(rect), left("left"), top("top"), right("right"), @@ -2171,10 +2169,10 @@ namespace LLInitParam width("width"), height("height") { - setBlockFromValue(); + updateBlockFromValue(); } - void TypedParam::setValueFromBlock() const + void ParamValue >::updateValueFromBlock() { LLRect rect; @@ -2235,40 +2233,41 @@ namespace LLInitParam rect.mBottom = bottom; rect.mTop = top; } - mData.mValue = rect; + updateValue(rect); } - void TypedParam::setBlockFromValue() + void ParamValue >::updateBlockFromValue() { // 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 - left.set(mData.mValue.mLeft, false); - right.set(mData.mValue.mRight, false); - bottom.set(mData.mValue.mBottom, false); - top.set(mData.mValue.mTop, false); - width.set(mData.mValue.getWidth(), false); - height.set(mData.mValue.getHeight(), false); + 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); } - TypedParam::TypedParam(BlockDescriptor& descriptor, const char* name, LLCoordGL value, ParamDescriptor::validation_func_t func, S32 min_count, S32 max_count) - : super_t(descriptor, name, value, func, min_count, max_count), + ParamValue >::ParamValue(const LLCoordGL& coord) + : super_t(coord), x("x"), y("y") { - setBlockFromValue(); + updateBlockFromValue(); } - void TypedParam::setValueFromBlock() const + void ParamValue >::updateValueFromBlock() { - mData.mValue.set(x, y); + updateValue(LLCoordGL(x, y)); } - void TypedParam::setBlockFromValue() + void ParamValue >::updateBlockFromValue() { - x.set(mData.mValue.mX, false); - y.set(mData.mValue.mY, false); + x.set(getValue().mX, false); + y.set(getValue().mY, false); } -- cgit v1.2.3