diff options
author | Steven Bennetts <steve@lindenlab.com> | 2008-08-12 17:29:50 +0000 |
---|---|---|
committer | Steven Bennetts <steve@lindenlab.com> | 2008-08-12 17:29:50 +0000 |
commit | 80be4c1d2d73982ea2df6dd7ef3fc3465416c882 (patch) | |
tree | 9c5958572368be494b6302db8b03967a2c67b7ad /indra/llui | |
parent | a09f7d41efdb945755efaeb07f7418c1f6e2a78b (diff) |
QAR-767 Combined maint-render-7 and maint-viewer-9 merge
merge release@93398 viewer-merge-1@94007 -> release
dataserver-is-deprecated
Diffstat (limited to 'indra/llui')
-rw-r--r-- | indra/llui/llbutton.cpp | 28 | ||||
-rw-r--r-- | indra/llui/llbutton.h | 1 | ||||
-rw-r--r-- | indra/llui/llcombobox.cpp | 6 | ||||
-rw-r--r-- | indra/llui/llfloater.cpp | 51 | ||||
-rw-r--r-- | indra/llui/llfloater.h | 7 | ||||
-rw-r--r-- | indra/llui/llmenugl.cpp | 7 | ||||
-rw-r--r-- | indra/llui/lltabcontainer.cpp | 48 | ||||
-rw-r--r-- | indra/llui/lltexteditor.cpp | 4 | ||||
-rw-r--r-- | indra/llui/llview.cpp | 2 | ||||
-rw-r--r-- | indra/llui/llview.h | 4 |
10 files changed, 124 insertions, 34 deletions
diff --git a/indra/llui/llbutton.cpp b/indra/llui/llbutton.cpp index 4f5f630fcd..3f6338006f 100644 --- a/indra/llui/llbutton.cpp +++ b/indra/llui/llbutton.cpp @@ -208,6 +208,7 @@ void LLButton::init(void (*click_callback)(void*), void *callback_data, const LL mHighlightColor = ( LLUI::sColorsGroup->getColor( "ButtonUnselectedFgColor" ) ); mUnselectedBgColor = ( LLUI::sColorsGroup->getColor( "ButtonUnselectedBgColor" ) ); mSelectedBgColor = ( LLUI::sColorsGroup->getColor( "ButtonSelectedBgColor" ) ); + mFlashBgColor = ( LLUI::sColorsGroup->getColor( "ButtonFlashBgColor" ) ); mImageOverlayAlignment = LLFontGL::HCENTER; mImageOverlayColor = LLColor4::white; @@ -433,7 +434,9 @@ void LLButton::draw() || mToggleState; BOOL use_glow_effect = FALSE; - if ( mNeedsHighlight || flash ) + LLColor4 glow_color = LLColor4::white; + LLRender::eBlendType glow_type = LLRender::BT_ADD_WITH_ALPHA; + if ( mNeedsHighlight ) { if (pressed) { @@ -469,6 +472,16 @@ void LLButton::draw() mImagep = mImageUnselected; } + if (mFlashing) + { + use_glow_effect = TRUE; + glow_type = LLRender::BT_ALPHA; // blend the glow + if (mNeedsHighlight) // highlighted AND flashing + glow_color = (glow_color*0.5f + mFlashBgColor*0.5f) % 2.0f; // average between flash and highlight colour, with sum of the opacity + else + glow_color = mFlashBgColor; + } + // Override if more data is available // HACK: Use gray checked state to mean either: // enabled and tentative @@ -555,7 +568,10 @@ void LLButton::draw() if (use_glow_effect) { - mCurGlowStrength = lerp(mCurGlowStrength, mHoverGlowStrength, LLCriticalDamp::getInterpolant(0.05f)); + mCurGlowStrength = lerp(mCurGlowStrength, + mFlashing ? (flash? 1.0 : 0.0) + : mHoverGlowStrength, + LLCriticalDamp::getInterpolant(0.05f)); } else { @@ -571,8 +587,8 @@ void LLButton::draw() mImagep->draw(getLocalRect(), getEnabled() ? mImageColor : mDisabledImageColor ); if (mCurGlowStrength > 0.01f) { - gGL.setSceneBlendType(LLRender::BT_ADD_WITH_ALPHA); - mImagep->drawSolid(0, 0, getRect().getWidth(), getRect().getHeight(), LLColor4(1.f, 1.f, 1.f, mCurGlowStrength)); + gGL.setSceneBlendType(glow_type); + mImagep->drawSolid(0, 0, getRect().getWidth(), getRect().getHeight(), glow_color % mCurGlowStrength); gGL.setSceneBlendType(LLRender::BT_ALPHA); } } @@ -581,8 +597,8 @@ void LLButton::draw() mImagep->draw(0, 0, getEnabled() ? mImageColor : mDisabledImageColor ); if (mCurGlowStrength > 0.01f) { - gGL.setSceneBlendType(LLRender::BT_ADD_WITH_ALPHA); - mImagep->drawSolid(0, 0, LLColor4(1.f, 1.f, 1.f, mCurGlowStrength)); + gGL.setSceneBlendType(glow_type); + mImagep->drawSolid(0, 0, glow_color % mCurGlowStrength); gGL.setSceneBlendType(LLRender::BT_ALPHA); } } diff --git a/indra/llui/llbutton.h b/indra/llui/llbutton.h index 9e24376938..2c35614401 100644 --- a/indra/llui/llbutton.h +++ b/indra/llui/llbutton.h @@ -267,6 +267,7 @@ private: LLColor4 mHighlightColor; LLColor4 mUnselectedBgColor; LLColor4 mSelectedBgColor; + LLColor4 mFlashBgColor; LLColor4 mImageColor; LLColor4 mDisabledImageColor; diff --git a/indra/llui/llcombobox.cpp b/indra/llui/llcombobox.cpp index 8d8487f612..89ce68a32e 100644 --- a/indra/llui/llcombobox.cpp +++ b/indra/llui/llcombobox.cpp @@ -774,6 +774,12 @@ BOOL LLComboBox::handleKeyHere(KEY key, MASK mask) BOOL result = FALSE; if (hasFocus()) { + if (mList->getVisible() + && key == KEY_ESCAPE && mask == MASK_NONE) + { + hideList(); + return TRUE; + } //give list a chance to pop up and handle key LLScrollListItem* last_selected_item = mList->getLastSelectedItem(); if (last_selected_item) diff --git a/indra/llui/llfloater.cpp b/indra/llui/llfloater.cpp index 838f6fa193..7f8f54a44a 100644 --- a/indra/llui/llfloater.cpp +++ b/indra/llui/llfloater.cpp @@ -649,24 +649,55 @@ void LLFloater::applyRectControl() } } -void LLFloater::setTitle( const std::string& title ) +void LLFloater::applyTitle() { if (gNoRender) { return; } - if (mDragHandle) - mDragHandle->setTitle( title ); + + if (!mDragHandle) + { + return; + } + + if (isMinimized() && !mShortTitle.empty()) + { + mDragHandle->setTitle( mShortTitle ); + } + else + { + mDragHandle->setTitle ( mTitle ); + } } -const std::string& LLFloater::getTitle() const +const std::string& LLFloater::getCurrentTitle() const { return mDragHandle ? mDragHandle->getTitle() : LLStringUtil::null; } +void LLFloater::setTitle( const std::string& title ) +{ + mTitle = title; + applyTitle(); +} + +std::string LLFloater::getTitle() +{ + if (mTitle.empty()) + { + return mDragHandle ? mDragHandle->getTitle() : LLStringUtil::null; + } + else + { + return mTitle; + } +} + void LLFloater::setShortTitle( const std::string& short_title ) { mShortTitle = short_title; + applyTitle(); } std::string LLFloater::getShortTitle() @@ -895,6 +926,9 @@ void LLFloater::setMinimized(BOOL minimize) // Reshape *after* setting mMinimized reshape( mExpandedRect.getWidth(), mExpandedRect.getHeight(), TRUE ); } + + applyTitle (); + make_ui_sound("UISndWindowClose"); updateButtons(); } @@ -1340,7 +1374,7 @@ void LLFloater::draw() gl_rect_2d( left, top, right, bottom, getTransparentColor() ); } - if(gFocusMgr.childHasKeyboardFocus(this) && !getIsChrome() && !getTitle().empty()) + if(gFocusMgr.childHasKeyboardFocus(this) && !getIsChrome() && !getCurrentTitle().empty()) { // draw highlight on title bar to indicate focus. RDW const LLFontGL* font = LLResMgr::getInstance()->getRes( LLFONT_SANSSERIF ); @@ -2846,7 +2880,7 @@ LLXMLNodePtr LLFloater::getXML(bool save_children) const { LLXMLNodePtr node = LLPanel::getXML(); - node->createChild("title", TRUE)->setStringValue(getTitle()); + node->createChild("title", TRUE)->setStringValue(getCurrentTitle()); node->createChild("can_resize", TRUE)->setBoolValue(isResizable()); @@ -2893,7 +2927,7 @@ LLView* LLFloater::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *f void LLFloater::initFloaterXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *factory, BOOL open) /* Flawfinder: ignore */ { std::string name(getName()); - std::string title(getTitle()); + std::string title(getCurrentTitle()); std::string short_title(getShortTitle()); std::string rect_control(""); BOOL resizable = isResizable(); @@ -2933,6 +2967,9 @@ void LLFloater::initFloaterXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactor minimizable, close_btn); + setTitle(title); + applyTitle (); + setShortTitle(short_title); BOOL can_tear_off; diff --git a/indra/llui/llfloater.h b/indra/llui/llfloater.h index e467d6f921..4ca15857b9 100644 --- a/indra/llui/llfloater.h +++ b/indra/llui/llfloater.h @@ -142,8 +142,10 @@ public: LLMultiFloater* getHost() { return (LLMultiFloater*)mHostHandle.get(); } - void setTitle( const std::string& title ); - const std::string& getTitle() const; + void applyTitle(); + const std::string& getCurrentTitle() const; + void setTitle( const std::string& title); + std::string getTitle(); void setShortTitle( const std::string& short_title ); std::string getShortTitle(); void setTitleVisible(bool visible); @@ -247,6 +249,7 @@ private: BOOL mMinimized; BOOL mForeground; LLHandle<LLFloater> mDependeeHandle; + std::string mTitle; std::string mShortTitle; BOOL mFirstLook; // TRUE if the _next_ time this floater is visible will be the first time in the session that it is visible. diff --git a/indra/llui/llmenugl.cpp b/indra/llui/llmenugl.cpp index fba0984dce..3237ef8e27 100644 --- a/indra/llui/llmenugl.cpp +++ b/indra/llui/llmenugl.cpp @@ -3902,6 +3902,13 @@ BOOL LLMenuBarGL::handleKeyHere(KEY key, MASK mask) { mAltKeyTrigger = FALSE; } + + if (key == KEY_ESCAPE && mask == MASK_NONE) + { + LLMenuGL::setKeyboardMode(FALSE); + // if any menus are visible, this will return TRUE, stopping further processing of ESCAPE key + return LLMenuGL::sMenuContainer->hideMenus(); + } // before processing any other key, check to see if ALT key has triggered menu access checkMenuTrigger(); diff --git a/indra/llui/lltabcontainer.cpp b/indra/llui/lltabcontainer.cpp index 488e62c61e..0bf7162d56 100644 --- a/indra/llui/lltabcontainer.cpp +++ b/indra/llui/lltabcontainer.cpp @@ -152,24 +152,43 @@ LLView* LLTabContainer::getChildView(const std::string& name, BOOL recurse, BOOL void LLTabContainer::draw() { S32 target_pixel_scroll = 0; - S32 cur_scroll_pos = mIsVertical ? 0 : getScrollPos(); + S32 cur_scroll_pos = getScrollPos(); if (cur_scroll_pos > 0) { - S32 available_width_with_arrows = getRect().getWidth() - mRightTabBtnOffset - 2 * (LLPANEL_BORDER_WIDTH + TABCNTR_ARROW_BTN_SIZE + TABCNTR_ARROW_BTN_SIZE + 1); - for(tuple_list_t::iterator iter = mTabList.begin(); iter != mTabList.end(); ++iter) + if (!mIsVertical) { - if (cur_scroll_pos == 0) + S32 available_width_with_arrows = getRect().getWidth() - mRightTabBtnOffset - 2 * (LLPANEL_BORDER_WIDTH + TABCNTR_ARROW_BTN_SIZE + TABCNTR_ARROW_BTN_SIZE + 1); + for(tuple_list_t::iterator iter = mTabList.begin(); iter != mTabList.end(); ++iter) { - break; + if (cur_scroll_pos == 0) + { + break; + } + target_pixel_scroll += (*iter)->mButton->getRect().getWidth(); + cur_scroll_pos--; } - target_pixel_scroll += (*iter)->mButton->getRect().getWidth(); - cur_scroll_pos--; - } - // Show part of the tab to the left of what is fully visible - target_pixel_scroll -= TABCNTR_TAB_PARTIAL_WIDTH; - // clamp so that rightmost tab never leaves right side of screen - target_pixel_scroll = llmin(mTotalTabWidth - available_width_with_arrows, target_pixel_scroll); + // Show part of the tab to the left of what is fully visible + target_pixel_scroll -= TABCNTR_TAB_PARTIAL_WIDTH; + // clamp so that rightmost tab never leaves right side of screen + target_pixel_scroll = llmin(mTotalTabWidth - available_width_with_arrows, target_pixel_scroll); + } + else + { + S32 available_height_with_arrows = getRect().getHeight() - getTopBorderHeight() - (LLPANEL_BORDER_WIDTH + TABCNTR_ARROW_BTN_SIZE + TABCNTR_ARROW_BTN_SIZE + 1); + for(tuple_list_t::iterator iter = mTabList.begin(); iter != mTabList.end(); ++iter) + { + if (cur_scroll_pos==0) + { + break; + } + target_pixel_scroll += (*iter)->mButton->getRect().getHeight(); + cur_scroll_pos--; + } + S32 total_tab_height = (BTN_HEIGHT + TABCNTRV_PAD) * getTabCount() + TABCNTRV_PAD; + // clamp so that the bottom tab never leaves bottom of panel + target_pixel_scroll = llmin(total_tab_height - available_height_with_arrows, target_pixel_scroll); + } } setScrollPosPixels((S32)lerp((F32)getScrollPosPixels(), (F32)target_pixel_scroll, LLCriticalDamp::getInterpolant(0.08f))); @@ -612,13 +631,13 @@ BOOL LLTabContainer::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, EDrag { if (has_scroll_arrows) { - if (mJumpPrevArrowBtn->getRect().pointInRect(x, y)) + if (mJumpPrevArrowBtn && mJumpPrevArrowBtn->getRect().pointInRect(x, y)) { S32 local_x = x - mJumpPrevArrowBtn->getRect().mLeft; S32 local_y = y - mJumpPrevArrowBtn->getRect().mBottom; mJumpPrevArrowBtn->handleHover(local_x, local_y, mask); } - if (mJumpNextArrowBtn->getRect().pointInRect(x, y)) + if (mJumpNextArrowBtn && mJumpNextArrowBtn->getRect().pointInRect(x, y)) { S32 local_x = x - mJumpNextArrowBtn->getRect().mLeft; S32 local_y = y - mJumpNextArrowBtn->getRect().mBottom; @@ -1794,3 +1813,4 @@ void LLTabContainer::commitHoveredButton(S32 x, S32 y) } + diff --git a/indra/llui/lltexteditor.cpp b/indra/llui/lltexteditor.cpp index b70ad4c53c..4f02715d2c 100644 --- a/indra/llui/lltexteditor.cpp +++ b/indra/llui/lltexteditor.cpp @@ -4180,8 +4180,8 @@ void LLTextEditor::setTextEditorParameters(LLXMLNodePtr node) /////////////////////////////////////////////////////////////////// S32 LLTextEditor::findHTMLToken(const std::string &line, S32 pos, BOOL reverse) const { - std::string openers=" \t('\"[{<>"; - std::string closers=" \t)'\"]}><;"; + std::string openers=" \t\n('\"[{<>"; + std::string closers=" \t\n)'\"]}><;"; S32 m2; S32 retval; diff --git a/indra/llui/llview.cpp b/indra/llui/llview.cpp index c1da6c93fe..b05014d94e 100644 --- a/indra/llui/llview.cpp +++ b/indra/llui/llview.cpp @@ -698,7 +698,7 @@ BOOL LLView::handleToolTip(S32 x, S32 y, std::string& msg, LLRect* sticky_rect_s { BOOL handled = FALSE; - std::string tool_tip; + std::string tool_tip; for ( child_list_iter_t child_it = mChildList.begin(); child_it != mChildList.end(); ++child_it) { diff --git a/indra/llui/llview.h b/indra/llui/llview.h index 2e1d0e3868..130c3b52f7 100644 --- a/indra/llui/llview.h +++ b/indra/llui/llview.h @@ -518,7 +518,7 @@ public: { // need non-const to update private dummy widget cache llwarns << "Making dummy " << xml_tag << " named " << name << " in " << getName() << llendl; - const_cast<LLView*>(this)->mDummyWidgets.insert(std::make_pair(name, widget)); + mDummyWidgets.insert(std::make_pair(name, widget)); } else { @@ -646,7 +646,7 @@ private: std::string mControlName; typedef std::map<std::string, LLView*> dummy_widget_map_t; - dummy_widget_map_t mDummyWidgets; + mutable dummy_widget_map_t mDummyWidgets; boost::signals::connection mControlConnection; |