summaryrefslogtreecommitdiff
path: root/indra/llui
diff options
context:
space:
mode:
Diffstat (limited to 'indra/llui')
-rw-r--r--indra/llui/llbutton.cpp14
-rw-r--r--indra/llui/llbutton.h18
-rw-r--r--indra/llui/llmultifloater.cpp8
-rw-r--r--indra/llui/lltabcontainer.cpp14
-rw-r--r--indra/llui/lltabcontainer.h11
-rw-r--r--indra/llui/lltextbase.cpp17
6 files changed, 46 insertions, 36 deletions
diff --git a/indra/llui/llbutton.cpp b/indra/llui/llbutton.cpp
index 14b77925f2..1d4dc35cee 100644
--- a/indra/llui/llbutton.cpp
+++ b/indra/llui/llbutton.cpp
@@ -81,10 +81,9 @@ LLButton::Params::Params()
image_pressed_selected("image_pressed_selected"),
image_overlay("image_overlay"),
image_overlay_alignment("image_overlay_alignment", std::string("center")),
- image_left_pad("image_left_pad"),
- image_right_pad("image_right_pad"),
image_top_pad("image_top_pad"),
image_bottom_pad("image_bottom_pad"),
+ imgoverlay_label_space("imgoverlay_label_space", 1),
label_color("label_color"),
label_color_selected("label_color_selected"), // requires is_toggle true
label_color_disabled("label_color_disabled"),
@@ -144,10 +143,9 @@ LLButton::LLButton(const LLButton::Params& p)
mImageOverlay(p.image_overlay()),
mImageOverlayColor(p.image_overlay_color()),
mImageOverlayAlignment(LLFontGL::hAlignFromName(p.image_overlay_alignment)),
- mImageOverlayLeftPad(p.image_left_pad),
- mImageOverlayRightPad(p.image_right_pad),
mImageOverlayTopPad(p.image_top_pad),
mImageOverlayBottomPad(p.image_bottom_pad),
+ mImgOverlayLabelSpace(p.imgoverlay_label_space),
mIsToggle(p.is_toggle),
mScaleImage(p.scale_image),
mDropShadowedText(p.label_shadow),
@@ -783,9 +781,9 @@ void LLButton::draw()
switch(mImageOverlayAlignment)
{
case LLFontGL::LEFT:
- text_left += overlay_width + 1;
+ text_left += overlay_width + mImgOverlayLabelSpace;
mImageOverlay->draw(
- mImageOverlayLeftPad,
+ mLeftHPad,
center_y - (overlay_height / 2),
overlay_width,
overlay_height,
@@ -800,9 +798,9 @@ void LLButton::draw()
overlay_color);
break;
case LLFontGL::RIGHT:
- text_right -= overlay_width + 1;
+ text_right -= overlay_width + mImgOverlayLabelSpace;
mImageOverlay->draw(
- getRect().getWidth() - mImageOverlayRightPad - overlay_width,
+ getRect().getWidth() - mRightHPad - overlay_width,
center_y - (overlay_height / 2),
overlay_width,
overlay_height,
diff --git a/indra/llui/llbutton.h b/indra/llui/llbutton.h
index 8e5f19602f..8f35db1007 100644
--- a/indra/llui/llbutton.h
+++ b/indra/llui/llbutton.h
@@ -107,11 +107,14 @@ public:
Optional<S32> pad_bottom; // under text label
//image overlay paddings
- Optional<S32> image_left_pad;
- Optional<S32> image_right_pad;
Optional<S32> image_top_pad;
Optional<S32> image_bottom_pad;
+ /**
+ * Space between image_overlay and label
+ */
+ Optional<S32> imgoverlay_label_space;
+
// callbacks
Optional<CommitCallbackParam> click_callback, // alias -> commit_callback
mouse_down_callback,
@@ -192,10 +195,6 @@ public:
void setLeftHPad( S32 pad ) { mLeftHPad = pad; }
void setRightHPad( S32 pad ) { mRightHPad = pad; }
- void setImageOverlayLeftPad( S32 pad ) { mImageOverlayLeftPad = pad; }
- S32 getImageOverlayLeftPad() const { return mImageOverlayLeftPad; }
- void setImageOverlayRightPad( S32 pad ) { mImageOverlayRightPad = pad; }
- S32 getImageOverlayRightPad() const { return mImageOverlayRightPad; }
void setImageOverlayTopPad( S32 pad ) { mImageOverlayTopPad = pad; }
S32 getImageOverlayTopPad() const { return mImageOverlayTopPad; }
void setImageOverlayBottomPad( S32 pad ) { mImageOverlayBottomPad = pad; }
@@ -328,11 +327,14 @@ private:
S32 mRightHPad;
S32 mBottomVPad; // under text label
- S32 mImageOverlayLeftPad;
- S32 mImageOverlayRightPad;
S32 mImageOverlayTopPad;
S32 mImageOverlayBottomPad;
+ /*
+ * Space between image_overlay and label
+ */
+ S32 mImgOverlayLabelSpace;
+
F32 mHoverGlowStrength;
F32 mCurGlowStrength;
diff --git a/indra/llui/llmultifloater.cpp b/indra/llui/llmultifloater.cpp
index 78738c826d..33d47a3f0e 100644
--- a/indra/llui/llmultifloater.cpp
+++ b/indra/llui/llmultifloater.cpp
@@ -92,14 +92,6 @@ void LLMultiFloater::draw()
}
else
{
- for (S32 i = 0; i < mTabContainer->getTabCount(); i++)
- {
- LLFloater* floaterp = (LLFloater*)mTabContainer->getPanelByIndex(i);
- if (floaterp->getShortTitle() != mTabContainer->getPanelTitle(i))
- {
- mTabContainer->setPanelTitle(i, floaterp->getShortTitle());
- }
- }
LLFloater::draw();
}
}
diff --git a/indra/llui/lltabcontainer.cpp b/indra/llui/lltabcontainer.cpp
index 19408989a5..2ec56d6089 100644
--- a/indra/llui/lltabcontainer.cpp
+++ b/indra/llui/lltabcontainer.cpp
@@ -212,7 +212,8 @@ LLTabContainer::Params::Params()
middle_tab("middle_tab"),
last_tab("last_tab"),
use_custom_icon_ctrl("use_custom_icon_ctrl", false),
- tab_icon_ctrl_pad("tab_icon_ctrl_pad", 0)
+ tab_icon_ctrl_pad("tab_icon_ctrl_pad", 0),
+ use_ellipses("use_ellipses")
{
name(std::string("tab_container"));
mouse_opaque = false;
@@ -249,7 +250,8 @@ LLTabContainer::LLTabContainer(const LLTabContainer::Params& p)
mMiddleTabParams(p.middle_tab),
mLastTabParams(p.last_tab),
mCustomIconCtrlUsed(p.use_custom_icon_ctrl),
- mTabIconCtrlPad(p.tab_icon_ctrl_pad)
+ mTabIconCtrlPad(p.tab_icon_ctrl_pad),
+ mUseTabEllipses(p.use_ellipses)
{
static LLUICachedControl<S32> tabcntr_vert_tab_min_width ("UITabCntrVertTabMinWidth", 0);
@@ -1485,8 +1487,8 @@ BOOL LLTabContainer::setTab(S32 which)
{
LLTabTuple* tuple = *iter;
BOOL is_selected = ( tuple == selected_tuple );
- tuple->mButton->setUseEllipses(TRUE);
- tuple->mButton->setHAlign(LLFontGL::LEFT);
+ tuple->mButton->setUseEllipses(mUseTabEllipses);
+ tuple->mButton->setHAlign(mFontHalign);
tuple->mTabPanel->setVisible( is_selected );
// tuple->mTabPanel->setFocus(is_selected); // not clear that we want to do this here.
tuple->mButton->setToggleState( is_selected );
@@ -1628,15 +1630,11 @@ void LLTabContainer::setTabImage(LLPanel* child, LLIconCtrl* icon)
void LLTabContainer::reshapeTuple(LLTabTuple* tuple)
{
static LLUICachedControl<S32> tab_padding ("UITabPadding", 0);
- static LLUICachedControl<S32> image_left_padding ("UIButtonImageLeftPadding", 4);
- static LLUICachedControl<S32> image_right_padding ("UIButtonImageRightPadding", 4);
static LLUICachedControl<S32> image_top_padding ("UIButtonImageTopPadding", 2);
static LLUICachedControl<S32> image_bottom_padding ("UIButtonImageBottomPadding", 2);
if (!mIsVertical)
{
- tuple->mButton->setImageOverlayLeftPad(image_left_padding);
- tuple->mButton->setImageOverlayRightPad(image_right_padding);
tuple->mButton->setImageOverlayTopPad(image_top_padding);
tuple->mButton->setImageOverlayBottomPad(image_bottom_padding);
diff --git a/indra/llui/lltabcontainer.h b/indra/llui/lltabcontainer.h
index 4b5d45fb73..50ec2679f6 100644
--- a/indra/llui/lltabcontainer.h
+++ b/indra/llui/lltabcontainer.h
@@ -93,6 +93,16 @@ public:
last_tab;
/**
+ * Tab label horizontal alignment
+ */
+ Optional<LLFontGL::HAlign> font_halign;
+
+ /**
+ * Tab label ellipses
+ */
+ Optional<bool> use_ellipses;
+
+ /**
* Use LLCustomButtonIconCtrl or LLButton in LLTabTuple
*/
Optional<bool> use_custom_icon_ctrl;
@@ -294,6 +304,7 @@ private:
bool mCustomIconCtrlUsed;
S32 mTabIconCtrlPad;
+ bool mUseTabEllipses;
};
#endif // LL_TABCONTAINER_H
diff --git a/indra/llui/lltextbase.cpp b/indra/llui/lltextbase.cpp
index a83cc19d36..b84e6f45fb 100644
--- a/indra/llui/lltextbase.cpp
+++ b/indra/llui/lltextbase.cpp
@@ -1575,8 +1575,10 @@ void LLTextBase::appendText(const std::string &new_text, bool prepend_newline, c
{
LLStyle::Params icon;
icon.image = image;
- // HACK: fix spacing of images and remove the fixed char spacing
- appendAndHighlightText(" ", prepend_newline, part, icon);
+ // Text will be replaced during rendering with the icon,
+ // but string cannot be empty or the segment won't be
+ // added (or drawn).
+ appendAndHighlightText(" ", prepend_newline, part, icon);
prepend_newline = false;
}
}
@@ -2297,14 +2299,21 @@ F32 LLNormalTextSegment::draw(S32 start, S32 end, S32 selection_start, S32 selec
{
if ( mStyle->isImage() && (start >= 0) && (end <= mEnd - mStart))
{
+ // ...for images, only render the image, not the underlying text,
+ // which is only a placeholder space
LLColor4 color = LLColor4::white % mEditor.getDrawContext().mAlpha;
LLUIImagePtr image = mStyle->getImage();
S32 style_image_height = image->getHeight();
S32 style_image_width = image->getWidth();
- // Center the image vertically
- S32 image_bottom = draw_rect.getCenterY() - (style_image_height/2);
+ // Text is drawn from the top of the draw_rect downward
+ S32 text_center = draw_rect.mTop - (mFontHeight / 2);
+ // Align image to center of text
+ S32 image_bottom = text_center - (style_image_height / 2);
image->draw(draw_rect.mLeft, image_bottom,
style_image_width, style_image_height, color);
+
+ const S32 IMAGE_HPAD = 3;
+ return draw_rect.mLeft + style_image_width + IMAGE_HPAD;
}
return drawClippedSegment( getStart() + start, getStart() + end, selection_start, selection_end, draw_rect);