diff options
author | Andrey Kleshchev <andreykproductengine@lindenlab.com> | 2024-06-10 17:06:06 +0300 |
---|---|---|
committer | Andrey Kleshchev <andreykproductengine@lindenlab.com> | 2024-06-10 19:25:02 +0300 |
commit | 0dcc912cecdfb365c1f4246545ece40ccb7bc18e (patch) | |
tree | ccf664c765d1adbbf4985069321df65c85ca36e2 /indra/llui/llviewborder.cpp | |
parent | bd8438f7083643ae5812b14e35e69e69ef1616c6 (diff) | |
parent | d317454c82e016a02c8a708a0118f3ff29aa8e82 (diff) |
Merge main into inventory_favorites
# Conflicts:
# indra/llui/llfolderviewmodel.h
# indra/newview/llpanelwearing.cpp
# indra/newview/llwearableitemslist.cpp
Diffstat (limited to 'indra/llui/llviewborder.cpp')
-rw-r--r-- | indra/llui/llviewborder.cpp | 392 |
1 files changed, 196 insertions, 196 deletions
diff --git a/indra/llui/llviewborder.cpp b/indra/llui/llviewborder.cpp index 919267dcc6..47cc57e42f 100644 --- a/indra/llui/llviewborder.cpp +++ b/indra/llui/llviewborder.cpp @@ -1,24 +1,24 @@ -/** +/** * @file llviewborder.cpp * * $LicenseInfo:firstyear=2001&license=viewerlgpl$ * Second Life Viewer Source Code * Copyright (C) 2010, Linden Research, Inc. - * + * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; * version 2.1 of the License only. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. - * + * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * + * * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * $/LicenseInfo$ */ @@ -34,237 +34,237 @@ static LLDefaultChildRegistry::Register<LLViewBorder> r("view_border"); void LLViewBorder::BevelValues::declareValues() { - declare("in", LLViewBorder::BEVEL_IN); - declare("out", LLViewBorder::BEVEL_OUT); - declare("bright", LLViewBorder::BEVEL_BRIGHT); - declare("none", LLViewBorder::BEVEL_NONE); + declare("in", LLViewBorder::BEVEL_IN); + declare("out", LLViewBorder::BEVEL_OUT); + declare("bright", LLViewBorder::BEVEL_BRIGHT); + declare("none", LLViewBorder::BEVEL_NONE); } void LLViewBorder::StyleValues::declareValues() { - declare("line", LLViewBorder::STYLE_LINE); - declare("texture", LLViewBorder::STYLE_TEXTURE); + declare("line", LLViewBorder::STYLE_LINE); + declare("texture", LLViewBorder::STYLE_TEXTURE); } LLViewBorder::Params::Params() -: bevel_style("bevel_style", BEVEL_OUT), - render_style("border_style", STYLE_LINE), - border_thickness("border_thickness"), - highlight_light_color("highlight_light_color"), - highlight_dark_color("highlight_dark_color"), - shadow_light_color("shadow_light_color"), - shadow_dark_color("shadow_dark_color") +: bevel_style("bevel_style", BEVEL_OUT), + render_style("border_style", STYLE_LINE), + border_thickness("border_thickness"), + highlight_light_color("highlight_light_color"), + highlight_dark_color("highlight_dark_color"), + shadow_light_color("shadow_light_color"), + shadow_dark_color("shadow_dark_color") { - addSynonym(border_thickness, "thickness"); - addSynonym(render_style, "style"); + addSynonym(border_thickness, "thickness"); + addSynonym(render_style, "style"); } LLViewBorder::LLViewBorder(const LLViewBorder::Params& p) -: LLView(p), - mTexture( NULL ), - mHasKeyboardFocus( FALSE ), - mBorderWidth(p.border_thickness), - mHighlightLight(p.highlight_light_color()), - mHighlightDark(p.highlight_dark_color()), - mShadowLight(p.shadow_light_color()), - mShadowDark(p.shadow_dark_color()), - mBevel(p.bevel_style), - mStyle(p.render_style) +: LLView(p), + mTexture( NULL ), + mHasKeyboardFocus( FALSE ), + mBorderWidth(p.border_thickness), + mHighlightLight(p.highlight_light_color()), + mHighlightDark(p.highlight_dark_color()), + mShadowLight(p.shadow_light_color()), + mShadowDark(p.shadow_dark_color()), + mBevel(p.bevel_style), + mStyle(p.render_style) {} void LLViewBorder::setColors( const LLColor4& shadow_dark, const LLColor4& highlight_light ) { - mShadowDark = shadow_dark; - mHighlightLight = highlight_light; + mShadowDark = shadow_dark; + mHighlightLight = highlight_light; } void LLViewBorder::setColorsExtended( const LLColor4& shadow_light, const LLColor4& shadow_dark, - const LLColor4& highlight_light, const LLColor4& highlight_dark ) + const LLColor4& highlight_light, const LLColor4& highlight_dark ) { - mShadowDark = shadow_dark; - mShadowLight = shadow_light; - mHighlightLight = highlight_light; - mHighlightDark = highlight_dark; + mShadowDark = shadow_dark; + mShadowLight = shadow_light; + mHighlightLight = highlight_light; + mHighlightDark = highlight_dark; } void LLViewBorder::setTexture( const LLUUID &image_id ) { - mTexture = LLUI::getUIImageByID(image_id); + mTexture = LLUI::getUIImageByID(image_id); } void LLViewBorder::draw() { - if( STYLE_LINE == mStyle ) - { - if( 0 == mBorderWidth ) - { - // no visible border - } - else - if( 1 == mBorderWidth ) - { - drawOnePixelLines(); - } - else - if( 2 == mBorderWidth ) - { - drawTwoPixelLines(); - } - else - { - llassert( FALSE ); // not implemented - } - } - - LLView::draw(); + if( STYLE_LINE == mStyle ) + { + if( 0 == mBorderWidth ) + { + // no visible border + } + else + if( 1 == mBorderWidth ) + { + drawOnePixelLines(); + } + else + if( 2 == mBorderWidth ) + { + drawTwoPixelLines(); + } + else + { + llassert( FALSE ); // not implemented + } + } + + LLView::draw(); } void LLViewBorder::drawOnePixelLines() { - gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); - - LLColor4 top_color = mHighlightLight.get(); - LLColor4 bottom_color = mHighlightLight.get(); - switch( mBevel ) - { - case BEVEL_OUT: - top_color = mHighlightLight.get(); - bottom_color = mShadowDark.get(); - break; - case BEVEL_IN: - top_color = mShadowDark.get(); - bottom_color = mHighlightLight.get(); - break; - case BEVEL_NONE: - // use defaults - break; - default: - llassert(0); - } - - if( mHasKeyboardFocus ) - { - top_color = gFocusMgr.getFocusColor(); - bottom_color = top_color; - - LLUI::setLineWidth(lerp(1.f, 3.f, gFocusMgr.getFocusFlashAmt())); - } - - S32 left = 0; - S32 top = getRect().getHeight(); - S32 right = getRect().getWidth(); - S32 bottom = 0; - - gGL.color4fv( top_color.mV ); - gl_line_2d(left, bottom, left, top); - gl_line_2d(left, top, right, top); - - gGL.color4fv( bottom_color.mV ); - gl_line_2d(right, top, right, bottom); - gl_line_2d(left, bottom, right, bottom); - - LLUI::setLineWidth(1.f); + gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); + + LLColor4 top_color = mHighlightLight.get(); + LLColor4 bottom_color = mHighlightLight.get(); + switch( mBevel ) + { + case BEVEL_OUT: + top_color = mHighlightLight.get(); + bottom_color = mShadowDark.get(); + break; + case BEVEL_IN: + top_color = mShadowDark.get(); + bottom_color = mHighlightLight.get(); + break; + case BEVEL_NONE: + // use defaults + break; + default: + llassert(0); + } + + if( mHasKeyboardFocus ) + { + top_color = gFocusMgr.getFocusColor(); + bottom_color = top_color; + + LLUI::setLineWidth(lerp(1.f, 3.f, gFocusMgr.getFocusFlashAmt())); + } + + S32 left = 0; + S32 top = getRect().getHeight(); + S32 right = getRect().getWidth(); + S32 bottom = 0; + + gGL.color4fv( top_color.mV ); + gl_line_2d(left, bottom, left, top); + gl_line_2d(left, top, right, top); + + gGL.color4fv( bottom_color.mV ); + gl_line_2d(right, top, right, bottom); + gl_line_2d(left, bottom, right, bottom); + + LLUI::setLineWidth(1.f); } void LLViewBorder::drawTwoPixelLines() { - gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); - - LLColor4 focus_color = gFocusMgr.getFocusColor(); - - LLColor4 top_in_color; - LLColor4 top_out_color; - LLColor4 bottom_in_color; - LLColor4 bottom_out_color; - - switch( mBevel ) - { - case BEVEL_OUT: - top_in_color = mHighlightLight.get(); - top_out_color = mHighlightDark.get(); - bottom_in_color = mShadowLight.get(); - bottom_out_color = mShadowDark.get(); - break; - case BEVEL_IN: - top_in_color = mShadowDark.get(); - top_out_color = mShadowLight.get(); - bottom_in_color = mHighlightDark.get(); - bottom_out_color = mHighlightLight.get(); - break; - case BEVEL_BRIGHT: - top_in_color = mHighlightLight.get(); - top_out_color = mHighlightLight.get(); - bottom_in_color = mHighlightLight.get(); - bottom_out_color = mHighlightLight.get(); - break; - case BEVEL_NONE: - top_in_color = mShadowDark.get(); - top_out_color = mShadowDark.get(); - bottom_in_color = mShadowDark.get(); - bottom_out_color = mShadowDark.get(); - // use defaults - break; - default: - llassert(0); - } - - if( mHasKeyboardFocus ) - { - top_out_color = focus_color; - bottom_out_color = focus_color; - } - - S32 left = 0; - S32 top = getRect().getHeight(); - S32 right = getRect().getWidth(); - S32 bottom = 0; - - // draw borders - gGL.color3fv( top_out_color.mV ); - gl_line_2d(left, bottom, left, top-1); - gl_line_2d(left, top-1, right, top-1); - - gGL.color3fv( top_in_color.mV ); - gl_line_2d(left+1, bottom+1, left+1, top-2); - gl_line_2d(left+1, top-2, right-1, top-2); - - gGL.color3fv( bottom_out_color.mV ); - gl_line_2d(right-1, top-1, right-1, bottom); - gl_line_2d(left, bottom, right, bottom); - - gGL.color3fv( bottom_in_color.mV ); - gl_line_2d(right-2, top-2, right-2, bottom+1); - gl_line_2d(left+1, bottom+1, right-1, bottom+1); + gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); + + LLColor4 focus_color = gFocusMgr.getFocusColor(); + + LLColor4 top_in_color; + LLColor4 top_out_color; + LLColor4 bottom_in_color; + LLColor4 bottom_out_color; + + switch( mBevel ) + { + case BEVEL_OUT: + top_in_color = mHighlightLight.get(); + top_out_color = mHighlightDark.get(); + bottom_in_color = mShadowLight.get(); + bottom_out_color = mShadowDark.get(); + break; + case BEVEL_IN: + top_in_color = mShadowDark.get(); + top_out_color = mShadowLight.get(); + bottom_in_color = mHighlightDark.get(); + bottom_out_color = mHighlightLight.get(); + break; + case BEVEL_BRIGHT: + top_in_color = mHighlightLight.get(); + top_out_color = mHighlightLight.get(); + bottom_in_color = mHighlightLight.get(); + bottom_out_color = mHighlightLight.get(); + break; + case BEVEL_NONE: + top_in_color = mShadowDark.get(); + top_out_color = mShadowDark.get(); + bottom_in_color = mShadowDark.get(); + bottom_out_color = mShadowDark.get(); + // use defaults + break; + default: + llassert(0); + } + + if( mHasKeyboardFocus ) + { + top_out_color = focus_color; + bottom_out_color = focus_color; + } + + S32 left = 0; + S32 top = getRect().getHeight(); + S32 right = getRect().getWidth(); + S32 bottom = 0; + + // draw borders + gGL.color3fv( top_out_color.mV ); + gl_line_2d(left, bottom, left, top-1); + gl_line_2d(left, top-1, right, top-1); + + gGL.color3fv( top_in_color.mV ); + gl_line_2d(left+1, bottom+1, left+1, top-2); + gl_line_2d(left+1, top-2, right-1, top-2); + + gGL.color3fv( bottom_out_color.mV ); + gl_line_2d(right-1, top-1, right-1, bottom); + gl_line_2d(left, bottom, right, bottom); + + gGL.color3fv( bottom_in_color.mV ); + gl_line_2d(right-2, top-2, right-2, bottom+1); + gl_line_2d(left+1, bottom+1, right-1, bottom+1); } BOOL LLViewBorder::getBevelFromAttribute(LLXMLNodePtr node, LLViewBorder::EBevel& bevel_style) { - if (node->hasAttribute("bevel_style")) - { - std::string bevel_string; - node->getAttributeString("bevel_style", bevel_string); - LLStringUtil::toLower(bevel_string); - - if (bevel_string == "none") - { - bevel_style = LLViewBorder::BEVEL_NONE; - } - else if (bevel_string == "in") - { - bevel_style = LLViewBorder::BEVEL_IN; - } - else if (bevel_string == "out") - { - bevel_style = LLViewBorder::BEVEL_OUT; - } - else if (bevel_string == "bright") - { - bevel_style = LLViewBorder::BEVEL_BRIGHT; - } - return TRUE; - } - return FALSE; + if (node->hasAttribute("bevel_style")) + { + std::string bevel_string; + node->getAttributeString("bevel_style", bevel_string); + LLStringUtil::toLower(bevel_string); + + if (bevel_string == "none") + { + bevel_style = LLViewBorder::BEVEL_NONE; + } + else if (bevel_string == "in") + { + bevel_style = LLViewBorder::BEVEL_IN; + } + else if (bevel_string == "out") + { + bevel_style = LLViewBorder::BEVEL_OUT; + } + else if (bevel_string == "bright") + { + bevel_style = LLViewBorder::BEVEL_BRIGHT; + } + return TRUE; + } + return FALSE; } |