diff options
author | Merov Linden <merov@lindenlab.com> | 2011-10-12 19:49:09 -0700 |
---|---|---|
committer | Merov Linden <merov@lindenlab.com> | 2011-10-12 19:49:09 -0700 |
commit | 303579309d805ce8f48dc0af3b19eaa38533dfe8 (patch) | |
tree | 19d86c250a2d2f6e6806c972d7eaeedbccf5bb84 /indra | |
parent | c14aa1b64e1190ff4bd7deef864d5393988e7f91 (diff) | |
parent | 8affdabac33abbe63bea028dc92620550c06aff4 (diff) |
Pull from richard/viewer-experience-fui
Diffstat (limited to 'indra')
-rw-r--r-- | indra/llui/llbutton.cpp | 39 | ||||
-rw-r--r-- | indra/llui/llbutton.h | 2 | ||||
-rw-r--r-- | indra/llui/llfloater.cpp | 23 | ||||
-rw-r--r-- | indra/llui/llfloater.h | 3 | ||||
-rw-r--r-- | indra/llui/lltoolbar.cpp | 46 | ||||
-rw-r--r-- | indra/llui/lltoolbar.h | 4 | ||||
-rw-r--r-- | indra/llui/llview.cpp | 7 | ||||
-rw-r--r-- | indra/llui/llview.h | 2 | ||||
-rw-r--r-- | indra/newview/app_settings/settings.xml | 12 | ||||
-rw-r--r-- | indra/newview/llviewermenu.cpp | 8 |
10 files changed, 87 insertions, 59 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/llfloater.cpp b/indra/llui/llfloater.cpp index 81b14aac17..fa533e8153 100644 --- a/indra/llui/llfloater.cpp +++ b/indra/llui/llfloater.cpp @@ -252,7 +252,6 @@ LLFloater::LLFloater(const LLSD& key, const LLFloater::Params& p) mHeaderHeight(p.header_height), mLegacyHeaderHeight(p.legacy_header_height), mMinimized(FALSE), - mVisibleWhenMinimized(TRUE), mForeground(FALSE), mFirstLook(TRUE), mButtonScale(1.0f), @@ -1433,17 +1432,6 @@ void LLFloater::removeDependentFloater(LLFloater* floaterp) floaterp->mDependeeHandle = LLHandle<LLFloater>(); } -void LLFloater::setVisibleWhenMinimized(bool visible) -{ - mVisibleWhenMinimized = visible; - if (visible && isMinimized()) - { - // restack in minimized stack - setMinimized(FALSE); - setMinimized(TRUE); - } -} - BOOL LLFloater::offerClickToButton(S32 x, S32 y, MASK mask, EFloaterButton index) { if( mButtonsEnabled[index] ) @@ -1820,14 +1808,11 @@ void LLFloater::draw() } if (isMinimized()) { - if (mVisibleWhenMinimized) + for (S32 i = 0; i < BUTTON_COUNT; i++) { - for (S32 i = 0; i < BUTTON_COUNT; i++) - { - drawChild(mButtons[i]); - } - drawChild(mDragHandle); + drawChild(mButtons[i]); } + drawChild(mDragHandle); } else { @@ -2482,7 +2467,7 @@ void LLFloaterView::getMinimizePosition(S32 *left, S32 *bottom) { // Examine minimized children. LLFloater* floater = (LLFloater*)((LLView*)*child_it); - if(floater->isMinimized() && floater->getVisibleWhenMinimized()) + if(floater->isMinimized()) { LLRect r = floater->getRect(); if((r.mBottom < (row + floater_header_size)) diff --git a/indra/llui/llfloater.h b/indra/llui/llfloater.h index 7cfec09e5f..8beb11507e 100644 --- a/indra/llui/llfloater.h +++ b/indra/llui/llfloater.h @@ -217,8 +217,6 @@ public: LLFloater* getDependee() { return (LLFloater*)mDependeeHandle.get(); } void removeDependentFloater(LLFloater* dependent); BOOL isMinimized() const { return mMinimized; } - void setVisibleWhenMinimized(bool visible); - bool getVisibleWhenMinimized() const { return mVisibleWhenMinimized;} /// isShown() differs from getVisible() in that isShown() also considers /// isMinimized(). isShown() is true only if visible and not minimized. bool isShown() const; @@ -429,7 +427,6 @@ private: S32 mLegacyHeaderHeight;// HACK see initFloaterXML() BOOL mMinimized; - bool mVisibleWhenMinimized; BOOL mForeground; LLHandle<LLFloater> mDependeeHandle; diff --git a/indra/llui/lltoolbar.cpp b/indra/llui/lltoolbar.cpp index 5e025f6a45..3ea0968bfc 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) { @@ -744,13 +744,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); @@ -948,3 +945,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 49750a9ac2..3be252298d 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"); |