diff options
| author | skolb <none@none> | 2009-12-11 08:49:37 -0800 | 
|---|---|---|
| committer | skolb <none@none> | 2009-12-11 08:49:37 -0800 | 
| commit | 6542ffe2f05c47d74dfbe659041d956d609f91f3 (patch) | |
| tree | 7794c0737c5a78b0339c2c34b47c9d32c44de749 /indra/llui | |
| parent | 431bfca2ade364dc1165e402537e5e2d3616ebfd (diff) | |
| parent | eda8634b17133df5f3104d96ad56d3626a90aad8 (diff) | |
Merge viewer 2-0 into media
Diffstat (limited to 'indra/llui')
| -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/llhelp.h | 2 | ||||
| -rw-r--r-- | indra/llui/llmenugl.cpp | 2 | ||||
| -rw-r--r-- | indra/llui/llmenugl.h | 15 | ||||
| -rw-r--r-- | indra/llui/llpanel.h | 1 | ||||
| -rw-r--r-- | indra/llui/lltextbase.cpp | 2 | ||||
| -rw-r--r-- | indra/llui/lltexteditor.cpp | 3 | ||||
| -rw-r--r-- | indra/llui/lluictrl.cpp | 29 | ||||
| -rw-r--r-- | indra/llui/lluictrl.h | 17 | ||||
| -rw-r--r-- | indra/llui/llurlentry.cpp | 25 | ||||
| -rw-r--r-- | indra/llui/llurlentry.h | 11 | ||||
| -rw-r--r-- | indra/llui/llurlregistry.cpp | 18 | 
14 files changed, 80 insertions, 59 deletions
| 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/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/llmenugl.cpp b/indra/llui/llmenugl.cpp index 907f2352a0..fd5c2b7fef 100644 --- a/indra/llui/llmenugl.cpp +++ b/indra/llui/llmenugl.cpp @@ -761,7 +761,7 @@ void LLMenuItemCallGL::initFromParams(const Params& p)  {  	if (p.on_visible.isProvided())  	{ -		mVisibleSignal.connect(initVisibleCallback(p.on_visible)); +		mVisibleSignal.connect(initEnableCallback(p.on_visible));  	}  	if (p.on_enable.isProvided())  	{ diff --git a/indra/llui/llmenugl.h b/indra/llui/llmenugl.h index cbb9b4d344..61e06f9e5f 100644 --- a/indra/llui/llmenugl.h +++ b/indra/llui/llmenugl.h @@ -175,9 +175,7 @@ protected:  	// This function appends the character string representation of  	// the current accelerator key and mask to the provided string.  	void appendAcceleratorString( std::string& st ) const; -	 -	void initMenuEnableCallback(const EnableCallbackParam& cb, enable_signal_t& sig); -	 +		  protected:  	KEY mAcceleratorKey;  	MASK mAcceleratorMask; @@ -249,7 +247,7 @@ public:  	{  		Optional<EnableCallbackParam > on_enable;  		Optional<CommitCallbackParam > on_click; -		Optional<VisibleCallbackParam > on_visible; +		Optional<EnableCallbackParam > on_visible;  		Params()  			: on_enable("on_enable"),  			  on_click("on_click"), @@ -284,15 +282,10 @@ public:  	{  		return mEnableSignal.connect(cb);  	} -	 -	boost::signals2::connection setVisibleCallback( const visible_signal_t::slot_type& cb ) -	{ -		return mVisibleSignal.connect(cb); -	} -	 +		  private:  	enable_signal_t mEnableSignal; -	visible_signal_t mVisibleSignal; +	enable_signal_t mVisibleSignal;  };  //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/indra/llui/llpanel.h b/indra/llui/llpanel.h index a8bd5fd5e5..d0986a06d3 100644 --- a/indra/llui/llpanel.h +++ b/indra/llui/llpanel.h @@ -249,7 +249,6 @@ protected:  	LLCallbackMap::map_t mFactoryMap;  	CommitCallbackRegistry::ScopedRegistrar mCommitCallbackRegistrar;  	EnableCallbackRegistry::ScopedRegistrar mEnableCallbackRegistrar; -	VisibleCallbackRegistry::ScopedRegistrar mVisibleCallbackRegistrar;  	commit_signal_t* mVisibleSignal;		// Called when visibility changes, passes new visibility as LLSD() diff --git a/indra/llui/lltextbase.cpp b/indra/llui/lltextbase.cpp index 2a9515171a..e0503a0844 100644 --- a/indra/llui/lltextbase.cpp +++ b/indra/llui/lltextbase.cpp @@ -2080,6 +2080,8 @@ void LLTextBase::updateRects()  		}  		mContentsRect.mTop += mVPad; +		// subtract a pixel off the bottom to deal with rounding errors in measuring font height +		mContentsRect.mBottom -= 1;  		S32 delta_pos = -mContentsRect.mBottom;  		// move line segments to fit new document 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/lluictrl.cpp b/indra/llui/lluictrl.cpp index 706712ec5e..6044908ca7 100644 --- a/indra/llui/lluictrl.cpp +++ b/indra/llui/lluictrl.cpp @@ -232,11 +232,6 @@ bool default_enable_handler(LLUICtrl* ctrl, const LLSD& param)  	return true;  } -bool default_visible_handler(LLUICtrl* ctrl, const LLSD& param) -{ -	return true; -} -  LLUICtrl::commit_signal_t::slot_type LLUICtrl::initCommitCallback(const CommitCallbackParam& cb)  { @@ -290,30 +285,6 @@ LLUICtrl::enable_signal_t::slot_type LLUICtrl::initEnableCallback(const EnableCa  	return default_enable_handler;  } -LLUICtrl::visible_signal_t::slot_type LLUICtrl::initVisibleCallback(const VisibleCallbackParam& cb) -{ -	// Set the callback function -	if (cb.function.isProvided()) -	{ -		if (cb.parameter.isProvided()) -			return boost::bind(cb.function(), this, cb.parameter); -		else -			return cb.function(); -	} -	else -	{ -		visible_callback_t* func = (VisibleCallbackRegistry::getValue(cb.function_name)); -		if (func) -		{ -			if (cb.parameter.isProvided()) -				return boost::bind((*func), this, cb.parameter); -			else -				return visible_signal_t::slot_type(*func); -		} -	} -	return default_visible_handler; -} -  // virtual  void LLUICtrl::onMouseEnter(S32 x, S32 y, MASK mask)  { diff --git a/indra/llui/lluictrl.h b/indra/llui/lluictrl.h index b20ff5d798..b9a4f61e15 100644 --- a/indra/llui/lluictrl.h +++ b/indra/llui/lluictrl.h @@ -63,9 +63,6 @@ public:  	typedef boost::function<bool (LLUICtrl* ctrl, const LLSD& param)> enable_callback_t;  	typedef boost::signals2::signal<bool (LLUICtrl* ctrl, const LLSD& param), boost_boolean_combiner> enable_signal_t; -	typedef boost::function<bool (LLUICtrl* ctrl, const LLSD& param)> visible_callback_t; -	typedef boost::signals2::signal<bool (LLUICtrl* ctrl, const LLSD& param), boost_boolean_combiner> visible_signal_t; -	  	struct CallbackParam : public LLInitParam::Block<CallbackParam>  	{  		Ignored					name; @@ -83,16 +80,12 @@ public:  		Optional<commit_callback_t> function;  	}; +	// also used for visible callbacks  	struct EnableCallbackParam : public LLInitParam::Block<EnableCallbackParam, CallbackParam >  	{  		Optional<enable_callback_t> function;  	}; -	 -	struct VisibleCallbackParam : public LLInitParam::Block<VisibleCallbackParam, CallbackParam > -	{ -		Optional<visible_callback_t> function; -	}; -	 +		  	struct EnableControls : public LLInitParam::Choice<EnableControls>  	{  		Alternative<std::string> enabled; @@ -148,7 +141,6 @@ protected:  	commit_signal_t::slot_type initCommitCallback(const CommitCallbackParam& cb);  	enable_signal_t::slot_type initEnableCallback(const EnableCallbackParam& cb); -	visible_signal_t::slot_type initVisibleCallback(const VisibleCallbackParam& cb);  	// We need this virtual so we can override it with derived versions  	virtual LLViewModel* getViewModel() const; @@ -269,10 +261,9 @@ public:  	{};	  	class CommitCallbackRegistry : public CallbackRegistry<commit_callback_t, CommitCallbackRegistry>{}; +	// the enable callback registry is also used for visiblity callbacks  	class EnableCallbackRegistry : public CallbackRegistry<enable_callback_t, EnableCallbackRegistry>{}; -	class VisibleCallbackRegistry : public CallbackRegistry<visible_callback_t, VisibleCallbackRegistry>{}; - -	 +		  protected:  	static bool controlListener(const LLSD& newvalue, LLHandle<LLUICtrl> handle, std::string type); 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;  	} | 
