From 3a02b9ec882c98009ae6c24913ee8a7a620b0f87 Mon Sep 17 00:00:00 2001 From: richard Date: Tue, 15 Dec 2009 19:33:18 -0800 Subject: 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 --- indra/llui/llui.cpp | 79 ++++++++++++++++++++++++++++++++++++----------------- 1 file changed, 54 insertions(+), 25 deletions(-) (limited to 'indra/llui/llui.cpp') 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::getValueFromBlock() const + void TypedParam::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::setBlockFromValue() + { + LLColor4 color = mData.mValue.get(); + red = color.mV[VRED]; + green = color.mV[VGREEN]; + blue = color.mV[VBLUE]; + alpha = color.mV[VALPHA]; + } void TypeValues::declareValues() { @@ -1932,28 +1941,32 @@ namespace LLInitParam addSynonym(name, ""); } - const LLFontGL* TypedParam::getValueFromBlock() const + void TypedParam::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::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::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::getValueFromBlock() const + void TypedParam::setValueFromBlock() const { LLRect rect; @@ -2027,7 +2040,17 @@ namespace LLInitParam rect.mBottom = bottom; rect.mTop = top; } - return rect; + mData.mValue = rect; + } + + void TypedParam::setBlockFromValue() + { + left = mData.mValue.mLeft; + right = mData.mValue.mRight; + bottom = mData.mValue.mBottom; + top = mData.mValue.mTop; + width.setProvided(false); + height.setProvided(false); } TypedParam::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::getValueFromBlock() const + void TypedParam::setValueFromBlock() const + { + mData.mValue.set(x, y); + } + + void TypedParam::setBlockFromValue() { - return LLCoordGL(x, y); + x = mData.mValue.mX; + y = mData.mValue.mY; } -- cgit v1.2.3 From e8fe81c4fcbec173606b5ad635e0b774e4d8b24b Mon Sep 17 00:00:00 2001 From: James Cook Date: Wed, 16 Dec 2009 16:04:09 -0800 Subject: Backed out changeset: cfa60aef8061, added setBlockFromValue so setting a LLRect param in code will set the individua --- indra/llui/llui.cpp | 79 +++++++++++++++++------------------------------------ 1 file changed, 25 insertions(+), 54 deletions(-) (limited to 'indra/llui/llui.cpp') 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::setValueFromBlock() const + LLUIColor TypedParam::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::setBlockFromValue() - { - LLColor4 color = mData.mValue.get(); - red = color.mV[VRED]; - green = color.mV[VGREEN]; - blue = color.mV[VBLUE]; - alpha = color.mV[VALPHA]; - } void TypeValues::declareValues() { @@ -1941,32 +1932,28 @@ namespace LLInitParam addSynonym(name, ""); } - void TypedParam::setValueFromBlock() const + const LLFontGL* TypedParam::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::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::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::setValueFromBlock() const + LLRect TypedParam::getValueFromBlock() const { LLRect rect; @@ -2040,17 +2027,7 @@ namespace LLInitParam rect.mBottom = bottom; rect.mTop = top; } - mData.mValue = rect; - } - - void TypedParam::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::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::setValueFromBlock() const - { - mData.mValue.set(x, y); - } - - void TypedParam::setBlockFromValue() + LLCoordGL TypedParam::getValueFromBlock() const { - x = mData.mValue.mX; - y = mData.mValue.mY; + return LLCoordGL(x, y); } -- cgit v1.2.3 From 9ff869a6b287a2b4b8c94219584d1c7b66ebb399 Mon Sep 17 00:00:00 2001 From: richard Date: Thu, 17 Dec 2009 10:01:55 -0800 Subject: Backed out changeset: 4d482c1ed041 --- indra/llui/llui.cpp | 79 ++++++++++++++++++++++++++++++++++++----------------- 1 file changed, 54 insertions(+), 25 deletions(-) (limited to 'indra/llui/llui.cpp') 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::getValueFromBlock() const + void TypedParam::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::setBlockFromValue() + { + LLColor4 color = mData.mValue.get(); + red = color.mV[VRED]; + green = color.mV[VGREEN]; + blue = color.mV[VBLUE]; + alpha = color.mV[VALPHA]; + } void TypeValues::declareValues() { @@ -1932,28 +1941,32 @@ namespace LLInitParam addSynonym(name, ""); } - const LLFontGL* TypedParam::getValueFromBlock() const + void TypedParam::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::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::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::getValueFromBlock() const + void TypedParam::setValueFromBlock() const { LLRect rect; @@ -2027,7 +2040,17 @@ namespace LLInitParam rect.mBottom = bottom; rect.mTop = top; } - return rect; + mData.mValue = rect; + } + + void TypedParam::setBlockFromValue() + { + left = mData.mValue.mLeft; + right = mData.mValue.mRight; + bottom = mData.mValue.mBottom; + top = mData.mValue.mTop; + width.setProvided(false); + height.setProvided(false); } TypedParam::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::getValueFromBlock() const + void TypedParam::setValueFromBlock() const + { + mData.mValue.set(x, y); + } + + void TypedParam::setBlockFromValue() { - return LLCoordGL(x, y); + x = mData.mValue.mX; + y = mData.mValue.mY; } -- cgit v1.2.3 From c89bb9848f302a9a06cdec4c6100da3fcc99ac0d Mon Sep 17 00:00:00 2001 From: richard Date: Thu, 17 Dec 2009 11:48:33 -0800 Subject: fix for bad xui warnings when loading font from legacy "resource" name --- indra/llui/llui.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'indra/llui/llui.cpp') diff --git a/indra/llui/llui.cpp b/indra/llui/llui.cpp index 67d3ed408b..1ea6b66a93 100644 --- a/indra/llui/llui.cpp +++ b/indra/llui/llui.cpp @@ -1947,6 +1947,7 @@ namespace LLInitParam if (res_fontp) { mData.mValue = res_fontp; + return; } U8 fontstyle = 0; -- cgit v1.2.3 From 2da83c55ee30faa93a6503a5ceca126410a7f4cd Mon Sep 17 00:00:00 2001 From: James Cook Date: Fri, 18 Dec 2009 14:39:54 -0800 Subject: Fix for color setup from Richard. --- indra/llui/llui.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'indra/llui/llui.cpp') diff --git a/indra/llui/llui.cpp b/indra/llui/llui.cpp index 1ea6b66a93..728ed4e7aa 100644 --- a/indra/llui/llui.cpp +++ b/indra/llui/llui.cpp @@ -1915,6 +1915,7 @@ namespace LLInitParam green = color.mV[VGREEN]; blue = color.mV[VBLUE]; alpha = color.mV[VALPHA]; + control.set("", false); } void TypeValues::declareValues() -- cgit v1.2.3 From 093795c10c9a15f293416467bf686f87f0fdbc8b Mon Sep 17 00:00:00 2001 From: richard Date: Mon, 21 Dec 2009 17:32:05 -0800 Subject: EXT-3599 - no chiclets in the im well window --- indra/llui/llui.cpp | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) (limited to 'indra/llui/llui.cpp') diff --git a/indra/llui/llui.cpp b/indra/llui/llui.cpp index 728ed4e7aa..d0ed3b6fca 100644 --- a/indra/llui/llui.cpp +++ b/indra/llui/llui.cpp @@ -2047,12 +2047,16 @@ namespace LLInitParam void TypedParam::setBlockFromValue() { - left = mData.mValue.mLeft; - right = mData.mValue.mRight; - bottom = mData.mValue.mBottom; - top = mData.mValue.mTop; - width.setProvided(false); - height.setProvided(false); + // 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); } TypedParam::TypedParam(BlockDescriptor& descriptor, const char* name, LLCoordGL value, ParamDescriptor::validation_func_t func, S32 min_count, S32 max_count) -- cgit v1.2.3