diff options
Diffstat (limited to 'indra/llui')
-rw-r--r-- | indra/llui/llflatlistview.cpp | 99 | ||||
-rw-r--r-- | indra/llui/llflatlistview.h | 6 | ||||
-rw-r--r-- | indra/llui/llfloater.cpp | 12 | ||||
-rw-r--r-- | indra/llui/llfloater.h | 3 | ||||
-rw-r--r-- | indra/llui/llnotificationsutil.cpp | 5 | ||||
-rw-r--r-- | indra/llui/llnotificationsutil.h | 2 | ||||
-rw-r--r-- | indra/llui/llscrollcontainer.cpp | 31 | ||||
-rw-r--r-- | indra/llui/llsearcheditor.cpp | 9 | ||||
-rw-r--r-- | indra/llui/llsearcheditor.h | 1 | ||||
-rw-r--r-- | indra/llui/lltextbase.cpp | 41 | ||||
-rw-r--r-- | indra/llui/lltextbase.h | 8 | ||||
-rw-r--r-- | indra/llui/llui.cpp | 6 | ||||
-rw-r--r-- | indra/llui/lluiimage.cpp | 36 | ||||
-rw-r--r-- | indra/llui/lluiimage.h | 9 | ||||
-rw-r--r-- | indra/llui/llurlentry.cpp | 26 | ||||
-rw-r--r-- | indra/llui/llurlregistry.cpp | 4 | ||||
-rw-r--r-- | indra/llui/llview.cpp | 11 | ||||
-rw-r--r-- | indra/llui/llview.h | 11 |
18 files changed, 207 insertions, 113 deletions
diff --git a/indra/llui/llflatlistview.cpp b/indra/llui/llflatlistview.cpp index f4a5f1c990..831ac66d06 100644 --- a/indra/llui/llflatlistview.cpp +++ b/indra/llui/llflatlistview.cpp @@ -689,6 +689,17 @@ LLRect LLFlatListView::getSelectedItemsRect() return rc; } +void LLFlatListView::selectFirstItem () +{ + selectItemPair(mItemPairs.front(), true); +} + +void LLFlatListView::selectLastItem () +{ + selectItemPair(mItemPairs.back(), true); +} + + // virtual bool LLFlatListView::selectNextItemPair(bool is_up_direction, bool reset_selection) { @@ -696,53 +707,53 @@ bool LLFlatListView::selectNextItemPair(bool is_up_direction, bool reset_selecti if ( !mItemPairs.size() ) return false; - item_pair_t* cur_sel_pair = NULL; + item_pair_t* to_sel_pair = NULL; - + item_pair_t* cur_sel_pair = NULL; if ( mSelectedItemPairs.size() ) { // Take the last selected pair cur_sel_pair = mSelectedItemPairs.back(); - } - else - { - // If there weren't selected items then choose the first one bases on given direction - cur_sel_pair = (is_up_direction) ? mItemPairs.back() : mItemPairs.front(); - // Force selection to first item - to_sel_pair = cur_sel_pair; - } - - // Bases on given direction choose next item to select - if ( is_up_direction ) - { - // Find current selected item position in mItemPairs list - pairs_list_t::reverse_iterator sel_it = std::find(mItemPairs.rbegin(), mItemPairs.rend(), cur_sel_pair); - - for (;++sel_it != mItemPairs.rend();) + // Bases on given direction choose next item to select + if ( is_up_direction ) { - // skip invisible items - if ( (*sel_it)->first->getVisible() ) + // Find current selected item position in mItemPairs list + pairs_list_t::reverse_iterator sel_it = std::find(mItemPairs.rbegin(), mItemPairs.rend(), cur_sel_pair); + + for (;++sel_it != mItemPairs.rend();) { - to_sel_pair = *sel_it; - break; + // skip invisible items + if ( (*sel_it)->first->getVisible() ) + { + to_sel_pair = *sel_it; + break; + } } } - } - else - { - // Find current selected item position in mItemPairs list - pairs_list_t::iterator sel_it = std::find(mItemPairs.begin(), mItemPairs.end(), cur_sel_pair); - - for (;++sel_it != mItemPairs.end();) + else { - // skip invisible items - if ( (*sel_it)->first->getVisible() ) + // Find current selected item position in mItemPairs list + pairs_list_t::iterator sel_it = std::find(mItemPairs.begin(), mItemPairs.end(), cur_sel_pair); + + for (;++sel_it != mItemPairs.end();) { - to_sel_pair = *sel_it; - break; + // skip invisible items + if ( (*sel_it)->first->getVisible() ) + { + to_sel_pair = *sel_it; + break; + } } } } + else + { + // If there weren't selected items then choose the first one bases on given direction + cur_sel_pair = (is_up_direction) ? mItemPairs.back() : mItemPairs.front(); + // Force selection to first item + to_sel_pair = cur_sel_pair; + } + if ( to_sel_pair ) { @@ -920,4 +931,26 @@ void LLFlatListView::onFocusLost() mSelectedItemsBorder->setVisible(FALSE); } +//virtual +S32 LLFlatListView::notify(const LLSD& info) +{ + if(info.has("action")) + { + std::string str_action = info["action"]; + if(str_action == "select_first") + { + setFocus(true); + selectFirstItem(); + return 1; + } + else if(str_action == "select_last") + { + setFocus(true); + selectLastItem(); + return 1; + } + } + return 0; +} + //EOF diff --git a/indra/llui/llflatlistview.h b/indra/llui/llflatlistview.h index 3867e910c0..ba824ff2df 100644 --- a/indra/llui/llflatlistview.h +++ b/indra/llui/llflatlistview.h @@ -279,6 +279,12 @@ public: bool updateValue(const LLSD& old_value, const LLSD& new_value); + + void selectFirstItem (); + void selectLastItem (); + + virtual S32 notify(const LLSD& info) ; + protected: /** Pairs LLpanel representing a single item LLPanel and LLSD associated with it */ diff --git a/indra/llui/llfloater.cpp b/indra/llui/llfloater.cpp index a63187678e..fd7b64af02 100644 --- a/indra/llui/llfloater.cpp +++ b/indra/llui/llfloater.cpp @@ -74,7 +74,6 @@ std::string LLFloater::sButtonNames[BUTTON_COUNT] = "llfloater_minimize_btn", //BUTTON_MINIMIZE "llfloater_tear_off_btn", //BUTTON_TEAR_OFF "llfloater_dock_btn", //BUTTON_DOCK - "llfloater_undock_btn", //BUTTON_UNDOCK "llfloater_help_btn" //BUTTON_HELP }; @@ -91,7 +90,6 @@ std::string LLFloater::sButtonToolTipsIndex[BUTTON_COUNT]= "BUTTON_MINIMIZE", //"Minimize", //BUTTON_MINIMIZE "BUTTON_TEAR_OFF", //"Tear Off", //BUTTON_TEAR_OFF "BUTTON_DOCK", - "BUTTON_UNDOCK", "BUTTON_HELP" }; @@ -102,7 +100,6 @@ LLFloater::click_callback LLFloater::sButtonCallbacks[BUTTON_COUNT] = LLFloater::onClickMinimize, //BUTTON_MINIMIZE LLFloater::onClickTearOff, //BUTTON_TEAR_OFF LLFloater::onClickDock, //BUTTON_DOCK - LLFloater::onClickDock, //BUTTON_UNDOCK LLFloater::onClickHelp //BUTTON_HELP }; @@ -179,14 +176,12 @@ LLFloater::Params::Params() minimize_image("minimize_image"), tear_off_image("tear_off_image"), dock_image("dock_image"), - undock_image("undock_image"), help_image("help_image"), close_pressed_image("close_pressed_image"), restore_pressed_image("restore_pressed_image"), minimize_pressed_image("minimize_pressed_image"), tear_off_pressed_image("tear_off_pressed_image"), dock_pressed_image("dock_pressed_image"), - undock_pressed_image("undock_pressed_image"), help_pressed_image("help_pressed_image"), open_callback("open_callback"), close_callback("close_callback") @@ -1395,12 +1390,10 @@ void LLFloater::setCanDock(bool b) if(mCanDock) { mButtonsEnabled[BUTTON_DOCK] = !mDocked; - mButtonsEnabled[BUTTON_UNDOCK] = mDocked; } else { mButtonsEnabled[BUTTON_DOCK] = FALSE; - mButtonsEnabled[BUTTON_UNDOCK] = FALSE; } } updateButtons(); @@ -1412,7 +1405,6 @@ void LLFloater::setDocked(bool docked, bool pop_on_undock) { mDocked = docked; mButtonsEnabled[BUTTON_DOCK] = !mDocked; - mButtonsEnabled[BUTTON_UNDOCK] = mDocked; updateButtons(); storeDockStateControl(); @@ -1864,8 +1856,6 @@ LLUIImage* LLFloater::getButtonImage(const Params& p, EFloaterButton e) return p.tear_off_image; case BUTTON_DOCK: return p.dock_image; - case BUTTON_UNDOCK: - return p.undock_image; case BUTTON_HELP: return p.help_image; } @@ -1887,8 +1877,6 @@ LLUIImage* LLFloater::getButtonPressedImage(const Params& p, EFloaterButton e) return p.tear_off_pressed_image; case BUTTON_DOCK: return p.dock_pressed_image; - case BUTTON_UNDOCK: - return p.undock_pressed_image; case BUTTON_HELP: return p.help_pressed_image; } diff --git a/indra/llui/llfloater.h b/indra/llui/llfloater.h index b5c835cb47..daf558de24 100644 --- a/indra/llui/llfloater.h +++ b/indra/llui/llfloater.h @@ -90,7 +90,6 @@ public: BUTTON_MINIMIZE, BUTTON_TEAR_OFF, BUTTON_DOCK, - BUTTON_UNDOCK, BUTTON_HELP, BUTTON_COUNT }; @@ -121,14 +120,12 @@ public: minimize_image, tear_off_image, dock_image, - undock_image, help_image; Optional<LLUIImage*> close_pressed_image, restore_pressed_image, minimize_pressed_image, tear_off_pressed_image, dock_pressed_image, - undock_pressed_image, help_pressed_image; Optional<CommitCallbackParam> open_callback, diff --git a/indra/llui/llnotificationsutil.cpp b/indra/llui/llnotificationsutil.cpp index 2cd165f1b3..f343d27cb4 100644 --- a/indra/llui/llnotificationsutil.cpp +++ b/indra/llui/llnotificationsutil.cpp @@ -89,3 +89,8 @@ S32 LLNotificationsUtil::getSelectedOption(const LLSD& notification, const LLSD& { return LLNotification::getSelectedOption(notification, response); } + +void LLNotificationsUtil::cancel(LLNotificationPtr pNotif) +{ + LLNotifications::instance().cancel(pNotif); +} diff --git a/indra/llui/llnotificationsutil.h b/indra/llui/llnotificationsutil.h index a0801b338f..d552fa915b 100644 --- a/indra/llui/llnotificationsutil.h +++ b/indra/llui/llnotificationsutil.h @@ -63,6 +63,8 @@ namespace LLNotificationsUtil boost::function<void (const LLSD&, const LLSD&)> functor); S32 getSelectedOption(const LLSD& notification, const LLSD& response); + + void cancel(LLNotificationPtr pNotif); } #endif diff --git a/indra/llui/llscrollcontainer.cpp b/indra/llui/llscrollcontainer.cpp index f6caed4617..a5e47e8547 100644 --- a/indra/llui/llscrollcontainer.cpp +++ b/indra/llui/llscrollcontainer.cpp @@ -235,18 +235,37 @@ BOOL LLScrollContainer::handleKeyHere(KEY key, MASK mask) BOOL LLScrollContainer::handleScrollWheel( S32 x, S32 y, S32 clicks ) { - if(LLUICtrl::handleScrollWheel(x,y,clicks)) + // Give event to my child views - they may have scroll bars + // (Bad UI design, but technically possible.) + if (LLUICtrl::handleScrollWheel(x,y,clicks)) return TRUE; - for( S32 i = 0; i < SCROLLBAR_COUNT; i++ ) - { - // Note: tries vertical and then horizontal + // When the vertical scrollbar is visible, scroll wheel + // only affects vertical scrolling. It's confusing to have + // scroll wheel perform both vertical and horizontal in a + // single container. + LLScrollbar* vertical = mScrollbar[VERTICAL]; + if (vertical->getVisible() + && vertical->getEnabled()) + { // Pretend the mouse is over the scrollbar - if( mScrollbar[i]->handleScrollWheel( 0, 0, clicks ) ) + if (vertical->handleScrollWheel( 0, 0, clicks ) ) { updateScroll(); - return TRUE; } + // Always eat the event + return TRUE; + } + + LLScrollbar* horizontal = mScrollbar[HORIZONTAL]; + // Test enablement and visibility for consistency with + // LLView::childrenHandleScrollWheel(). + if (horizontal->getVisible() + && horizontal->getEnabled() + && horizontal->handleScrollWheel( 0, 0, clicks ) ) + { + updateScroll(); + return TRUE; } return FALSE; } diff --git a/indra/llui/llsearcheditor.cpp b/indra/llui/llsearcheditor.cpp index fad2b7bc99..6fa99df82e 100644 --- a/indra/llui/llsearcheditor.cpp +++ b/indra/llui/llsearcheditor.cpp @@ -141,6 +141,15 @@ void LLSearchEditor::clear() } } +//virtual +void LLSearchEditor::setFocus( BOOL b ) +{ + if (mSearchEditor) + { + mSearchEditor->setFocus(b); + } +} + void LLSearchEditor::onClearButtonClick(const LLSD& data) { setText(LLStringUtil::null); diff --git a/indra/llui/llsearcheditor.h b/indra/llui/llsearcheditor.h index f395e7e816..bd2d595174 100644 --- a/indra/llui/llsearcheditor.h +++ b/indra/llui/llsearcheditor.h @@ -83,6 +83,7 @@ public: virtual BOOL setLabelArg( const std::string& key, const LLStringExplicit& text ); virtual void setLabel( const LLStringExplicit &new_label ); virtual void clear(); + virtual void setFocus( BOOL b ); void setKeystrokeCallback( commit_callback_t cb ) { mKeystrokeCallback = cb; } diff --git a/indra/llui/lltextbase.cpp b/indra/llui/lltextbase.cpp index 82a3c5cf47..2a9515171a 100644 --- a/indra/llui/lltextbase.cpp +++ b/indra/llui/lltextbase.cpp @@ -194,7 +194,7 @@ LLTextBase::LLTextBase(const LLTextBase::Params &p) mHAlign(p.font_halign), mLineSpacingMult(p.line_spacing.multiple), mLineSpacingPixels(p.line_spacing.pixels), - mClipPartial(p.clip_partial), + mClipPartial(p.clip_partial && !p.allow_scroll), mTrackEnd( p.track_end ), mScrollIndex(-1), mSelectionStart( 0 ), @@ -529,11 +529,6 @@ void LLTextBase::drawText() S32 next_line = cur_line + 1; line_info& line = mLineInfoList[cur_line]; - if ((line.mRect.mTop - scrolled_view_rect.mBottom) < mTextRect.mBottom) - { - break; - } - S32 next_start = -1; S32 line_end = text_len; @@ -543,17 +538,9 @@ void LLTextBase::drawText() line_end = next_start; } - // A patch for EXT-1944 "Implement ellipses in message well" - // introduced a regression where text in SansSerif ending in the - // letter "r" is clipped. This may be due to an off-by-one in - // font width information out of FreeType with our fractional font - // sizes. For now, just make an extra pixel of space to resolve - // EXT-2971 "Letter R doesn't show when it's the last letter in a - // text block". See James/Richard for details. - const S32 FIX_CLIPPING_HACK = 1; LLRect text_rect(line.mRect.mLeft + mTextRect.mLeft - scrolled_view_rect.mLeft, line.mRect.mTop - scrolled_view_rect.mBottom + mTextRect.mBottom, - llmin(mDocumentView->getRect().getWidth(), line.mRect.mRight) - scrolled_view_rect.mLeft + FIX_CLIPPING_HACK, + llmin(mDocumentView->getRect().getWidth(), line.mRect.mRight) - scrolled_view_rect.mLeft, line.mRect.mBottom - scrolled_view_rect.mBottom + mTextRect.mBottom); // draw a single line of text @@ -1086,6 +1073,10 @@ void LLTextBase::reflow(S32 start_index) { mReflowNeeded = FALSE; + // shrink document to minimum size (visible portion of text widget) + // to force inlined widgets with follows set to shrink + mDocumentView->setShape(mTextRect); + bool scrolled_to_bottom = mScroller ? mScroller->isAtBottom() : false; LLRect old_cursor_rect = getLocalRectFromDocIndex(mCursorPos); @@ -1348,13 +1339,11 @@ std::pair<S32, S32> LLTextBase::getVisibleLines(bool fully_visible) if (fully_visible) { - // binary search for line that starts before top of visible buffer and starts before end of visible buffer first_iter = std::lower_bound(mLineInfoList.begin(), mLineInfoList.end(), visible_region.mTop, compare_top()); last_iter = std::lower_bound(mLineInfoList.begin(), mLineInfoList.end(), visible_region.mBottom, compare_bottom()); } else { - // binary search for line that starts before top of visible buffer and starts before end of visible buffer first_iter = std::lower_bound(mLineInfoList.begin(), mLineInfoList.end(), visible_region.mTop, compare_bottom()); last_iter = std::lower_bound(mLineInfoList.begin(), mLineInfoList.end(), visible_region.mBottom, compare_top()); } @@ -2105,7 +2094,7 @@ void LLTextBase::updateRects() LLRect doc_rect = mContentsRect; // use old mTextRect constraint document to width of viewable region doc_rect.mLeft = 0; - doc_rect.mRight = mTextRect.getWidth(); + doc_rect.mRight = llmax(mTextRect.getWidth(), mContentsRect.mRight); mDocumentView->setShape(doc_rect); @@ -2125,7 +2114,7 @@ void LLTextBase::updateRects() } // update document container again, using new mTextRect - doc_rect.mRight = doc_rect.mLeft + mTextRect.getWidth(); + doc_rect.mRight = llmax(mTextRect.getWidth(), mContentsRect.mRight); mDocumentView->setShape(doc_rect); } @@ -2218,6 +2207,12 @@ LLNormalTextSegment::LLNormalTextSegment( const LLStyleSP& style, S32 start, S32 mEditor(editor) { mFontHeight = llceil(mStyle->getFont()->getLineHeight()); + + LLUIImagePtr image = mStyle->getImage(); + if (image.notNull()) + { + mImageLoadedConnection = image->addLoadedCallback(boost::bind(&LLTextBase::needsReflow, &mEditor)); + } } LLNormalTextSegment::LLNormalTextSegment( const LLColor4& color, S32 start, S32 end, LLTextBase& editor, BOOL is_visible) @@ -2230,6 +2225,12 @@ LLNormalTextSegment::LLNormalTextSegment( const LLColor4& color, S32 start, S32 mFontHeight = llceil(mStyle->getFont()->getLineHeight()); } +LLNormalTextSegment::~LLNormalTextSegment() +{ + mImageLoadedConnection.disconnect(); +} + + F32 LLNormalTextSegment::draw(S32 start, S32 end, S32 selection_start, S32 selection_end, const LLRect& draw_rect) { if( end - start > 0 ) @@ -2243,7 +2244,7 @@ F32 LLNormalTextSegment::draw(S32 start, S32 end, S32 selection_start, S32 selec // Center the image vertically S32 image_bottom = draw_rect.getCenterY() - (style_image_height/2); image->draw(draw_rect.mLeft, image_bottom, - style_image_width, style_image_height); + style_image_width, style_image_height, color); } return drawClippedSegment( getStart() + start, getStart() + end, selection_start, selection_end, draw_rect); diff --git a/indra/llui/lltextbase.h b/indra/llui/lltextbase.h index c60b040655..0138ca3704 100644 --- a/indra/llui/lltextbase.h +++ b/indra/llui/lltextbase.h @@ -136,7 +136,6 @@ public: // TODO: move into LLTextSegment? void createUrlContextMenu(S32 x, S32 y, const std::string &url); // create a popup context menu for the given Url - // Text accessors // TODO: add optional style parameter virtual void setText(const LLStringExplicit &utf8str , const LLStyle::Params& input_params = LLStyle::Params()); // uses default style @@ -148,6 +147,8 @@ public: LLWString getWText() const; void appendText(const std::string &new_text, bool prepend_newline, const LLStyle::Params& input_params = LLStyle::Params()); + // force reflow of text + void needsReflow() { mReflowNeeded = TRUE; } S32 getLength() const { return getWText().length(); } S32 getLineCount() const { return mLineInfoList.size(); } @@ -162,7 +163,6 @@ public: S32 getVPad() { return mVPad; } S32 getHPad() { return mHPad; } - S32 getDocIndexFromLocalCoord( S32 local_x, S32 local_y, BOOL round ) const; LLRect getLocalRectFromDocIndex(S32 pos) const; LLRect getDocRectFromDocIndex(S32 pos) const; @@ -180,6 +180,7 @@ public: void changePage( S32 delta ); void changeLine( S32 delta ); + const LLFontGL* getDefaultFont() const { return mDefaultFont; } public: @@ -303,7 +304,6 @@ protected: // misc void updateRects(); - void needsReflow() { mReflowNeeded = TRUE; } void needsScroll() { mScrollNeeded = TRUE; } void replaceUrlLabel(const std::string &url, const std::string &label); @@ -426,6 +426,7 @@ class LLNormalTextSegment : public LLTextSegment public: LLNormalTextSegment( const LLStyleSP& style, S32 start, S32 end, LLTextBase& editor ); LLNormalTextSegment( const LLColor4& color, S32 start, S32 end, LLTextBase& editor, BOOL is_visible = TRUE); + ~LLNormalTextSegment(); /*virtual*/ bool getDimensions(S32 first_char, S32 num_chars, S32& width, S32& height) const; /*virtual*/ S32 getOffset(S32 segment_local_x_coord, S32 start_offset, S32 num_chars, bool round) const; @@ -457,6 +458,7 @@ protected: S32 mFontHeight; LLKeywordToken* mToken; std::string mTooltip; + boost::signals2::connection mImageLoadedConnection; }; class LLIndexSegment : public LLTextSegment diff --git a/indra/llui/llui.cpp b/indra/llui/llui.cpp index 4cf503b413..6603887905 100644 --- a/indra/llui/llui.cpp +++ b/indra/llui/llui.cpp @@ -1847,8 +1847,8 @@ LLControlGroup& LLUI::getControlControlGroup (const std::string& controlname) // spawn_x and spawn_y are top left corner of view in screen GL coordinates void LLUI::positionViewNearMouse(LLView* view, S32 spawn_x, S32 spawn_y) { - const S32 CURSOR_HEIGHT = 18; // Approximate "normal" cursor size - const S32 CURSOR_WIDTH = 9; + const S32 CURSOR_HEIGHT = 16; // Approximate "normal" cursor size + const S32 CURSOR_WIDTH = 8; LLView* parent = view->getParent(); @@ -1866,7 +1866,7 @@ void LLUI::positionViewNearMouse(LLView* view, S32 spawn_x, S32 spawn_y) LLRect virtual_window_rect = parent->getLocalRect(); LLRect mouse_rect; - const S32 MOUSE_CURSOR_PADDING = 5; + const S32 MOUSE_CURSOR_PADDING = 1; mouse_rect.setLeftTopAndSize(mouse_x - MOUSE_CURSOR_PADDING, mouse_y + MOUSE_CURSOR_PADDING, CURSOR_WIDTH + MOUSE_CURSOR_PADDING * 2, diff --git a/indra/llui/lluiimage.cpp b/indra/llui/lluiimage.cpp index a8683e55c3..f941f391eb 100644 --- a/indra/llui/lluiimage.cpp +++ b/indra/llui/lluiimage.cpp @@ -39,18 +39,20 @@ #include "lluiimage.h" #include "llui.h" -LLUIImage::LLUIImage(const std::string& name, LLPointer<LLTexture> image) : - mName(name), - mImage(image), - mScaleRegion(0.f, 1.f, 1.f, 0.f), - mClipRegion(0.f, 1.f, 1.f, 0.f), - mUniformScaling(TRUE), - mNoClip(TRUE) +LLUIImage::LLUIImage(const std::string& name, LLPointer<LLTexture> image) +: mName(name), + mImage(image), + mScaleRegion(0.f, 1.f, 1.f, 0.f), + mClipRegion(0.f, 1.f, 1.f, 0.f), + mUniformScaling(TRUE), + mNoClip(TRUE), + mImageLoaded(NULL) { } LLUIImage::~LLUIImage() { + delete mImageLoaded; } void LLUIImage::setClipRegion(const LLRectf& region) @@ -138,6 +140,25 @@ S32 LLUIImage::getTextureHeight() const return mImage->getHeight(0); } +boost::signals2::connection LLUIImage::addLoadedCallback( const image_loaded_signal_t::slot_type& cb ) +{ + if (!mImageLoaded) + { + mImageLoaded = new image_loaded_signal_t(); + } + return mImageLoaded->connect(cb); +} + + +void LLUIImage::onImageLoaded() +{ + if (mImageLoaded) + { + (*mImageLoaded)(); + } +} + + namespace LLInitParam { LLUIImage* TypedParam<LLUIImage*>::getValueFromBlock() const @@ -170,3 +191,4 @@ namespace LLInitParam return (a == b); } } + diff --git a/indra/llui/lluiimage.h b/indra/llui/lluiimage.h index 9d734bcfdf..5fa9610ab2 100644 --- a/indra/llui/lluiimage.h +++ b/indra/llui/lluiimage.h @@ -39,6 +39,7 @@ #include "llrefcount.h" #include "llrect.h" #include <boost/function.hpp> +#include <boost/signals2.hpp> #include "llinitparam.h" #include "lltexture.h" @@ -47,6 +48,8 @@ extern const LLColor4 UI_VERTEX_COLOR; class LLUIImage : public LLRefCount { public: + typedef boost::signals2::signal<void (void)> image_loaded_signal_t; + LLUIImage(const std::string& name, LLPointer<LLTexture> image); virtual ~LLUIImage(); @@ -77,7 +80,13 @@ public: S32 getTextureWidth() const; S32 getTextureHeight() const; + boost::signals2::connection addLoadedCallback( const image_loaded_signal_t::slot_type& cb ); + + void onImageLoaded(); + protected: + image_loaded_signal_t* mImageLoaded; + std::string mName; LLRectf mScaleRegion; LLRectf mClipRegion; diff --git a/indra/llui/llurlentry.cpp b/indra/llui/llurlentry.cpp index b51709e208..7694d02837 100644 --- a/indra/llui/llurlentry.cpp +++ b/indra/llui/llurlentry.cpp @@ -386,36 +386,24 @@ std::string LLUrlEntryGroup::getLabel(const std::string &url, const LLUrlLabelCa // // LLUrlEntryInventory Describes a Second Life inventory Url, e.g., -// secondlife:///app/agent/0e346d8b-4433-4d66-a6b0-fd37083abc4c/select +// secondlife:///app/inventory/0e346d8b-4433-4d66-a6b0-fd37083abc4c/select // LLUrlEntryInventory::LLUrlEntryInventory() { - mPattern = boost::regex("secondlife:///app/inventory/[\\da-f-]+/\\w+", + //*TODO: add supporting of inventory item names with whitespaces + //this pattern cann't parse for example + //secondlife:///app/inventory/0e346d8b-4433-4d66-a6b0-fd37083abc4c/select?name=name with spaces¶m2=value + mPattern = boost::regex("secondlife:///app/inventory/[\\da-f-]+/\\w+\\S*", boost::regex::perl|boost::regex::icase); mMenuName = "menu_url_inventory.xml"; } std::string LLUrlEntryInventory::getLabel(const std::string &url, const LLUrlLabelCallback &cb) { - return unescapeUrl(url); - // TODO: Figure out if we can somehow access the inventory from here to get the actual item name - /* - std::string inventory_id_string = getIDStringFromUrl(url); - if (inventory_id_string.empty()) - { - // something went wrong, give raw url - return unescapeUrl(url); - } - LLUUID inventory_id(inventory_id_string); - LLInventoryItem* item = gInventory.getItem(inventory_id); - if(!item) - { - return unescapeUrl(url); - } - return item->getName(); */ + std::string label = getStringAfterToken(url, "name="); + return LLURI::unescape(label.empty() ? url : label); } - /// /// LLUrlEntryParcel Describes a Second Life parcel Url, e.g., /// secondlife:///app/parcel/0000060e-4b39-e00b-d0c3-d98b1934e3a8/about diff --git a/indra/llui/llurlregistry.cpp b/indra/llui/llurlregistry.cpp index b2f084e5ac..f47db2db1a 100644 --- a/indra/llui/llurlregistry.cpp +++ b/indra/llui/llurlregistry.cpp @@ -53,9 +53,11 @@ LLUrlRegistry::LLUrlRegistry() registerUrl(new LLUrlEntryTeleport()); registerUrl(new LLUrlEntryWorldMap()); registerUrl(new LLUrlEntryPlace()); + registerUrl(new LLUrlEntryInventory()); + //LLUrlEntrySL and LLUrlEntrySLLabel have more common pattern, + //so it should be registered in the end of list registerUrl(new LLUrlEntrySL()); registerUrl(new LLUrlEntrySLLabel()); - registerUrl(new LLUrlEntryInventory()); } LLUrlRegistry::~LLUrlRegistry() diff --git a/indra/llui/llview.cpp b/indra/llui/llview.cpp index 6f8455774d..8917e4b813 100644 --- a/indra/llui/llview.cpp +++ b/indra/llui/llview.cpp @@ -2850,18 +2850,21 @@ LLView::default_widget_map_t& LLView::getDefaultWidgetMap() const return *mDefaultWidgets; } -void LLView::notifyParent(const LLSD& info) +S32 LLView::notifyParent(const LLSD& info) { LLView* parent = getParent(); if(parent) - parent->notifyParent(info); + return parent->notifyParent(info); + return 0; } -void LLView::notifyChildren(const LLSD& info) +bool LLView::notifyChildren(const LLSD& info) { + bool ret = false; for ( child_list_iter_t child_it = mChildList.begin(); child_it != mChildList.end(); ++child_it) { - (*child_it)->notifyChildren(info); + ret |= (*child_it)->notifyChildren(info); } + return ret; } // convenient accessor for draw context diff --git a/indra/llui/llview.h b/indra/llui/llview.h index d485244a05..f8460f5361 100644 --- a/indra/llui/llview.h +++ b/indra/llui/llview.h @@ -511,8 +511,15 @@ public: virtual void handleReshape(const LLRect& rect, bool by_user); virtual void dirtyRect(); - virtual void notifyParent(const LLSD& info); - virtual void notifyChildren(const LLSD& info); + //send custom notification to LLView parent + virtual S32 notifyParent(const LLSD& info); + + //send custom notification to all view childrend + // return true if _any_ children return true. otherwise false. + virtual bool notifyChildren(const LLSD& info); + + //send custom notification to current view + virtual S32 notify(const LLSD& info) { return 0;}; static const LLViewDrawContext& getDrawContext(); |