diff options
Diffstat (limited to 'indra/llui')
-rw-r--r-- | indra/llui/llaccordionctrltab.cpp | 8 | ||||
-rw-r--r-- | indra/llui/lldraghandle.cpp | 7 | ||||
-rw-r--r-- | indra/llui/lldraghandle.h | 3 | ||||
-rw-r--r-- | indra/llui/llflatlistview.cpp | 17 | ||||
-rw-r--r-- | indra/llui/llflatlistview.h | 5 | ||||
-rw-r--r-- | indra/llui/llfloater.cpp | 52 | ||||
-rw-r--r-- | indra/llui/llfloater.h | 11 | ||||
-rw-r--r-- | indra/llui/llnotifications.cpp | 8 | ||||
-rw-r--r-- | indra/llui/llnotifications.h | 57 | ||||
-rw-r--r-- | indra/llui/lltextbase.cpp | 11 |
10 files changed, 139 insertions, 40 deletions
diff --git a/indra/llui/llaccordionctrltab.cpp b/indra/llui/llaccordionctrltab.cpp index e12776f83a..0959722aa6 100644 --- a/indra/llui/llaccordionctrltab.cpp +++ b/indra/llui/llaccordionctrltab.cpp @@ -465,10 +465,11 @@ void LLAccordionCtrlTab::setHeaderVisible(bool value) reshape(getRect().getWidth(), getRect().getHeight(), FALSE); }; -//vurtual +//virtual BOOL LLAccordionCtrlTab::postBuild() { - mHeader->setVisible(mHeaderVisible); + if(mHeader) + mHeader->setVisible(mHeaderVisible); static LLUICachedControl<S32> scrollbar_size ("UIScrollbarSize", 0); @@ -504,7 +505,8 @@ BOOL LLAccordionCtrlTab::postBuild() mScrollbar->setVisible(false); } - mContainerPanel->setVisible(mDisplayChildren); + if(mContainerPanel) + mContainerPanel->setVisible(mDisplayChildren); return LLUICtrl::postBuild(); } diff --git a/indra/llui/lldraghandle.cpp b/indra/llui/lldraghandle.cpp index 832f148902..9d4e2fa495 100644 --- a/indra/llui/lldraghandle.cpp +++ b/indra/llui/lldraghandle.cpp @@ -248,15 +248,14 @@ void LLDragHandleTop::reshapeTitleBox() return; } const LLFontGL* font = LLFontGL::getFontSansSerif(); - S32 title_width = font->getWidth( mTitleBox->getText() ) + TITLE_HPAD; - if (getMaxTitleWidth() > 0) - title_width = llmin(title_width, getMaxTitleWidth()); + S32 title_width = getRect().getWidth(); + title_width -= 2 * LEFT_PAD + 2 * BORDER_PAD + getButtonsRect().getWidth(); S32 title_height = llround(font->getLineHeight()); LLRect title_rect; title_rect.setLeftTopAndSize( LEFT_PAD, getRect().getHeight() - title_vpad, - getRect().getWidth() - LEFT_PAD - RIGHT_PAD, + title_width, title_height); // calls reshape on mTitleBox diff --git a/indra/llui/lldraghandle.h b/indra/llui/lldraghandle.h index dc5410787b..825bc9303e 100644 --- a/indra/llui/lldraghandle.h +++ b/indra/llui/lldraghandle.h @@ -71,6 +71,8 @@ public: BOOL getForeground() const { return mForeground; } void setMaxTitleWidth(S32 max_width) {mMaxTitleWidth = llmin(max_width, mMaxTitleWidth); } S32 getMaxTitleWidth() const { return mMaxTitleWidth; } + void setButtonsRect(const LLRect& rect){ mButtonsRect = rect; } + LLRect getButtonsRect() { return mButtonsRect; } void setTitleVisible(BOOL visible); virtual void setTitle( const std::string& title ) = 0; @@ -88,6 +90,7 @@ protected: LLTextBox* mTitleBox; private: + LLRect mButtonsRect; S32 mDragLastScreenX; S32 mDragLastScreenY; S32 mLastMouseScreenX; diff --git a/indra/llui/llflatlistview.cpp b/indra/llui/llflatlistview.cpp index d499e08ecb..0fd7e7ed55 100644 --- a/indra/llui/llflatlistview.cpp +++ b/indra/llui/llflatlistview.cpp @@ -53,17 +53,6 @@ LLFlatListView::Params::Params() no_items_text("no_items_text") {}; -LLFlatListView::~LLFlatListView() -{ - clear(); - // Route menu back to the default - if( gEditMenuHandler == this ) - { - gEditMenuHandler = NULL; - } -}; - - void LLFlatListView::reshape(S32 width, S32 height, BOOL called_from_parent /* = TRUE */) { LLScrollContainer::reshape(width, height, called_from_parent); @@ -795,13 +784,13 @@ bool LLFlatListView::selectNextItemPair(bool is_up_direction, bool reset_selecti BOOL LLFlatListView::canSelectAll() const { - return !mItemPairs.empty() && mAllowSelection; + return !mItemPairs.empty() && mAllowSelection && mMultipleSelection; } void LLFlatListView::selectAll() { - if (!mAllowSelection) - return; + if (!mAllowSelection || !mMultipleSelection) + return false; mSelectedItemPairs.clear(); diff --git a/indra/llui/llflatlistview.h b/indra/llui/llflatlistview.h index 3a2ab54658..e2f01964de 100644 --- a/indra/llui/llflatlistview.h +++ b/indra/llui/llflatlistview.h @@ -380,11 +380,14 @@ private: void setNoItemsCommentVisible(bool visible) const; -private: +protected: /** Comparator to use when sorting the list. */ const ItemComparator* mItemComparator; + +private: + LLPanel* mItemsPanel; S32 mItemsNoScrollWidth; diff --git a/indra/llui/llfloater.cpp b/indra/llui/llfloater.cpp index a9accc0ba6..e672252a50 100644 --- a/indra/llui/llfloater.cpp +++ b/indra/llui/llfloater.cpp @@ -346,7 +346,7 @@ void LLFloater::layoutDragHandle() rect = getLocalRect(); } mDragHandle->setRect(rect); - updateButtons(); + updateTitleButtons(); applyTitle(); } @@ -1061,11 +1061,10 @@ void LLFloater::setMinimized(BOOL minimize) // Reshape *after* setting mMinimized reshape( mExpandedRect.getWidth(), mExpandedRect.getHeight(), TRUE ); } - - applyTitle (); make_ui_sound("UISndWindowClose"); - updateButtons(); + updateTitleButtons(); + applyTitle (); } void LLFloater::setFocus( BOOL b ) @@ -1121,6 +1120,7 @@ void LLFloater::setIsChrome(BOOL is_chrome) setFocus(FALSE); // can't Ctrl-Tab to "chrome" floaters setFocusRoot(FALSE); + mButtons[BUTTON_CLOSE]->setToolTip(LLStringExplicit(getButtonTooltip(Params(), BUTTON_CLOSE, is_chrome))); } // no titles displayed on "chrome" floaters @@ -1190,7 +1190,7 @@ void LLFloater::setHost(LLMultiFloater* host) mButtonScale = 1.f; //mButtonsEnabled[BUTTON_TEAR_OFF] = FALSE; } - updateButtons(); + updateTitleButtons(); if (host) { mHostHandle = host->getHandle(); @@ -1389,7 +1389,7 @@ void LLFloater::setCanDock(bool b) mButtonsEnabled[BUTTON_DOCK] = FALSE; } } - updateButtons(); + updateTitleButtons(); } void LLFloater::setDocked(bool docked, bool pop_on_undock) @@ -1398,7 +1398,7 @@ void LLFloater::setDocked(bool docked, bool pop_on_undock) { mDocked = docked; mButtonsEnabled[BUTTON_DOCK] = !mDocked; - updateButtons(); + updateTitleButtons(); storeDockStateControl(); } @@ -1451,7 +1451,7 @@ void LLFloater::onClickTearOff(LLFloater* self) } self->setTornOff(false); } - self->updateButtons(); + self->updateTitleButtons(); } // static @@ -1691,7 +1691,7 @@ void LLFloater::setCanMinimize(BOOL can_minimize) mButtonsEnabled[BUTTON_MINIMIZE] = can_minimize && !isMinimized(); mButtonsEnabled[BUTTON_RESTORE] = can_minimize && isMinimized(); - updateButtons(); + updateTitleButtons(); } void LLFloater::setCanClose(BOOL can_close) @@ -1699,7 +1699,7 @@ void LLFloater::setCanClose(BOOL can_close) mCanClose = can_close; mButtonsEnabled[BUTTON_CLOSE] = can_close; - updateButtons(); + updateTitleButtons(); } void LLFloater::setCanTearOff(BOOL can_tear_off) @@ -1707,7 +1707,7 @@ void LLFloater::setCanTearOff(BOOL can_tear_off) mCanTearOff = can_tear_off; mButtonsEnabled[BUTTON_TEAR_OFF] = mCanTearOff && !mHostHandle.isDead(); - updateButtons(); + updateTitleButtons(); } @@ -1731,10 +1731,11 @@ void LLFloater::setCanDrag(BOOL can_drag) } } -void LLFloater::updateButtons() +void LLFloater::updateTitleButtons() { static LLUICachedControl<S32> floater_close_box_size ("UIFloaterCloseBoxSize", 0); static LLUICachedControl<S32> close_box_from_top ("UICloseBoxFromTop", 0); + LLRect buttons_rect; S32 button_count = 0; for (S32 i = 0; i < BUTTON_COUNT; i++) { @@ -1785,6 +1786,15 @@ void LLFloater::updateButtons() llround((F32)floater_close_box_size * mButtonScale)); } + if(!buttons_rect.isValid()) + { + buttons_rect = btn_rect; + } + else + { + mDragOnLeft ? buttons_rect.mRight + btn_rect.mRight : + buttons_rect.mLeft = btn_rect.mLeft; + } mButtons[i]->setRect(btn_rect); mButtons[i]->setVisible(TRUE); // the restore button should have a tab stop so that it takes action when you Ctrl-Tab to a minimized floater @@ -1796,7 +1806,10 @@ void LLFloater::updateButtons() } } if (mDragHandle) - mDragHandle->setMaxTitleWidth(getRect().getWidth() - (button_count * (floater_close_box_size + 1))); + { + localRectToOtherView(buttons_rect, &buttons_rect, mDragHandle); + mDragHandle->setButtonsRect(buttons_rect); + } } void LLFloater::buildButtons(const Params& floater_params) @@ -1844,7 +1857,7 @@ void LLFloater::buildButtons(const Params& floater_params) p.click_callback.function(boost::bind(sButtonCallbacks[i], this)); p.tab_stop(false); p.follows.flags(FOLLOWS_TOP|FOLLOWS_RIGHT); - p.tool_tip = getButtonTooltip(floater_params, (EFloaterButton)i); + p.tool_tip = getButtonTooltip(floater_params, (EFloaterButton)i, getIsChrome()); p.scale_image(true); p.chrome(true); @@ -1853,7 +1866,7 @@ void LLFloater::buildButtons(const Params& floater_params) mButtons[i] = buttonp; } - updateButtons(); + updateTitleButtons(); } // static @@ -1899,8 +1912,15 @@ LLUIImage* LLFloater::getButtonPressedImage(const Params& p, EFloaterButton e) } // static -std::string LLFloater::getButtonTooltip(const Params& p, EFloaterButton e) +std::string LLFloater::getButtonTooltip(const Params& p, EFloaterButton e, bool is_chrome) { + // EXT-4081 (Lag Meter: Ctrl+W does not close floater) + // If floater is chrome set 'Close' text for close button's tooltip + if(is_chrome && BUTTON_CLOSE == e) + { + static std::string close_tooltip_chrome = LLTrans::getString("BUTTON_CLOSE_CHROME"); + return close_tooltip_chrome; + } // TODO: per-floater localizable tooltips set in XML return sButtonToolTips[e]; } diff --git a/indra/llui/llfloater.h b/indra/llui/llfloater.h index 97d2bda594..403723d9d8 100644 --- a/indra/llui/llfloater.h +++ b/indra/llui/llfloater.h @@ -311,19 +311,26 @@ protected: virtual void onClickCloseBtn(); + virtual void updateTitleButtons(); + private: void setForeground(BOOL b); // called only by floaterview void cleanupHandles(); // remove handles to dead floaters void createMinimizeButton(); - void updateButtons(); void buildButtons(const Params& p); // Images and tooltips are named in the XML, but we want to look them // up by index. static LLUIImage* getButtonImage(const Params& p, EFloaterButton e); static LLUIImage* getButtonPressedImage(const Params& p, EFloaterButton e); - static std::string getButtonTooltip(const Params& p, EFloaterButton e); + /** + * @params is_chrome - if floater is Chrome it means that floater will never get focus. + * Therefore it can't be closed with 'Ctrl+W'. So the tooltip text of close button( X ) + * should be 'Close' not 'Close(Ctrl+W)' as for usual floaters. + */ + static std::string getButtonTooltip(const Params& p, EFloaterButton e, bool is_chrome); + BOOL offerClickToButton(S32 x, S32 y, MASK mask, EFloaterButton index); void addResizeCtrls(); void layoutResizeCtrls(); diff --git a/indra/llui/llnotifications.cpp b/indra/llui/llnotifications.cpp index d7424cf05a..65ef53443b 100644 --- a/indra/llui/llnotifications.cpp +++ b/indra/llui/llnotifications.cpp @@ -1552,3 +1552,11 @@ std::ostream& operator<<(std::ostream& s, const LLNotification& notification) return s; } +void LLPostponedNotification::onCachedNameReceived(const LLUUID& id, const std::string& first, + const std::string& last, bool is_group) +{ + gCacheName->getFullName(id, mName); + modifyNotificationParams(); + LLNotifications::instance().add(mParams); + cleanup(); +} diff --git a/indra/llui/llnotifications.h b/indra/llui/llnotifications.h index 400491a154..1799ca65b7 100644 --- a/indra/llui/llnotifications.h +++ b/indra/llui/llnotifications.h @@ -104,6 +104,7 @@ #include "llinitparam.h" #include "llnotificationslistener.h" #include "llnotificationptr.h" +#include "llcachename.h" typedef enum e_notification_priority @@ -949,6 +950,62 @@ private: boost::scoped_ptr<LLNotificationsListener> mListener; }; +/** + * Abstract class for postponed notifications. + * Provides possibility to add notification after specified by id avatar or group will be + * received from cache name. The object of this type automatically well be deleted + * by cleanup method after respond will be received from cache name. + * + * To add custom postponed notification to the notification system client should: + * 1 create class derived from LLPostponedNotification; + * 2 call LLPostponedNotification::add method; + */ +class LLPostponedNotification +{ +public: + /** + * Performs hooking cache name callback which will add notification to notifications system. + * Type of added notification should be specified by template parameter T + * and non-private derived from LLPostponedNotification class, + * otherwise compilation error will occur. + */ + template<class T> + static void add(const LLNotification::Params& params, + const LLUUID& id, bool is_group) + { + // upcast T to the base type to restrict T derivation from LLPostponedNotification + LLPostponedNotification* thiz = new T(); + + thiz->mParams = params; + + gCacheName->get(id, is_group, boost::bind( + &LLPostponedNotification::onCachedNameReceived, thiz, _1, _2, + _3, _4)); + } + +private: + void onCachedNameReceived(const LLUUID& id, const std::string& first, + const std::string& last, bool is_group); + + void cleanup() + { + delete this; + } + +protected: + LLPostponedNotification() {} + virtual ~LLPostponedNotification() {} + + /** + * Abstract method provides possibility to modify notification parameters and + * will be called after cache name retrieve information about avatar or group + * and before notification will be added to the notification system. + */ + virtual void modifyNotificationParams() = 0; + + LLNotification::Params mParams; + std::string mName; +}; #endif//LL_LLNOTIFICATIONS_H diff --git a/indra/llui/lltextbase.cpp b/indra/llui/lltextbase.cpp index fb8cb1c93b..e08026eaf4 100644 --- a/indra/llui/lltextbase.cpp +++ b/indra/llui/lltextbase.cpp @@ -962,7 +962,18 @@ void LLTextBase::reshape(S32 width, S32 height, BOOL called_from_parent) { if (width != getRect().getWidth() || height != getRect().getHeight()) { + //EXT-4288 + //to keep consistance scrolling behaviour + //when scrolling from top and from bottom... + bool is_scrolled_to_end = (mScroller!=NULL) && scrolledToEnd(); + LLUICtrl::reshape( width, height, called_from_parent ); + + if (is_scrolled_to_end) + { + deselect(); + endOfDoc(); + } // do this first after reshape, because other things depend on // up-to-date mVisibleTextRect |