From bf7494017f5d90624243e5069dea9342c6b1869c Mon Sep 17 00:00:00 2001 From: Lynx Linden <lynx@lindenlab.com> Date: Mon, 21 Dec 2009 15:49:52 +0000 Subject: EXT-3486: Support SLapps and URLs in the nav bar. If the user enters a string into the navigation bar that is not recognized as an SL location, the behavior is now: - handle any secondlife:// SLapps, or - open any http: or https: URLs in the media browser, or - otherwise, send the text to the search floater --- indra/llui/llurlregistry.cpp | 20 ++++++++++++++++++++ indra/llui/llurlregistry.h | 4 ++++ 2 files changed, 24 insertions(+) (limited to 'indra/llui') diff --git a/indra/llui/llurlregistry.cpp b/indra/llui/llurlregistry.cpp index afcff0d409..ad5c0911f8 100644 --- a/indra/llui/llurlregistry.cpp +++ b/indra/llui/llurlregistry.cpp @@ -223,3 +223,23 @@ bool LLUrlRegistry::hasUrl(const LLWString &text) LLUrlMatch match; return findUrl(text, match); } + +bool LLUrlRegistry::isUrl(const std::string &text) +{ + LLUrlMatch match; + if (findUrl(text, match)) + { + return (match.getStart() == 0 && match.getEnd() >= text.size()-1); + } + return false; +} + +bool LLUrlRegistry::isUrl(const LLWString &text) +{ + LLUrlMatch match; + if (findUrl(text, match)) + { + return (match.getStart() == 0 && match.getEnd() >= text.size()-1); + } + return false; +} diff --git a/indra/llui/llurlregistry.h b/indra/llui/llurlregistry.h index d7800d8cfc..399ee0a988 100644 --- a/indra/llui/llurlregistry.h +++ b/indra/llui/llurlregistry.h @@ -85,6 +85,10 @@ public: bool hasUrl(const std::string &text); bool hasUrl(const LLWString &text); + // return true if the given string is a URL that findUrl would match + bool isUrl(const std::string &text); + bool isUrl(const LLWString &text); + private: LLUrlRegistry(); friend class LLSingleton<LLUrlRegistry>; -- cgit v1.2.3 From aa56836ab7537e3afad53c03da455e2e7dacb87a Mon Sep 17 00:00:00 2001 From: Yuri Chebotarev <ychebotarev@productengine.com> Date: Mon, 21 Dec 2009 18:15:44 +0200 Subject: additional fix for (EXT-3601) Accordion Ctrl didn't autoscroll to accordion header while navigating with keyboard there was no autoscroll when scrolled by keyboard to _last_ of _first_ item in LLFlatListView. --HG-- branch : product-engine --- indra/llui/llflatlistview.cpp | 24 +++++++++++++++++++++++- indra/llui/llflatlistview.h | 2 ++ 2 files changed, 25 insertions(+), 1 deletion(-) (limited to 'indra/llui') diff --git a/indra/llui/llflatlistview.cpp b/indra/llui/llflatlistview.cpp index 09124c3013..7b7a3139a4 100644 --- a/indra/llui/llflatlistview.cpp +++ b/indra/llui/llflatlistview.cpp @@ -560,6 +560,8 @@ BOOL LLFlatListView::handleKeyHere(KEY key, MASK mask) if ( ( key == KEY_UP || key == KEY_DOWN ) && mSelectedItemPairs.size() ) { + ensureSelectedVisible(); + /* LLRect visible_rc = getVisibleContentRect(); LLRect selected_rc = getLastSelectedItemRect(); @@ -572,7 +574,8 @@ BOOL LLFlatListView::handleKeyHere(KEY key, MASK mask) // In case we are in accordion tab notify parent to show selected rectangle LLRect screen_rc; localRectToScreen(selected_rc, &screen_rc); - notifyParent(LLSD().with("scrollToShowRect",screen_rc.getValue())); + notifyParent(LLSD().with("scrollToShowRect",screen_rc.getValue()));*/ + handled = TRUE; } @@ -694,11 +697,30 @@ LLRect LLFlatListView::getSelectedItemsRect() void LLFlatListView::selectFirstItem () { selectItemPair(mItemPairs.front(), true); + ensureSelectedVisible(); } void LLFlatListView::selectLastItem () { selectItemPair(mItemPairs.back(), true); + ensureSelectedVisible(); +} + +void LLFlatListView::ensureSelectedVisible() +{ + LLRect visible_rc = getVisibleContentRect(); + LLRect selected_rc = getLastSelectedItemRect(); + + if ( !visible_rc.contains (selected_rc) ) + { + // But scroll in Items panel coordinates + scrollToShowRect(selected_rc); + } + + // In case we are in accordion tab notify parent to show selected rectangle + LLRect screen_rc; + localRectToScreen(selected_rc, &screen_rc); + notifyParent(LLSD().with("scrollToShowRect",screen_rc.getValue())); } diff --git a/indra/llui/llflatlistview.h b/indra/llui/llflatlistview.h index ba824ff2df..26e84a6fe1 100644 --- a/indra/llui/llflatlistview.h +++ b/indra/llui/llflatlistview.h @@ -359,6 +359,8 @@ protected: LLRect getSelectedItemsRect(); + void ensureSelectedVisible(); + private: void setItemsNoScrollWidth(S32 new_width) {mItemsNoScrollWidth = new_width - 2 * mBorderThickness;} -- cgit v1.2.3