summaryrefslogtreecommitdiff
path: root/indra
diff options
context:
space:
mode:
authorRichard Nelson <richard@lindenlab.com>2011-10-12 18:17:18 -0700
committerRichard Nelson <richard@lindenlab.com>2011-10-12 18:17:18 -0700
commit86cbb16e27b63d540d39a3e7342b0c07acabcaee (patch)
treec1dcc86e8159a66e8ca0becd742075d630bf4a55 /indra
parent40ebe180a6592381804555d1c9e8df84bf35345a (diff)
parent9206226a377c88d34036ebd8a3ac6d9d55bc4146 (diff)
Automated merge with ssh://hg.lindenlab.com/richard/viewer-experience-fui
Diffstat (limited to 'indra')
-rw-r--r--indra/llui/llbutton.cpp39
-rw-r--r--indra/llui/llbutton.h2
-rw-r--r--indra/llui/lltoolbar.cpp46
-rw-r--r--indra/llui/lltoolbar.h4
-rw-r--r--indra/llui/llview.cpp7
-rw-r--r--indra/llui/llview.h2
-rw-r--r--indra/newview/app_settings/settings.xml12
-rw-r--r--indra/newview/llviewermenu.cpp8
8 files changed, 83 insertions, 37 deletions
diff --git a/indra/llui/llbutton.cpp b/indra/llui/llbutton.cpp
index 4f0c0d31bd..f40d99c024 100644
--- a/indra/llui/llbutton.cpp
+++ b/indra/llui/llbutton.cpp
@@ -732,16 +732,7 @@ void LLButton::draw()
}
// Unselected label assignments
- LLWString label;
-
- if( getToggleState() )
- {
- label = mSelectedLabel;
- }
- else
- {
- label = mUnselectedLabel;
- }
+ LLWString label = getCurrentLabel();
// overlay with keyboard focus border
if (hasFocus())
@@ -988,6 +979,23 @@ void LLButton::setLabelSelected( const LLStringExplicit& label )
mSelectedLabel = label;
}
+bool LLButton::labelIsTruncated() const
+{
+ return getCurrentLabel().getString().size() > mLastDrawCharsCount;
+}
+
+const LLUIString& LLButton::getCurrentLabel() const
+{
+ if( getToggleState() )
+ {
+ return mSelectedLabel;
+ }
+ else
+ {
+ return mUnselectedLabel;
+ }
+}
+
void LLButton::setImageUnselected(LLPointer<LLUIImage> image)
{
mImageUnselected = image;
@@ -999,16 +1007,7 @@ void LLButton::setImageUnselected(LLPointer<LLUIImage> image)
void LLButton::autoResize()
{
- LLUIString label;
- if(getToggleState())
- {
- label = mSelectedLabel;
- }
- else
- {
- label = mUnselectedLabel;
- }
- resize(label);
+ resize(getCurrentLabel());
}
void LLButton::resize(LLUIString label)
diff --git a/indra/llui/llbutton.h b/indra/llui/llbutton.h
index ba0345f610..7d9adcd892 100644
--- a/indra/llui/llbutton.h
+++ b/indra/llui/llbutton.h
@@ -242,6 +242,8 @@ public:
S32 getLastDrawCharsCount() const { return mLastDrawCharsCount; }
+ bool labelIsTruncated() const;
+ const LLUIString& getCurrentLabel() const;
void setScaleImage(BOOL scale) { mScaleImage = scale; }
BOOL getScaleImage() const { return mScaleImage; }
diff --git a/indra/llui/lltoolbar.cpp b/indra/llui/lltoolbar.cpp
index 21eeed1d27..e67e18872c 100644
--- a/indra/llui/lltoolbar.cpp
+++ b/indra/llui/lltoolbar.cpp
@@ -194,9 +194,9 @@ void LLToolBar::initFromParams(const LLToolBar::Params& p)
mCenteringStack->addChild(LLUICtrlFactory::create<LLLayoutPanel>(border_panel_p));
- BOOST_FOREACH(LLCommandId::Params params, p.commands)
+ BOOST_FOREACH(LLCommandId id, p.commands)
{
- addCommand(params);
+ addCommand(id);
}
mNeedsLayout = true;
@@ -452,17 +452,17 @@ int LLToolBar::getRankFromPosition(S32 x, S32 y)
{
// We hit passed the end of the list so put the insertion point at the end
if (orientation == LLLayoutStack::HORIZONTAL)
- {
+ {
mDragx = button_rect.mRight + mPadRight;
mDragy = button_rect.mTop + mPadTop;
- }
- else
- {
+ }
+ else
+ {
mDragx = button_rect.mLeft - mPadLeft;
mDragy = button_rect.mBottom - mPadBottom;
}
}
-
+
// Update the "girth" of the caret, i.e. the width or height (depending of orientation)
if (orientation == LLLayoutStack::HORIZONTAL)
{
@@ -723,13 +723,10 @@ LLToolBarButton* LLToolBar::createButton(const LLCommandId& id)
LLCommand* commandp = LLCommandManager::instance().getCommand(id);
if (!commandp) return NULL;
- std::string label = LLTrans::getString(commandp->labelRef());
- std::string tooltip = label + "\n" + LLTrans::getString(commandp->tooltipRef());
-
LLToolBarButton::Params button_p;
button_p.name = id.name();
- button_p.label = label;
- button_p.tool_tip = tooltip;
+ button_p.label = LLTrans::getString(commandp->labelRef());
+ button_p.tool_tip = LLTrans::getString(commandp->tooltipRef());
button_p.image_overlay = LLUI::getUIImage(commandp->icon());
button_p.overwriteFrom(mButtonParams[mButtonType]);
LLToolBarButton* button = LLUICtrlFactory::create<LLToolBarButton>(button_p);
@@ -925,3 +922,28 @@ void LLToolBarButton::reshape(S32 width, S32 height, BOOL called_from_parent)
{
LLButton::reshape(mWidthRange.clamp(width), height, called_from_parent);
}
+
+const std::string LLToolBarButton::getToolTip() const
+{
+ std::string tooltip;
+ if (labelIsTruncated() || getCurrentLabel().empty())
+ {
+ return LLTrans::getString(LLCommandManager::instance().getCommand(mId)->labelRef()) + " -- " + LLView::getToolTip();
+ }
+ else
+ {
+ return LLView::getToolTip();
+ }
+}
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/indra/llui/lltoolbar.h b/indra/llui/lltoolbar.h
index 7f8ae4f839..8d38bc0234 100644
--- a/indra/llui/lltoolbar.h
+++ b/indra/llui/lltoolbar.h
@@ -72,6 +72,10 @@ public:
void onMouseEnter(S32 x, S32 y, MASK mask);
void onMouseCaptureLost();
+ virtual const std::string getToolTip() const;
+
+
+
private:
LLCommandId mId;
S32 mMouseDownX;
diff --git a/indra/llui/llview.cpp b/indra/llui/llview.cpp
index e10c2f0d1e..55d053254c 100644
--- a/indra/llui/llview.cpp
+++ b/indra/llui/llview.cpp
@@ -708,15 +708,16 @@ BOOL LLView::handleToolTip(S32 x, S32 y, MASK mask)
// parents provide tooltips first, which are optionally
// overridden by children, in case child is mouse_opaque
- if (!mToolTipMsg.empty())
+ std::string tooltip = getToolTip();
+ if (!tooltip.empty())
{
// allow "scrubbing" over ui by showing next tooltip immediately
// if previous one was still visible
F32 timeout = LLToolTipMgr::instance().toolTipVisible()
- ? 0.f
+ ? LLUI::sSettingGroups["config"]->getF32( "ToolTipFastDelay" )
: LLUI::sSettingGroups["config"]->getF32( "ToolTipDelay" );
LLToolTipMgr::instance().show(LLToolTip::Params()
- .message(mToolTipMsg)
+ .message(tooltip)
.sticky_rect(calcScreenRect())
.delay_time(timeout));
diff --git a/indra/llui/llview.h b/indra/llui/llview.h
index a1c46f3bf3..5e3387dc98 100644
--- a/indra/llui/llview.h
+++ b/indra/llui/llview.h
@@ -238,7 +238,7 @@ public:
ECursorType getHoverCursor() { return mHoverCursor; }
- const std::string& getToolTip() const { return mToolTipMsg.getString(); }
+ virtual const std::string getToolTip() const { return mToolTipMsg.getString(); }
void sendChildToFront(LLView* child);
void sendChildToBack(LLView* child);
diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml
index dd540654fb..4b847dfbf7 100644
--- a/indra/newview/app_settings/settings.xml
+++ b/indra/newview/app_settings/settings.xml
@@ -10905,7 +10905,17 @@
<key>Value</key>
<real>0.699999988079</real>
</map>
- <key>ToolTipFadeTime</key>
+ <key>ToolTipFastDelay</key>
+ <map>
+ <key>Comment</key>
+ <string>Seconds before displaying tooltip when mouse stops over UI element (when a tooltip is already visible)</string>
+ <key>Persist</key>
+ <integer>1</integer>
+ <key>Type</key>
+ <string>F32</string>
+ <key>Value</key>
+ <real>0.1</real>
+ </map> <key>ToolTipFadeTime</key>
<map>
<key>Comment</key>
<string>Seconds over which tooltip fades away</string>
diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp
index 478af6ab7d..aee46ed5be 100644
--- a/indra/newview/llviewermenu.cpp
+++ b/indra/newview/llviewermenu.cpp
@@ -6875,6 +6875,13 @@ class LLToolsEnableSaveToObjectInventory : public view_listener_t
}
};
+class LLToggleHowTo : public view_listener_t
+{
+ bool handleEvent(const LLSD& userdata)
+ {
+ return true;
+ }
+};
class LLViewEnableMouselook : public view_listener_t
{
@@ -8039,6 +8046,7 @@ void initialize_menus()
// Help menu
// most items use the ShowFloater method
+ view_listener_t::addMenu(new LLToggleHowTo(), "Help.ToggleHowTo");
// Advanced menu
view_listener_t::addMenu(new LLAdvancedToggleConsole(), "Advanced.ToggleConsole");