EXT-1352 First pass background images for floaters and panels, including pretty header.
Reviewed with Leyla.master
parent
34398aac4b
commit
e018ecf469
|
|
@ -49,9 +49,9 @@
|
|||
#include "lluictrlfactory.h"
|
||||
|
||||
const S32 LEADING_PAD = 5;
|
||||
const S32 TITLE_PAD = 8;
|
||||
const S32 TITLE_HPAD = 8;
|
||||
const S32 BORDER_PAD = 1;
|
||||
const S32 LEFT_PAD = BORDER_PAD + TITLE_PAD + LEADING_PAD;
|
||||
const S32 LEFT_PAD = BORDER_PAD + TITLE_HPAD + LEADING_PAD;
|
||||
const S32 RIGHT_PAD = BORDER_PAD + 32; // HACK: space for close btn and minimize btn
|
||||
|
||||
S32 LLDragHandle::sSnapMargin = 5;
|
||||
|
|
@ -240,19 +240,20 @@ void LLDragHandleLeft::draw()
|
|||
|
||||
void LLDragHandleTop::reshapeTitleBox()
|
||||
{
|
||||
static LLUICachedControl<S32> title_vpad("UIFloaterTitleVPad", 0);
|
||||
if( ! mTitleBox)
|
||||
{
|
||||
return;
|
||||
}
|
||||
const LLFontGL* font = LLFontGL::getFontSansSerif();
|
||||
S32 title_width = font->getWidth( mTitleBox->getText() ) + TITLE_PAD;
|
||||
S32 title_width = font->getWidth( mTitleBox->getText() ) + TITLE_HPAD;
|
||||
if (getMaxTitleWidth() > 0)
|
||||
title_width = llmin(title_width, getMaxTitleWidth());
|
||||
S32 title_height = llround(font->getLineHeight());
|
||||
LLRect title_rect;
|
||||
title_rect.setLeftTopAndSize(
|
||||
LEFT_PAD,
|
||||
getRect().getHeight() - BORDER_PAD,
|
||||
getRect().getHeight() - title_vpad,
|
||||
getRect().getWidth() - LEFT_PAD - RIGHT_PAD,
|
||||
title_height);
|
||||
|
||||
|
|
|
|||
|
|
@ -219,7 +219,7 @@ void LLFloater::initClass()
|
|||
static LLWidgetNameRegistry::StaticRegistrar sRegisterFloaterParams(&typeid(LLFloater::Params), "floater");
|
||||
|
||||
LLFloater::LLFloater(const LLSD& key, const LLFloater::Params& p)
|
||||
: LLPanel(),
|
||||
: LLPanel(p),
|
||||
mDragHandle(NULL),
|
||||
mTitle(p.title),
|
||||
mShortTitle(p.short_title),
|
||||
|
|
@ -1548,26 +1548,42 @@ void LLFloater::draw()
|
|||
shadow_color % alpha,
|
||||
llround(shadow_offset));
|
||||
|
||||
// No transparent windows in simple UI
|
||||
LLUIImage* image = NULL;
|
||||
LLColor4 color;
|
||||
if (isBackgroundOpaque())
|
||||
{
|
||||
gl_rect_2d( left, top, right, bottom, getBackgroundColor() % alpha );
|
||||
// NOTE: image may not be set
|
||||
image = getBackgroundImage();
|
||||
color = getBackgroundColor();
|
||||
}
|
||||
else
|
||||
{
|
||||
gl_rect_2d( left, top, right, bottom, getTransparentColor() % alpha );
|
||||
image = getTransparentImage();
|
||||
color = getTransparentColor();
|
||||
}
|
||||
|
||||
if(hasFocus()
|
||||
&& !getIsChrome()
|
||||
&& !getCurrentTitle().empty())
|
||||
if (image)
|
||||
{
|
||||
static LLUIColor titlebar_focus_color = LLUIColorTable::instance().getColor("TitleBarFocusColor");
|
||||
// We're using images for this floater's backgrounds
|
||||
image->draw(getLocalRect(), UI_VERTEX_COLOR % alpha);
|
||||
}
|
||||
else
|
||||
{
|
||||
// We're not using images, use old-school flat colors
|
||||
gl_rect_2d( left, top, right, bottom, color % alpha );
|
||||
|
||||
// draw highlight on title bar to indicate focus. RDW
|
||||
const LLFontGL* font = LLFontGL::getFontSansSerif();
|
||||
LLRect r = getRect();
|
||||
gl_rect_2d_offset_local(0, r.getHeight(), r.getWidth(), r.getHeight() - (S32)font->getLineHeight() - 1,
|
||||
titlebar_focus_color % alpha, 0, TRUE);
|
||||
if(hasFocus()
|
||||
&& !getIsChrome()
|
||||
&& !getCurrentTitle().empty())
|
||||
{
|
||||
static LLUIColor titlebar_focus_color = LLUIColorTable::instance().getColor("TitleBarFocusColor");
|
||||
|
||||
const LLFontGL* font = LLFontGL::getFontSansSerif();
|
||||
LLRect r = getRect();
|
||||
gl_rect_2d_offset_local(0, r.getHeight(), r.getWidth(), r.getHeight() - (S32)font->getLineHeight() - 1,
|
||||
titlebar_focus_color % alpha, 0, TRUE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1617,18 +1633,6 @@ void LLFloater::draw()
|
|||
drawChild(focused_child);
|
||||
}
|
||||
|
||||
if( isBackgroundVisible() )
|
||||
{
|
||||
// add in a border to improve spacialized visual aclarity ;)
|
||||
// use lines instead of gl_rect_2d so we can round the edges as per james' recommendation
|
||||
static LLUIColor focus_border_color = LLUIColorTable::instance().getColor("FloaterFocusBorderColor");
|
||||
static LLUIColor unfocus_border_color = LLUIColorTable::instance().getColor("FloaterUnfocusBorderColor");
|
||||
LLUI::setLineWidth(1.5f);
|
||||
LLColor4 outlineColor = gFocusMgr.childHasKeyboardFocus(this) ? focus_border_color : unfocus_border_color;
|
||||
gl_rect_2d_offset_local(0, getRect().getHeight() + 1, getRect().getWidth() + 1, 0, outlineColor % alpha, -LLPANEL_BORDER_WIDTH, FALSE);
|
||||
LLUI::setLineWidth(1.f);
|
||||
}
|
||||
|
||||
// update tearoff button for torn off floaters
|
||||
// when last host goes away
|
||||
if (mCanTearOff && !getHost())
|
||||
|
|
|
|||
|
|
@ -71,10 +71,12 @@ const LLPanel::Params& LLPanel::getDefaultParams()
|
|||
LLPanel::Params::Params()
|
||||
: has_border("border", false),
|
||||
border(""),
|
||||
bg_opaque_color("bg_opaque_color"),
|
||||
bg_alpha_color("bg_alpha_color"),
|
||||
background_visible("background_visible", false),
|
||||
background_opaque("background_opaque", false),
|
||||
bg_opaque_color("bg_opaque_color"),
|
||||
bg_alpha_color("bg_alpha_color"),
|
||||
bg_opaque_image("bg_opaque_image"),
|
||||
bg_alpha_image("bg_alpha_image"),
|
||||
min_width("min_width", 100),
|
||||
min_height("min_height", 100),
|
||||
strings("string"),
|
||||
|
|
@ -92,10 +94,12 @@ LLPanel::Params::Params()
|
|||
|
||||
LLPanel::LLPanel(const LLPanel::Params& p)
|
||||
: LLUICtrl(p),
|
||||
mBgColorAlpha(p.bg_alpha_color()),
|
||||
mBgColorOpaque(p.bg_opaque_color()),
|
||||
mBgVisible(p.background_visible),
|
||||
mBgOpaque(p.background_opaque),
|
||||
mBgOpaqueColor(p.bg_opaque_color()),
|
||||
mBgAlphaColor(p.bg_alpha_color()),
|
||||
mBgOpaqueImage(p.bg_opaque_image()),
|
||||
mBgAlphaImage(p.bg_alpha_image()),
|
||||
mDefaultBtn(NULL),
|
||||
mBorder(NULL),
|
||||
mLabel(p.label),
|
||||
|
|
@ -178,19 +182,31 @@ void LLPanel::draw()
|
|||
// draw background
|
||||
if( mBgVisible )
|
||||
{
|
||||
//RN: I don't see the point of this
|
||||
S32 left = 0;//LLPANEL_BORDER_WIDTH;
|
||||
S32 top = getRect().getHeight();// - LLPANEL_BORDER_WIDTH;
|
||||
S32 right = getRect().getWidth();// - LLPANEL_BORDER_WIDTH;
|
||||
S32 bottom = 0;//LLPANEL_BORDER_WIDTH;
|
||||
|
||||
LLRect local_rect = getLocalRect();
|
||||
if (mBgOpaque )
|
||||
{
|
||||
gl_rect_2d( left, top, right, bottom, mBgColorOpaque.get() % alpha);
|
||||
// opaque, in-front look
|
||||
if (mBgOpaqueImage.notNull())
|
||||
{
|
||||
mBgOpaqueImage->draw( local_rect, UI_VERTEX_COLOR % alpha );
|
||||
}
|
||||
else
|
||||
{
|
||||
// fallback to flat colors when there are no images
|
||||
gl_rect_2d( local_rect, mBgOpaqueColor.get() % alpha);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
gl_rect_2d( left, top, right, bottom, mBgColorAlpha.get() % alpha);
|
||||
// transparent, in-back look
|
||||
if (mBgAlphaImage.notNull())
|
||||
{
|
||||
mBgAlphaImage->draw( local_rect, UI_VERTEX_COLOR % alpha );
|
||||
}
|
||||
else
|
||||
{
|
||||
gl_rect_2d( local_rect, mBgAlphaColor.get() % alpha );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -48,6 +48,7 @@ const BOOL BORDER_YES = TRUE;
|
|||
const BOOL BORDER_NO = FALSE;
|
||||
|
||||
class LLButton;
|
||||
class LLUIImage;
|
||||
|
||||
/*
|
||||
* General purpose concrete view base class.
|
||||
|
|
@ -72,12 +73,15 @@ public:
|
|||
Optional<bool> has_border;
|
||||
Optional<LLViewBorder::Params> border;
|
||||
|
||||
Optional<LLUIColor> bg_opaque_color,
|
||||
bg_alpha_color;
|
||||
|
||||
Optional<bool> background_visible,
|
||||
background_opaque;
|
||||
|
||||
Optional<LLUIColor> bg_opaque_color,
|
||||
bg_alpha_color;
|
||||
// opaque image is for "panel in foreground" look
|
||||
Optional<LLUIImage*> bg_opaque_image,
|
||||
bg_alpha_image;
|
||||
|
||||
Optional<S32> min_width,
|
||||
min_height;
|
||||
|
||||
|
|
@ -127,10 +131,12 @@ public:
|
|||
BOOL hasBorder() const { return mBorder != NULL; }
|
||||
void setBorderVisible( BOOL b );
|
||||
|
||||
void setBackgroundColor( const LLColor4& color ) { mBgColorOpaque = color; }
|
||||
const LLColor4& getBackgroundColor() const { return mBgColorOpaque; }
|
||||
void setTransparentColor(const LLColor4& color) { mBgColorAlpha = color; }
|
||||
const LLColor4& getTransparentColor() const { return mBgColorAlpha; }
|
||||
void setBackgroundColor( const LLColor4& color ) { mBgOpaqueColor = color; }
|
||||
const LLColor4& getBackgroundColor() const { return mBgOpaqueColor; }
|
||||
void setTransparentColor(const LLColor4& color) { mBgAlphaColor = color; }
|
||||
const LLColor4& getTransparentColor() const { return mBgAlphaColor; }
|
||||
LLPointer<LLUIImage> getBackgroundImage() const { return mBgOpaqueImage; }
|
||||
LLPointer<LLUIImage> getTransparentImage() const { return mBgAlphaImage; }
|
||||
void setBackgroundVisible( BOOL b ) { mBgVisible = b; }
|
||||
BOOL isBackgroundVisible() const { return mBgVisible; }
|
||||
void setBackgroundOpaque(BOOL b) { mBgOpaque = b; }
|
||||
|
|
@ -248,10 +254,12 @@ protected:
|
|||
std::string mHelpTopic; // the name of this panel's help topic to display in the Help Viewer
|
||||
|
||||
private:
|
||||
LLUIColor mBgColorAlpha;
|
||||
LLUIColor mBgColorOpaque;
|
||||
BOOL mBgVisible;
|
||||
BOOL mBgOpaque;
|
||||
BOOL mBgVisible; // any background at all?
|
||||
BOOL mBgOpaque; // use opaque color or image
|
||||
LLUIColor mBgOpaqueColor;
|
||||
LLUIColor mBgAlphaColor;
|
||||
LLPointer<LLUIImage> mBgOpaqueImage; // "panel in front" look
|
||||
LLPointer<LLUIImage> mBgAlphaImage; // "panel in back" look
|
||||
LLViewBorder* mBorder;
|
||||
LLButton* mDefaultBtn;
|
||||
LLUIString mLabel;
|
||||
|
|
|
|||
|
|
@ -8779,13 +8779,13 @@
|
|||
<key>UICloseBoxFromTop</key>
|
||||
<map>
|
||||
<key>Comment</key>
|
||||
<string>Size of UI floater close box from top</string>
|
||||
<string>Distance from top of floater to top of close box icon, pixels</string>
|
||||
<key>Persist</key>
|
||||
<integer>1</integer>
|
||||
<key>Type</key>
|
||||
<string>S32</string>
|
||||
<key>Value</key>
|
||||
<real>1</real>
|
||||
<real>5</real>
|
||||
</map>
|
||||
<key>UIExtraTriangleHeight</key>
|
||||
<map>
|
||||
|
|
@ -8823,13 +8823,13 @@
|
|||
<key>UIFloaterHeaderSize</key>
|
||||
<map>
|
||||
<key>Comment</key>
|
||||
<string>Size of UI floater header size</string>
|
||||
<string>UI floater header height in pixels</string>
|
||||
<key>Persist</key>
|
||||
<integer>1</integer>
|
||||
<key>Type</key>
|
||||
<string>S32</string>
|
||||
<key>Value</key>
|
||||
<real>18</real>
|
||||
<real>25</real>
|
||||
</map>
|
||||
<key>UIFloaterHPad</key>
|
||||
<map>
|
||||
|
|
@ -8853,16 +8853,16 @@
|
|||
<key>Value</key>
|
||||
<integer>0</integer>
|
||||
</map>
|
||||
<key>UIFloaterVPad</key>
|
||||
<key>UIFloaterTitleVPad</key>
|
||||
<map>
|
||||
<key>Comment</key>
|
||||
<string>Size of UI floater vertical pad</string>
|
||||
<string>Distance from top of floater to top of title string, pixels</string>
|
||||
<key>Persist</key>
|
||||
<integer>1</integer>
|
||||
<key>Type</key>
|
||||
<string>S32</string>
|
||||
<key>Value</key>
|
||||
<real>6</real>
|
||||
<real>7</real>
|
||||
</map>
|
||||
<key>UIImgDefaultEyesUUID</key>
|
||||
<map>
|
||||
|
|
|
|||
|
|
@ -471,8 +471,10 @@
|
|||
|
||||
<texture name="Widget_DownArrow" file_name="icons/Widget_DownArrow.png" preload="true" />
|
||||
|
||||
<texture name="Window_Background" file_name="windows/Window_Background.png" preload="true" />
|
||||
<texture name="Window_Foreground" file_name="windows/Window_Foreground.png" preload="true" />
|
||||
<texture name="Window_Background" file_name="windows/Window_Background.png" preload="true"
|
||||
scale.left="4" scale.top="24" scale.right="26" scale.bottom="4" />
|
||||
<texture name="Window_Foreground" file_name="windows/Window_Foreground.png" preload="true"
|
||||
scale.left="4" scale.top="24" scale.right="26" scale.bottom="4" />
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
Binary file not shown.
|
Before Width: | Height: | Size: 950 B After Width: | Height: | Size: 509 B |
Binary file not shown.
|
Before Width: | Height: | Size: 959 B After Width: | Height: | Size: 508 B |
|
|
@ -1,6 +1,9 @@
|
|||
<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
|
||||
<!-- See also settings.xml UIFloater* settings for configuration -->
|
||||
<floater name="floater"
|
||||
bg_opaque_color="FloaterFocusBackgroundColor"
|
||||
bg_alpha_color="FloaterDefaultBackgroundColor"
|
||||
bg_opaque_image="Window_Foreground"
|
||||
bg_alpha_image="Window_Background"
|
||||
background_visible="true"
|
||||
background_opaque="false"/>
|
||||
|
|
|
|||
|
|
@ -1,5 +1,9 @@
|
|||
<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
|
||||
<!-- Optional parameters:
|
||||
bg_opaque_image - image name for "in-front" panel look
|
||||
bg_alpha_image - image name for "in-back" or transparent panel look
|
||||
-->
|
||||
<panel bg_opaque_color="PanelFocusBackgroundColor"
|
||||
bg_alpha_color="PanelDefaultBackgroundColor"
|
||||
background_visible="false"
|
||||
background_opaque="false"/>
|
||||
background_opaque="false"/>
|
||||
|
|
|
|||
Loading…
Reference in New Issue