diff --git a/indra/llui/llfunctorregistry.h b/indra/llui/llfunctorregistry.h index 7c03f2f69..31d48084b 100644 --- a/indra/llui/llfunctorregistry.h +++ b/indra/llui/llfunctorregistry.h @@ -40,7 +40,7 @@ #include #include "llsd.h" -#include "llmemory.h" +#include "llsingleton.h" /** * @class LLFunctorRegistry diff --git a/indra/llui/llmenugl.cpp b/indra/llui/llmenugl.cpp index 21c216c8c..cf9af9b32 100644 --- a/indra/llui/llmenugl.cpp +++ b/indra/llui/llmenugl.cpp @@ -77,11 +77,6 @@ S32 MENU_BAR_WIDTH = 0; /// Local function declarations, constants, enums, and typedefs ///============================================================================ -const std::string SEPARATOR_NAME("separator"); -const std::string TEAROFF_SEPARATOR_LABEL( "~~~~~~~~~~~" ); -const std::string SEPARATOR_LABEL( "-----------" ); -const std::string VERTICAL_SEPARATOR_LABEL( "|" ); - const S32 LABEL_BOTTOM_PAD_PIXELS = 2; const U32 LEFT_PAD_PIXELS = 3; @@ -101,7 +96,12 @@ const U32 SEPARATOR_HEIGHT_PIXELS = 8; const S32 TEAROFF_SEPARATOR_HEIGHT_PIXELS = 10; const S32 MENU_ITEM_PADDING = 4; -const std::string BOOLEAN_TRUE_PREFIX( "\xe2\x9c\x93" ); // U+2714 -- MC +const std::string SEPARATOR_NAME("separator"); +const std::string SEPARATOR_LABEL( "-----------" ); +const std::string VERTICAL_SEPARATOR_LABEL( "|" ); +const std::string TEAROFF_SEPARATOR_LABEL( "~~~~~~~~~~~" ); + +const std::string BOOLEAN_TRUE_PREFIX( "\xE2\x9C\x94" ); // U+2714 HEAVY CHECK MARK const std::string BRANCH_SUFFIX( "\xE2\x96\xB6" ); // U+25B6 BLACK RIGHT-POINTING TRIANGLE const std::string ARROW_UP ("^^^^^^^"); const std::string ARROW_DOWN("vvvvvvv"); diff --git a/indra/llui/llmultislider.cpp b/indra/llui/llmultislider.cpp index 06903d742..810cb0a25 100644 --- a/indra/llui/llmultislider.cpp +++ b/indra/llui/llmultislider.cpp @@ -88,8 +88,9 @@ LLMultiSlider::LLMultiSlider( mThumbCenterSelectedColor( LLUI::sColorsGroup->getColor( "MultiSliderThumbCenterSelectedColor" ) ), mDisabledThumbColor(LLUI::sColorsGroup->getColor( "MultiSliderDisabledThumbColor" ) ), mTriangleColor(LLUI::sColorsGroup->getColor( "MultiSliderTriangleColor" ) ), - mMouseDownCallback( NULL ), - mMouseUpCallback( NULL ) + mMouseDownSignal( NULL ), + mMouseUpSignal( NULL ), + mThumbWidth(MULTI_THUMB_WIDTH) { mValue.emptyMap(); mCurSlider = LLStringUtil::null; @@ -101,6 +102,13 @@ LLMultiSlider::LLMultiSlider( setValue(getValue()); } +LLMultiSlider::~LLMultiSlider() +{ + delete mMouseDownSignal; + delete mMouseUpSignal; +} + + void LLMultiSlider::setSliderValue(const std::string& name, F32 value, BOOL from_event) { // exit if not there @@ -152,12 +160,12 @@ void LLMultiSlider::setSliderValue(const std::string& name, F32 value, BOOL from F32 t = (newValue - mMinValue) / (mMaxValue - mMinValue); - S32 left_edge = MULTI_THUMB_WIDTH/2; - S32 right_edge = getRect().getWidth() - (MULTI_THUMB_WIDTH/2); + S32 left_edge = mThumbWidth/2; + S32 right_edge = getRect().getWidth() - (mThumbWidth/2); S32 x = left_edge + S32( t * (right_edge - left_edge) ); - mThumbRects[name].mLeft = x - (MULTI_THUMB_WIDTH/2); - mThumbRects[name].mRight = x + (MULTI_THUMB_WIDTH/2); + mThumbRects[name].mLeft = x - (mThumbWidth/2); + mThumbRects[name].mRight = x + (mThumbWidth/2); } void LLMultiSlider::setValue(const LLSD& value) @@ -211,7 +219,7 @@ const std::string& LLMultiSlider::addSlider(F32 val) } // add a new thumb rect - mThumbRects[newName.str()] = LLRect( 0, getRect().getHeight(), MULTI_THUMB_WIDTH, 0 ); + mThumbRects[newName.str()] = LLRect( 0, getRect().getHeight(), mThumbWidth, 0 ); // add the value and set the current slider to this one mValue.insert(newName.str(), initVal); @@ -223,6 +231,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; @@ -302,8 +334,8 @@ BOOL LLMultiSlider::handleHover(S32 x, S32 y, MASK mask) { if( gFocusMgr.getMouseCapture() == this ) { - S32 left_edge = MULTI_THUMB_WIDTH/2; - S32 right_edge = getRect().getWidth() - (MULTI_THUMB_WIDTH/2); + S32 left_edge = mThumbWidth/2; + S32 right_edge = getRect().getWidth() - (mThumbWidth/2); x += mMouseOffset; x = llclamp( x, left_edge, right_edge ); @@ -331,10 +363,9 @@ BOOL LLMultiSlider::handleMouseUp(S32 x, S32 y, MASK mask) { gFocusMgr.setMouseCapture( NULL ); - if( mMouseUpCallback ) - { - mMouseUpCallback( this, mCallbackUserData ); - } + if (mMouseUpSignal) + (*mMouseUpSignal)( this, LLSD() ); + handled = TRUE; make_ui_sound("UISndClickRelease"); } @@ -353,10 +384,8 @@ BOOL LLMultiSlider::handleMouseDown(S32 x, S32 y, MASK mask) { setFocus(TRUE); } - if( mMouseDownCallback ) - { - mMouseDownCallback( this, mCallbackUserData ); - } + if (mMouseDownSignal) + (*mMouseDownSignal)( this, LLSD() ); if (MASK_CONTROL & mask) // if CTRL is modifying { @@ -379,7 +408,7 @@ BOOL LLMultiSlider::handleMouseDown(S32 x, S32 y, MASK mask) // Find the offset of the actual mouse location from the center of the thumb. if (mThumbRects[mCurSlider].pointInRect(x,y)) { - mMouseOffset = (mThumbRects[mCurSlider].mLeft + MULTI_THUMB_WIDTH/2) - x; + mMouseOffset = (mThumbRects[mCurSlider].mLeft + mThumbWidth/2) - x; } else { @@ -566,6 +595,18 @@ void LLMultiSlider::draw() LLUICtrl::draw(); } +boost::signals2::connection LLMultiSlider::setMouseDownCallback( const commit_signal_t::slot_type& cb ) +{ + if (!mMouseDownSignal) mMouseDownSignal = new commit_signal_t(); + return mMouseDownSignal->connect(cb); +} + +boost::signals2::connection LLMultiSlider::setMouseUpCallback( const commit_signal_t::slot_type& cb ) +{ + if (!mMouseUpSignal) mMouseUpSignal = new commit_signal_t(); + return mMouseUpSignal->connect(cb); +} + // virtual LLXMLNodePtr LLMultiSlider::getXML(bool save_children) const { diff --git a/indra/llui/llmultislider.h b/indra/llui/llmultislider.h index cdbdb597f..f8363fd97 100644 --- a/indra/llui/llmultislider.h +++ b/indra/llui/llmultislider.h @@ -59,6 +59,7 @@ public: virtual LLXMLNodePtr getXML(bool save_children = true) const; static LLView* fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *factory); + virtual ~LLMultiSlider(); void setSliderValue(const std::string& name, F32 value, BOOL from_event = FALSE); F32 getSliderValue(const std::string& name) const; @@ -80,15 +81,17 @@ public: void setMinValue(F32 min_value) { mMinValue = min_value; } void setMaxValue(F32 max_value) { mMaxValue = max_value; } void setIncrement(F32 increment) { mIncrement = increment; } - void setMouseDownCallback( void (*cb)(LLUICtrl* ctrl, void* userdata) ) { mMouseDownCallback = cb; } - void setMouseUpCallback( void (*cb)(LLUICtrl* ctrl, void* userdata) ) { mMouseUpCallback = cb; } + + boost::signals2::connection setMouseDownCallback( const commit_signal_t::slot_type& cb ); + boost::signals2::connection setMouseUpCallback( const commit_signal_t::slot_type& cb ); bool findUnusedValue(F32& initVal); const std::string& addSlider(); const std::string& addSlider(F32 val); - void deleteSlider(const std::string& name); - void deleteCurSlider() { deleteSlider(mCurSlider); } - void clear(); + void addSlider(F32 val, const std::string& name); + void deleteSlider(const std::string& name); + void deleteCurSlider() { deleteSlider(mCurSlider); } + void clear(); virtual BOOL handleHover(S32 x, S32 y, MASK mask); virtual BOOL handleMouseUp(S32 x, S32 y, MASK mask); @@ -112,6 +115,7 @@ protected: S32 mMouseOffset; LLRect mDragStartThumbRect; + S32 mThumbWidth; std::map mThumbRects; LLColor4 mTrackColor; @@ -121,8 +125,8 @@ protected: LLColor4 mDisabledThumbColor; LLColor4 mTriangleColor; - void (*mMouseDownCallback)(LLUICtrl* ctrl, void* userdata); - void (*mMouseUpCallback)(LLUICtrl* ctrl, void* userdata); + commit_signal_t* mMouseDownSignal; + commit_signal_t* mMouseUpSignal; }; #endif // LL_LLSLIDER_H diff --git a/indra/llui/llmultisliderctrl.cpp b/indra/llui/llmultisliderctrl.cpp index acf928f01..f4970b792 100644 --- a/indra/llui/llmultisliderctrl.cpp +++ b/indra/llui/llmultisliderctrl.cpp @@ -78,9 +78,7 @@ LLMultiSliderCtrl::LLMultiSliderCtrl(const std::string& name, const LLRect& rect mEditor( NULL ), mTextBox( NULL ), mTextEnabledColor( LLUI::sColorsGroup->getColor( "LabelTextColor" ) ), - mTextDisabledColor( LLUI::sColorsGroup->getColor( "LabelDisabledColor" ) ), - mSliderMouseUpCallback( NULL ), - mSliderMouseDownCallback( NULL ) + mTextDisabledColor( LLUI::sColorsGroup->getColor( "LabelDisabledColor" ) ) { S32 top = getRect().getHeight(); S32 bottom = 0; @@ -421,37 +419,14 @@ void LLMultiSliderCtrl::setPrecision(S32 precision) updateText(); } -void LLMultiSliderCtrl::setSliderMouseDownCallback( void (*slider_mousedown_callback)(LLUICtrl* caller, void* userdata) ) +boost::signals2::connection LLMultiSliderCtrl::setSliderMouseDownCallback( const commit_signal_t::slot_type& cb ) { - mSliderMouseDownCallback = slider_mousedown_callback; - mMultiSlider->setMouseDownCallback( LLMultiSliderCtrl::onSliderMouseDown ); + return mMultiSlider->setMouseDownCallback( cb ); } -// static -void LLMultiSliderCtrl::onSliderMouseDown(LLUICtrl* caller, void* userdata) +boost::signals2::connection LLMultiSliderCtrl::setSliderMouseUpCallback( const commit_signal_t::slot_type& cb ) { - LLMultiSliderCtrl* self = (LLMultiSliderCtrl*) userdata; - if( self->mSliderMouseDownCallback ) - { - self->mSliderMouseDownCallback( self, self->mCallbackUserData ); - } -} - - -void LLMultiSliderCtrl::setSliderMouseUpCallback( void (*slider_mouseup_callback)(LLUICtrl* caller, void* userdata) ) -{ - mSliderMouseUpCallback = slider_mouseup_callback; - mMultiSlider->setMouseUpCallback( LLMultiSliderCtrl::onSliderMouseUp ); -} - -// static -void LLMultiSliderCtrl::onSliderMouseUp(LLUICtrl* caller, void* userdata) -{ - LLMultiSliderCtrl* self = (LLMultiSliderCtrl*) userdata; - if( self->mSliderMouseUpCallback ) - { - self->mSliderMouseUpCallback( self, self->mCallbackUserData ); - } + return mMultiSlider->setMouseUpCallback( cb ); } void LLMultiSliderCtrl::onTabInto() diff --git a/indra/llui/llmultisliderctrl.h b/indra/llui/llmultisliderctrl.h index b62b5ec32..47b1d1fb1 100644 --- a/indra/llui/llmultisliderctrl.h +++ b/indra/llui/llmultisliderctrl.h @@ -112,8 +112,8 @@ public: void setLabelColor(const LLColor4& c) { mTextEnabledColor = c; } void setDisabledLabelColor(const LLColor4& c) { mTextDisabledColor = c; } - void setSliderMouseDownCallback( void (*slider_mousedown_callback)(LLUICtrl* caller, void* userdata) ); - void setSliderMouseUpCallback( void (*slider_mouseup_callback)(LLUICtrl* caller, void* userdata) ); + boost::signals2::connection setSliderMouseDownCallback( const commit_signal_t::slot_type& cb ); + boost::signals2::connection setSliderMouseUpCallback( const commit_signal_t::slot_type& cb ); virtual void onTabInto(); @@ -124,10 +124,8 @@ public: virtual std::string getControlName() const; static void onSliderCommit(LLUICtrl* caller, void* userdata); - static void onSliderMouseDown(LLUICtrl* caller,void* userdata); - static void onSliderMouseUp(LLUICtrl* caller,void* userdata); - - static void onEditorCommit(LLUICtrl* caller, void* userdata); + + static void onEditorCommit(LLUICtrl* ctrl, void* userdata); static void onEditorGainFocus(LLFocusableElement* caller, void *userdata); static void onEditorChangeFocus(LLUICtrl* caller, S32 direction, void *userdata); @@ -151,9 +149,6 @@ private: LLColor4 mTextEnabledColor; LLColor4 mTextDisabledColor; - - void (*mSliderMouseUpCallback)( LLUICtrl* ctrl, void* userdata ); - void (*mSliderMouseDownCallback)( LLUICtrl* ctrl, void* userdata ); }; #endif // LL_MULTI_SLIDERCTRL_H diff --git a/indra/llui/llslider.cpp b/indra/llui/llslider.cpp index 28b30cccb..145901681 100644 --- a/indra/llui/llslider.cpp +++ b/indra/llui/llslider.cpp @@ -70,8 +70,8 @@ LLSlider::LLSlider( mTrackColor( LLUI::sColorsGroup->getColor( "SliderTrackColor" ) ), mThumbOutlineColor( LLUI::sColorsGroup->getColor( "SliderThumbOutlineColor" ) ), mThumbCenterColor( LLUI::sColorsGroup->getColor( "SliderThumbCenterColor" ) ), - mMouseDownCallback( NULL ), - mMouseUpCallback( NULL ) + mMouseDownSignal( NULL ), + mMouseUpSignal( NULL ) { mThumbImage = LLUI::getUIImage("icn_slide-thumb_dark.tga"); mTrackImage = LLUI::getUIImage("icn_slide-groove_dark.tga"); @@ -87,6 +87,11 @@ LLSlider::LLSlider( mDragStartThumbRect = mThumbRect; } +LLSlider::~LLSlider() +{ + delete mMouseDownSignal; + delete mMouseUpSignal; +} void LLSlider::setValue(F32 value, BOOL from_event) { @@ -109,10 +114,11 @@ void LLSlider::setValue(F32 value, BOOL from_event) void LLSlider::updateThumbRect() { + const S32 DEFAULT_THUMB_SIZE = 16; F32 t = (mValue - mMinValue) / (mMaxValue - mMinValue); - S32 thumb_width = mThumbImage->getWidth(); - S32 thumb_height = mThumbImage->getHeight(); + S32 thumb_width = mThumbImage ? mThumbImage->getWidth() : DEFAULT_THUMB_SIZE; + S32 thumb_height = mThumbImage ? mThumbImage->getHeight() : DEFAULT_THUMB_SIZE; S32 left_edge = (thumb_width / 2); S32 right_edge = getRect().getWidth() - (thumb_width / 2); @@ -169,10 +175,9 @@ BOOL LLSlider::handleMouseUp(S32 x, S32 y, MASK mask) { gFocusMgr.setMouseCapture( NULL ); - if( mMouseUpCallback ) - { - mMouseUpCallback( this, mCallbackUserData ); - } + if (mMouseUpSignal) + (*mMouseUpSignal)( this, getValueF32() ); + handled = TRUE; make_ui_sound("UISndClickRelease"); } @@ -191,10 +196,8 @@ BOOL LLSlider::handleMouseDown(S32 x, S32 y, MASK mask) { setFocus(TRUE); } - if( mMouseDownCallback ) - { - mMouseDownCallback( this, mCallbackUserData ); - } + if (mMouseDownSignal) + (*mMouseDownSignal)( this, getValueF32() ); if (MASK_CONTROL & mask) // if CTRL is modifying { @@ -309,6 +312,17 @@ LLXMLNodePtr LLSlider::getXML(bool save_children) const return node; } +boost::signals2::connection LLSlider::setMouseDownCallback( const commit_signal_t::slot_type& cb ) +{ + if (!mMouseDownSignal) mMouseDownSignal = new commit_signal_t(); + return mMouseDownSignal->connect(cb); +} + +boost::signals2::connection LLSlider::setMouseUpCallback( const commit_signal_t::slot_type& cb ) +{ + if (!mMouseUpSignal) mMouseUpSignal = new commit_signal_t(); + return mMouseUpSignal->connect(cb); +} //static LLView* LLSlider::fromXML(LLXMLNodePtr node, LLView *parent, class LLUICtrlFactory *factory) diff --git a/indra/llui/llslider.h b/indra/llui/llslider.h index 253b72803..e09f537dd 100644 --- a/indra/llui/llslider.h +++ b/indra/llui/llslider.h @@ -55,6 +55,7 @@ public: virtual LLXMLNodePtr getXML(bool save_children = true) const; static LLView* fromXML(LLXMLNodePtr node, LLView *parent, class LLUICtrlFactory *factory); + virtual ~LLSlider(); void setValue( F32 value, BOOL from_event = FALSE ); F32 getValueF32() const { return mValue; } @@ -71,8 +72,10 @@ public: void setMinValue(F32 min_value) {mMinValue = min_value; updateThumbRect(); } void setMaxValue(F32 max_value) {mMaxValue = max_value; updateThumbRect(); } void setIncrement(F32 increment) {mIncrement = increment;} - void setMouseDownCallback( void (*cb)(LLUICtrl* ctrl, void* userdata) ) { mMouseDownCallback = cb; } - void setMouseUpCallback( void (*cb)(LLUICtrl* ctrl, void* userdata) ) { mMouseUpCallback = cb; } + + boost::signals2::connection setMouseDownCallback( const commit_signal_t::slot_type& cb ); + boost::signals2::connection setMouseUpCallback( const commit_signal_t::slot_type& cb ); + virtual BOOL handleHover(S32 x, S32 y, MASK mask); virtual BOOL handleMouseUp(S32 x, S32 y, MASK mask); @@ -103,8 +106,8 @@ private: LLColor4 mThumbOutlineColor; LLColor4 mThumbCenterColor; - void (*mMouseDownCallback)(LLUICtrl* ctrl, void* userdata); - void (*mMouseUpCallback)(LLUICtrl* ctrl, void* userdata); + commit_signal_t* mMouseDownSignal; + commit_signal_t* mMouseUpSignal; }; #endif // LL_LLSLIDER_H diff --git a/indra/llui/llsliderctrl.cpp b/indra/llui/llsliderctrl.cpp index 590d3cf2e..ad6382729 100644 --- a/indra/llui/llsliderctrl.cpp +++ b/indra/llui/llsliderctrl.cpp @@ -76,9 +76,7 @@ LLSliderCtrl::LLSliderCtrl(const std::string& name, const LLRect& rect, mEditor( NULL ), mTextBox( NULL ), mTextEnabledColor( LLUI::sColorsGroup->getColor( "LabelTextColor" ) ), - mTextDisabledColor( LLUI::sColorsGroup->getColor( "LabelDisabledColor" ) ), - mSliderMouseUpCallback( NULL ), - mSliderMouseDownCallback( NULL ) + mTextDisabledColor( LLUI::sColorsGroup->getColor( "LabelDisabledColor" ) ) { S32 top = getRect().getHeight(); S32 bottom = 0; @@ -352,37 +350,14 @@ void LLSliderCtrl::setPrecision(S32 precision) updateText(); } -void LLSliderCtrl::setSliderMouseDownCallback( void (*slider_mousedown_callback)(LLUICtrl* caller, void* userdata) ) +boost::signals2::connection LLSliderCtrl::setSliderMouseDownCallback( const commit_signal_t::slot_type& cb ) { - mSliderMouseDownCallback = slider_mousedown_callback; - mSlider->setMouseDownCallback( LLSliderCtrl::onSliderMouseDown ); + return mSlider->setMouseDownCallback( cb ); } -// static -void LLSliderCtrl::onSliderMouseDown(LLUICtrl* caller, void* userdata) +boost::signals2::connection LLSliderCtrl::setSliderMouseUpCallback( const commit_signal_t::slot_type& cb ) { - LLSliderCtrl* self = (LLSliderCtrl*) userdata; - if( self->mSliderMouseDownCallback ) - { - self->mSliderMouseDownCallback( self, self->mCallbackUserData ); - } -} - - -void LLSliderCtrl::setSliderMouseUpCallback( void (*slider_mouseup_callback)(LLUICtrl* caller, void* userdata) ) -{ - mSliderMouseUpCallback = slider_mouseup_callback; - mSlider->setMouseUpCallback( LLSliderCtrl::onSliderMouseUp ); -} - -// static -void LLSliderCtrl::onSliderMouseUp(LLUICtrl* caller, void* userdata) -{ - LLSliderCtrl* self = (LLSliderCtrl*) userdata; - if( self->mSliderMouseUpCallback ) - { - self->mSliderMouseUpCallback( self, self->mCallbackUserData ); - } + return mSlider->setMouseUpCallback( cb ); } void LLSliderCtrl::onTabInto() diff --git a/indra/llui/llsliderctrl.h b/indra/llui/llsliderctrl.h index 272dd7ffd..68748eb4d 100644 --- a/indra/llui/llsliderctrl.h +++ b/indra/llui/llsliderctrl.h @@ -75,14 +75,18 @@ public: virtual LLSD getValue() const { return LLSD(getValueF32()); } virtual BOOL setLabelArg( const std::string& key, const LLStringExplicit& text ); - virtual void setMinValue(LLSD min_value) { setMinValue((F32)min_value.asReal()); } - virtual void setMaxValue(LLSD max_value) { setMaxValue((F32)max_value.asReal()); } + BOOL isMouseHeldDown() const { return mSlider->hasMouseCapture(); } + + virtual void setPrecision(S32 precision); + virtual void setEnabled( BOOL b ); virtual void clear(); - virtual void setPrecision(S32 precision); + + virtual void setMinValue(LLSD min_value) { setMinValue((F32)min_value.asReal()); } + virtual void setMaxValue(LLSD max_value) { setMaxValue((F32)max_value.asReal()); } void setMinValue(F32 min_value) { mSlider->setMinValue(min_value); updateText(); } void setMaxValue(F32 max_value) { mSlider->setMaxValue(max_value); updateText(); } void setIncrement(F32 increment) { mSlider->setIncrement(increment);} @@ -94,8 +98,8 @@ public: void setLabelColor(const LLColor4& c) { mTextEnabledColor = c; } void setDisabledLabelColor(const LLColor4& c) { mTextDisabledColor = c; } - void setSliderMouseDownCallback( void (*slider_mousedown_callback)(LLUICtrl* caller, void* userdata) ); - void setSliderMouseUpCallback( void (*slider_mouseup_callback)(LLUICtrl* caller, void* userdata) ); + boost::signals2::connection setSliderMouseDownCallback( const commit_signal_t::slot_type& cb ); + boost::signals2::connection setSliderMouseUpCallback( const commit_signal_t::slot_type& cb ); virtual void onTabInto(); @@ -111,8 +115,6 @@ public: virtual std::string getControlName() const { return mSlider->getControlName(); } static void onSliderCommit(LLUICtrl* caller, void* userdata); - static void onSliderMouseDown(LLUICtrl* caller,void* userdata); - static void onSliderMouseUp(LLUICtrl* caller,void* userdata); static void onEditorCommit(LLUICtrl* caller, void* userdata); static void onEditorGainFocus(LLFocusableElement* caller, void *userdata); @@ -138,9 +140,6 @@ private: LLColor4 mTextEnabledColor; LLColor4 mTextDisabledColor; - - void (*mSliderMouseUpCallback)( LLUICtrl* ctrl, void* userdata ); - void (*mSliderMouseDownCallback)( LLUICtrl* ctrl, void* userdata ); }; #endif // LL_LLSLIDERCTRL_H diff --git a/indra/llui/llviewquery.h b/indra/llui/llviewquery.h index e87795f9a..98d9bf879 100644 --- a/indra/llui/llviewquery.h +++ b/indra/llui/llviewquery.h @@ -35,7 +35,7 @@ #include -#include "llmemory.h" +#include "llsingleton.h" #include "llui.h" class LLView; diff --git a/indra/newview/llpaneldisplay.cpp b/indra/newview/llpaneldisplay.cpp index c7aeabcce..925ca40c7 100644 --- a/indra/newview/llpaneldisplay.cpp +++ b/indra/newview/llpaneldisplay.cpp @@ -120,7 +120,7 @@ BOOL LLPanelDisplay::postBuild() // radio set for fullscreen size mCtrlWindowed = getChild( "windowed mode"); - mCtrlWindowed->setCommitCallback(onCommitWindowedMode); + mCtrlWindowed->setCommitCallback(&LLPanelDisplay::onCommitWindowedMode); mCtrlWindowed->setCallbackUserData(this); mAspectRatioLabel1 = getChild("AspectRatioLabel1"); @@ -215,7 +215,7 @@ BOOL LLPanelDisplay::postBuild() // radio performance box mCtrlSliderQuality = getChild("QualityPerformanceSelection"); - mCtrlSliderQuality->setSliderMouseUpCallback(onChangeQuality); + mCtrlSliderQuality->setSliderMouseUpCallback(boost::bind(&LLPanelDisplay::onChangeQuality,mCtrlSliderQuality,this)); mCtrlSliderQuality->setCallbackUserData(this); mCtrlCustomSettings = getChild("CustomSettings");