diff options
| author | Tofu Linden <tofu.linden@lindenlab.com> | 2010-01-04 15:31:19 -0800 | 
|---|---|---|
| committer | Tofu Linden <tofu.linden@lindenlab.com> | 2010-01-04 15:31:19 -0800 | 
| commit | c9868071b113b251e03d95163118b696e28bbe98 (patch) | |
| tree | 8428d2e97f7a61b1a10e7e10494199a39969369d /indra/llui/llmultislider.cpp | |
| parent | e833e7ad442f5b59f95c6ccfcaaf1d103d247d69 (diff) | |
| parent | e8659e0e13c65308ad2f036dc7e7ccff0e665976 (diff) | |
Merge from trunk.  Conflicts manually resolved in:
U indra/llui/lluictrlfactory.cpp
U indra/newview/llinventorybridge.cpp
U indra/newview/llviewertexture.cpp
U indra/newview/llviewertexture.h
Diffstat (limited to 'indra/llui/llmultislider.cpp')
| -rw-r--r-- | indra/llui/llmultislider.cpp | 48 | 
1 files changed, 46 insertions, 2 deletions
diff --git a/indra/llui/llmultislider.cpp b/indra/llui/llmultislider.cpp index 1891bca36c..aea7c5f87c 100644 --- a/indra/llui/llmultislider.cpp +++ b/indra/llui/llmultislider.cpp @@ -50,6 +50,12 @@ const F32 FLOAT_THRESHOLD = 0.00001f;  S32 LLMultiSlider::mNameCounter = 0; +LLMultiSlider::SliderParams::SliderParams() +:	name("name"), +	value("value", 0.f) +{ +} +  LLMultiSlider::Params::Params()  :	max_sliders("max_sliders", 1),  	allow_overlap("allow_overlap", false), @@ -63,7 +69,8 @@ LLMultiSlider::Params::Params()  	triangle_color("triangle_color"),  	mouse_down_callback("mouse_down_callback"),  	mouse_up_callback("mouse_up_callback"), -	thumb_width("thumb_width") +	thumb_width("thumb_width"), +	sliders("slider")  {  	name = "multi_slider_bar";  	mouse_opaque(true); @@ -99,6 +106,20 @@ LLMultiSlider::LLMultiSlider(const LLMultiSlider::Params& p)  	{  		setMouseUpCallback(initCommitCallback(p.mouse_up_callback));  	} + +	for (LLInitParam::ParamIterator<SliderParams>::const_iterator it = p.sliders().begin(); +		it != p.sliders().end(); +		++it) +	{ +		if (it->name.isProvided()) +		{ +			addSlider(it->value, it->name); +		} +		else +		{ +			addSlider(it->value); +		} +	}  }  LLMultiSlider::~LLMultiSlider() @@ -230,6 +251,30 @@ const std::string& LLMultiSlider::addSlider(F32 val)  	return mCurSlider;  } +void LLMultiSlider::addSlider(F32 val, const std::string& name) +{ +	F32 initVal = val; + +	if(mValue.size() >= mMaxNumSliders) { +		return; +	} + +	bool foundOne = findUnusedValue(initVal); +	if(!foundOne) { +		return; +	} + +	// add a new thumb rect +	mThumbRects[name] = LLRect( 0, getRect().getHeight(), mThumbWidth, 0 ); + +	// add the value and set the current slider to this one +	mValue.insert(name, initVal); +	mCurSlider = name; + +	// move the slider +	setSliderValue(mCurSlider, initVal, TRUE); +} +  bool LLMultiSlider::findUnusedValue(F32& initVal)  {  	bool firstTry = true; @@ -572,7 +617,6 @@ void LLMultiSlider::draw()  	LLF32UICtrl::draw();  } -  boost::signals2::connection LLMultiSlider::setMouseDownCallback( const commit_signal_t::slot_type& cb )   {   	if (!mMouseDownSignal) mMouseDownSignal = new commit_signal_t();  | 
