diff options
Diffstat (limited to 'indra/llui')
-rw-r--r-- | indra/llui/llbutton.cpp | 7 | ||||
-rw-r--r-- | indra/llui/llbutton.h | 3 | ||||
-rw-r--r-- | indra/llui/lldockablefloater.h | 3 | ||||
-rw-r--r-- | indra/llui/lldockcontrol.h | 3 | ||||
-rw-r--r-- | indra/llui/llflatlistview.cpp | 8 | ||||
-rw-r--r-- | indra/llui/llfloater.cpp | 12 | ||||
-rw-r--r-- | indra/llui/llhelp.h | 2 | ||||
-rw-r--r-- | indra/llui/lltabcontainer.cpp | 2 | ||||
-rw-r--r-- | indra/llui/lltexteditor.cpp | 3 | ||||
-rw-r--r-- | indra/llui/llurlentry.cpp | 25 | ||||
-rw-r--r-- | indra/llui/llurlentry.h | 11 | ||||
-rw-r--r-- | indra/llui/llurlregistry.cpp | 18 |
12 files changed, 89 insertions, 8 deletions
diff --git a/indra/llui/llbutton.cpp b/indra/llui/llbutton.cpp index 7721137e29..e9f6288f44 100644 --- a/indra/llui/llbutton.cpp +++ b/indra/llui/llbutton.cpp @@ -63,7 +63,6 @@ template class LLButton* LLView::getChild<class LLButton>( // globals loaded from settings.xml S32 LLBUTTON_H_PAD = 0; -S32 LLBUTTON_V_PAD = 0; S32 BTN_HEIGHT_SMALL= 0; S32 BTN_HEIGHT = 0; @@ -93,6 +92,7 @@ LLButton::Params::Params() flash_color("flash_color"), pad_right("pad_right", LLUI::sSettingGroups["config"]->getS32("ButtonHPad")), pad_left("pad_left", LLUI::sSettingGroups["config"]->getS32("ButtonHPad")), + pad_bottom("pad_bottom"), click_callback("click_callback"), mouse_down_callback("mouse_down_callback"), mouse_up_callback("mouse_up_callback"), @@ -148,6 +148,7 @@ LLButton::LLButton(const LLButton::Params& p) mHAlign(p.font_halign), mLeftHPad(p.pad_left), mRightHPad(p.pad_right), + mBottomVPad(p.pad_bottom), mHoverGlowStrength(p.hover_glow_amount), mCommitOnReturn(p.commit_on_return), mFadeWhenDisabled(FALSE), @@ -839,7 +840,9 @@ void LLButton::draw() // LLFontGL::render expects S32 max_chars variable but process in a separate way -1 value. // Due to U32_MAX is equal to S32 -1 value I have rest this value for non-ellipses mode. // Not sure if it is really needed. Probably S32_MAX should be always passed as max_chars. - mLastDrawCharsCount = mGLFont->render(label, 0, (F32)x, (F32)(LLBUTTON_V_PAD + y_offset), + mLastDrawCharsCount = mGLFont->render(label, 0, + (F32)x, + (F32)(mBottomVPad + y_offset), label_color % alpha, mHAlign, LLFontGL::BOTTOM, LLFontGL::NORMAL, diff --git a/indra/llui/llbutton.h b/indra/llui/llbutton.h index 4c7400220d..5e28b8cdff 100644 --- a/indra/llui/llbutton.h +++ b/indra/llui/llbutton.h @@ -49,7 +49,6 @@ // PLEASE please use these "constants" when building your own buttons. // They are loaded from settings.xml at run time. extern S32 LLBUTTON_H_PAD; -extern S32 LLBUTTON_V_PAD; extern S32 BTN_HEIGHT_SMALL; extern S32 BTN_HEIGHT; @@ -105,6 +104,7 @@ public: // layout Optional<S32> pad_right; Optional<S32> pad_left; + Optional<S32> pad_bottom; // under text label // callbacks Optional<CommitCallbackParam> click_callback, // alias -> commit_callback @@ -310,6 +310,7 @@ private: LLFontGL::HAlign mHAlign; S32 mLeftHPad; S32 mRightHPad; + S32 mBottomVPad; // under text label F32 mHoverGlowStrength; F32 mCurGlowStrength; diff --git a/indra/llui/lldockablefloater.h b/indra/llui/lldockablefloater.h index 46491d8a29..2c339f4a3f 100644 --- a/indra/llui/lldockablefloater.h +++ b/indra/llui/lldockablefloater.h @@ -83,6 +83,8 @@ public: virtual void onDockHidden(); virtual void onDockShown(); + LLDockControl* getDockControl(); + private: /** * Provides unique of dockable floater. @@ -92,7 +94,6 @@ private: protected: void setDockControl(LLDockControl* dockControl); - LLDockControl* getDockControl(); const LLUIImagePtr& getDockTongue(); private: diff --git a/indra/llui/lldockcontrol.h b/indra/llui/lldockcontrol.h index 30a45bedc7..550955c4c5 100644 --- a/indra/llui/lldockcontrol.h +++ b/indra/llui/lldockcontrol.h @@ -76,6 +76,9 @@ public: // gets a rect that bounds possible positions for a dockable control (EXT-1111) void getAllowedRect(LLRect& rect); + S32 getTongueWidth() { return mDockTongue->getWidth(); } + S32 getTongueHeight() { return mDockTongue->getHeight(); } + private: virtual void moveDockable(); private: diff --git a/indra/llui/llflatlistview.cpp b/indra/llui/llflatlistview.cpp index 831ac66d06..64a4824a17 100644 --- a/indra/llui/llflatlistview.cpp +++ b/indra/llui/llflatlistview.cpp @@ -891,7 +891,13 @@ void LLFlatListView::setNoItemsCommentVisible(bool visible) const // We have to update child rect here because of issues with rect after reshaping while creating LLTextbox // It is possible to have invalid LLRect if Flat List is in LLAccordionTab LLRect comment_rect = getLocalRect(); - comment_rect.stretch(-getBorderWidth()); + + // To see comment correctly (EXT - 3244) in mNoItemsCommentTextbox we must get border width + // of LLFlatListView (@see getBorderWidth()) and stretch mNoItemsCommentTextbox to this width + // But getBorderWidth() returns 0 if LLFlatListView not visible. So we have to get border width + // from 'scroll_border' + LLViewBorder* scroll_border = getChild<LLViewBorder>("scroll border"); + comment_rect.stretch(-scroll_border->getBorderWidth()); mNoItemsCommentTextbox->setRect(comment_rect); } mNoItemsCommentTextbox->setVisible(visible); diff --git a/indra/llui/llfloater.cpp b/indra/llui/llfloater.cpp index 9037578077..5fd707fea3 100644 --- a/indra/llui/llfloater.cpp +++ b/indra/llui/llfloater.cpp @@ -2704,6 +2704,18 @@ bool LLFloater::initFloaterXML(LLXMLNodePtr node, LLView *parent, LLXMLNodePtr o output_node, output_params, &default_params); } + // Default floater position to top-left corner of screen + // However, some legacy floaters have explicit top or bottom + // coordinates set, so respect their wishes. + if (!params.rect.top.isProvided() && !params.rect.bottom.isProvided()) + { + params.rect.top.set(0); + } + if (!params.rect.left.isProvided() && !params.rect.right.isProvided()) + { + params.rect.left.set(0); + } + setupParams(params, parent); initFromParams(params); diff --git a/indra/llui/llhelp.h b/indra/llui/llhelp.h index 82c3bc385f..938419d374 100644 --- a/indra/llui/llhelp.h +++ b/indra/llui/llhelp.h @@ -42,6 +42,8 @@ class LLHelp virtual std::string defaultTopic() = 0; // return topic to use before the user logs in virtual std::string preLoginTopic() = 0; + // return topic to use for the top-level help, invoked by F1 + virtual std::string f1HelpTopic() = 0; }; #endif // headerguard diff --git a/indra/llui/lltabcontainer.cpp b/indra/llui/lltabcontainer.cpp index d7d61cf6cb..2d9106923e 100644 --- a/indra/llui/lltabcontainer.cpp +++ b/indra/llui/lltabcontainer.cpp @@ -906,7 +906,7 @@ void LLTabContainer::addTabPanel(const TabPanelParams& panel) if (placeholder) { - btn_rect.translate(0, -LLBUTTON_V_PAD-2); + btn_rect.translate(0, -3); // *TODO: make configurable LLTextBox::Params params; params.name(trimmed_label); params.rect(btn_rect); diff --git a/indra/llui/lltexteditor.cpp b/indra/llui/lltexteditor.cpp index e68affc36c..faf9ccbeb8 100644 --- a/indra/llui/lltexteditor.cpp +++ b/indra/llui/lltexteditor.cpp @@ -1887,9 +1887,10 @@ void LLTextEditor::doDelete() removeChar(); } - onKeyStroke(); } + onKeyStroke(); + needsReflow(); } diff --git a/indra/llui/llurlentry.cpp b/indra/llui/llurlentry.cpp index 7694d02837..7350457274 100644 --- a/indra/llui/llurlentry.cpp +++ b/indra/llui/llurlentry.cpp @@ -197,6 +197,31 @@ std::string LLUrlEntryHTTPLabel::getUrl(const std::string &string) } // +// LLUrlEntryHTTPNoProtocol Describes generic Urls like www.google.com +// +LLUrlEntryHTTPNoProtocol::LLUrlEntryHTTPNoProtocol() +{ + mPattern = boost::regex("(\\bwww\\.\\S+\\.\\S+|\\S+.com\\S*|\\S+.net\\S*|\\S+.edu\\S*|\\S+.org\\S*)", + boost::regex::perl|boost::regex::icase); + mMenuName = "menu_url_http.xml"; + mTooltip = LLTrans::getString("TooltipHttpUrl"); +} + +std::string LLUrlEntryHTTPNoProtocol::getLabel(const std::string &url, const LLUrlLabelCallback &cb) +{ + return unescapeUrl(url); +} + +std::string LLUrlEntryHTTPNoProtocol::getUrl(const std::string &string) +{ + if (string.find("://") == std::string::npos) + { + return "http://" + escapeUrl(string); + } + return escapeUrl(string); +} + +// // LLUrlEntrySLURL Describes generic http: and https: Urls // LLUrlEntrySLURL::LLUrlEntrySLURL() diff --git a/indra/llui/llurlentry.h b/indra/llui/llurlentry.h index b3fb333fdd..4adffde99c 100644 --- a/indra/llui/llurlentry.h +++ b/indra/llui/llurlentry.h @@ -135,6 +135,17 @@ public: }; /// +/// LLUrlEntryHTTPNoProtocol Describes generic Urls like www.google.com +/// +class LLUrlEntryHTTPNoProtocol : public LLUrlEntryBase +{ +public: + LLUrlEntryHTTPNoProtocol(); + /*virtual*/ std::string getLabel(const std::string &url, const LLUrlLabelCallback &cb); + /*virtual*/ std::string getUrl(const std::string &string); +}; + +/// /// LLUrlEntrySLURL Describes http://slurl.com/... Urls /// class LLUrlEntrySLURL : public LLUrlEntryBase diff --git a/indra/llui/llurlregistry.cpp b/indra/llui/llurlregistry.cpp index f47db2db1a..afcff0d409 100644 --- a/indra/llui/llurlregistry.cpp +++ b/indra/llui/llurlregistry.cpp @@ -58,6 +58,9 @@ LLUrlRegistry::LLUrlRegistry() //so it should be registered in the end of list registerUrl(new LLUrlEntrySL()); registerUrl(new LLUrlEntrySLLabel()); + // most common pattern is a URL without any protocol, + // e.g., "secondlife.com" + registerUrl(new LLUrlEntryHTTPNoProtocol()); } LLUrlRegistry::~LLUrlRegistry() @@ -118,10 +121,23 @@ static bool matchRegex(const char *text, boost::regex regex, U32 &start, U32 &en return true; } +static bool stringHasUrl(const std::string &text) +{ + // fast heuristic test for a URL in a string. This is used + // to avoid lots of costly regex calls, BUT it needs to be + // kept in sync with the LLUrlEntry regexes we support. + return (text.find("://") != std::string::npos || + text.find("www.") != std::string::npos || + text.find(".com") != std::string::npos || + text.find(".net") != std::string::npos || + text.find(".edu") != std::string::npos || + text.find(".org") != std::string::npos); +} + bool LLUrlRegistry::findUrl(const std::string &text, LLUrlMatch &match, const LLUrlLabelCallback &cb) { // avoid costly regexes if there is clearly no URL in the text - if (text.find("://") == std::string::npos) + if (! stringHasUrl(text)) { return false; } |