From 8eba0c4029a58616e82600e4a6b866c0b76096b3 Mon Sep 17 00:00:00 2001 From: Tofu Linden Date: Mon, 8 Feb 2010 13:20:03 +0000 Subject: Add some asserts to catch some null derefs that, at least, the render-pipeline code seems to be hitting. --- indra/llui/llview.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'indra/llui') diff --git a/indra/llui/llview.cpp b/indra/llui/llview.cpp index f1b08c380b..63e627ceb5 100644 --- a/indra/llui/llview.cpp +++ b/indra/llui/llview.cpp @@ -1720,6 +1720,7 @@ LLView* LLView::findChildView(const std::string& name, BOOL recurse) const for ( child_it = mChildList.begin(); child_it != mChildList.end(); ++child_it) { LLView* childp = *child_it; + llassert(childp); if (childp->getName() == name) { return childp; @@ -1731,6 +1732,7 @@ LLView* LLView::findChildView(const std::string& name, BOOL recurse) const for ( child_it = mChildList.begin(); child_it != mChildList.end(); ++child_it) { LLView* childp = *child_it; + llassert(childp); LLView* viewp = childp->findChildView(name, recurse); if ( viewp ) { -- cgit v1.2.3 From 92ac9932878b4cd0b0369746482c6e1f47d76994 Mon Sep 17 00:00:00 2001 From: James Cook Date: Thu, 4 Feb 2010 22:19:15 -0800 Subject: Fix placement of icon next to linked agent/group names. Suppresses rendering of text in LLNormalTextSegment that represent an icon, properly computes vertical spacing based on font height, and adds padding to the right of the icon. (transplanted from 33be702e47c359ccaeb47f251e10753fd173cc09) --- indra/llui/lltextbase.cpp | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) (limited to 'indra/llui') diff --git a/indra/llui/lltextbase.cpp b/indra/llui/lltextbase.cpp index a83cc19d36..99c3179884 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 = 2; + return draw_rect.mLeft + style_image_width + IMAGE_HPAD; } return drawClippedSegment( getStart() + start, getStart() + end, selection_start, selection_end, draw_rect); -- cgit v1.2.3 From a4d224ff9316bf3b99e17f72f844d91e0ef80cc7 Mon Sep 17 00:00:00 2001 From: Tofu Linden Date: Sat, 6 Feb 2010 21:38:57 +0000 Subject: EXT-5055 LLInstanceTracker promotes some dangerous patterns - detect them --- indra/llui/lllayoutstack.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'indra/llui') diff --git a/indra/llui/lllayoutstack.cpp b/indra/llui/lllayoutstack.cpp index 1aaba88c49..dc79550eb4 100644 --- a/indra/llui/lllayoutstack.cpp +++ b/indra/llui/lllayoutstack.cpp @@ -816,7 +816,10 @@ void LLLayoutStack::calcMinExtents() //static void LLLayoutStack::updateClass() { - for (LLLayoutStack::instance_iter it = beginInstances(); it != endInstances(); ++it) + LLInstanceTrackerScopedGuard guard; + for (LLLayoutStack::instance_iter it = guard.beginInstances(); + it != guard.endInstances(); + ++it) { it->updateLayout(); } -- cgit v1.2.3 From 93bd065356a0502fcf05bd3936c35e4d688e5756 Mon Sep 17 00:00:00 2001 From: Paul Guslisty Date: Mon, 8 Feb 2010 15:21:24 +0200 Subject: Fixed normal bug EXT - 3835 ([BSI] tabs in instant message floater should never change sizes) --HG-- branch : product-engine --- indra/llui/llmultifloater.cpp | 8 -------- 1 file changed, 8 deletions(-) (limited to 'indra/llui') 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(); } } -- cgit v1.2.3 From 7199c9cc1bbd17eecea33b77a97a5ad7b20d2888 Mon Sep 17 00:00:00 2001 From: Paul Guslisty Date: Mon, 8 Feb 2010 18:05:48 +0200 Subject: EXT-3232 Refactoring: Improved the way of horizontal alignment of button's image overlay. Now mLeftHPad/mRightHPad is used instead of mImageOverlayLeftPad and mImageOverlayRightPad. Also mImgOverlayLabelSpace/imgoverlay_label_space members was added to button.(h/xml) to define space between image overlay and button's label --HG-- branch : product-engine --- indra/llui/llbutton.cpp | 10 ++++++---- indra/llui/llbutton.h | 10 ++++++++++ 2 files changed, 16 insertions(+), 4 deletions(-) (limited to 'indra/llui') diff --git a/indra/llui/llbutton.cpp b/indra/llui/llbutton.cpp index 14b77925f2..a4a8cc4e17 100644 --- a/indra/llui/llbutton.cpp +++ b/indra/llui/llbutton.cpp @@ -85,6 +85,7 @@ LLButton::Params::Params() 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"), @@ -148,6 +149,7 @@ LLButton::LLButton(const LLButton::Params& p) 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 +785,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 +802,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..3fbc5c6785 100644 --- a/indra/llui/llbutton.h +++ b/indra/llui/llbutton.h @@ -112,6 +112,11 @@ public: Optional image_top_pad; Optional image_bottom_pad; + /** + * Space between image_overlay and label + */ + Optional imgoverlay_label_space; + // callbacks Optional click_callback, // alias -> commit_callback mouse_down_callback, @@ -333,6 +338,11 @@ private: S32 mImageOverlayTopPad; S32 mImageOverlayBottomPad; + /* + * Space between image_overlay and label + */ + S32 mImgOverlayLabelSpace; + F32 mHoverGlowStrength; F32 mCurGlowStrength; -- cgit v1.2.3 From acc0a2962bc645335f19bb5e6142690ea99df449 Mon Sep 17 00:00:00 2001 From: Paul Guslisty Date: Mon, 8 Feb 2010 19:09:23 +0200 Subject: EXT - 3232 Refactoring: deleted unnecessary image_left_padding, image_right_padding members from button.h and button.xml and their the only place usage in LLTabContainer::reshapeTuple . Now image overlay placement adjustible via: mLeftHPad, mRightHPad, mImageOverlayBottomPad, mImageOverlayTopPad, mImgOverlayLabelSpace --HG-- branch : product-engine --- indra/llui/llbutton.cpp | 4 ---- indra/llui/llbutton.h | 8 -------- indra/llui/lltabcontainer.cpp | 4 ---- 3 files changed, 16 deletions(-) (limited to 'indra/llui') diff --git a/indra/llui/llbutton.cpp b/indra/llui/llbutton.cpp index a4a8cc4e17..1d4dc35cee 100644 --- a/indra/llui/llbutton.cpp +++ b/indra/llui/llbutton.cpp @@ -81,8 +81,6 @@ 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), @@ -145,8 +143,6 @@ 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), diff --git a/indra/llui/llbutton.h b/indra/llui/llbutton.h index 3fbc5c6785..8f35db1007 100644 --- a/indra/llui/llbutton.h +++ b/indra/llui/llbutton.h @@ -107,8 +107,6 @@ public: Optional pad_bottom; // under text label //image overlay paddings - Optional image_left_pad; - Optional image_right_pad; Optional image_top_pad; Optional image_bottom_pad; @@ -197,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; } @@ -333,8 +327,6 @@ private: S32 mRightHPad; S32 mBottomVPad; // under text label - S32 mImageOverlayLeftPad; - S32 mImageOverlayRightPad; S32 mImageOverlayTopPad; S32 mImageOverlayBottomPad; diff --git a/indra/llui/lltabcontainer.cpp b/indra/llui/lltabcontainer.cpp index 19408989a5..ef9d195a19 100644 --- a/indra/llui/lltabcontainer.cpp +++ b/indra/llui/lltabcontainer.cpp @@ -1628,15 +1628,11 @@ void LLTabContainer::setTabImage(LLPanel* child, LLIconCtrl* icon) void LLTabContainer::reshapeTuple(LLTabTuple* tuple) { static LLUICachedControl tab_padding ("UITabPadding", 0); - static LLUICachedControl image_left_padding ("UIButtonImageLeftPadding", 4); - static LLUICachedControl image_right_padding ("UIButtonImageRightPadding", 4); static LLUICachedControl image_top_padding ("UIButtonImageTopPadding", 2); static LLUICachedControl 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); -- cgit v1.2.3 From e0f6dc33ab2d683e5b74333989ab77baade5ac85 Mon Sep 17 00:00:00 2001 From: James Cook Date: Mon, 8 Feb 2010 09:11:27 -0800 Subject: Tweak avatar name icon padding --- indra/llui/lltextbase.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/llui') diff --git a/indra/llui/lltextbase.cpp b/indra/llui/lltextbase.cpp index 99c3179884..b84e6f45fb 100644 --- a/indra/llui/lltextbase.cpp +++ b/indra/llui/lltextbase.cpp @@ -2312,7 +2312,7 @@ F32 LLNormalTextSegment::draw(S32 start, S32 end, S32 selection_start, S32 selec image->draw(draw_rect.mLeft, image_bottom, style_image_width, style_image_height, color); - const S32 IMAGE_HPAD = 2; + const S32 IMAGE_HPAD = 3; return draw_rect.mLeft + style_image_width + IMAGE_HPAD; } -- cgit v1.2.3 From e7889301723e23b94813464a4519ee6a7751f413 Mon Sep 17 00:00:00 2001 From: Paul Guslisty Date: Tue, 9 Feb 2010 10:06:52 +0200 Subject: Fixed normal bug EXT - 4878 (Tab labels are no longer obeying halign attribute) --HG-- branch : product-engine --- indra/llui/lltabcontainer.cpp | 10 ++++++---- indra/llui/lltabcontainer.h | 11 +++++++++++ 2 files changed, 17 insertions(+), 4 deletions(-) (limited to 'indra/llui') diff --git a/indra/llui/lltabcontainer.cpp b/indra/llui/lltabcontainer.cpp index ef9d195a19..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 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 ); 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 @@ -92,6 +92,16 @@ public: middle_tab, last_tab; + /** + * Tab label horizontal alignment + */ + Optional font_halign; + + /** + * Tab label ellipses + */ + Optional use_ellipses; + /** * Use LLCustomButtonIconCtrl or LLButton in LLTabTuple */ @@ -294,6 +304,7 @@ private: bool mCustomIconCtrlUsed; S32 mTabIconCtrlPad; + bool mUseTabEllipses; }; #endif // LL_TABCONTAINER_H -- cgit v1.2.3