From f112356d77ab0dd6e47446adf0513975bc4f38a7 Mon Sep 17 00:00:00 2001 From: richard Date: Tue, 10 Nov 2009 14:01:55 -0800 Subject: added filenames to xui names output when using filename="" in XUI reviewed by Richard --- indra/llui/llpanel.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'indra/llui') diff --git a/indra/llui/llpanel.cpp b/indra/llui/llpanel.cpp index 07c0f3ce84..89c4656297 100644 --- a/indra/llui/llpanel.cpp +++ b/indra/llui/llpanel.cpp @@ -512,6 +512,8 @@ BOOL LLPanel::initPanelXML(LLXMLNodePtr node, LLView *parent, LLXMLNodePtr outpu // add children using dimensions from referenced xml for consistent layout setShape(params.rect); LLUICtrlFactory::createChildren(this, referenced_xml, child_registry_t::instance()); + + setXMLFilename(xml_filename); } // ask LLUICtrlFactory for filename, since xml_filename might be empty -- cgit v1.2.3 From 8523d2d5b641cb5b0e4557237700065bd24daf83 Mon Sep 17 00:00:00 2001 From: Yuri Chebotarev Date: Wed, 11 Nov 2009 17:05:36 +0200 Subject: fix for normal bug EXT-2303 Distinguish Object-generated Nearby Chat from other Nearby Chat --HG-- branch : product-engine --- indra/llui/lltextbase.cpp | 6 ++++++ indra/llui/lltextbase.h | 2 ++ 2 files changed, 8 insertions(+) (limited to 'indra/llui') diff --git a/indra/llui/lltextbase.cpp b/indra/llui/lltextbase.cpp index 97ba691341..69b45af3e7 100644 --- a/indra/llui/lltextbase.cpp +++ b/indra/llui/lltextbase.cpp @@ -995,6 +995,12 @@ void LLTextBase::setColor( const LLColor4& c ) mFgColor = c; } +//virtual +void LLTextBase::setReadOnlyColor(const LLColor4 &c) +{ + mReadOnlyFgColor = c; +} + //virtual void LLTextBase::setValue(const LLSD& value ) { diff --git a/indra/llui/lltextbase.h b/indra/llui/lltextbase.h index 8cae8fde22..fb01cd1e7c 100644 --- a/indra/llui/lltextbase.h +++ b/indra/llui/lltextbase.h @@ -118,6 +118,8 @@ public: // LLUICtrl interface /*virtual*/ BOOL acceptsTextInput() const { return !mReadOnly; } /*virtual*/ void setColor( const LLColor4& c ); + virtual void setReadOnlyColor(const LLColor4 &c); + /*virtual*/ void setValue(const LLSD& value ); /*virtual*/ LLTextViewModel* getViewModel() const; -- cgit v1.2.3 From 3176622afead3a962f1a81a12e747fec0686a210 Mon Sep 17 00:00:00 2001 From: Alexei Arabadji Date: Wed, 11 Nov 2009 17:45:14 +0200 Subject: fixed EXT-2353 "IM window should auto-undock when dragged" made all dockable floaters undock on dragging; --HG-- branch : product-engine --- indra/llui/lldockcontrol.cpp | 2 -- 1 file changed, 2 deletions(-) (limited to 'indra/llui') diff --git a/indra/llui/lldockcontrol.cpp b/indra/llui/lldockcontrol.cpp index 35a854267a..045505af5b 100644 --- a/indra/llui/lldockcontrol.cpp +++ b/indra/llui/lldockcontrol.cpp @@ -256,7 +256,6 @@ void LLDockControl::on() { if (isDockVisible()) { - mDockableFloater->setCanDrag(false); mEnabled = true; mRecalculateDocablePosition = true; } @@ -264,7 +263,6 @@ void LLDockControl::on() void LLDockControl::off() { - mDockableFloater->setCanDrag(true); mEnabled = false; } -- cgit v1.2.3 From fedf86c216a36e46fcdec571399d44e6f5cbc836 Mon Sep 17 00:00:00 2001 From: richard Date: Wed, 11 Nov 2009 12:01:57 -0800 Subject: fix wrapping of text segment containing multiple newlines and ending on a newline reviewed by leyla --- indra/llui/lltextbase.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'indra/llui') diff --git a/indra/llui/lltextbase.cpp b/indra/llui/lltextbase.cpp index 97ba691341..1a903d31f1 100644 --- a/indra/llui/lltextbase.cpp +++ b/indra/llui/lltextbase.cpp @@ -2370,7 +2370,9 @@ bool LLNormalTextSegment::getDimensions(S32 first_char, S32 num_chars, S32& widt height = mFontHeight; width = mStyle->getFont()->getWidth(text.c_str(), mStart + first_char, num_chars); - return num_chars >= 1 && text[mStart + num_chars - 1] == '\n'; + // if last character is a newline, then return true, forcing line break + llwchar last_char = text[mStart + first_char + num_chars - 1]; + return num_chars >= 1 && last_char == '\n'; } S32 LLNormalTextSegment::getOffset(S32 segment_local_x_coord, S32 start_offset, S32 num_chars, bool round) const -- cgit v1.2.3 From 0a095bdaed81f4df90bceac3373fa3481787e7fb Mon Sep 17 00:00:00 2001 From: richard Date: Wed, 11 Nov 2009 12:19:54 -0800 Subject: added stylized text to tooltips for showxuinames --- indra/llui/lltooltip.cpp | 32 +++++++++++++++++++++----------- indra/llui/lltooltip.h | 18 +++++++++++++----- 2 files changed, 34 insertions(+), 16 deletions(-) (limited to 'indra/llui') diff --git a/indra/llui/lltooltip.cpp b/indra/llui/lltooltip.cpp index fe1c2ba67c..376bef1434 100644 --- a/indra/llui/lltooltip.cpp +++ b/indra/llui/lltooltip.cpp @@ -168,7 +168,6 @@ LLToolTip::Params::Params() LLToolTip::LLToolTip(const LLToolTip::Params& p) : LLPanel(p), - mMaxWidth(p.max_width), mHasClickCallback(p.click_callback.isProvided()), mPadding(p.padding), mTextBox(NULL), @@ -177,11 +176,9 @@ LLToolTip::LLToolTip(const LLToolTip::Params& p) mHomePageButton(NULL) { LLTextBox::Params params; - params.initial_value = "tip_text"; params.name = params.initial_value().asString(); // bake textbox padding into initial rect params.rect = LLRect (mPadding, mPadding + 1, mPadding + 1, mPadding); - params.follows.flags = FOLLOWS_ALL; params.h_pad = 0; params.v_pad = 0; params.mouse_opaque = false; @@ -206,7 +203,6 @@ LLToolTip::LLToolTip(const LLToolTip::Params& p) TOOLTIP_ICON_SIZE = (imagep ? imagep->getWidth() : 16); icon_rect.setOriginAndSize(mPadding, mPadding, TOOLTIP_ICON_SIZE, TOOLTIP_ICON_SIZE); icon_params.rect = icon_rect; - //icon_params.follows.flags = FOLLOWS_LEFT | FOLLOWS_BOTTOM; icon_params.image_unselected(imagep); icon_params.image_selected(imagep); @@ -277,15 +273,30 @@ LLToolTip::LLToolTip(const LLToolTip::Params& p) } } -void LLToolTip::setValue(const LLSD& value) +void LLToolTip::initFromParams(const LLToolTip::Params& p) { + LLPanel::initFromParams(p); + + // do this *after* we've had our size set in LLPanel::initFromParams(); const S32 REALLY_LARGE_HEIGHT = 10000; - reshape(mMaxWidth, REALLY_LARGE_HEIGHT); + mTextBox->reshape(p.max_width, REALLY_LARGE_HEIGHT); - mTextBox->setValue(value); + if (p.styled_message.isProvided()) + { + for (LLInitParam::ParamIterator::const_iterator text_it = p.styled_message().begin(); + text_it != p.styled_message().end(); + ++text_it) + { + mTextBox->appendText(text_it->text(), false, text_it->style); + } + } + else + { + mTextBox->setText(p.message()); + } LLRect text_contents_rect = mTextBox->getContentsRect(); - S32 text_width = llmin(mMaxWidth, text_contents_rect.getWidth()); + S32 text_width = llmin(p.max_width(), text_contents_rect.getWidth()); S32 text_height = text_contents_rect.getHeight(); mTextBox->reshape(text_width, text_height); @@ -296,7 +307,7 @@ void LLToolTip::setValue(const LLSD& value) tooltip_rect.mBottom = 0; tooltip_rect.mLeft = 0; - setRect(tooltip_rect); + setShape(tooltip_rect); } void LLToolTip::setVisible(BOOL visible) @@ -407,9 +418,8 @@ void LLToolTipMgr::createToolTip(const LLToolTip::Params& params) } tooltip_params.rect = LLRect (0, 1, 1, 0); - mToolTip = LLUICtrlFactory::create (tooltip_params); - mToolTip->setValue(params.message()); + gToolTipView->addChild(mToolTip); if (params.pos.isProvided()) diff --git a/indra/llui/lltooltip.h b/indra/llui/lltooltip.h index 30d251266c..6e9cb8b434 100644 --- a/indra/llui/lltooltip.h +++ b/indra/llui/lltooltip.h @@ -37,6 +37,7 @@ #include "llsingleton.h" #include "llinitparam.h" #include "llpanel.h" +#include "llstyle.h" // // Classes @@ -65,11 +66,19 @@ public: class LLToolTip : public LLPanel { public: + + struct StyledText : public LLInitParam::Block + { + Mandatory text; + Optional style; + }; + struct Params : public LLInitParam::Block { typedef boost::function click_callback_t; - Mandatory message; + Optional message; + Multiple styled_message; Optional pos; Optional delay_time, @@ -85,8 +94,8 @@ public: Optional click_callback, click_playmedia_callback, click_homepage_callback; - Optional max_width; - Optional padding; + Optional max_width, + padding; Optional wrap; Params(); @@ -94,7 +103,6 @@ public: /*virtual*/ void draw(); /*virtual*/ BOOL handleHover(S32 x, S32 y, MASK mask); /*virtual*/ void onMouseLeave(S32 x, S32 y, MASK mask); - /*virtual*/ void setValue(const LLSD& value); /*virtual*/ void setVisible(BOOL visible); bool isFading(); @@ -102,6 +110,7 @@ public: bool hasClickCallback(); LLToolTip(const Params& p); + void initFromParams(const LLToolTip::Params& params); private: class LLTextBox* mTextBox; @@ -111,7 +120,6 @@ private: LLFrameTimer mFadeTimer; LLFrameTimer mVisibleTimer; - S32 mMaxWidth; bool mHasClickCallback; S32 mPadding; // pixels }; -- cgit v1.2.3 From d023672e597770671720f8b68f7799b662f82175 Mon Sep 17 00:00:00 2001 From: Rick Pasetto Date: Wed, 11 Nov 2009 15:08:00 -0800 Subject: Add ToolTip functionality to LLScrollListCell This change enables a user to set a custom tool tip on a particular scroll list cell by calling setToolTip(). Then, this tool tip is used. If this is not done, the existing tooltip functionality is left alone. Reviewed by Richard --- indra/llui/llscrolllistcell.cpp | 21 ++++++++++++++++++--- indra/llui/llscrolllistcell.h | 9 ++++++++- indra/llui/llscrolllistctrl.cpp | 2 +- 3 files changed, 27 insertions(+), 5 deletions(-) (limited to 'indra/llui') diff --git a/indra/llui/llscrolllistcell.cpp b/indra/llui/llscrolllistcell.cpp index a7c268758a..9f169ac777 100644 --- a/indra/llui/llscrolllistcell.cpp +++ b/indra/llui/llscrolllistcell.cpp @@ -71,7 +71,7 @@ LLScrollListCell* LLScrollListCell::create(const LLScrollListCell::Params& cell_ LLScrollListCell::LLScrollListCell(const LLScrollListCell::Params& p) -: mWidth(p.width) +: mWidth(p.width), mToolTip(p.tool_tip) {} // virtual @@ -204,13 +204,28 @@ BOOL LLScrollListText::isText() const return TRUE; } +// virtual +const std::string &LLScrollListText::getToolTip() const +{ + // If base class has a tooltip, return that + if (! LLScrollListCell::getToolTip().empty()) + return LLScrollListCell::getToolTip(); + + // ...otherwise, return the value itself as the tooltip + return mText.getString(); +} + +// virtual BOOL LLScrollListText::needsToolTip() const { - // show tooltips for truncated text + // If base class has a tooltip, return that + if (LLScrollListCell::needsToolTip()) + return LLScrollListCell::needsToolTip(); + + // ...otherwise, show tooltips for truncated text return mFont->getWidth(mText.getString()) > getWidth(); } - //virtual BOOL LLScrollListText::getVisible() const { diff --git a/indra/llui/llscrolllistcell.h b/indra/llui/llscrolllistcell.h index 758623f121..cff8434b32 100644 --- a/indra/llui/llscrolllistcell.h +++ b/indra/llui/llscrolllistcell.h @@ -66,6 +66,7 @@ public: Optional userdata; Optional value; + Optional tool_tip; Optional font; Optional font_color; @@ -80,6 +81,7 @@ public: enabled("enabled", true), visible("visible", true), value("value"), + tool_tip("tool_tip", ""), font("font", LLFontGL::getFontSansSerifSmall()), font_color("font_color", LLColor4::black), color("color", LLColor4::white), @@ -87,6 +89,7 @@ public: { addSynonym(column, "name"); addSynonym(font_color, "font-color"); + addSynonym(tool_tip, "tooltip"); } }; @@ -101,11 +104,13 @@ public: virtual S32 getHeight() const { return 0; } virtual const LLSD getValue() const; virtual void setValue(const LLSD& value) { } + virtual const std::string &getToolTip() const { return mToolTip; } + virtual void setToolTip(const std::string &str) { mToolTip = str; } virtual BOOL getVisible() const { return TRUE; } virtual void setWidth(S32 width) { mWidth = width; } virtual void highlightText(S32 offset, S32 num_chars) {} virtual BOOL isText() const { return FALSE; } - virtual BOOL needsToolTip() const { return FALSE; } + virtual BOOL needsToolTip() const { return ! mToolTip.empty(); } virtual void setColor(const LLColor4&) {} virtual void onCommit() {}; @@ -114,6 +119,7 @@ public: private: S32 mWidth; + std::string mToolTip; }; class LLScrollListSpacer : public LLScrollListCell @@ -143,6 +149,7 @@ public: /*virtual*/ void setColor(const LLColor4&); /*virtual*/ BOOL isText() const; + /*virtual*/ const std::string & getToolTip() const; /*virtual*/ BOOL needsToolTip() const; void setText(const LLStringExplicit& text); diff --git a/indra/llui/llscrolllistctrl.cpp b/indra/llui/llscrolllistctrl.cpp index 1c2c02e1cc..a53a30b501 100644 --- a/indra/llui/llscrolllistctrl.cpp +++ b/indra/llui/llscrolllistctrl.cpp @@ -1565,7 +1565,7 @@ BOOL LLScrollListCtrl::handleToolTip(S32 x, S32 y, MASK mask) // display tooltip exactly over original cell, in same font LLToolTipMgr::instance().show(LLToolTip::Params() - .message(hit_cell->getValue().asString()) + .message(hit_cell->getToolTip()) .font(LLFontGL::getFontSansSerifSmall()) .pos(LLCoordGL(sticky_rect.mLeft - 5, sticky_rect.mTop + 6)) .delay_time(0.2f) -- cgit v1.2.3 From e3356c069557a91fc0a2c24875db23eaf64358da Mon Sep 17 00:00:00 2001 From: Rick Pasetto Date: Wed, 11 Nov 2009 16:07:02 -0800 Subject: some minor changes based on Richard's code review Code Collab #34 --- indra/llui/llscrolllistcell.cpp | 3 ++- indra/llui/llscrolllistcell.h | 1 - 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'indra/llui') diff --git a/indra/llui/llscrolllistcell.cpp b/indra/llui/llscrolllistcell.cpp index 9f169ac777..544352176a 100644 --- a/indra/llui/llscrolllistcell.cpp +++ b/indra/llui/llscrolllistcell.cpp @@ -71,7 +71,8 @@ LLScrollListCell* LLScrollListCell::create(const LLScrollListCell::Params& cell_ LLScrollListCell::LLScrollListCell(const LLScrollListCell::Params& p) -: mWidth(p.width), mToolTip(p.tool_tip) +: mWidth(p.width), + mToolTip(p.tool_tip) {} // virtual diff --git a/indra/llui/llscrolllistcell.h b/indra/llui/llscrolllistcell.h index cff8434b32..5fecf5aade 100644 --- a/indra/llui/llscrolllistcell.h +++ b/indra/llui/llscrolllistcell.h @@ -89,7 +89,6 @@ public: { addSynonym(column, "name"); addSynonym(font_color, "font-color"); - addSynonym(tool_tip, "tooltip"); } }; -- cgit v1.2.3 From 391f423cd0633262233d474622b56dd3b151ab32 Mon Sep 17 00:00:00 2001 From: James Cook Date: Wed, 11 Nov 2009 16:34:23 -0800 Subject: Revert global font setting for UI controls because it makes About Land crash Apparently moving ui_ctrl to a different registry breaks our ability to create dummy ones in code. Reverting until I have time to investigate. Discussed with Richard --- indra/llui/lluictrl.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'indra/llui') diff --git a/indra/llui/lluictrl.cpp b/indra/llui/lluictrl.cpp index dd807a3f7e..aaadc1b58d 100644 --- a/indra/llui/lluictrl.cpp +++ b/indra/llui/lluictrl.cpp @@ -38,7 +38,11 @@ #include "llpanel.h" #include "lluictrlfactory.h" -static LLWidgetNameRegistry::StaticRegistrar r(&typeid(LLUICtrl::Params), "ui_ctrl"); +// This breaks the ability to construct dummy LLUICtrls for calls like +// getChild("not-there") +//static LLWidgetNameRegistry::StaticRegistrar r(&typeid(LLUICtrl::Params), "ui_ctrl"); +// This doesn't appear to read/apply ui_ctrl.xml +static LLDefaultChildRegistry::Register r("ui_ctrl"); LLUICtrl::Params::Params() : tab_stop("tab_stop", true), -- cgit v1.2.3