From 93c1e1bd6eaa8f77e746b1346b1729ed564081b4 Mon Sep 17 00:00:00 2001 From: Sergei Litovchuk Date: Sat, 14 Nov 2009 19:15:51 +0200 Subject: No ticket. - Fixed toggleable menu in Picks panel. - Minor optimization of LLToggleableMenu. --HG-- branch : product-engine --- indra/llui/lltoggleablemenu.cpp | 9 ++++++++- indra/llui/lltoggleablemenu.h | 3 +++ 2 files changed, 11 insertions(+), 1 deletion(-) (limited to 'indra/llui') diff --git a/indra/llui/lltoggleablemenu.cpp b/indra/llui/lltoggleablemenu.cpp index 717e135412..5df1d35383 100644 --- a/indra/llui/lltoggleablemenu.cpp +++ b/indra/llui/lltoggleablemenu.cpp @@ -40,6 +40,7 @@ static LLDefaultChildRegistry::Register r("toggleable_menu"); LLToggleableMenu::LLToggleableMenu(const LLToggleableMenu::Params& p) : LLMenuGL(p), + mButtonRect(), mClosedByButtonClick(false) { } @@ -56,13 +57,19 @@ void LLToggleableMenu::handleVisibilityChange (BOOL curVisibilityIn) } } -void LLToggleableMenu::setButtonRect(const LLRect& rect, LLView* current_view) +void LLToggleableMenu::setButtonRect(const LLRect& rect, LLView* current_view) { LLRect screen; current_view->localRectToScreen(rect, &screen); mButtonRect = screen; } +void LLToggleableMenu::setButtonRect(LLView* current_view) +{ + LLRect rect = current_view->getLocalRect(); + setButtonRect(rect, current_view); +} + bool LLToggleableMenu::toggleVisibility() { if (mClosedByButtonClick) diff --git a/indra/llui/lltoggleablemenu.h b/indra/llui/lltoggleablemenu.h index 3cd66e04a8..9d8c5261b9 100644 --- a/indra/llui/lltoggleablemenu.h +++ b/indra/llui/lltoggleablemenu.h @@ -49,8 +49,11 @@ protected: public: virtual void handleVisibilityChange (BOOL curVisibilityIn); + const LLRect& getButtonRect() const { return mButtonRect; } + // Converts the given local button rect to a screen rect void setButtonRect(const LLRect& rect, LLView* current_view); + void setButtonRect(LLView* current_view); // Returns "true" if menu was not closed by button click // and is not still visible. If menu is visible toggles -- cgit v1.2.3 From e7519e8a977138627b429ca43a10184c82efc66e Mon Sep 17 00:00:00 2001 From: Alexei Arabadji Date: Mon, 16 Nov 2009 11:41:21 +0200 Subject: fixed EXT-2402 "Clicking on notification item in the Message Well should bring it to front" made LLToast and LLDockableFloater goes foreground on setVisible(TRUE); --HG-- branch : product-engine --- indra/llui/lldockablefloater.cpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'indra/llui') diff --git a/indra/llui/lldockablefloater.cpp b/indra/llui/lldockablefloater.cpp index f56cb2eee7..c3dd4ae647 100644 --- a/indra/llui/lldockablefloater.cpp +++ b/indra/llui/lldockablefloater.cpp @@ -127,6 +127,10 @@ void LLDockableFloater::setVisible(BOOL visible) mDockControl.get()->repositionDockable(); } + if (visible) + { + LLFloater::setFrontmost(TRUE); + } LLFloater::setVisible(visible); } -- cgit v1.2.3 From 1baf1d218644ac5dc00d9b41119a1ef168c709a2 Mon Sep 17 00:00:00 2001 From: angela Date: Mon, 16 Nov 2009 20:46:40 +0800 Subject: fix chat format for /me --- indra/llui/llstyle.cpp | 29 +++++++++++++++++++++++++++-- indra/llui/llstyle.h | 5 +++++ indra/llui/lltextbase.cpp | 11 +++++------ 3 files changed, 37 insertions(+), 8 deletions(-) (limited to 'indra/llui') diff --git a/indra/llui/llstyle.cpp b/indra/llui/llstyle.cpp index 71511f69a4..92c0b7c1b4 100644 --- a/indra/llui/llstyle.cpp +++ b/indra/llui/llstyle.cpp @@ -44,7 +44,10 @@ LLStyle::Params::Params() color("color", LLColor4::black), font("font", LLFontGL::getFontMonospace()), image("image"), - link_href("href") + link_href("href"), + italic("italic", false ), + bold("bold", false), + underline("bold", false) {} @@ -55,7 +58,10 @@ LLStyle::LLStyle(const LLStyle::Params& p) mFont(p.font()), mLink(p.link_href), mDropShadow(p.drop_shadow), - mImagep(p.image()) + mImagep(p.image()), + mItalic(p.italic()), + mBold(p.bold), + mUnderline(p.underline) {} void LLStyle::setFont(const LLFontGL* font) @@ -69,6 +75,25 @@ const LLFontGL* LLStyle::getFont() const return mFont; } +const S32 LLStyle::getFontStyle() const +{ + S32 ret = 0; + if (mBold) + { + ret |= LLFontGL::BOLD; + } + if (mItalic) + { + ret |= LLFontGL::ITALIC; + } + if (mUnderline) + { + ret |= LLFontGL::UNDERLINE; + } + return ret; +} + + void LLStyle::setLinkHREF(const std::string& href) { mLink = href; diff --git a/indra/llui/llstyle.h b/indra/llui/llstyle.h index ee9ca730e9..cc72011903 100644 --- a/indra/llui/llstyle.h +++ b/indra/llui/llstyle.h @@ -51,12 +51,17 @@ public: Optional font; Optional image; Optional link_href; + Optional italic; + Optional bold; + Optional underline; Params(); }; LLStyle(const Params& p = Params()); public: const LLColor4& getColor() const { return mColor; } void setColor(const LLColor4 &color) { mColor = color; } + + const S32 getFontStyle() const; const LLColor4& getReadOnlyColor() const { return mReadOnlyColor; } diff --git a/indra/llui/lltextbase.cpp b/indra/llui/lltextbase.cpp index 7b1aaac35c..d7697ac7cc 100644 --- a/indra/llui/lltextbase.cpp +++ b/indra/llui/lltextbase.cpp @@ -1506,9 +1506,8 @@ void LLTextBase::appendText(const std::string &new_text, bool prepend_newline, c LLStyle::Params link_params = style_params; link_params.color = match.getColor(); // apply font name from requested style_params - std::string font_name = LLFontGL::nameFromFont(style_params.font()); - link_params.font.name.setIfNotProvided(font_name); - link_params.font.style = "UNDERLINE"; + std::string font_name = LLFontGL::nameFromFont(style_params.font()); + link_params.underline = true; link_params.link_href = match.getUrl(); // output the text before the Url @@ -2251,7 +2250,7 @@ F32 LLNormalTextSegment::drawClippedSegment(S32 seg_start, S32 seg_end, S32 sele rect.mLeft, rect.mTop, color, LLFontGL::LEFT, LLFontGL::TOP, - 0, + mStyle->getFontStyle(), mStyle->getShadowType(), length, rect.getWidth(), &right_x, @@ -2270,7 +2269,7 @@ F32 LLNormalTextSegment::drawClippedSegment(S32 seg_start, S32 seg_end, S32 sele rect.mLeft, rect.mTop, LLColor4( 1.f - color.mV[0], 1.f - color.mV[1], 1.f - color.mV[2], 1.f ), LLFontGL::LEFT, LLFontGL::TOP, - 0, + mStyle->getFontStyle(), LLFontGL::NO_SHADOW, length, rect.mRight, &right_x, @@ -2287,7 +2286,7 @@ F32 LLNormalTextSegment::drawClippedSegment(S32 seg_start, S32 seg_end, S32 sele rect.mLeft, rect.mTop, color, LLFontGL::LEFT, LLFontGL::TOP, - 0, + mStyle->getFontStyle(), mStyle->getShadowType(), length, rect.mRight, &right_x, -- cgit v1.2.3 From aba8b04cfc6763ee565a5ae9929e8be044272b08 Mon Sep 17 00:00:00 2001 From: Dmitry Oleshko Date: Mon, 16 Nov 2009 18:51:54 +0200 Subject: fix of a normal bug (EXT-2448) [BSI] Notification toasts should resize when text is to long to be displayed A maximum number of characters for textbox/texteditor could be set only through XML. In case when a corresponding attribute was absent - the maximun number was set to 255, and there were no chance (no function) to change it. So in this fix such a function was added. --HG-- branch : product-engine --- indra/llui/lltextbase.h | 1 + 1 file changed, 1 insertion(+) (limited to 'indra/llui') diff --git a/indra/llui/lltextbase.h b/indra/llui/lltextbase.h index 70d78c77cd..c376a73615 100644 --- a/indra/llui/lltextbase.h +++ b/indra/llui/lltextbase.h @@ -139,6 +139,7 @@ public: // TODO: add optional style parameter virtual void setText(const LLStringExplicit &utf8str , const LLStyle::Params& input_params = LLStyle::Params()); // uses default style virtual std::string getText() const; + void setMaxTextLength(S32 length) { mMaxTextByteLength = length; } // wide-char versions void setWText(const LLWString& text); -- cgit v1.2.3 From d5efbfcd2874dd7045baabe33944da37e738872e Mon Sep 17 00:00:00 2001 From: James Cook Date: Mon, 16 Nov 2009 12:36:35 -0800 Subject: Convert mForcePressedState to bool from BOOL --- indra/llui/llbutton.cpp | 2 +- indra/llui/llbutton.h | 4 ++-- indra/llui/llmenubutton.cpp | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) (limited to 'indra/llui') diff --git a/indra/llui/llbutton.cpp b/indra/llui/llbutton.cpp index bbaf908d2e..b65f248db2 100644 --- a/indra/llui/llbutton.cpp +++ b/indra/llui/llbutton.cpp @@ -146,7 +146,7 @@ LLButton::LLButton(const LLButton::Params& p) mHoverGlowStrength(p.hover_glow_amount), mCommitOnReturn(p.commit_on_return), mFadeWhenDisabled(FALSE), - mForcePressedState(FALSE), + mForcePressedState(false), mLastDrawCharsCount(0) { static LLUICachedControl llbutton_orig_h_pad ("UIButtonOrigHPad", 0); diff --git a/indra/llui/llbutton.h b/indra/llui/llbutton.h index 08f289092f..3c1b57c4be 100644 --- a/indra/llui/llbutton.h +++ b/indra/llui/llbutton.h @@ -238,7 +238,7 @@ public: static void setDockableFloaterToggle(LLUICtrl* ctrl, const LLSD& sdname); static void showHelp(LLUICtrl* ctrl, const LLSD& sdname); - void setForcePressedState(BOOL b) { mForcePressedState = b; } + void setForcePressedState(bool b) { mForcePressedState = b; } protected: LLPointer getImageUnselected() const { return mImageUnselected; } @@ -315,7 +315,7 @@ private: BOOL mNeedsHighlight; BOOL mCommitOnReturn; BOOL mFadeWhenDisabled; - BOOL mForcePressedState; + bool mForcePressedState; LLFrameTimer mFlashingTimer; }; diff --git a/indra/llui/llmenubutton.cpp b/indra/llui/llmenubutton.cpp index a657ed039a..cdbd17e4dc 100644 --- a/indra/llui/llmenubutton.cpp +++ b/indra/llui/llmenubutton.cpp @@ -133,11 +133,11 @@ void LLMenuButton::draw() if (mMenuVisibleLastFrame) { - setForcePressedState(TRUE); + setForcePressedState(true); } LLButton::draw(); - setForcePressedState(FALSE); + setForcePressedState(false); } -- cgit v1.2.3 From 7cc233b3a83bd82f7a42bf1f64901d2578beaf2c Mon Sep 17 00:00:00 2001 From: James Cook Date: Mon, 16 Nov 2009 12:52:25 -0800 Subject: EXT-772 Dropbox widget needs "pressed" state - currently shows wrong art Reviewed with Richard. --- indra/llui/llcombobox.cpp | 19 +++++++++++++++++-- indra/llui/llcombobox.h | 3 ++- 2 files changed, 19 insertions(+), 3 deletions(-) (limited to 'indra/llui') diff --git a/indra/llui/llcombobox.cpp b/indra/llui/llcombobox.cpp index 36e309d639..803978bfa2 100644 --- a/indra/llui/llcombobox.cpp +++ b/indra/llui/llcombobox.cpp @@ -109,7 +109,8 @@ LLComboBox::LLComboBox(const LLComboBox::Params& p) // Text label button LLButton::Params button_params = (mAllowTextEntry ? p.combo_button : p.drop_down_button); - button_params.mouse_down_callback.function(boost::bind(&LLComboBox::onButtonDown, this)); + button_params.mouse_down_callback.function( + boost::bind(&LLComboBox::onButtonMouseDown, this)); button_params.follows.flags(FOLLOWS_LEFT|FOLLOWS_BOTTOM|FOLLOWS_RIGHT); button_params.rect(p.rect); @@ -140,6 +141,10 @@ LLComboBox::LLComboBox(const LLComboBox::Params& p) mList = LLUICtrlFactory::create(params); addChild(mList); + // Mouse-down on button will transfer mouse focus to the list + // Grab the mouse-up event and make sure the button state is correct + mList->setMouseUpCallback(boost::bind(&LLComboBox::onListMouseUp, this)); + for (LLInitParam::ParamIterator::const_iterator it = p.items().begin(); it != p.items().end(); ++it) @@ -644,7 +649,7 @@ void LLComboBox::hideList() } } -void LLComboBox::onButtonDown() +void LLComboBox::onButtonMouseDown() { if (!mList->getVisible()) { @@ -670,6 +675,10 @@ void LLComboBox::onButtonDown() if (mButton->hasMouseCapture()) { gFocusMgr.setMouseCapture(mList); + + // But keep the "pressed" look, which buttons normally lose when they + // lose focus + mButton->setForcePressedState(true); } } else @@ -679,6 +688,12 @@ void LLComboBox::onButtonDown() } +void LLComboBox::onListMouseUp() +{ + // In some cases this is the termination of a mouse click that started on + // the button, so clear its pressed state + mButton->setForcePressedState(false); +} //------------------------------------------------------------------ // static functions diff --git a/indra/llui/llcombobox.h b/indra/llui/llcombobox.h index 6285ca5170..11acdb9b8f 100644 --- a/indra/llui/llcombobox.h +++ b/indra/llui/llcombobox.h @@ -204,7 +204,8 @@ public: void setButtonVisible(BOOL visible); - void onButtonDown(); + void onButtonMouseDown(); + void onListMouseUp(); void onItemSelected(const LLSD& data); void onTextCommit(const LLSD& data); -- cgit v1.2.3 From 028a8af51946cac42e9b3d1a0ecd1b79b36d0383 Mon Sep 17 00:00:00 2001 From: James Cook Date: Mon, 16 Nov 2009 23:33:12 -0800 Subject: Allow UI tooltips and "ambient inspector" tips to have different text colors --- indra/llui/lltooltip.cpp | 3 ++- indra/llui/lltooltip.h | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) (limited to 'indra/llui') diff --git a/indra/llui/lltooltip.cpp b/indra/llui/lltooltip.cpp index bb85177811..959313a5b6 100644 --- a/indra/llui/lltooltip.cpp +++ b/indra/llui/lltooltip.cpp @@ -163,6 +163,7 @@ LLToolTip::Params::Params() visible_time_far("visible_time_far", LLUI::sSettingGroups["config"]->getF32( "ToolTipVisibleTimeFar" )), sticky_rect("sticky_rect"), image("image"), + text_color("text_color"), time_based_media("time_based_media", false), web_based_media("web_based_media", false), media_playing("media_playing", false) @@ -186,7 +187,7 @@ LLToolTip::LLToolTip(const LLToolTip::Params& p) params.h_pad = 0; params.v_pad = 0; params.mouse_opaque = false; - params.text_color = LLUIColorTable::instance().getColor( "ToolTipTextColor" ); + params.text_color = p.text_color; params.bg_visible = false; params.font = p.font; params.use_ellipses = true; diff --git a/indra/llui/lltooltip.h b/indra/llui/lltooltip.h index 8c8fdf0a4c..7978b6a583 100644 --- a/indra/llui/lltooltip.h +++ b/indra/llui/lltooltip.h @@ -88,6 +88,7 @@ public: Optional sticky_rect; Optional font; Optional image; + Optional text_color; Optional time_based_media, web_based_media, media_playing; -- cgit v1.2.3 From 0098bf40ea73078e2164ae55a8fa2f9049d0d4e9 Mon Sep 17 00:00:00 2001 From: angela Date: Tue, 17 Nov 2009 16:33:49 +0800 Subject: undo the changes for LLStyle params; add sizeFromFont in LLFontGL ; use font.style, font.name and font.size params for font creating --- indra/llui/llstyle.cpp | 29 ++--------------------------- indra/llui/llstyle.h | 5 ----- indra/llui/lltextbase.cpp | 14 +++++++++----- 3 files changed, 11 insertions(+), 37 deletions(-) (limited to 'indra/llui') diff --git a/indra/llui/llstyle.cpp b/indra/llui/llstyle.cpp index 92c0b7c1b4..71511f69a4 100644 --- a/indra/llui/llstyle.cpp +++ b/indra/llui/llstyle.cpp @@ -44,10 +44,7 @@ LLStyle::Params::Params() color("color", LLColor4::black), font("font", LLFontGL::getFontMonospace()), image("image"), - link_href("href"), - italic("italic", false ), - bold("bold", false), - underline("bold", false) + link_href("href") {} @@ -58,10 +55,7 @@ LLStyle::LLStyle(const LLStyle::Params& p) mFont(p.font()), mLink(p.link_href), mDropShadow(p.drop_shadow), - mImagep(p.image()), - mItalic(p.italic()), - mBold(p.bold), - mUnderline(p.underline) + mImagep(p.image()) {} void LLStyle::setFont(const LLFontGL* font) @@ -75,25 +69,6 @@ const LLFontGL* LLStyle::getFont() const return mFont; } -const S32 LLStyle::getFontStyle() const -{ - S32 ret = 0; - if (mBold) - { - ret |= LLFontGL::BOLD; - } - if (mItalic) - { - ret |= LLFontGL::ITALIC; - } - if (mUnderline) - { - ret |= LLFontGL::UNDERLINE; - } - return ret; -} - - void LLStyle::setLinkHREF(const std::string& href) { mLink = href; diff --git a/indra/llui/llstyle.h b/indra/llui/llstyle.h index cc72011903..ee9ca730e9 100644 --- a/indra/llui/llstyle.h +++ b/indra/llui/llstyle.h @@ -51,17 +51,12 @@ public: Optional font; Optional image; Optional link_href; - Optional italic; - Optional bold; - Optional underline; Params(); }; LLStyle(const Params& p = Params()); public: const LLColor4& getColor() const { return mColor; } void setColor(const LLColor4 &color) { mColor = color; } - - const S32 getFontStyle() const; const LLColor4& getReadOnlyColor() const { return mReadOnlyColor; } diff --git a/indra/llui/lltextbase.cpp b/indra/llui/lltextbase.cpp index d7697ac7cc..a06b7e237b 100644 --- a/indra/llui/lltextbase.cpp +++ b/indra/llui/lltextbase.cpp @@ -1506,8 +1506,12 @@ void LLTextBase::appendText(const std::string &new_text, bool prepend_newline, c LLStyle::Params link_params = style_params; link_params.color = match.getColor(); // apply font name from requested style_params - std::string font_name = LLFontGL::nameFromFont(style_params.font()); - link_params.underline = true; + std::string font_name = LLFontGL::nameFromFont(style_params.font()); + std::string font_size = LLFontGL::sizeFromFont(style_params.font()); + link_params.font.name(font_name); + link_params.font.size(font_name); + link_params.font.style("UNDERLINE"); + link_params.link_href = match.getUrl(); // output the text before the Url @@ -2250,7 +2254,7 @@ F32 LLNormalTextSegment::drawClippedSegment(S32 seg_start, S32 seg_end, S32 sele rect.mLeft, rect.mTop, color, LLFontGL::LEFT, LLFontGL::TOP, - mStyle->getFontStyle(), + 0, mStyle->getShadowType(), length, rect.getWidth(), &right_x, @@ -2269,7 +2273,7 @@ F32 LLNormalTextSegment::drawClippedSegment(S32 seg_start, S32 seg_end, S32 sele rect.mLeft, rect.mTop, LLColor4( 1.f - color.mV[0], 1.f - color.mV[1], 1.f - color.mV[2], 1.f ), LLFontGL::LEFT, LLFontGL::TOP, - mStyle->getFontStyle(), + 0, LLFontGL::NO_SHADOW, length, rect.mRight, &right_x, @@ -2286,7 +2290,7 @@ F32 LLNormalTextSegment::drawClippedSegment(S32 seg_start, S32 seg_end, S32 sele rect.mLeft, rect.mTop, color, LLFontGL::LEFT, LLFontGL::TOP, - mStyle->getFontStyle(), + 0, mStyle->getShadowType(), length, rect.mRight, &right_x, -- cgit v1.2.3 From a2041387b1c39328aaf0d5037ca039a971a6d79c Mon Sep 17 00:00:00 2001 From: James Cook Date: Tue, 17 Nov 2009 10:02:01 -0800 Subject: Fix broken URL highlighting in local chat, broken in 5068 : ce08ac445035. Typo, not reviewed. --- 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 a06b7e237b..caaf47240f 100644 --- a/indra/llui/lltextbase.cpp +++ b/indra/llui/lltextbase.cpp @@ -1509,7 +1509,7 @@ void LLTextBase::appendText(const std::string &new_text, bool prepend_newline, c std::string font_name = LLFontGL::nameFromFont(style_params.font()); std::string font_size = LLFontGL::sizeFromFont(style_params.font()); link_params.font.name(font_name); - link_params.font.size(font_name); + link_params.font.size(font_size); link_params.font.style("UNDERLINE"); link_params.link_href = match.getUrl(); -- cgit v1.2.3