summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--indra/llui/llbutton.cpp51
-rw-r--r--indra/llui/llbutton.h8
-rw-r--r--indra/llui/llfloater.cpp8
-rw-r--r--indra/llui/llfocusmgr.cpp43
-rw-r--r--indra/llui/llfocusmgr.h16
-rw-r--r--indra/llui/lllineeditor.cpp6
-rw-r--r--indra/llui/llmenugl.cpp17
-rw-r--r--indra/llui/llmultislider.cpp37
-rw-r--r--indra/llui/llmultislider.h9
-rw-r--r--indra/llui/llmultisliderctrl.cpp4
-rw-r--r--indra/llui/llpanel.cpp25
-rw-r--r--indra/llui/llpanel.h6
-rw-r--r--indra/llui/llslider.cpp36
-rw-r--r--indra/llui/llslider.h9
-rw-r--r--indra/llui/llsliderctrl.cpp4
-rw-r--r--indra/llui/llspinctrl.cpp6
-rw-r--r--indra/llui/lltabcontainer.cpp6
-rw-r--r--indra/llui/lluictrl.cpp179
-rw-r--r--indra/llui/lluictrl.h42
-rw-r--r--indra/newview/llchiclet.cpp9
-rw-r--r--indra/newview/llfavoritesbar.cpp6
-rw-r--r--indra/newview/llfloaterbuyland.cpp2
-rw-r--r--indra/newview/llfloaterchat.cpp2
-rw-r--r--indra/newview/llfloaterchatterbox.cpp2
-rw-r--r--indra/newview/llfloaterland.cpp2
-rw-r--r--indra/newview/llimpanel.cpp2
-rw-r--r--indra/newview/llmediactrl.cpp2
-rw-r--r--indra/newview/llpanelavatartag.cpp2
-rw-r--r--indra/newview/llpanelpeople.cpp2
-rw-r--r--indra/newview/llpreviewgesture.cpp2
30 files changed, 409 insertions, 136 deletions
diff --git a/indra/llui/llbutton.cpp b/indra/llui/llbutton.cpp
index b65f248db2..8930e32055 100644
--- a/indra/llui/llbutton.cpp
+++ b/indra/llui/llbutton.cpp
@@ -147,7 +147,11 @@ LLButton::LLButton(const LLButton::Params& p)
mCommitOnReturn(p.commit_on_return),
mFadeWhenDisabled(FALSE),
mForcePressedState(false),
- mLastDrawCharsCount(0)
+ mLastDrawCharsCount(0),
+ mMouseDownSignal(NULL),
+ mMouseUpSignal(NULL),
+ mHeldDownSignal(NULL)
+
{
static LLUICachedControl<S32> llbutton_orig_h_pad ("UIButtonOrigHPad", 0);
static Params default_params(LLUICtrlFactory::getDefaultParams<LLButton>());
@@ -215,13 +219,28 @@ LLButton::LLButton(const LLButton::Params& p)
}
if (p.click_callback.isProvided())
- initCommitCallback(p.click_callback, mCommitSignal); // alias -> commit_callback
+ {
+ setCommitCallback(initCommitCallback(p.click_callback)); // alias -> commit_callback
+ }
if (p.mouse_down_callback.isProvided())
- initCommitCallback(p.mouse_down_callback, mMouseDownSignal);
+ {
+ setMouseDownCallback(initCommitCallback(p.mouse_down_callback));
+ }
if (p.mouse_up_callback.isProvided())
- initCommitCallback(p.mouse_up_callback, mMouseUpSignal);
+ {
+ setMouseUpCallback(initCommitCallback(p.mouse_up_callback));
+ }
if (p.mouse_held_callback.isProvided())
- initCommitCallback(p.mouse_held_callback, mHeldDownSignal);
+ {
+ setHeldDownCallback(initCommitCallback(p.mouse_held_callback));
+ }
+}
+
+LLButton::~LLButton()
+{
+ delete mMouseDownSignal;
+ delete mMouseUpSignal;
+ delete mHeldDownSignal;
}
// HACK: Committing a button is the same as instantly clicking it.
@@ -232,9 +251,9 @@ void LLButton::onCommit()
// panel containing it. Therefore we need to call LLUICtrl::onCommit()
// LAST, otherwise this becomes deleted memory.
- mMouseDownSignal(this, LLSD());
+ if (mMouseDownSignal) (*mMouseDownSignal)(this, LLSD());
- mMouseUpSignal(this, LLSD());
+ if (mMouseUpSignal) (*mMouseUpSignal)(this, LLSD());
if (getSoundFlags() & MOUSE_DOWN)
{
@@ -257,19 +276,23 @@ void LLButton::onCommit()
boost::signals2::connection LLButton::setClickedCallback( const commit_signal_t::slot_type& cb )
{
- return mCommitSignal.connect(cb);
+ if (!mCommitSignal) mCommitSignal = new commit_signal_t();
+ return mCommitSignal->connect(cb);
}
boost::signals2::connection LLButton::setMouseDownCallback( const commit_signal_t::slot_type& cb )
{
- return mMouseDownSignal.connect(cb);
+ if (!mMouseDownSignal) mMouseDownSignal = new commit_signal_t();
+ return mMouseDownSignal->connect(cb);
}
boost::signals2::connection LLButton::setMouseUpCallback( const commit_signal_t::slot_type& cb )
{
- return mMouseUpSignal.connect(cb);
+ if (!mMouseUpSignal) mMouseUpSignal = new commit_signal_t();
+ return mMouseUpSignal->connect(cb);
}
boost::signals2::connection LLButton::setHeldDownCallback( const commit_signal_t::slot_type& cb )
{
- return mHeldDownSignal.connect(cb);
+ if (!mHeldDownSignal) mHeldDownSignal = new commit_signal_t();
+ return mHeldDownSignal->connect(cb);
}
@@ -351,7 +374,7 @@ BOOL LLButton::handleMouseDown(S32 x, S32 y, MASK mask)
*/
LLUICtrl::handleMouseDown(x, y, mask);
- mMouseDownSignal(this, LLSD());
+ if(mMouseDownSignal) (*mMouseDownSignal)(this, LLSD());
mMouseDownTimer.start();
mMouseDownFrame = (S32) LLFrameTimer::getFrameCount();
@@ -383,7 +406,7 @@ BOOL LLButton::handleMouseUp(S32 x, S32 y, MASK mask)
LLUICtrl::handleMouseUp(x, y, mask);
// Regardless of where mouseup occurs, handle callback
- mMouseUpSignal(this, LLSD());
+ if(mMouseUpSignal) (*mMouseUpSignal)(this, LLSD());
resetMouseDownTimer();
@@ -493,7 +516,7 @@ BOOL LLButton::handleHover(S32 x, S32 y, MASK mask)
{
LLSD param;
param["count"] = mMouseHeldDownCount++;
- mHeldDownSignal(this, param);
+ if (mHeldDownSignal) (*mHeldDownSignal)(this, param);
}
}
diff --git a/indra/llui/llbutton.h b/indra/llui/llbutton.h
index 3c1b57c4be..8c3b4bd859 100644
--- a/indra/llui/llbutton.h
+++ b/indra/llui/llbutton.h
@@ -128,6 +128,8 @@ protected:
LLButton(const Params&);
public:
+
+ ~LLButton();
// For backward compatability only
typedef boost::function<void(void*)> button_callback_t;
@@ -251,9 +253,9 @@ private:
void resetMouseDownTimer();
private:
- commit_signal_t mMouseDownSignal;
- commit_signal_t mMouseUpSignal;
- commit_signal_t mHeldDownSignal;
+ commit_signal_t* mMouseDownSignal;
+ commit_signal_t* mMouseUpSignal;
+ commit_signal_t* mHeldDownSignal;
const LLFontGL* mGLFont;
diff --git a/indra/llui/llfloater.cpp b/indra/llui/llfloater.cpp
index bf965e8e28..262afbe661 100644
--- a/indra/llui/llfloater.cpp
+++ b/indra/llui/llfloater.cpp
@@ -2642,10 +2642,14 @@ void LLFloater::initFromParams(const LLFloater::Params& p)
// open callback
if (p.open_callback.isProvided())
- initCommitCallback(p.open_callback, mOpenSignal);
+ {
+ mOpenSignal.connect(initCommitCallback(p.open_callback));
+ }
// close callback
if (p.close_callback.isProvided())
- initCommitCallback(p.close_callback, mCloseSignal);
+ {
+ mCloseSignal.connect(initCommitCallback(p.close_callback));
+ }
}
LLFastTimer::DeclareTimer POST_BUILD("Floater Post Build");
diff --git a/indra/llui/llfocusmgr.cpp b/indra/llui/llfocusmgr.cpp
index 00a80478cf..35fbc7b0a8 100644
--- a/indra/llui/llfocusmgr.cpp
+++ b/indra/llui/llfocusmgr.cpp
@@ -41,6 +41,10 @@ const F32 FOCUS_FADE_TIME = 0.3f;
// NOTE: the LLFocusableElement implementation has been moved here from lluictrl.cpp.
LLFocusableElement::LLFocusableElement()
+: mFocusLostCallback(NULL),
+ mFocusReceivedCallback(NULL),
+ mFocusChangedCallback(NULL),
+ mTopLostCallback(NULL)
{
}
@@ -59,23 +63,27 @@ BOOL LLFocusableElement::handleUnicodeChar(llwchar uni_char, BOOL called_from_pa
// virtual
LLFocusableElement::~LLFocusableElement()
{
+ delete mFocusLostCallback;
+ delete mFocusReceivedCallback;
+ delete mFocusChangedCallback;
+ delete mTopLostCallback;
}
void LLFocusableElement::onFocusReceived()
{
- mFocusReceivedCallback(this);
- mFocusChangedCallback(this);
+ if (mFocusReceivedCallback) (*mFocusReceivedCallback)(this);
+ if (mFocusChangedCallback) (*mFocusChangedCallback)(this);
}
void LLFocusableElement::onFocusLost()
{
- mFocusLostCallback(this);
- mFocusChangedCallback(this);
+ if (mFocusLostCallback) (*mFocusLostCallback)(this);
+ if (mFocusChangedCallback) (*mFocusChangedCallback)(this);
}
void LLFocusableElement::onTopLost()
{
- mTopLostCallback(this);
+ if (mTopLostCallback) (*mTopLostCallback)(this);
}
BOOL LLFocusableElement::hasFocus() const
@@ -87,6 +95,31 @@ void LLFocusableElement::setFocus(BOOL b)
{
}
+boost::signals2::connection LLFocusableElement::setFocusLostCallback( const focus_signal_t::slot_type& cb)
+{
+ if (!mFocusLostCallback) mFocusLostCallback = new focus_signal_t();
+ return mFocusLostCallback->connect(cb);
+}
+
+boost::signals2::connection LLFocusableElement::setFocusReceivedCallback(const focus_signal_t::slot_type& cb)
+{
+ if (!mFocusReceivedCallback) mFocusReceivedCallback = new focus_signal_t();
+ return mFocusReceivedCallback->connect(cb);
+}
+
+boost::signals2::connection LLFocusableElement::setFocusChangedCallback(const focus_signal_t::slot_type& cb)
+{
+ if (!mFocusChangedCallback) mFocusChangedCallback = new focus_signal_t();
+ return mFocusChangedCallback->connect(cb);
+}
+
+boost::signals2::connection LLFocusableElement::setTopLostCallback(const focus_signal_t::slot_type& cb)
+{
+ if (!mTopLostCallback) mTopLostCallback = new focus_signal_t();
+ return mTopLostCallback->connect(cb);
+}
+
+
LLFocusMgr gFocusMgr;
diff --git a/indra/llui/llfocusmgr.h b/indra/llui/llfocusmgr.h
index 2fa4e124fb..83ecd1d301 100644
--- a/indra/llui/llfocusmgr.h
+++ b/indra/llui/llfocusmgr.h
@@ -56,10 +56,10 @@ public:
typedef boost::signals2::signal<void(LLFocusableElement*)> focus_signal_t;
- boost::signals2::connection setFocusLostCallback( const focus_signal_t::slot_type& cb) { return mFocusLostCallback.connect(cb);}
- boost::signals2::connection setFocusReceivedCallback(const focus_signal_t::slot_type& cb) { return mFocusReceivedCallback.connect(cb);}
- boost::signals2::connection setFocusChangedCallback(const focus_signal_t::slot_type& cb) { return mFocusChangedCallback.connect(cb);}
- void setTopLostCallback(const focus_signal_t::slot_type& cb) { mTopLostCallback.connect(cb);}
+ boost::signals2::connection setFocusLostCallback( const focus_signal_t::slot_type& cb);
+ boost::signals2::connection setFocusReceivedCallback(const focus_signal_t::slot_type& cb);
+ boost::signals2::connection setFocusChangedCallback(const focus_signal_t::slot_type& cb);
+ boost::signals2::connection setTopLostCallback(const focus_signal_t::slot_type& cb);
// These were brought up the hierarchy from LLView so that we don't have to use dynamic_cast when dealing with keyboard focus.
virtual BOOL handleKey(KEY key, MASK mask, BOOL called_from_parent);
@@ -69,10 +69,10 @@ protected:
virtual void onFocusReceived();
virtual void onFocusLost();
virtual void onTopLost(); // called when registered as top ctrl and user clicks elsewhere
- focus_signal_t mFocusLostCallback;
- focus_signal_t mFocusReceivedCallback;
- focus_signal_t mFocusChangedCallback;
- focus_signal_t mTopLostCallback;
+ focus_signal_t* mFocusLostCallback;
+ focus_signal_t* mFocusReceivedCallback;
+ focus_signal_t* mFocusChangedCallback;
+ focus_signal_t* mTopLostCallback;
};
diff --git a/indra/llui/lllineeditor.cpp b/indra/llui/lllineeditor.cpp
index c2f91ff7e0..406c77a365 100644
--- a/indra/llui/lllineeditor.cpp
+++ b/indra/llui/lllineeditor.cpp
@@ -626,7 +626,8 @@ BOOL LLLineEditor::handleMouseDown(S32 x, S32 y, MASK mask)
// delay cursor flashing
mKeystrokeTimer.reset();
- mMouseDownSignal(this,x,y,mask);
+ if (mMouseDownSignal)
+ (*mMouseDownSignal)(this,x,y,mask);
return TRUE;
}
@@ -742,7 +743,8 @@ BOOL LLLineEditor::handleMouseUp(S32 x, S32 y, MASK mask)
}
// We won't call LLUICtrl::handleMouseUp to avoid double calls of childrenHandleMouseUp().Just invoke the signal manually.
- mMouseUpSignal(this,x,y, mask);
+ if (mMouseUpSignal)
+ (*mMouseUpSignal)(this,x,y, mask);
return handled;
}
diff --git a/indra/llui/llmenugl.cpp b/indra/llui/llmenugl.cpp
index de9a854f63..f8935d03ac 100644
--- a/indra/llui/llmenugl.cpp
+++ b/indra/llui/llmenugl.cpp
@@ -760,21 +760,25 @@ void LLMenuItemCallGL::initFromParams(const Params& p)
{
if (p.on_visible.isProvided())
{
- initVisibleCallback(p.on_visible, mVisibleSignal);
+ mVisibleSignal.connect(initVisibleCallback(p.on_visible));
}
if (p.on_enable.isProvided())
{
- initEnableCallback(p.on_enable, mEnableSignal);
+ setEnableCallback(initEnableCallback(p.on_enable));
// Set the enabled control variable (for backwards compatability)
if (p.on_enable.control_name.isProvided() && !p.on_enable.control_name().empty())
{
LLControlVariable* control = findControl(p.on_enable.control_name());
if (control)
+ {
setEnabledControlVariable(control);
+ }
}
}
if (p.on_click.isProvided())
- initCommitCallback(p.on_click, mCommitSignal);
+ {
+ setCommitCallback(initCommitCallback(p.on_click));
+ }
LLUICtrl::initFromParams(p);
}
@@ -795,7 +799,10 @@ void LLMenuItemCallGL::updateEnabled( void )
if (mEnabledControlVariable)
{
if (!enabled)
- mEnabledControlVariable->set(false); // callback overrides control variable; this will call setEnabled()
+ {
+ // callback overrides control variable; this will call setEnabled()
+ mEnabledControlVariable->set(false);
+ }
}
else
{
@@ -854,7 +861,7 @@ void LLMenuItemCheckGL::initFromParams(const Params& p)
{
if (p.on_check.isProvided())
{
- initEnableCallback(p.on_check, mCheckSignal);
+ setCheckCallback(initEnableCallback(p.on_check));
// Set the control name (for backwards compatability)
if (p.on_check.control_name.isProvided() && !p.on_check.control_name().empty())
{
diff --git a/indra/llui/llmultislider.cpp b/indra/llui/llmultislider.cpp
index 68e496aed1..1891bca36c 100644
--- a/indra/llui/llmultislider.cpp
+++ b/indra/llui/llmultislider.cpp
@@ -84,17 +84,30 @@ LLMultiSlider::LLMultiSlider(const LLMultiSlider::Params& p)
mThumbCenterSelectedColor(p.thumb_center_selected_color()),
mDisabledThumbColor(p.thumb_disabled_color()),
mTriangleColor(p.triangle_color()),
- mThumbWidth(p.thumb_width)
+ mThumbWidth(p.thumb_width),
+ mMouseDownSignal(NULL),
+ mMouseUpSignal(NULL)
{
mValue.emptyMap();
mCurSlider = LLStringUtil::null;
if (p.mouse_down_callback.isProvided())
- initCommitCallback(p.mouse_down_callback, mMouseDownSignal);
+ {
+ setMouseDownCallback(initCommitCallback(p.mouse_down_callback));
+ }
if (p.mouse_up_callback.isProvided())
- initCommitCallback(p.mouse_up_callback, mMouseUpSignal);
+ {
+ setMouseUpCallback(initCommitCallback(p.mouse_up_callback));
+ }
+}
+
+LLMultiSlider::~LLMultiSlider()
+{
+ delete mMouseDownSignal;
+ delete mMouseUpSignal;
}
+
void LLMultiSlider::setSliderValue(const std::string& name, F32 value, BOOL from_event)
{
// exit if not there
@@ -325,7 +338,8 @@ BOOL LLMultiSlider::handleMouseUp(S32 x, S32 y, MASK mask)
{
gFocusMgr.setMouseCapture( NULL );
- mMouseUpSignal( this, LLSD() );
+ if (mMouseUpSignal)
+ (*mMouseUpSignal)( this, LLSD() );
handled = TRUE;
make_ui_sound("UISndClickRelease");
@@ -345,7 +359,8 @@ BOOL LLMultiSlider::handleMouseDown(S32 x, S32 y, MASK mask)
{
setFocus(TRUE);
}
- mMouseDownSignal( this, LLSD() );
+ if (mMouseDownSignal)
+ (*mMouseDownSignal)( this, LLSD() );
if (MASK_CONTROL & mask) // if CTRL is modifying
{
@@ -557,3 +572,15 @@ void LLMultiSlider::draw()
LLF32UICtrl::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);
+}
diff --git a/indra/llui/llmultislider.h b/indra/llui/llmultislider.h
index da633cc1cd..f8e43a0470 100644
--- a/indra/llui/llmultislider.h
+++ b/indra/llui/llmultislider.h
@@ -67,6 +67,7 @@ protected:
LLMultiSlider(const Params&);
friend class LLUICtrlFactory;
public:
+ virtual ~LLMultiSlider();
void setSliderValue(const std::string& name, F32 value, BOOL from_event = FALSE);
F32 getSliderValue(const std::string& name) const;
@@ -78,8 +79,8 @@ public:
/*virtual*/ void setValue(const LLSD& value);
/*virtual*/ LLSD getValue() const { return mValue; }
- boost::signals2::connection setMouseDownCallback( const commit_signal_t::slot_type& cb ) { return mMouseDownSignal.connect(cb); }
- boost::signals2::connection setMouseUpCallback( const commit_signal_t::slot_type& cb ) { return mMouseUpSignal.connect(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();
@@ -116,8 +117,8 @@ protected:
LLUIColor mDisabledThumbColor;
LLUIColor mTriangleColor;
- commit_signal_t mMouseDownSignal;
- commit_signal_t mMouseUpSignal;
+ commit_signal_t* mMouseDownSignal;
+ commit_signal_t* mMouseUpSignal;
};
#endif // LL_MULTI_SLIDER_H
diff --git a/indra/llui/llmultisliderctrl.cpp b/indra/llui/llmultisliderctrl.cpp
index a9f462173d..87938c19d4 100644
--- a/indra/llui/llmultisliderctrl.cpp
+++ b/indra/llui/llmultisliderctrl.cpp
@@ -344,7 +344,7 @@ void LLMultiSliderCtrl::onEditorCommit( LLUICtrl* ctrl, const LLSD& userdata)
if( self->mMultiSlider->getMinValue() <= val && val <= self->mMultiSlider->getMaxValue() )
{
self->setCurSliderValue( val ); // set the value temporarily so that the callback can retrieve it.
- if( self->mValidateSignal( self, val ) )
+ if( !self->mValidateSignal || (*(self->mValidateSignal))( self, val ) )
{
success = TRUE;
}
@@ -378,7 +378,7 @@ void LLMultiSliderCtrl::onSliderCommit(LLUICtrl* ctrl, const LLSD& userdata)
F32 new_val = self->mMultiSlider->getCurSliderValue();
self->mCurValue = new_val; // set the value temporarily so that the callback can retrieve it.
- if( self->mValidateSignal( self, new_val ) )
+ if( !self->mValidateSignal || (*(self->mValidateSignal))( self, new_val ) )
{
success = TRUE;
}
diff --git a/indra/llui/llpanel.cpp b/indra/llui/llpanel.cpp
index 89c4656297..063822dd56 100644
--- a/indra/llui/llpanel.cpp
+++ b/indra/llui/llpanel.cpp
@@ -106,7 +106,8 @@ LLPanel::LLPanel(const LLPanel::Params& p)
mHelpTopic(p.help_topic),
mCommitCallbackRegistrar(false),
mEnableCallbackRegistrar(false),
- mXMLFilename(p.filename)
+ mXMLFilename(p.filename),
+ mVisibleSignal(NULL)
// *NOTE: Be sure to also change LLPanel::initFromParams(). We have too
// many classes derived from LLPanel to retrofit them all to pass in params.
{
@@ -118,6 +119,11 @@ LLPanel::LLPanel(const LLPanel::Params& p)
mPanelHandle.bind(this);
}
+LLPanel::~LLPanel()
+{
+ delete mVisibleSignal;
+}
+
// virtual
BOOL LLPanel::isPanel() const
{
@@ -332,7 +338,8 @@ BOOL LLPanel::handleKeyHere( KEY key, MASK mask )
void LLPanel::handleVisibilityChange ( BOOL new_visibility )
{
LLUICtrl::handleVisibilityChange ( new_visibility );
- mVisibleSignal(this, LLSD(new_visibility) ); // Pass BOOL as LLSD
+ if (mVisibleSignal)
+ (*mVisibleSignal)(this, LLSD(new_visibility) ); // Pass BOOL as LLSD
}
void LLPanel::setFocus(BOOL b)
@@ -424,7 +431,9 @@ void LLPanel::initFromParams(const LLPanel::Params& p)
// visible callback
if (p.visible_callback.isProvided())
- initCommitCallback(p.visible_callback, mVisibleSignal);
+ {
+ setVisibleCallback(initCommitCallback(p.visible_callback));
+ }
for (LLInitParam::ParamIterator<LocalizedString>::const_iterator it = p.strings().begin();
it != p.strings().end();
@@ -907,3 +916,13 @@ void LLPanel::childSetControlName(const std::string& id, const std::string& cont
view->setControlName(control_name, NULL);
}
}
+
+boost::signals2::connection LLPanel::setVisibleCallback( const commit_signal_t::slot_type& cb )
+{
+ if (!mVisibleSignal)
+ {
+ mVisibleSignal = new commit_signal_t();
+ }
+
+ return mVisibleSignal->connect(cb);
+}
diff --git a/indra/llui/llpanel.h b/indra/llui/llpanel.h
index c213809d68..0a0fed82fb 100644
--- a/indra/llui/llpanel.h
+++ b/indra/llui/llpanel.h
@@ -109,7 +109,7 @@ protected:
public:
// LLPanel(const std::string& name, const LLRect& rect = LLRect(), BOOL bordered = TRUE);
- /*virtual*/ ~LLPanel() {}
+ /*virtual*/ ~LLPanel();
// LLView interface
/*virtual*/ BOOL isPanel() const;
@@ -241,6 +241,8 @@ public:
void setXMLFilename(std::string filename) { mXMLFilename = filename; };
std::string getXMLFilename() { return mXMLFilename; };
+ boost::signals2::connection setVisibleCallback( const commit_signal_t::slot_type& cb );
+
protected:
// Override to set not found list
LLButton* getDefaultButton() { return mDefaultBtn; }
@@ -249,7 +251,7 @@ protected:
EnableCallbackRegistry::ScopedRegistrar mEnableCallbackRegistrar;
VisibleCallbackRegistry::ScopedRegistrar mVisibleCallbackRegistrar;
- commit_signal_t mVisibleSignal; // Called when visibility changes, passes new visibility as LLSD()
+ commit_signal_t* mVisibleSignal; // Called when visibility changes, passes new visibility as LLSD()
std::string mHelpTopic; // the name of this panel's help topic to display in the Help Viewer
diff --git a/indra/llui/llslider.cpp b/indra/llui/llslider.cpp
index da2fc7c68b..a6f729b396 100644
--- a/indra/llui/llslider.cpp
+++ b/indra/llui/llslider.cpp
@@ -77,7 +77,9 @@ LLSlider::LLSlider(const LLSlider::Params& p)
mTrackImageHorizontal(p.track_image_horizontal),
mTrackImageVertical(p.track_image_vertical),
mTrackHighlightHorizontalImage(p.track_highlight_horizontal_image),
- mTrackHighlightVerticalImage(p.track_highlight_vertical_image)
+ mTrackHighlightVerticalImage(p.track_highlight_vertical_image),
+ mMouseDownSignal(NULL),
+ mMouseUpSignal(NULL)
{
mViewModel->setValue(p.initial_value);
updateThumbRect();
@@ -86,9 +88,19 @@ LLSlider::LLSlider(const LLSlider::Params& p)
setValue(getValueF32());
if (p.mouse_down_callback.isProvided())
- initCommitCallback(p.mouse_down_callback, mMouseDownSignal);
+ {
+ setMouseDownCallback(initCommitCallback(p.mouse_down_callback));
+ }
if (p.mouse_up_callback.isProvided())
- initCommitCallback(p.mouse_up_callback, mMouseUpSignal);
+ {
+ setMouseUpCallback(initCommitCallback(p.mouse_up_callback));
+ }
+}
+
+LLSlider::~LLSlider()
+{
+ delete mMouseDownSignal;
+ delete mMouseUpSignal;
}
void LLSlider::setValue(F32 value, BOOL from_event)
@@ -202,7 +214,8 @@ BOOL LLSlider::handleMouseUp(S32 x, S32 y, MASK mask)
{
gFocusMgr.setMouseCapture( NULL );
- mMouseUpSignal( this, getValueF32() );
+ if (mMouseUpSignal)
+ (*mMouseUpSignal)( this, getValueF32() );
handled = TRUE;
make_ui_sound("UISndClickRelease");
@@ -222,7 +235,8 @@ BOOL LLSlider::handleMouseDown(S32 x, S32 y, MASK mask)
{
setFocus(TRUE);
}
- mMouseDownSignal( this, getValueF32() );
+ if (mMouseDownSignal)
+ (*mMouseDownSignal)( this, getValueF32() );
if (MASK_CONTROL & mask) // if CTRL is modifying
{
@@ -364,3 +378,15 @@ void LLSlider::draw()
LLUICtrl::draw();
}
+
+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);
+}
diff --git a/indra/llui/llslider.h b/indra/llui/llslider.h
index 6ab0ed7922..45f8f81e40 100644
--- a/indra/llui/llslider.h
+++ b/indra/llui/llslider.h
@@ -67,6 +67,7 @@ protected:
LLSlider(const Params&);
friend class LLUICtrlFactory;
public:
+ virtual ~LLSlider();
void setValue( F32 value, BOOL from_event = FALSE );
// overrides for LLF32UICtrl methods
virtual void setValue(const LLSD& value ) { setValue((F32)value.asReal(), TRUE); }
@@ -76,8 +77,8 @@ public:
virtual void setMinValue(F32 min_value) { LLF32UICtrl::setMinValue(min_value); updateThumbRect(); }
virtual void setMaxValue(F32 max_value) { LLF32UICtrl::setMaxValue(max_value); updateThumbRect(); }
- boost::signals2::connection setMouseDownCallback( const commit_signal_t::slot_type& cb ) { return mMouseDownSignal.connect(cb); }
- boost::signals2::connection setMouseUpCallback( const commit_signal_t::slot_type& cb ) { return mMouseUpSignal.connect(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);
@@ -109,8 +110,8 @@ private:
LLUIColor mThumbOutlineColor;
LLUIColor mThumbCenterColor;
- commit_signal_t mMouseDownSignal;
- commit_signal_t mMouseUpSignal;
+ 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 ed22c0a47f..a4f89ae1d3 100644
--- a/indra/llui/llsliderctrl.cpp
+++ b/indra/llui/llsliderctrl.cpp
@@ -260,7 +260,7 @@ void LLSliderCtrl::onEditorCommit( LLUICtrl* ctrl, const LLSD& userdata )
if( self->mSlider->getMinValue() <= val && val <= self->mSlider->getMaxValue() )
{
self->setValue( val ); // set the value temporarily so that the callback can retrieve it.
- if( self->mValidateSignal( self, val ) )
+ if( !self->mValidateSignal || (*(self->mValidateSignal))( self, val ) )
{
success = TRUE;
}
@@ -294,7 +294,7 @@ void LLSliderCtrl::onSliderCommit( LLUICtrl* ctrl, const LLSD& userdata )
F32 new_val = self->mSlider->getValueF32();
self->mValue = new_val; // set the value temporarily so that the callback can retrieve it.
- if( self->mValidateSignal( self, new_val ) )
+ if( !self->mValidateSignal || (*(self->mValidateSignal))( self, new_val ) )
{
success = TRUE;
}
diff --git a/indra/llui/llspinctrl.cpp b/indra/llui/llspinctrl.cpp
index bedf16a397..d6d46654d5 100644
--- a/indra/llui/llspinctrl.cpp
+++ b/indra/llui/llspinctrl.cpp
@@ -190,7 +190,7 @@ void LLSpinCtrl::onUpBtn( const LLSD& data )
F32 saved_val = (F32)getValue().asReal();
setValue(val);
- if( !mValidateSignal( this, val ) )
+ if( mValidateSignal && !(*mValidateSignal)( this, val ) )
{
setValue( saved_val );
reportInvalidData();
@@ -224,7 +224,7 @@ void LLSpinCtrl::onDownBtn( const LLSD& data )
F32 saved_val = (F32)getValue().asReal();
setValue(val);
- if( !mValidateSignal( this, val ) )
+ if( mValidateSignal && !(*mValidateSignal)( this, val ) )
{
setValue( saved_val );
reportInvalidData();
@@ -316,7 +316,7 @@ void LLSpinCtrl::onEditorCommit( const LLSD& data )
F32 saved_val = getValueF32();
setValue(val);
- if( mValidateSignal( this, val ) )
+ if( !mValidateSignal || (*mValidateSignal)( this, val ) )
{
success = TRUE;
onCommit();
diff --git a/indra/llui/lltabcontainer.cpp b/indra/llui/lltabcontainer.cpp
index f5d8174820..d7d61cf6cb 100644
--- a/indra/llui/lltabcontainer.cpp
+++ b/indra/llui/lltabcontainer.cpp
@@ -1339,12 +1339,12 @@ BOOL LLTabContainer::selectTab(S32 which)
cbdata = selected_tuple->mTabPanel->getName();
BOOL res = FALSE;
- if( mValidateSignal( this, cbdata ) )
+ if( !mValidateSignal || (*mValidateSignal)( this, cbdata ) )
{
res = setTab(which);
- if (res)
+ if (res && mCommitSignal)
{
- mCommitSignal(this, cbdata);
+ (*mCommitSignal)(this, cbdata);
}
}
diff --git a/indra/llui/lluictrl.cpp b/indra/llui/lluictrl.cpp
index 08fc8fb784..a30d5b4651 100644
--- a/indra/llui/lluictrl.cpp
+++ b/indra/llui/lluictrl.cpp
@@ -78,7 +78,16 @@ LLUICtrl::LLUICtrl(const LLUICtrl::Params& p, const LLViewModelPtr& viewmodel)
mEnabledControlVariable(NULL),
mDisabledControlVariable(NULL),
mMakeVisibleControlVariable(NULL),
- mMakeInvisibleControlVariable(NULL)
+ mMakeInvisibleControlVariable(NULL),
+ mCommitSignal(NULL),
+ mValidateSignal(NULL),
+ mMouseEnterSignal(NULL),
+ mMouseLeaveSignal(NULL),
+ mMouseDownSignal(NULL),
+ mMouseUpSignal(NULL),
+ mRightMouseDownSignal(NULL),
+ mRightMouseUpSignal(NULL),
+ mDoubleClickSignal(NULL)
{
mUICtrlHandle.bind(this);
}
@@ -129,10 +138,14 @@ void LLUICtrl::initFromParams(const Params& p)
}
if (p.commit_callback.isProvided())
- initCommitCallback(p.commit_callback, mCommitSignal);
+ {
+ setCommitCallback(initCommitCallback(p.commit_callback));
+ }
if (p.validate_callback.isProvided())
- initEnableCallback(p.validate_callback, mValidateSignal);
+ {
+ setValidateCallback(initEnableCallback(p.validate_callback));
+ }
if (p.init_callback.isProvided())
{
@@ -151,10 +164,14 @@ void LLUICtrl::initFromParams(const Params& p)
}
if(p.mouseenter_callback.isProvided())
- initCommitCallback(p.mouseenter_callback, mMouseEnterSignal);
+ {
+ setMouseEnterCallback(initCommitCallback(p.mouseenter_callback));
+ }
if(p.mouseleave_callback.isProvided())
- initCommitCallback(p.mouseleave_callback, mMouseLeaveSignal);
+ {
+ setMouseLeaveCallback(initCommitCallback(p.mouseleave_callback));
+ }
}
@@ -167,16 +184,40 @@ LLUICtrl::~LLUICtrl()
llwarns << "UI Control holding top ctrl deleted: " << getName() << ". Top view removed." << llendl;
gFocusMgr.removeTopCtrlWithoutCallback( this );
}
+
+ delete mCommitSignal;
+ delete mValidateSignal;
+ delete mMouseEnterSignal;
+ delete mMouseLeaveSignal;
+ delete mMouseDownSignal;
+ delete mMouseUpSignal;
+ delete mRightMouseDownSignal;
+ delete mRightMouseUpSignal;
+ delete mDoubleClickSignal;
}
-void LLUICtrl::initCommitCallback(const CommitCallbackParam& cb, commit_signal_t& sig)
+void default_commit_handler(LLUICtrl* ctrl, const LLSD& param)
+{}
+
+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)
{
if (cb.function.isProvided())
{
if (cb.parameter.isProvided())
- sig.connect(boost::bind(cb.function(), _1, cb.parameter));
+ return boost::bind(cb.function(), _1, cb.parameter);
else
- sig.connect(cb.function());
+ return cb.function();
}
else
{
@@ -185,26 +226,27 @@ void LLUICtrl::initCommitCallback(const CommitCallbackParam& cb, commit_signal_t
if (func)
{
if (cb.parameter.isProvided())
- sig.connect(boost::bind((*func), _1, cb.parameter));
+ return boost::bind((*func), _1, cb.parameter);
else
- sig.connect(*func);
+ return commit_signal_t::slot_type(*func);
}
else if (!function_name.empty())
{
llwarns << "No callback found for: '" << function_name << "' in control: " << getName() << llendl;
}
}
+ return default_commit_handler;
}
-void LLUICtrl::initEnableCallback(const EnableCallbackParam& cb, enable_signal_t& sig)
+LLUICtrl::enable_signal_t::slot_type LLUICtrl::initEnableCallback(const EnableCallbackParam& cb)
{
// Set the callback function
if (cb.function.isProvided())
{
if (cb.parameter.isProvided())
- sig.connect(boost::bind(cb.function(), this, cb.parameter));
+ return boost::bind(cb.function(), this, cb.parameter);
else
- sig.connect(cb.function());
+ return cb.function();
}
else
{
@@ -212,22 +254,23 @@ void LLUICtrl::initEnableCallback(const EnableCallbackParam& cb, enable_signal_t
if (func)
{
if (cb.parameter.isProvided())
- sig.connect(boost::bind((*func), this, cb.parameter));
+ return boost::bind((*func), this, cb.parameter);
else
- sig.connect(*func);
+ return enable_signal_t::slot_type(*func);
}
}
+ return default_enable_handler;
}
-void LLUICtrl::initVisibleCallback(const VisibleCallbackParam& cb, visible_signal_t& sig)
+LLUICtrl::visible_signal_t::slot_type LLUICtrl::initVisibleCallback(const VisibleCallbackParam& cb)
{
// Set the callback function
if (cb.function.isProvided())
{
if (cb.parameter.isProvided())
- sig.connect(boost::bind(cb.function(), this, cb.parameter));
+ return boost::bind(cb.function(), this, cb.parameter);
else
- sig.connect(cb.function());
+ return cb.function();
}
else
{
@@ -235,30 +278,40 @@ void LLUICtrl::initVisibleCallback(const VisibleCallbackParam& cb, visible_signa
if (func)
{
if (cb.parameter.isProvided())
- sig.connect(boost::bind((*func), this, cb.parameter));
+ return boost::bind((*func), this, cb.parameter);
else
- sig.connect(*func);
+ return visible_signal_t::slot_type(*func);
}
}
+ return default_visible_handler;
}
// virtual
void LLUICtrl::onMouseEnter(S32 x, S32 y, MASK mask)
{
- mMouseEnterSignal(this, getValue());
+ if (mMouseEnterSignal)
+ {
+ (*mMouseEnterSignal)(this, getValue());
+ }
}
// virtual
void LLUICtrl::onMouseLeave(S32 x, S32 y, MASK mask)
{
- mMouseLeaveSignal(this, getValue());
+ if(mMouseLeaveSignal)
+ {
+ (*mMouseLeaveSignal)(this, getValue());
+ }
}
//virtual
BOOL LLUICtrl::handleMouseDown(S32 x, S32 y, MASK mask)
{
BOOL handled = LLView::handleMouseDown(x,y,mask);
- mMouseDownSignal(this,x,y,mask);
+ if (mMouseDownSignal)
+ {
+ (*mMouseDownSignal)(this,x,y,mask);
+ }
return handled;
}
@@ -266,7 +319,10 @@ BOOL LLUICtrl::handleMouseDown(S32 x, S32 y, MASK mask)
BOOL LLUICtrl::handleMouseUp(S32 x, S32 y, MASK mask)
{
BOOL handled = LLView::handleMouseUp(x,y,mask);
- mMouseUpSignal(this,x,y,mask);
+ if (mMouseUpSignal)
+ {
+ (*mMouseUpSignal)(this,x,y,mask);
+ }
return handled;
}
@@ -274,7 +330,10 @@ BOOL LLUICtrl::handleMouseUp(S32 x, S32 y, MASK mask)
BOOL LLUICtrl::handleRightMouseDown(S32 x, S32 y, MASK mask)
{
BOOL handled = LLView::handleRightMouseDown(x,y,mask);
- mRightMouseDownSignal(this,x,y,mask);
+ if (mRightMouseDownSignal)
+ {
+ (*mRightMouseDownSignal)(this,x,y,mask);
+ }
return handled;
}
@@ -282,14 +341,20 @@ BOOL LLUICtrl::handleRightMouseDown(S32 x, S32 y, MASK mask)
BOOL LLUICtrl::handleRightMouseUp(S32 x, S32 y, MASK mask)
{
BOOL handled = LLView::handleRightMouseUp(x,y,mask);
- mRightMouseUpSignal(this,x,y,mask);
+ if(mRightMouseUpSignal)
+ {
+ (*mRightMouseUpSignal)(this,x,y,mask);
+ }
return handled;
}
BOOL LLUICtrl::handleDoubleClick(S32 x, S32 y, MASK mask)
{
BOOL handled = LLView::handleDoubleClick(x, y, mask);
- mDoubleClickSignal(this, x, y, mask);
+ if (mDoubleClickSignal)
+ {
+ (*mDoubleClickSignal)(this, x, y, mask);
+ }
return handled;
}
@@ -302,7 +367,8 @@ BOOL LLUICtrl::canFocusChildren() const
void LLUICtrl::onCommit()
{
- mCommitSignal(this, getValue());
+ if (mCommitSignal)
+ (*mCommitSignal)(this, getValue());
}
//virtual
@@ -832,7 +898,8 @@ boost::signals2::connection LLUICtrl::setCommitCallback( boost::function<void (L
}
boost::signals2::connection LLUICtrl::setValidateBeforeCommit( boost::function<bool (const LLSD& data)> cb )
{
- return mValidateSignal.connect(boost::bind(cb, _2));
+ if (!mValidateSignal) mValidateSignal = new enable_signal_t();
+ return mValidateSignal->connect(boost::bind(cb, _2));
}
// virtual
@@ -850,3 +917,57 @@ BOOL LLUICtrl::getTentative() const
// virtual
void LLUICtrl::setColor(const LLColor4& color)
{ }
+
+boost::signals2::connection LLUICtrl::setCommitCallback( const commit_signal_t::slot_type& cb )
+{
+ if (!mCommitSignal) mCommitSignal = new commit_signal_t();
+ return mCommitSignal->connect(cb);
+}
+
+boost::signals2::connection LLUICtrl::setValidateCallback( const enable_signal_t::slot_type& cb )
+{
+ if (!mValidateSignal) mValidateSignal = new enable_signal_t();
+ return mValidateSignal->connect(cb);
+}
+
+boost::signals2::connection LLUICtrl::setMouseEnterCallback( const commit_signal_t::slot_type& cb )
+{
+ if (!mMouseEnterSignal) mMouseEnterSignal = new commit_signal_t();
+ return mMouseEnterSignal->connect(cb);
+}
+
+boost::signals2::connection LLUICtrl::setMouseLeaveCallback( const commit_signal_t::slot_type& cb )
+{
+ if (!mMouseLeaveSignal) mMouseLeaveSignal = new commit_signal_t();
+ return mMouseLeaveSignal->connect(cb);
+}
+
+boost::signals2::connection LLUICtrl::setMouseDownCallback( const mouse_signal_t::slot_type& cb )
+{
+ if (!mMouseDownSignal) mMouseDownSignal = new mouse_signal_t();
+ return mMouseDownSignal->connect(cb);
+}
+
+boost::signals2::connection LLUICtrl::setMouseUpCallback( const mouse_signal_t::slot_type& cb )
+{
+ if (!mMouseUpSignal) mMouseUpSignal = new mouse_signal_t();
+ return mMouseUpSignal->connect(cb);
+}
+
+boost::signals2::connection LLUICtrl::setRightMouseDownCallback( const mouse_signal_t::slot_type& cb )
+{
+ if (!mRightMouseDownSignal) mRightMouseDownSignal = new mouse_signal_t();
+ return mRightMouseDownSignal->connect(cb);
+}
+
+boost::signals2::connection LLUICtrl::setRightMouseUpCallback( const mouse_signal_t::slot_type& cb )
+{
+ if (!mRightMouseUpSignal) mRightMouseUpSignal = new mouse_signal_t();
+ return mRightMouseUpSignal->connect(cb);
+}
+
+boost::signals2::connection LLUICtrl::setDoubleClickCallback( const mouse_signal_t::slot_type& cb )
+{
+ if (!mDoubleClickSignal) mDoubleClickSignal = new mouse_signal_t();
+ return mDoubleClickSignal->connect(cb);
+}
diff --git a/indra/llui/lluictrl.h b/indra/llui/lluictrl.h
index dd22851100..aef1bcd519 100644
--- a/indra/llui/lluictrl.h
+++ b/indra/llui/lluictrl.h
@@ -162,9 +162,9 @@ protected:
LLUICtrl(const Params& p = getDefaultParams(),
const LLViewModelPtr& viewmodel=LLViewModelPtr(new LLViewModel));
- void initCommitCallback(const CommitCallbackParam& cb, commit_signal_t& sig);
- void initEnableCallback(const EnableCallbackParam& cb, enable_signal_t& sig);
- void initVisibleCallback(const VisibleCallbackParam& cb, visible_signal_t& sig);
+ 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;
@@ -254,18 +254,18 @@ public:
// topic then put in help_topic_out
bool findHelpTopic(std::string& help_topic_out);
- boost::signals2::connection setCommitCallback( const commit_signal_t::slot_type& cb ) { return mCommitSignal.connect(cb); }
- boost::signals2::connection setValidateCallback( const enable_signal_t::slot_type& cb ) { return mValidateSignal.connect(cb); }
+ boost::signals2::connection setCommitCallback( const commit_signal_t::slot_type& cb );
+ boost::signals2::connection setValidateCallback( const enable_signal_t::slot_type& cb );
- boost::signals2::connection setMouseEnterCallback( const commit_signal_t::slot_type& cb ) { return mMouseEnterSignal.connect(cb); }
- boost::signals2::connection setMouseLeaveCallback( const commit_signal_t::slot_type& cb ) { return mMouseLeaveSignal.connect(cb); }
+ boost::signals2::connection setMouseEnterCallback( const commit_signal_t::slot_type& cb );
+ boost::signals2::connection setMouseLeaveCallback( const commit_signal_t::slot_type& cb );
- boost::signals2::connection setMouseDownCallback( const mouse_signal_t::slot_type& cb ) { return mMouseDownSignal.connect(cb); }
- boost::signals2::connection setMouseUpCallback( const mouse_signal_t::slot_type& cb ) { return mMouseUpSignal.connect(cb); }
- boost::signals2::connection setRightMouseDownCallback( const mouse_signal_t::slot_type& cb ) { return mRightMouseDownSignal.connect(cb); }
- boost::signals2::connection setRightMouseUpCallback( const mouse_signal_t::slot_type& cb ) { return mRightMouseUpSignal.connect(cb); }
+ boost::signals2::connection setMouseDownCallback( const mouse_signal_t::slot_type& cb );
+ boost::signals2::connection setMouseUpCallback( const mouse_signal_t::slot_type& cb );
+ boost::signals2::connection setRightMouseDownCallback( const mouse_signal_t::slot_type& cb );
+ boost::signals2::connection setRightMouseUpCallback( const mouse_signal_t::slot_type& cb );
- boost::signals2::connection setDoubleClickCallback( const mouse_signal_t::slot_type& cb ) { return mDoubleClickSignal.connect(cb); }
+ boost::signals2::connection setDoubleClickCallback( const mouse_signal_t::slot_type& cb );
// *TODO: Deprecate; for backwards compatability only:
boost::signals2::connection setCommitCallback( boost::function<void (LLUICtrl*,void*)> cb, void* data);
@@ -293,18 +293,18 @@ protected:
static bool controlListener(const LLSD& newvalue, LLHandle<LLUICtrl> handle, std::string type);
- commit_signal_t mCommitSignal;
- enable_signal_t mValidateSignal;
+ commit_signal_t* mCommitSignal;
+ enable_signal_t* mValidateSignal;
- commit_signal_t mMouseEnterSignal;
- commit_signal_t mMouseLeaveSignal;
+ commit_signal_t* mMouseEnterSignal;
+ commit_signal_t* mMouseLeaveSignal;
- mouse_signal_t mMouseDownSignal;
- mouse_signal_t mMouseUpSignal;
- mouse_signal_t mRightMouseDownSignal;
- mouse_signal_t mRightMouseUpSignal;
+ mouse_signal_t* mMouseDownSignal;
+ mouse_signal_t* mMouseUpSignal;
+ mouse_signal_t* mRightMouseDownSignal;
+ mouse_signal_t* mRightMouseUpSignal;
- mouse_signal_t mDoubleClickSignal;
+ mouse_signal_t* mDoubleClickSignal;
LLViewModelPtr mViewModel;
diff --git a/indra/newview/llchiclet.cpp b/indra/newview/llchiclet.cpp
index 9845664c74..5fd4dcd343 100644
--- a/indra/newview/llchiclet.cpp
+++ b/indra/newview/llchiclet.cpp
@@ -163,7 +163,7 @@ LLChiclet::~LLChiclet()
boost::signals2::connection LLChiclet::setLeftButtonClickCallback(
const commit_callback_t& cb)
{
- return mCommitSignal.connect(cb);
+ return setCommitCallback(cb);
}
BOOL LLChiclet::handleMouseDown(S32 x, S32 y, MASK mask)
@@ -972,7 +972,10 @@ void LLChicletPanel::onChicletSizeChanged(LLChiclet* ctrl, const LLSD& param)
void LLChicletPanel::onChicletClick(LLUICtrl*ctrl,const LLSD&param)
{
- mCommitSignal(ctrl,param);
+ if (mCommitSignal)
+ {
+ (*mCommitSignal)(ctrl,param);
+ }
}
void LLChicletPanel::removeChiclet(chiclet_list_t::iterator it)
@@ -1277,7 +1280,7 @@ void LLChicletPanel::onRightScrollHeldDown()
boost::signals2::connection LLChicletPanel::setChicletClickedCallback(
const commit_callback_t& cb)
{
- return mCommitSignal.connect(cb);
+ return setCommitCallback(cb);
}
BOOL LLChicletPanel::handleScrollWheel(S32 x, S32 y, S32 clicks)
diff --git a/indra/newview/llfavoritesbar.cpp b/indra/newview/llfavoritesbar.cpp
index ae5be8cc7c..8406ddeeca 100644
--- a/indra/newview/llfavoritesbar.cpp
+++ b/indra/newview/llfavoritesbar.cpp
@@ -232,13 +232,15 @@ public:
virtual BOOL handleMouseDown(S32 x, S32 y, MASK mask)
{
- mMouseDownSignal(this, x, y, mask);
+ if (mMouseDownSignal)
+ (*mMouseDownSignal)(this, x, y, mask);
return LLMenuItemCallGL::handleMouseDown(x, y, mask);
}
virtual BOOL handleMouseUp(S32 x, S32 y, MASK mask)
{
- mMouseUpSignal(this, x, y, mask);
+ if (mMouseUpSignal)
+ (*mMouseUpSignal)(this, x, y, mask);
return LLMenuItemCallGL::handleMouseUp(x, y, mask);
}
diff --git a/indra/newview/llfloaterbuyland.cpp b/indra/newview/llfloaterbuyland.cpp
index 467796b4a3..976aaf8044 100644
--- a/indra/newview/llfloaterbuyland.cpp
+++ b/indra/newview/llfloaterbuyland.cpp
@@ -903,7 +903,7 @@ void LLFloaterBuyLandUI::tellUserError(
// virtual
BOOL LLFloaterBuyLandUI::postBuild()
{
- mVisibleSignal.connect(boost::bind(&LLFloaterBuyLandUI::onVisibilityChange, this, _2));
+ setVisibleCallback(boost::bind(&LLFloaterBuyLandUI::onVisibilityChange, this, _2));
mCurrency.prepare();
diff --git a/indra/newview/llfloaterchat.cpp b/indra/newview/llfloaterchat.cpp
index 58025ef78b..57bb93d81a 100644
--- a/indra/newview/llfloaterchat.cpp
+++ b/indra/newview/llfloaterchat.cpp
@@ -129,7 +129,7 @@ void LLFloaterChat::draw()
BOOL LLFloaterChat::postBuild()
{
// Hide the chat overlay when our history is visible.
- mVisibleSignal.connect(boost::bind(&LLFloaterChat::updateConsoleVisibility, this));
+ setVisibleCallback(boost::bind(&LLFloaterChat::updateConsoleVisibility, this));
mPanel = (LLPanelActiveSpeakers*)getChild<LLPanel>("active_speakers_panel");
diff --git a/indra/newview/llfloaterchatterbox.cpp b/indra/newview/llfloaterchatterbox.cpp
index fbf09207fe..1b14ca573a 100644
--- a/indra/newview/llfloaterchatterbox.cpp
+++ b/indra/newview/llfloaterchatterbox.cpp
@@ -114,7 +114,7 @@ LLFloaterChatterBox::~LLFloaterChatterBox()
BOOL LLFloaterChatterBox::postBuild()
{
- mVisibleSignal.connect(boost::bind(&LLFloaterChatterBox::onVisibilityChange, this, _2));
+ setVisibleCallback(boost::bind(&LLFloaterChatterBox::onVisibilityChange, this, _2));
if (gSavedSettings.getBOOL("ContactsTornOff"))
{
diff --git a/indra/newview/llfloaterland.cpp b/indra/newview/llfloaterland.cpp
index 22d6098d5b..d855ab1dfa 100644
--- a/indra/newview/llfloaterland.cpp
+++ b/indra/newview/llfloaterland.cpp
@@ -239,7 +239,7 @@ LLFloaterLand::LLFloaterLand(const LLSD& seed)
BOOL LLFloaterLand::postBuild()
{
- mVisibleSignal.connect(boost::bind(&LLFloaterLand::onVisibilityChange, this, _2));
+ setVisibleCallback(boost::bind(&LLFloaterLand::onVisibilityChange, this, _2));
LLTabContainer* tab = getChild<LLTabContainer>("landtab");
diff --git a/indra/newview/llimpanel.cpp b/indra/newview/llimpanel.cpp
index 87b801d73b..e6ded5f371 100644
--- a/indra/newview/llimpanel.cpp
+++ b/indra/newview/llimpanel.cpp
@@ -216,7 +216,7 @@ LLFloaterIMPanel::~LLFloaterIMPanel()
BOOL LLFloaterIMPanel::postBuild()
{
- mVisibleSignal.connect(boost::bind(&LLFloaterIMPanel::onVisibilityChange, this, _2));
+ setVisibleCallback(boost::bind(&LLFloaterIMPanel::onVisibilityChange, this, _2));
mInputEditor = getChild<LLLineEditor>("chat_editor");
mInputEditor->setFocusReceivedCallback( boost::bind(onInputEditorFocusReceived, _1, this) );
diff --git a/indra/newview/llmediactrl.cpp b/indra/newview/llmediactrl.cpp
index 5cd40273f6..2376a3581d 100644
--- a/indra/newview/llmediactrl.cpp
+++ b/indra/newview/llmediactrl.cpp
@@ -356,7 +356,7 @@ void LLMediaCtrl::onFocusLost()
//
BOOL LLMediaCtrl::postBuild ()
{
- mVisibleSignal.connect(boost::bind(&LLMediaCtrl::onVisibilityChange, this, _2));
+ setVisibleCallback(boost::bind(&LLMediaCtrl::onVisibilityChange, this, _2));
return TRUE;
}
diff --git a/indra/newview/llpanelavatartag.cpp b/indra/newview/llpanelavatartag.cpp
index 03ad19f911..7563cc7f61 100644
--- a/indra/newview/llpanelavatartag.cpp
+++ b/indra/newview/llpanelavatartag.cpp
@@ -92,7 +92,7 @@ void LLPanelAvatarTag::setAvatarId(const LLUUID& avatar_id)
boost::signals2::connection LLPanelAvatarTag::setLeftButtonClickCallback(
const commit_callback_t& cb)
{
- return mCommitSignal.connect(cb);
+ return setCommitCallback(cb);
}
BOOL LLPanelAvatarTag::handleMouseDown(S32 x, S32 y, MASK mask)
diff --git a/indra/newview/llpanelpeople.cpp b/indra/newview/llpanelpeople.cpp
index 4dc8872557..03421ce4f0 100644
--- a/indra/newview/llpanelpeople.cpp
+++ b/indra/newview/llpanelpeople.cpp
@@ -483,7 +483,7 @@ void LLPanelPeople::onFriendsAccordionExpandedCollapsed(const LLSD& param, LLAva
BOOL LLPanelPeople::postBuild()
{
- mVisibleSignal.connect(boost::bind(&LLPanelPeople::onVisibilityChange, this, _2));
+ setVisibleCallback(boost::bind(&LLPanelPeople::onVisibilityChange, this, _2));
mFilterEditor = getChild<LLFilterEditor>("filter_input");
mFilterEditor->setCommitCallback(boost::bind(&LLPanelPeople::onFilterEdit, this, _2));
diff --git a/indra/newview/llpreviewgesture.cpp b/indra/newview/llpreviewgesture.cpp
index 49a2a3723d..3d2c529dda 100644
--- a/indra/newview/llpreviewgesture.cpp
+++ b/indra/newview/llpreviewgesture.cpp
@@ -355,7 +355,7 @@ LLPreviewGesture::~LLPreviewGesture()
BOOL LLPreviewGesture::postBuild()
{
- mVisibleSignal.connect(boost::bind(&LLPreviewGesture::onVisibilityChange, this, _2));
+ setVisibleCallback(boost::bind(&LLPreviewGesture::onVisibilityChange, this, _2));
LLLineEditor* edit;
LLComboBox* combo;