Modernized lluictrl. Added LLViewModel. Fixed focus callbacks being called excessively. Updated LLButton, and implemented boost::signals2 to replace old callback handling.

This commit is contained in:
Shyotl
2012-03-02 16:57:33 -06:00
parent fb10af2723
commit 500135941a
48 changed files with 1359 additions and 961 deletions

View File

@@ -79,6 +79,7 @@ set(llui_SOURCE_FILES
lluistring.cpp lluistring.cpp
llundo.cpp llundo.cpp
llviewborder.cpp llviewborder.cpp
llviewmodel.cpp
llview.cpp llview.cpp
llviewquery.cpp llviewquery.cpp
) )
@@ -146,6 +147,7 @@ set(llui_HEADER_FILES
lluixmltags.h lluixmltags.h
llundo.h llundo.h
llviewborder.h llviewborder.h
llviewmodel.h
llview.h llview.h
llviewquery.h llviewquery.h
) )

File diff suppressed because it is too large Load Diff

View File

@@ -41,6 +41,8 @@
#include "llfontgl.h" #include "llfontgl.h"
#include "lluiimage.h" #include "lluiimage.h"
#include "lluistring.h" #include "lluistring.h"
#include "llinitparam.h"
#include "lluicolor.h"
// //
// Constants // Constants
@@ -85,21 +87,26 @@ public:
const LLFontGL* mGLFont = NULL, const LLFontGL* mGLFont = NULL,
const std::string& unselected_label = LLStringUtil::null, const std::string& unselected_label = LLStringUtil::null,
const std::string& selected_label = LLStringUtil::null ); const std::string& selected_label = LLStringUtil::null );
public:
virtual ~LLButton(); ~LLButton();
void init(void (*click_callback)(void*), void *callback_data, const LLFontGL* font, const std::string& control_name); // For backward compatability only
typedef boost::function<void(void*)> button_callback_t;
void addImageAttributeToXML(LLXMLNodePtr node, const LLPointer<LLUIImage>, const std::string& xmlTagName) const;
void addImageAttributeToXML(LLXMLNodePtr node, const std::string& imageName, void init(void (*click_callback)(void*), void *callback_data, const std::string& control_name);
const LLUUID& imageID,const std::string& xmlTagName) const;
virtual LLXMLNodePtr getXML(bool save_children = true) const; virtual LLXMLNodePtr getXML(bool save_children = true) const;
static LLView* fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *factory); static LLView* fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *factory);
virtual void setAlpha( F32 alpha ) { mAlpha = alpha; }
virtual BOOL handleUnicodeCharHere(llwchar uni_char); virtual BOOL handleUnicodeCharHere(llwchar uni_char);
virtual BOOL handleKeyHere(KEY key, MASK mask); virtual BOOL handleKeyHere(KEY key, MASK mask);
virtual BOOL handleMouseDown(S32 x, S32 y, MASK mask); virtual BOOL handleMouseDown(S32 x, S32 y, MASK mask);
virtual BOOL handleMouseUp(S32 x, S32 y, MASK mask); virtual BOOL handleMouseUp(S32 x, S32 y, MASK mask);
virtual BOOL handleHover(S32 x, S32 y, MASK mask); virtual BOOL handleHover(S32 x, S32 y, MASK mask);
virtual BOOL handleRightMouseDown(S32 x, S32 y, MASK mask);
virtual BOOL handleRightMouseUp(S32 x, S32 y, MASK mask);
virtual BOOL handleDoubleClick(S32 x, S32 y, MASK mask);
virtual void draw(); virtual void draw();
virtual void onMouseCaptureLost(); virtual void onMouseCaptureLost();
@@ -109,29 +116,48 @@ public:
void setUnselectedLabelColor( const LLColor4& c ) { mUnselectedLabelColor = c; } void setUnselectedLabelColor( const LLColor4& c ) { mUnselectedLabelColor = c; }
void setSelectedLabelColor( const LLColor4& c ) { mSelectedLabelColor = c; } void setSelectedLabelColor( const LLColor4& c ) { mSelectedLabelColor = c; }
void setClickedCallback( void (*cb)(void *data), void* data = NULL ); // mouse down and up within button
void setMouseDownCallback( void (*cb)(void *data) ) { mMouseDownCallback = cb; } // mouse down within button /*boost::signals2::connection setClickedCallback(const CommitCallbackParam& cb);
void setMouseUpCallback( void (*cb)(void *data) ) { mMouseUpCallback = cb; } // mouse up, EVEN IF NOT IN BUTTON boost::signals2::connection setMouseDownCallback(const CommitCallbackParam& cb);
void setHeldDownCallback( void (*cb)(void *data) ) { mHeldDownCallback = cb; } // Mouse button held down and in button boost::signals2::connection setMouseUpCallback(const CommitCallbackParam& cb);
boost::signals2::connection setHeldDownCallback(const CommitCallbackParam& cb);*/
boost::signals2::connection setClickedCallback( const commit_signal_t::slot_type& cb ); // mouse down and up within button
boost::signals2::connection setMouseDownCallback( const commit_signal_t::slot_type& cb );
boost::signals2::connection setMouseUpCallback( const commit_signal_t::slot_type& cb ); // mouse up, EVEN IF NOT IN BUTTON
// Passes a 'count' parameter in the commit param payload, i.e. param["count"])
boost::signals2::connection setHeldDownCallback( const commit_signal_t::slot_type& cb ); // Mouse button held down and in button
// *TODO: Deprecate (for backwards compatability only)
boost::signals2::connection setClickedCallback( button_callback_t cb, void* data );
boost::signals2::connection setMouseDownCallback( button_callback_t cb, void* data );
boost::signals2::connection setMouseUpCallback( button_callback_t cb, void* data );
boost::signals2::connection setHeldDownCallback( button_callback_t cb, void* data );
void setHeldDownDelay( F32 seconds, S32 frames = 0) { mHeldDownDelay = seconds; mHeldDownFrameDelay = frames; } void setHeldDownDelay( F32 seconds, S32 frames = 0) { mHeldDownDelay = seconds; mHeldDownFrameDelay = frames; }
F32 getHeldDownTime() const { return mMouseDownTimer.getElapsedTimeF32(); } F32 getHeldDownTime() const { return mMouseDownTimer.getElapsedTimeF32(); }
BOOL getIsToggle() const { return mIsToggle; }
void setIsToggle(BOOL is_toggle) { mIsToggle = is_toggle; }
BOOL toggleState(); BOOL toggleState();
BOOL getToggleState() const { return mToggleState; } BOOL getToggleState() const;
void setToggleState(BOOL b); void setToggleState(BOOL b);
void setHighlight(bool b);
void setFlashing( BOOL b ); void setFlashing( BOOL b );
BOOL getFlashing() const { return mFlashing; } BOOL getFlashing() const { return mFlashing; }
void setHAlign( LLFontGL::HAlign align ) { mHAlign = align; } void setHAlign( LLFontGL::HAlign align ) { mHAlign = align; }
LLFontGL::HAlign getHAlign() const { return mHAlign; } LLFontGL::HAlign getHAlign() const { return mHAlign; }
void setLeftHPad( S32 pad ) { mLeftHPad = pad; } void setLeftHPad( S32 pad ) { mLeftHPad = pad; }
S32 getLeftHPad() const { return mLeftHPad; } S32 getLeftHPad() const { return mLeftHPad; }
void setRightHPad( S32 pad ) { mRightHPad = pad; } void setRightHPad( S32 pad ) { mRightHPad = pad; }
S32 getRightHPad() const { return mRightHPad; } S32 getRightHPad() const { return mRightHPad; }
void setImageOverlayTopPad( S32 pad ) { mImageOverlayTopPad = pad; }
S32 getImageOverlayTopPad() const { return mImageOverlayTopPad; }
void setImageOverlayBottomPad( S32 pad ) { mImageOverlayBottomPad = pad; }
S32 getImageOverlayBottomPad() const { return mImageOverlayBottomPad; }
const std::string getLabelUnselected() const { return wstring_to_utf8str(mUnselectedLabel); } const std::string getLabelUnselected() const { return wstring_to_utf8str(mUnselectedLabel); }
const std::string getLabelSelected() const { return wstring_to_utf8str(mSelectedLabel); } const std::string getLabelSelected() const { return wstring_to_utf8str(mSelectedLabel); }
@@ -139,35 +165,31 @@ public:
void setImageColor(const std::string& color_control); void setImageColor(const std::string& color_control);
void setImageColor(const LLColor4& c); void setImageColor(const LLColor4& c);
/*virtual*/ void setColor(const LLColor4& c); /*virtual*/ void setColor(const LLColor4& c);
/*virtual*/ void setAlpha(F32 alpha);
void setImages(const std::string &image_name, const std::string &selected_name); void setImages(const std::string &image_name, const std::string &selected_name);
void setDisabledImages(const std::string &image_name, const std::string &selected_name);
void setDisabledImages(const std::string &image_name, const std::string &selected_name, const LLColor4& c);
void setHoverImages(const std::string &image_name, const std::string &selected_name);
void setDisabledImageColor(const LLColor4& c) { mDisabledImageColor = c; } void setDisabledImageColor(const LLColor4& c) { mDisabledImageColor = c; }
void setDisabledSelectedLabelColor( const LLColor4& c ) { mDisabledSelectedLabelColor = c; } void setDisabledSelectedLabelColor( const LLColor4& c ) { mDisabledSelectedLabelColor = c; }
void setImageOverlay(const std::string& image_name, LLFontGL::HAlign alignment = LLFontGL::HCENTER, const LLColor4& color = LLColor4::white); void setImageOverlay(const std::string& image_name, LLFontGL::HAlign alignment = LLFontGL::HCENTER, const LLColor4& color = LLColor4::white);
void setImageOverlay(const LLUUID& image_id, LLFontGL::HAlign alignment = LLFontGL::HCENTER, const LLColor4& color = LLColor4::white);
LLPointer<LLUIImage> getImageOverlay() { return mImageOverlay; } LLPointer<LLUIImage> getImageOverlay() { return mImageOverlay; }
LLFontGL::HAlign getImageOverlayHAlign() const { return mImageOverlayAlignment; }
void autoResize(); // resize with label of current btn state
virtual void setValue(const LLSD& value ); void resize(LLUIString label); // resize with label input
virtual LLSD getValue() const;
void setLabel( const LLStringExplicit& label); void setLabel( const LLStringExplicit& label);
virtual BOOL setLabelArg( const std::string& key, const LLStringExplicit& text ); virtual BOOL setLabelArg( const std::string& key, const LLStringExplicit& text );
void setLabelUnselected(const LLStringExplicit& label); void setLabelUnselected(const LLStringExplicit& label);
void setLabelSelected(const LLStringExplicit& label); void setLabelSelected(const LLStringExplicit& label);
void setDisabledLabel(const LLStringExplicit& disabled_label);
void setDisabledSelectedLabel(const LLStringExplicit& disabled_label);
void setDisabledLabelColor( const LLColor4& c ) { mDisabledLabelColor = c; } void setDisabledLabelColor( const LLColor4& c ) { mDisabledLabelColor = c; }
void setFont(const LLFontGL *font) void setFont(const LLFontGL *font)
{ mGLFont = ( font ? font : LLFontGL::getFontSansSerif()); } { mGLFont = ( font ? font : LLFontGL::getFontSansSerif()); }
const LLFontGL* getFont() const { return mGLFont; }
const LLUIString& getCurrentLabel() const;
void setScaleImage(BOOL scale) { mScaleImage = scale; } void setScaleImage(BOOL scale) { mScaleImage = scale; }
BOOL getScaleImage() const { return mScaleImage; } BOOL getScaleImage() const { return mScaleImage; }
@@ -175,132 +197,130 @@ public:
void setBorderEnabled(BOOL b) { mBorderEnabled = b; } void setBorderEnabled(BOOL b) { mBorderEnabled = b; }
static void onHeldDown(void *userdata); // to be called by gIdleCallbacks
void setHoverGlowStrength(F32 strength) { mHoverGlowStrength = strength; } void setHoverGlowStrength(F32 strength) { mHoverGlowStrength = strength; }
void setImageUnselected(const std::string &image_name);
const std::string& getImageUnselectedName() const { return mImageUnselectedName; }
void setImageSelected(const std::string &image_name);
const std::string& getImageSelectedName() const { return mImageSelectedName; }
void setImageHoverSelected(const std::string &image_name);
void setImageHoverUnselected(const std::string &image_name);
void setImageDisabled(const std::string &image_name);
void setImageDisabledSelected(const std::string &image_name);
void setImageUnselected(LLPointer<LLUIImage> image); void setImageUnselected(LLPointer<LLUIImage> image);
void setImageSelected(LLPointer<LLUIImage> image); void setImageSelected(LLPointer<LLUIImage> image);
void setImageHoverSelected(LLPointer<LLUIImage> image); void setImageHoverSelected(LLPointer<LLUIImage> image);
void setImageHoverUnselected(LLPointer<LLUIImage> image); void setImageHoverUnselected(LLPointer<LLUIImage> image);
void setImageDisabled(LLPointer<LLUIImage> image); void setImageDisabled(LLPointer<LLUIImage> image);
void setImageDisabledSelected(LLPointer<LLUIImage> image); void setImageDisabledSelected(LLPointer<LLUIImage> image);
void setImageFlash(LLPointer<LLUIImage> image);
void setImagePressed(LLPointer<LLUIImage> image);
void setCommitOnReturn(BOOL commit) { mCommitOnReturn = commit; } void setCommitOnReturn(BOOL commit) { mCommitOnReturn = commit; }
BOOL getCommitOnReturn() const { return mCommitOnReturn; } BOOL getCommitOnReturn() const { return mCommitOnReturn; }
static void onHeldDown(void *userdata); // to be called by gIdleCallbacks
void setHelpURLCallback(const std::string &help_url); void setHelpURLCallback(const std::string &help_url);
const std::string& getHelpURL() const { return mHelpURL; } const std::string& getHelpURL() const { return mHelpURL; }
void setForcePressedState(bool b) { mForcePressedState = b; }
void setAutoResize(bool auto_resize) { mAutoResize = auto_resize; }
bool getIsToggle() const { return mIsToggle; }
bool setIsToggle(bool toggle) { return mIsToggle = toggle; }
protected: protected:
virtual void drawBorder(const LLColor4& color, S32 size);
void setImageUnselectedID(const LLUUID &image_id);
const LLUUID& getImageUnselectedID() const { return mImageUnselectedID; }
void setImageSelectedID(const LLUUID &image_id);
const LLUUID& getImageSelectedID() const { return mImageSelectedID; }
void setImageHoverSelectedID(const LLUUID &image_id);
void setImageHoverUnselectedID(const LLUUID &image_id);
void setImageDisabledID(const LLUUID &image_id);
void setImageDisabledSelectedID(const LLUUID &image_id);
const LLPointer<LLUIImage>& getImageUnselected() const { return mImageUnselected; } const LLPointer<LLUIImage>& getImageUnselected() const { return mImageUnselected; }
const LLPointer<LLUIImage>& getImageSelected() const { return mImageSelected; } const LLPointer<LLUIImage>& getImageSelected() const { return mImageSelected; }
void getOverlayImageSize(S32& overlay_width, S32& overlay_height);
LLFrameTimer mMouseDownTimer; LLFrameTimer mMouseDownTimer;
bool mNeedsHighlight;
S32 mButtonFlashCount;
F32 mButtonFlashRate;
private: void drawBorder(LLUIImage* imagep, const LLColor4& color, S32 size);
void resetMouseDownTimer();
void (*mClickedCallback)(void* data );
void (*mMouseDownCallback)(void *data);
void (*mMouseUpCallback)(void *data);
void (*mHeldDownCallback)(void *data);
commit_signal_t* mMouseDownSignal;
commit_signal_t* mMouseUpSignal;
commit_signal_t* mHeldDownSignal;
const LLFontGL *mGLFont; const LLFontGL *mGLFont;
S32 mMouseDownFrame; S32 mMouseDownFrame;
F32 mHeldDownDelay; // seconds, after which held-down callbacks get called S32 mMouseHeldDownCount; // Counter for parameter passed to held-down callback
S32 mHeldDownFrameDelay; // frames, after which held-down callbacks get called F32 mHeldDownDelay; // seconds, after which held-down callbacks get called
S32 mHeldDownFrameDelay; // frames, after which held-down callbacks get called
LLPointer<LLUIImage> mImageOverlay; LLPointer<LLUIImage> mImageOverlay;
LLFontGL::HAlign mImageOverlayAlignment; LLFontGL::HAlign mImageOverlayAlignment;
LLColor4 mImageOverlayColor; LLUIColor mImageOverlayColor;
LLUIColor mImageOverlaySelectedColor;
LLUIColor mImageOverlayDisabledColor;
LLPointer<LLUIImage> mImageUnselected; LLPointer<LLUIImage> mImageUnselected;
LLUIString mUnselectedLabel; LLUIString mUnselectedLabel;
LLColor4 mUnselectedLabelColor; LLUIColor mUnselectedLabelColor;
LLPointer<LLUIImage> mImageSelected; LLPointer<LLUIImage> mImageSelected;
LLUIString mSelectedLabel; LLUIString mSelectedLabel;
LLColor4 mSelectedLabelColor; LLUIColor mSelectedLabelColor;
LLPointer<LLUIImage> mImageHoverSelected; LLPointer<LLUIImage> mImageHoverSelected;
LLPointer<LLUIImage> mImageHoverUnselected; LLPointer<LLUIImage> mImageHoverUnselected;
LLPointer<LLUIImage> mImageDisabled; LLPointer<LLUIImage> mImageDisabled;
LLUIString mDisabledLabel; LLUIColor mDisabledLabelColor;
LLColor4 mDisabledLabelColor;
LLPointer<LLUIImage> mImageDisabledSelected; LLPointer<LLUIImage> mImageDisabledSelected;
LLUIString mDisabledSelectedLabel; LLUIString mDisabledSelectedLabel;
LLColor4 mDisabledSelectedLabelColor; LLUIColor mDisabledSelectedLabelColor;
LLUUID mImageUnselectedID; LLPointer<LLUIImage> mImagePressed;
LLUUID mImageSelectedID; LLPointer<LLUIImage> mImagePressedSelected;
LLUUID mImageHoverSelectedID;
LLUUID mImageHoverUnselectedID;
LLUUID mImageDisabledID;
LLUUID mImageDisabledSelectedID;
std::string mImageUnselectedName;
std::string mImageSelectedName;
std::string mImageHoverSelectedName;
std::string mImageHoverUnselectedName;
std::string mImageDisabledName;
std::string mImageDisabledSelectedName;
LLColor4 mHighlightColor; /* There are two ways an image can flash- by making changes in color according to flash_color attribute
LLColor4 mUnselectedBgColor; or by changing icon from current to the one specified in image_flash. Second way is used only if
LLColor4 mSelectedBgColor; flash icon name is set in attributes(by default it isn't). First way is used otherwise. */
LLColor4 mFlashBgColor; LLPointer<LLUIImage> mImageFlash;
LLColor4 mImageColor; LLUIColor mFlashBgColor;
LLColor4 mDisabledImageColor;
BOOL mIsToggle; LLUIColor mImageColor;
BOOL mToggleState; LLUIColor mDisabledImageColor;
BOOL mScaleImage;
BOOL mDropShadowedText; bool mIsToggle;
bool mScaleImage;
BOOL mBorderEnabled; bool mDropShadowedText;
bool mAutoResize;
bool mBorderEnabled;
bool mFlashing;
BOOL mFlashing; LLFontGL::HAlign mHAlign;
S32 mLeftHPad;
S32 mRightHPad;
S32 mBottomVPad; // under text label
LLFontGL::HAlign mHAlign; S32 mImageOverlayTopPad;
S32 mLeftHPad; S32 mImageOverlayBottomPad;
S32 mRightHPad;
F32 mHoverGlowStrength; /*
F32 mCurGlowStrength; * Space between image_overlay and label
*/
S32 mImgOverlayLabelSpace;
BOOL mNeedsHighlight; F32 mHoverGlowStrength;
BOOL mCommitOnReturn; F32 mCurGlowStrength;
std::string mHelpURL; bool mCommitOnReturn;
bool mFadeWhenDisabled;
LLPointer<LLUIImage> mImagep; bool mForcePressedState;
bool mDisplayPressedState;
LLFrameTimer mFlashingTimer; std::string mHelpURL;
LLFrameTimer mFlashingTimer;
bool mHandleRightMouse;
F32 mAlpha;
}; };
#endif // LL_LLBUTTON_H #endif // LL_LLBUTTON_H

View File

@@ -113,37 +113,27 @@ LLCheckBoxCtrl::LLCheckBoxCtrl(const std::string& name, const LLRect& rect,
LLCHECKBOXCTRL_VPAD, LLCHECKBOXCTRL_VPAD,
LLCHECKBOXCTRL_BTN_SIZE + LLCHECKBOXCTRL_SPACING + text_width + LLCHECKBOXCTRL_HPAD, LLCHECKBOXCTRL_BTN_SIZE + LLCHECKBOXCTRL_SPACING + text_width + LLCHECKBOXCTRL_HPAD,
llmax( text_height, LLCHECKBOXCTRL_BTN_SIZE ) + LLCHECKBOXCTRL_VPAD); llmax( text_height, LLCHECKBOXCTRL_BTN_SIZE ) + LLCHECKBOXCTRL_VPAD);
std::string active_true_id, active_false_id;
std::string inactive_true_id, inactive_false_id; std::string active_true_id = mRadioStyle ? "UIImgRadioActiveSelectedUUID" : "UIImgCheckboxActiveSelectedUUID";
if (mRadioStyle) std::string active_false_id = mRadioStyle ? "UIImgRadioActiveUUID" : "UIImgCheckboxActiveUUID";
{ std::string inactive_true_id = mRadioStyle ? "UIImgRadioInactiveSelectedUUID" : "UIImgCheckboxInactiveSelectedUUID";
active_true_id = "UIImgRadioActiveSelectedUUID"; std::string inactive_false_id = mRadioStyle ? "UIImgRadioInactiveUUID" : "UIImgCheckboxInactiveUUID";
active_false_id = "UIImgRadioActiveUUID"; std::string button_name = mRadioStyle ? "Radio control button" : "Checkbox control button";
inactive_true_id = "UIImgRadioInactiveSelectedUUID";
inactive_false_id = "UIImgRadioInactiveUUID"; mButton = new LLButton( button_name, btn_rect,
mButton = new LLButton(std::string("Radio control button"), btn_rect, active_false_id, active_true_id, control_which,
active_false_id, active_true_id, control_which, &LLCheckBoxCtrl::onButtonPress, this, LLFontGL::getFontSansSerif() );
&LLCheckBoxCtrl::onButtonPress, this, LLFontGL::getFontSansSerif() );
mButton->setDisabledImages( inactive_false_id, inactive_true_id ); mButton->setImageDisabledSelected(LLUI::getUIImage(inactive_true_id));
mButton->setHoverGlowStrength(0.35f); mButton->setImageDisabled(LLUI::getUIImage(inactive_false_id));
} mButton->setHoverGlowStrength(0.35f);
else
{
active_false_id = "UIImgCheckboxActiveUUID";
active_true_id = "UIImgCheckboxActiveSelectedUUID";
inactive_true_id = "UIImgCheckboxInactiveSelectedUUID";
inactive_false_id = "UIImgCheckboxInactiveUUID";
mButton = new LLButton(std::string("Checkbox control button"), btn_rect,
active_false_id, active_true_id, control_which,
&LLCheckBoxCtrl::onButtonPress, this, LLFontGL::getFontSansSerif() );
mButton->setDisabledImages( inactive_false_id, inactive_true_id );
mButton->setHoverGlowStrength(0.35f);
}
mButton->setIsToggle(TRUE); mButton->setIsToggle(TRUE);
mButton->setToggleState( initial_value ); mButton->setToggleState( initial_value );
mButton->setFollowsLeft(); mButton->setFollowsLeft();
mButton->setFollowsBottom(); mButton->setFollowsBottom();
mButton->setCommitOnReturn(FALSE); mButton->setCommitOnReturn(FALSE);
mButton->setScaleImage(FALSE);
addChild(mButton); addChild(mButton);
} }
@@ -156,22 +146,8 @@ LLCheckBoxCtrl::~LLCheckBoxCtrl()
// static // static
void LLCheckBoxCtrl::onButtonPress( void *userdata ) void LLCheckBoxCtrl::onButtonPress( void *userdata )
{ {
LLCheckBoxCtrl* self = (LLCheckBoxCtrl*) userdata; LLCheckBoxCtrl* self = (LLCheckBoxCtrl*)userdata;
if (self->mRadioStyle)
{
self->setValue(TRUE);
}
self->setControlValue(self->getValue());
// HACK: because buttons don't normally commit
self->onCommit(); self->onCommit();
if (self->mKeyboardFocusOnClick)
{
self->setFocus( TRUE );
self->onFocusReceived();
}
} }
void LLCheckBoxCtrl::onCommit() void LLCheckBoxCtrl::onCommit()
@@ -179,6 +155,7 @@ void LLCheckBoxCtrl::onCommit()
if( getEnabled() ) if( getEnabled() )
{ {
setTentative(FALSE); setTentative(FALSE);
setControlValue(getValue());
LLUICtrl::onCommit(); LLUICtrl::onCommit();
} }
} }
@@ -186,7 +163,15 @@ void LLCheckBoxCtrl::onCommit()
void LLCheckBoxCtrl::setEnabled(BOOL b) void LLCheckBoxCtrl::setEnabled(BOOL b)
{ {
LLView::setEnabled(b); LLView::setEnabled(b);
mButton->setEnabled(b);
if (b)
{
mLabel->setColor( mTextEnabledColor.get() );
}
else
{
mLabel->setColor( mTextDisabledColor.get() );
}
} }
void LLCheckBoxCtrl::clear() void LLCheckBoxCtrl::clear()
@@ -219,21 +204,6 @@ void LLCheckBoxCtrl::reshape(S32 width, S32 height, BOOL called_from_parent)
LLUICtrl::reshape(width, height, called_from_parent); LLUICtrl::reshape(width, height, called_from_parent);
} }
void LLCheckBoxCtrl::draw()
{
if (getEnabled())
{
mLabel->setColor( mTextEnabledColor );
}
else
{
mLabel->setColor( mTextDisabledColor );
}
// Draw children
LLUICtrl::draw();
}
//virtual //virtual
void LLCheckBoxCtrl::setValue(const LLSD& value ) void LLCheckBoxCtrl::setValue(const LLSD& value )
{ {
@@ -246,6 +216,18 @@ LLSD LLCheckBoxCtrl::getValue() const
return mButton->getValue(); return mButton->getValue();
} }
//virtual
void LLCheckBoxCtrl::setTentative(BOOL b)
{
mButton->setTentative(b);
}
//virtual
BOOL LLCheckBoxCtrl::getTentative() const
{
return mButton->getTentative();
}
void LLCheckBoxCtrl::setLabel( const LLStringExplicit& label ) void LLCheckBoxCtrl::setLabel( const LLStringExplicit& label )
{ {
mLabel->setText( label ); mLabel->setText( label );
@@ -282,7 +264,7 @@ BOOL LLCheckBoxCtrl::isDirty() const
{ {
if ( mButton ) if ( mButton )
{ {
return (mSetValue != mButton->getToggleState()); return mButton->isDirty();
} }
return FALSE; // Shouldn't get here return FALSE; // Shouldn't get here
} }
@@ -293,11 +275,12 @@ void LLCheckBoxCtrl::resetDirty()
{ {
if ( mButton ) if ( mButton )
{ {
mSetValue = mButton->getToggleState(); mButton->resetDirty();
} }
} }
// virtual // virtual
LLXMLNodePtr LLCheckBoxCtrl::getXML(bool save_children) const LLXMLNodePtr LLCheckBoxCtrl::getXML(bool save_children) const
{ {

View File

@@ -82,7 +82,6 @@ public:
virtual void setEnabled( BOOL b ); virtual void setEnabled( BOOL b );
virtual void draw();
virtual void reshape(S32 width, S32 height, BOOL called_from_parent = TRUE); virtual void reshape(S32 width, S32 height, BOOL called_from_parent = TRUE);
// LLUICtrl interface // LLUICtrl interface
@@ -91,8 +90,8 @@ public:
BOOL get() { return (BOOL)getValue().asBoolean(); } BOOL get() { return (BOOL)getValue().asBoolean(); }
void set(BOOL value) { setValue(value); } void set(BOOL value) { setValue(value); }
virtual void setTentative(BOOL b) { mButton->setTentative(b); } virtual void setTentative(BOOL b);
virtual BOOL getTentative() const { return mButton->getTentative(); } virtual BOOL getTentative() const;
virtual BOOL setLabelArg( const std::string& key, const LLStringExplicit& text ); virtual BOOL setLabelArg( const std::string& key, const LLStringExplicit& text );
@@ -108,6 +107,9 @@ public:
void setLabel( const LLStringExplicit& label ); void setLabel( const LLStringExplicit& label );
std::string getLabel() const; std::string getLabel() const;
void setFont( const LLFontGL* font ) { mFont = font; }
const LLFontGL* getFont() { return mFont; }
virtual void setControlName(const std::string& control_name, LLView* context); virtual void setControlName(const std::string& control_name, LLView* context);
virtual std::string getControlName() const; virtual std::string getControlName() const;
@@ -121,8 +123,9 @@ protected:
LLButton* mButton; LLButton* mButton;
LLTextBox* mLabel; LLTextBox* mLabel;
const LLFontGL* mFont; const LLFontGL* mFont;
LLColor4 mTextEnabledColor;
LLColor4 mTextDisabledColor; LLUIColor mTextEnabledColor;
LLUIColor mTextDisabledColor;
BOOL mRadioStyle; BOOL mRadioStyle;
BOOL mInitialValue; // Value set in constructor BOOL mInitialValue; // Value set in constructor
BOOL mSetValue; // Value set programmatically BOOL mSetValue; // Value set programmatically

View File

@@ -85,13 +85,13 @@ LLComboBox::LLComboBox( const std::string& name, const LLRect &rect, const std::
LLRect(), LLRect(),
LLStringUtil::null, LLStringUtil::null,
NULL, this); NULL, this);
mButton->setImageUnselected(std::string("square_btn_32x128.tga")); mButton->setImageUnselected(LLUI::getUIImage("square_btn_32x128.tga"));
mButton->setImageSelected(std::string("square_btn_selected_32x128.tga")); mButton->setImageSelected(LLUI::getUIImage("square_btn_selected_32x128.tga"));
mButton->setImageDisabled(std::string("square_btn_32x128.tga")); mButton->setImageDisabled(LLUI::getUIImage("square_btn_32x128.tga"));
mButton->setImageDisabledSelected(std::string("square_btn_selected_32x128.tga")); mButton->setImageDisabledSelected(LLUI::getUIImage("square_btn_selected_32x128.tga"));
mButton->setScaleImage(TRUE); mButton->setScaleImage(TRUE);
mButton->setMouseDownCallback(onButtonDown); mButton->setMouseDownCallback(boost::bind(&LLComboBox::onButtonDown,this));
mButton->setFont(LLFontGL::getFontSansSerifSmall()); mButton->setFont(LLFontGL::getFontSansSerifSmall());
mButton->setFollows(FOLLOWS_LEFT | FOLLOWS_BOTTOM | FOLLOWS_RIGHT); mButton->setFollows(FOLLOWS_LEFT | FOLLOWS_BOTTOM | FOLLOWS_RIGHT);
mButton->setHAlign( LLFontGL::LEFT ); mButton->setHAlign( LLFontGL::LEFT );
@@ -244,8 +244,6 @@ void LLComboBox::clear()
} }
mButton->setLabelSelected(LLStringUtil::null); mButton->setLabelSelected(LLStringUtil::null);
mButton->setLabelUnselected(LLStringUtil::null); mButton->setLabelUnselected(LLStringUtil::null);
mButton->setDisabledLabel(LLStringUtil::null);
mButton->setDisabledSelectedLabel(LLStringUtil::null);
mList->deselectAllItems(); mList->deselectAllItems();
} }
@@ -445,8 +443,6 @@ void LLComboBox::setLabel(const LLStringExplicit& name)
{ {
mButton->setLabelUnselected(name); mButton->setLabelUnselected(name);
mButton->setLabelSelected(name); mButton->setLabelSelected(name);
mButton->setDisabledLabel(name);
mButton->setDisabledSelectedLabel(name);
} }
} }
@@ -1218,7 +1214,7 @@ LLFlyoutButton::LLFlyoutButton(
LLRect(), LLStringUtil::null, NULL, this); LLRect(), LLStringUtil::null, NULL, this);
mActionButton->setScaleImage(TRUE); mActionButton->setScaleImage(TRUE);
mActionButton->setClickedCallback(onActionButtonClick); mActionButton->setClickedCallback(boost::bind(&LLFlyoutButton::onActionButtonClick, this));
mActionButton->setFollowsAll(); mActionButton->setFollowsAll();
mActionButton->setHAlign( LLFontGL::HCENTER ); mActionButton->setHAlign( LLFontGL::HCENTER );
mActionButton->setLabel(label); mActionButton->setLabel(label);

View File

@@ -707,6 +707,8 @@ const std::string& LLFloater::getCurrentTitle() const
void LLFloater::setTitle( const std::string& title ) void LLFloater::setTitle( const std::string& title )
{ {
if(mTitle == title)
return;
mTitle = title; mTitle = title;
applyTitle(); applyTitle();
} }
@@ -1742,8 +1744,8 @@ void LLFloater::buildButtons()
buttonp->setFollowsRight(); buttonp->setFollowsRight();
buttonp->setToolTip( sButtonToolTips[i] ); buttonp->setToolTip( sButtonToolTips[i] );
buttonp->setImageColor(LLUI::sColorsGroup->getColor("FloaterButtonImageColor")); buttonp->setImageColor(LLUI::sColorsGroup->getColor("FloaterButtonImageColor"));
buttonp->setHoverImages(sButtonPressedImageNames[i], buttonp->setImageHoverSelected(LLUI::getUIImage(sButtonPressedImageNames[i]));
sButtonPressedImageNames[i]); buttonp->setImageHoverUnselected(LLUI::getUIImage(sButtonPressedImageNames[i]));
buttonp->setScaleImage(TRUE); buttonp->setScaleImage(TRUE);
buttonp->setSaveToXML(false); buttonp->setSaveToXML(false);
addChild(buttonp); addChild(buttonp);

View File

@@ -127,7 +127,7 @@ LLScrollbar::LLScrollbar(
line_up_btn->setFollowsLeft(); line_up_btn->setFollowsLeft();
line_up_btn->setFollowsBottom(); line_up_btn->setFollowsBottom();
} }
line_up_btn->setHeldDownCallback( &LLScrollbar::onLineUpBtnPressed ); line_up_btn->setHeldDownCallback( boost::bind(&LLScrollbar::onLineUpBtnPressed, (void*)this) );
line_up_btn->setTabStop(FALSE); line_up_btn->setTabStop(FALSE);
line_up_btn->setScaleImage(TRUE); line_up_btn->setScaleImage(TRUE);
@@ -138,7 +138,7 @@ LLScrollbar::LLScrollbar(
&LLScrollbar::onLineDownBtnPressed, this, LLFontGL::getFontSansSerif() ); &LLScrollbar::onLineDownBtnPressed, this, LLFontGL::getFontSansSerif() );
line_down_btn->setFollowsRight(); line_down_btn->setFollowsRight();
line_down_btn->setFollowsBottom(); line_down_btn->setFollowsBottom();
line_down_btn->setHeldDownCallback( &LLScrollbar::onLineDownBtnPressed ); line_down_btn->setHeldDownCallback( boost::bind(&LLScrollbar::onLineDownBtnPressed, this) );
line_down_btn->setTabStop(FALSE); line_down_btn->setTabStop(FALSE);
line_down_btn->setScaleImage(TRUE); line_down_btn->setScaleImage(TRUE);
addChild(line_down_btn); addChild(line_down_btn);

View File

@@ -3679,9 +3679,9 @@ LLColumnHeader::LLColumnHeader(const std::string& label, const LLRect &rect, LLS
mButton->setTabStop(FALSE); mButton->setTabStop(FALSE);
// require at least two frames between mouse down and mouse up event to capture intentional "hold" not just bad framerate // require at least two frames between mouse down and mouse up event to capture intentional "hold" not just bad framerate
mButton->setHeldDownDelay(LLUI::sConfigGroup->getF32("ColumnHeaderDropDownDelay"), 2); mButton->setHeldDownDelay(LLUI::sConfigGroup->getF32("ColumnHeaderDropDownDelay"), 2);
mButton->setHeldDownCallback(onHeldDown); mButton->setHeldDownCallback(boost::bind(&LLColumnHeader::onHeldDown, this));
mButton->setClickedCallback(onClick); mButton->setClickedCallback(boost::bind(&LLColumnHeader::onClick, this));
mButton->setMouseDownCallback(onMouseDown); mButton->setMouseDownCallback(boost::bind(&LLColumnHeader::onMouseDown, this));
mButton->setCallbackUserData(this); mButton->setCallbackUserData(this);
mButton->setToolTip(label); mButton->setToolTip(label);
@@ -3843,8 +3843,8 @@ void LLColumnHeader::setImage(const std::string &image_name)
{ {
if (mButton) if (mButton)
{ {
mButton->setImageSelected(image_name); mButton->setImageSelected(LLUI::getUIImage(image_name));
mButton->setImageUnselected(image_name); mButton->setImageUnselected(LLUI::getUIImage(image_name));
} }
} }

View File

@@ -101,7 +101,7 @@ LLSpinCtrl::LLSpinCtrl( const std::string& name, const LLRect& rect, const std::
&LLSpinCtrl::onUpBtn, this, LLFontGL::getFontSansSerif() ); &LLSpinCtrl::onUpBtn, this, LLFontGL::getFontSansSerif() );
mUpBtn->setFollowsLeft(); mUpBtn->setFollowsLeft();
mUpBtn->setFollowsBottom(); mUpBtn->setFollowsBottom();
mUpBtn->setHeldDownCallback( &LLSpinCtrl::onUpBtn ); mUpBtn->setHeldDownCallback(boost::bind(&LLSpinCtrl::onUpBtn,this));
mUpBtn->setTabStop(FALSE); mUpBtn->setTabStop(FALSE);
addChild(mUpBtn); addChild(mUpBtn);
@@ -115,7 +115,7 @@ LLSpinCtrl::LLSpinCtrl( const std::string& name, const LLRect& rect, const std::
&LLSpinCtrl::onDownBtn, this, LLFontGL::getFontSansSerif() ); &LLSpinCtrl::onDownBtn, this, LLFontGL::getFontSansSerif() );
mDownBtn->setFollowsLeft(); mDownBtn->setFollowsLeft();
mDownBtn->setFollowsBottom(); mDownBtn->setFollowsBottom();
mDownBtn->setHeldDownCallback( &LLSpinCtrl::onDownBtn ); mDownBtn->setHeldDownCallback(boost::bind(&LLSpinCtrl::onDownBtn,this));
mDownBtn->setTabStop(FALSE); mDownBtn->setTabStop(FALSE);
addChild(mDownBtn); addChild(mDownBtn);

View File

@@ -803,7 +803,7 @@ void LLTabContainer::addTabPanel(LLPanel* child,
LLStringUtil::null, LLStringUtil::null,
LLStringUtil::null, LLStringUtil::null,
LLStringUtil::null, LLStringUtil::null,
&LLTabContainer::onTabBtn, NULL, NULL, NULL,
font, font,
trimmed_label, trimmed_label); trimmed_label, trimmed_label);
btn->setImages(std::string("tab_left.tga"), std::string("tab_left_selected.tga")); btn->setImages(std::string("tab_left.tga"), std::string("tab_left_selected.tga"));
@@ -825,7 +825,7 @@ void LLTabContainer::addTabPanel(LLPanel* child,
btn = new LLButton(std::string(child->getName()) + " tab", btn = new LLButton(std::string(child->getName()) + " tab",
btn_rect, btn_rect,
LLStringUtil::null, LLStringUtil::null, LLStringUtil::null, LLStringUtil::null, LLStringUtil::null, LLStringUtil::null,
&LLTabContainer::onTabBtn, NULL, // set userdata below NULL, NULL, // set userdata below
font, font,
trimmed_label, trimmed_label ); trimmed_label, trimmed_label );
btn->setVisible( FALSE ); btn->setVisible( FALSE );
@@ -865,7 +865,7 @@ void LLTabContainer::addTabPanel(LLPanel* child,
if (btn) if (btn)
{ {
btn->setSaveToXML(false); btn->setSaveToXML(false);
btn->setCallbackUserData( tuple ); btn->setClickedCallback(&LLTabContainer::onTabBtn, tuple);
addChild( btn, 0 ); addChild( btn, 0 );
} }
if (child) if (child)
@@ -1682,7 +1682,7 @@ void LLTabContainer::initButtons()
mPrevArrowBtn = new LLButton(std::string("Left Arrow"), left_arrow_btn_rect, mPrevArrowBtn = new LLButton(std::string("Left Arrow"), left_arrow_btn_rect,
out_id, in_id, LLStringUtil::null, out_id, in_id, LLStringUtil::null,
&LLTabContainer::onPrevBtn, this, LLFontGL::getFontSansSerif() ); &LLTabContainer::onPrevBtn, this, LLFontGL::getFontSansSerif() );
mPrevArrowBtn->setHeldDownCallback(onPrevBtnHeld); mPrevArrowBtn->setHeldDownCallback(boost::bind(LLTabContainer::onPrevBtnHeld, this));
mPrevArrowBtn->setFollowsLeft(); mPrevArrowBtn->setFollowsLeft();
out_id = "UIImgBtnJumpRightOutUUID"; out_id = "UIImgBtnJumpRightOutUUID";
@@ -1717,12 +1717,12 @@ void LLTabContainer::initButtons()
} }
} }
mPrevArrowBtn->setHeldDownCallback(onPrevBtnHeld); mPrevArrowBtn->setHeldDownCallback(boost::bind(&LLTabContainer::onPrevBtnHeld, this));
mPrevArrowBtn->setSaveToXML(false); mPrevArrowBtn->setSaveToXML(false);
mPrevArrowBtn->setTabStop(FALSE); mPrevArrowBtn->setTabStop(FALSE);
addChild(mPrevArrowBtn); addChild(mPrevArrowBtn);
mNextArrowBtn->setHeldDownCallback(onNextBtnHeld); mNextArrowBtn->setHeldDownCallback(boost::bind(&LLTabContainer::onNextBtnHeld, this));
mNextArrowBtn->setSaveToXML(false); mNextArrowBtn->setSaveToXML(false);
mNextArrowBtn->setTabStop(FALSE); mNextArrowBtn->setTabStop(FALSE);
addChild(mNextArrowBtn); addChild(mNextArrowBtn);

View File

@@ -42,6 +42,7 @@ static LLRegisterWidget<LLUICtrl> r("ui_ctrl");
// NOTE: the LLFocusableElement implementation has been moved to llfocusmgr.cpp, to mirror the header where the class is defined. // NOTE: the LLFocusableElement implementation has been moved to llfocusmgr.cpp, to mirror the header where the class is defined.
LLUICtrl::LLUICtrl() : LLUICtrl::LLUICtrl() :
mViewModel(LLViewModelPtr(new LLViewModel)),
mCommitSignal(NULL), mCommitSignal(NULL),
mValidateSignal(NULL), mValidateSignal(NULL),
mCommitCallback(NULL), mCommitCallback(NULL),
@@ -62,6 +63,7 @@ LLUICtrl::LLUICtrl(const std::string& name, const LLRect& rect, BOOL mouse_opaqu
LLView( name, rect, mouse_opaque, reshape ), LLView( name, rect, mouse_opaque, reshape ),
mCommitSignal(NULL), mCommitSignal(NULL),
mValidateSignal(NULL), mValidateSignal(NULL),
mViewModel(LLViewModelPtr(new LLViewModel)),
mCommitCallback( on_commit_callback), mCommitCallback( on_commit_callback),
mValidateCallback( NULL ), mValidateCallback( NULL ),
mCallbackUserData( callback_userdata ), mCallbackUserData( callback_userdata ),
@@ -101,12 +103,33 @@ BOOL LLUICtrl::isCtrl() const
return TRUE; return TRUE;
} }
//virtual
void LLUICtrl::setValue(const LLSD& value)
{
mViewModel->setValue(value);
}
//virtual //virtual
LLSD LLUICtrl::getValue() const LLSD LLUICtrl::getValue() const
{ {
return LLSD(); return mViewModel->getValue();
} }
/// When two widgets are displaying the same data (e.g. during a skin
/// change), share their ViewModel.
void LLUICtrl::shareViewModelFrom(const LLUICtrl& other)
{
// Because mViewModel is an LLViewModelPtr, this assignment will quietly
// dispose of the previous LLViewModel -- unless it's already shared by
// somebody else.
mViewModel = other.mViewModel;
}
//virtual
LLViewModel* LLUICtrl::getViewModel() const
{
return mViewModel;
}
// virtual // virtual
BOOL LLUICtrl::setTextArg( const std::string& key, const LLStringExplicit& text ) BOOL LLUICtrl::setTextArg( const std::string& key, const LLStringExplicit& text )
{ {
@@ -169,43 +192,12 @@ void LLUICtrl::onFocusReceived()
{ {
// trigger callbacks // trigger callbacks
LLFocusableElement::onFocusReceived(); LLFocusableElement::onFocusReceived();
// find first view in hierarchy above new focus that is a LLUICtrl
LLView* viewp = getParent();
LLUICtrl* last_focus = dynamic_cast<LLUICtrl*>(gFocusMgr.getLastKeyboardFocus());
while (viewp && !viewp->isCtrl())
{
viewp = viewp->getParent();
}
// and if it has newly gained focus, call onFocusReceived()
LLUICtrl* ctrlp = static_cast<LLUICtrl*>(viewp);
if (ctrlp && (!last_focus || !last_focus->hasAncestor(ctrlp)))
{
ctrlp->onFocusReceived();
}
} }
void LLUICtrl::onFocusLost() void LLUICtrl::onFocusLost()
{ {
// trigger callbacks // trigger callbacks
LLFocusableElement::onFocusLost(); LLFocusableElement::onFocusLost();
// find first view in hierarchy above old focus that is a LLUICtrl
LLView* viewp = getParent();
while (viewp && !viewp->isCtrl())
{
viewp = viewp->getParent();
}
// and if it has just lost focus, call onFocusReceived()
LLUICtrl* ctrlp = static_cast<LLUICtrl*>(viewp);
// hasFocus() includes any descendants
if (ctrlp && !ctrlp->hasFocus())
{
ctrlp->onFocusLost();
}
} }
// virtual // virtual
@@ -229,12 +221,13 @@ BOOL LLUICtrl::acceptsTextInput() const
//virtual //virtual
BOOL LLUICtrl::isDirty() const BOOL LLUICtrl::isDirty() const
{ {
return FALSE; return mViewModel->isDirty();
}; };
//virtual //virtual
void LLUICtrl::resetDirty() void LLUICtrl::resetDirty()
{ {
mViewModel->resetDirty();
} }
// virtual // virtual

View File

@@ -38,11 +38,13 @@
#include "llrect.h" #include "llrect.h"
#include "llsd.h" #include "llsd.h"
#include "llviewmodel.h" // *TODO move dependency to .cpp file
class LLUICtrl class LLUICtrl
: public LLView : public LLView
{ {
public: public:
typedef boost::function<void (LLUICtrl* ctrl, const LLSD& param)> commit_callback_t;
typedef boost::signals2::signal<void (LLUICtrl* ctrl, const LLSD& param)> commit_signal_t; typedef boost::signals2::signal<void (LLUICtrl* ctrl, const LLSD& param)> commit_signal_t;
typedef boost::signals2::signal<bool (LLUICtrl* ctrl, const LLSD& param), boost_boolean_combiner> enable_signal_t; typedef boost::signals2::signal<bool (LLUICtrl* ctrl, const LLSD& param), boost_boolean_combiner> enable_signal_t;
@@ -56,6 +58,10 @@ public:
U32 reshape=FOLLOWS_NONE); U32 reshape=FOLLOWS_NONE);
/*virtual*/ ~LLUICtrl(); /*virtual*/ ~LLUICtrl();
// We need this virtual so we can override it with derived versions
virtual LLViewModel* getViewModel() const;
// We shouldn't ever need to set this directly
//virtual void setViewModel(const LLViewModelPtr&);
// LLView interface // LLView interface
/*virtual*/ void initFromXML(LLXMLNodePtr node, LLView* parent); /*virtual*/ void initFromXML(LLXMLNodePtr node, LLView* parent);
/*virtual*/ LLXMLNodePtr getXML(bool save_children = true) const; /*virtual*/ LLXMLNodePtr getXML(bool save_children = true) const;
@@ -63,8 +69,6 @@ public:
/*virtual*/ void onFocusReceived(); /*virtual*/ void onFocusReceived();
/*virtual*/ void onFocusLost(); /*virtual*/ void onFocusLost();
/*virtual*/ BOOL isCtrl() const; /*virtual*/ BOOL isCtrl() const;
/*virtual*/ void setTentative(BOOL b);
/*virtual*/ BOOL getTentative() const;
// From LLFocusableElement // From LLFocusableElement
/*virtual*/ void setFocus( BOOL b ); /*virtual*/ void setFocus( BOOL b );
@@ -77,7 +81,14 @@ public:
virtual class LLCtrlListInterface* getListInterface(); virtual class LLCtrlListInterface* getListInterface();
virtual class LLCtrlScrollInterface* getScrollInterface(); virtual class LLCtrlScrollInterface* getScrollInterface();
virtual void setTentative(BOOL b);
virtual BOOL getTentative() const;
virtual void setValue(const LLSD& value);
virtual LLSD getValue() const; virtual LLSD getValue() const;
/// When two widgets are displaying the same data (e.g. during a skin
/// change), share their ViewModel.
virtual void shareViewModelFrom(const LLUICtrl& other);
virtual BOOL setTextArg( const std::string& key, const LLStringExplicit& text ); virtual BOOL setTextArg( const std::string& key, const LLStringExplicit& text );
virtual void setIsChrome(BOOL is_chrome); virtual void setIsChrome(BOOL is_chrome);
@@ -141,6 +152,8 @@ protected:
commit_signal_t* mCommitSignal; commit_signal_t* mCommitSignal;
enable_signal_t* mValidateSignal; enable_signal_t* mValidateSignal;
LLViewModelPtr mViewModel;
void (*mCommitCallback)( LLUICtrl* ctrl, void* userdata ); void (*mCommitCallback)( LLUICtrl* ctrl, void* userdata );
BOOL (*mValidateCallback)( LLUICtrl* ctrl, void* userdata ); BOOL (*mValidateCallback)( LLUICtrl* ctrl, void* userdata );

View File

@@ -504,16 +504,6 @@ LLRect LLView::getRequiredRect()
return mRect; return mRect;
} }
//virtual
void LLView::onFocusLost()
{
}
//virtual
void LLView::onFocusReceived()
{
}
BOOL LLView::focusNextRoot() BOOL LLView::focusNextRoot()
{ {
LLView::child_list_t result = LLView::getFocusRootsQuery().run(this); LLView::child_list_t result = LLView::getFocusRootsQuery().run(this);

View File

@@ -411,10 +411,6 @@ public:
BOOL getSaveToXML() const { return mSaveToXML; } BOOL getSaveToXML() const { return mSaveToXML; }
void setSaveToXML(BOOL b) { mSaveToXML = b; } void setSaveToXML(BOOL b) { mSaveToXML = b; }
// inherited from LLFocusableElement
/* virtual */ void onFocusLost();
/* virtual */ void onFocusReceived();
typedef enum e_hit_test_type typedef enum e_hit_test_type
{ {
HIT_TEST_USE_BOUNDING_RECT, HIT_TEST_USE_BOUNDING_RECT,

157
indra/llui/llviewmodel.cpp Normal file
View File

@@ -0,0 +1,157 @@
/**
* @file llviewmodel.cpp
* @author Nat Goodspeed
* @date 2008-08-08
* @brief Implementation for llviewmodel.
*
* $LicenseInfo:firstyear=2008&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
// Precompiled header
#include "linden_common.h"
// associated header
#include "llviewmodel.h"
// STL headers
// std headers
// external library headers
// other Linden headers
///
LLViewModel::LLViewModel()
: mDirty(false)
{
}
/// Instantiate an LLViewModel with an existing data value
LLViewModel::LLViewModel(const LLSD& value)
: mDirty(false)
{
setValue(value);
}
/// Update the stored value
void LLViewModel::setValue(const LLSD& value)
{
mValue = value;
mDirty = true;
}
LLSD LLViewModel::getValue() const
{
return mValue;
}
////////////////////////////////////////////////////////////////////////////
///
LLTextViewModel::LLTextViewModel()
: LLViewModel(false),
mUpdateFromDisplay(false)
{
}
/// Instantiate an LLViewModel with an existing data value
LLTextViewModel::LLTextViewModel(const LLSD& value)
: LLViewModel(value),
mUpdateFromDisplay(false)
{
}
/// Update the stored value
void LLTextViewModel::setValue(const LLSD& value)
{
LLViewModel::setValue(value);
mDisplay = utf8str_to_wstring(value.asString());
// mDisplay and mValue agree
mUpdateFromDisplay = false;
}
void LLTextViewModel::setDisplay(const LLWString& value)
{
// This is the strange way to alter the value. Normally we'd setValue()
// and do the utf8str_to_wstring() to get the corresponding mDisplay
// value. But a text editor might want to edit the display string
// directly, then convert back to UTF8 on commit.
mDisplay = value;
mDirty = true;
// Don't immediately convert to UTF8 -- do it lazily -- we expect many
// more setDisplay() calls than getValue() calls. Just flag that it needs
// doing.
mUpdateFromDisplay = true;
}
LLSD LLTextViewModel::getValue() const
{
// Has anyone called setDisplay() since the last setValue()? If so, have
// to convert mDisplay back to UTF8.
if (mUpdateFromDisplay)
{
// The fact that we're lazily updating fields in this object should be
// transparent to clients, which is why this method is left
// conventionally const. Nor do we particularly want to make these
// members mutable. Just cast away constness in this one place.
LLTextViewModel* nthis = const_cast<LLTextViewModel*>(this);
nthis->mUpdateFromDisplay = false;
nthis->mValue = wstring_to_utf8str(mDisplay);
}
return LLViewModel::getValue();
}
////////////////////////////////////////////////////////////////////////////
LLListViewModel::LLListViewModel(const LLSD& values)
: LLViewModel()
{
}
void LLListViewModel::addColumn(const LLSD& column, EAddPosition pos)
{
}
void LLListViewModel::clearColumns()
{
}
void LLListViewModel::setColumnLabel(const std::string& column, const std::string& label)
{
}
LLScrollListItem* LLListViewModel::addElement(const LLSD& value, EAddPosition pos,
void* userdata)
{
return NULL;
}
LLScrollListItem* LLListViewModel::addSimpleElement(const std::string& value, EAddPosition pos,
const LLSD& id)
{
return NULL;
}
void LLListViewModel::clearRows()
{
}
void LLListViewModel::sortByColumn(const std::string& name, bool ascending)
{
}

214
indra/llui/llviewmodel.h Normal file
View File

@@ -0,0 +1,214 @@
/**
* @file llviewmodel.h
* @author Nat Goodspeed
* @date 2008-08-08
* @brief Define "View Model" classes intended to store data values for use
* by LLUICtrl subclasses. The phrase is borrowed from Microsoft
* terminology, in which "View Model" means the storage object
* underlying a specific widget object -- as in our case -- rather
* than the business "model" object underlying the overall "view"
* presented by the collection of widgets.
*
* $LicenseInfo:firstyear=2008&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
#if ! defined(LL_LLVIEWMODEL_H)
#define LL_LLVIEWMODEL_H
#include "llpointer.h"
#include "llsd.h"
#include "llrefcount.h"
#include "stdenums.h"
#include "llstring.h"
#include <string>
class LLScrollListItem;
class LLViewModel;
class LLTextViewModel;
class LLListViewModel;
// Because LLViewModel is derived from LLRefCount, always pass, store
// and return LLViewModelPtr rather than plain LLViewModel*.
typedef LLPointer<LLViewModel> LLViewModelPtr;
typedef LLPointer<LLTextViewModel> LLTextViewModelPtr;
typedef LLPointer<LLListViewModel> LLListViewModelPtr;
/**
* LLViewModel stores a scalar LLSD data item, the current display value of a
* scalar LLUICtrl widget. LLViewModel subclasses are used to store data
* collections used for aggregate widgets. LLViewModel is ref-counted because
* -- for multiple skins -- we may have distinct widgets sharing the same
* LLViewModel data. This way, the LLViewModel is quietly deleted when the
* last referencing widget is destroyed.
*/
class LLViewModel: public LLRefCount
{
public:
LLViewModel();
/// Instantiate an LLViewModel with an existing data value
LLViewModel(const LLSD& value);
/// Update the stored value
virtual void setValue(const LLSD& value);
/// Get the stored value, in appropriate type.
virtual LLSD getValue() const;
/// Has the value been changed since last time we checked?
bool isDirty() const { return mDirty; }
/// Once the value has been saved to a file, or otherwise consumed by the
/// app, we no longer need to enable the Save button
void resetDirty() { mDirty = false; }
//
void setDirty() { mDirty = true; }
protected:
LLSD mValue;
bool mDirty;
};
/**
* LLTextViewModel stores a value displayed as text.
*/
class LLTextViewModel: public LLViewModel
{
public:
LLTextViewModel();
/// Instantiate an LLViewModel with an existing data value
LLTextViewModel(const LLSD& value);
// LLViewModel functions
virtual void setValue(const LLSD& value);
virtual LLSD getValue() const;
// New functions
/// Get the stored value in string form
const LLWString& getDisplay() const { return mDisplay; }
/**
* Set the display string directly (see LLTextEditor). What the user is
* editing is actually the LLWString value rather than the underlying
* UTF-8 value.
*/
void setDisplay(const LLWString& value);
private:
/// To avoid converting every widget's stored value from LLSD to LLWString
/// every frame, cache the converted value
LLWString mDisplay;
/// As the user edits individual characters (setDisplay()), defer
/// LLWString-to-UTF8 conversions until s/he's done.
bool mUpdateFromDisplay;
};
/**
* LLListViewModel stores a list of data items. The semantics are borrowed
* from LLScrollListCtrl.
*/
class LLListViewModel: public LLViewModel
{
public:
LLListViewModel() {}
LLListViewModel(const LLSD& values);
virtual void addColumn(const LLSD& column, EAddPosition pos = ADD_BOTTOM);
virtual void clearColumns();
virtual void setColumnLabel(const std::string& column, const std::string& label);
virtual LLScrollListItem* addElement(const LLSD& value, EAddPosition pos = ADD_BOTTOM,
void* userdata = NULL);
virtual LLScrollListItem* addSimpleElement(const std::string& value, EAddPosition pos,
const LLSD& id);
virtual void clearRows();
virtual void sortByColumn(const std::string& name, bool ascending);
};
//namespace LLViewModel
//{
// class Value
// {
// public:
// Value(const LLSD& value = LLSD());
//
// LLSD getValue() const { return mValue; }
// void setValue(const LLSD& value) { mValue = value; }
//
// bool isAvailable() const { return false; }
// bool isReadOnly() const { return false; }
//
// bool undo() { return false; }
// bool redo() { return false; }
//
// /// Has the value been changed since last time we checked?
// bool isDirty() const { return mDirty; }
// /// Once the value has been saved to a file, or otherwise consumed by the
// /// app, we no longer need to enable the Save button
// void resetDirty() { mDirty = false; }
// //
// void setDirty() { mDirty = true; }
//
// protected:
// LLSD mValue;
// bool mDirty;
// };
//
// class Numeric : public Value
// {
// public:
// Numeric(S32 value = 0);
// Numeric(F32 value);
//
// F32 getPrecision();
// F32 getMin();
// F32 getMax();
//
// void increment();
// void decrement();
// };
//
// class MultipleValues : public Value
// {
// class Selector
// {};
//
// MultipleValues();
// virtual S32 numElements();
// };
//
// class Tuple : public MultipleValues
// {
// Tuple(S32 size);
// LLSD getValue(S32 which) const;
// void setValue(S32 which, const LLSD& value);
// };
//
// class List : public MultipleValues
// {
// List();
//
// void add(const ValueModel& value);
// bool remove(const Selector& item);
//
// void setSortElement(const Selector& element);
// void sort();
// };
//
//};
#endif /* ! defined(LL_LLVIEWMODEL_H) */

View File

@@ -65,6 +65,11 @@ class HippoFloaterXmlImpl : public LLFloater
private: private:
std::string mName; std::string mName;
bool mIsNotifyOnClose; bool mIsNotifyOnClose;
//Must retain handles to unregister notices.
typedef boost::signals2::scoped_connection notice_connection_t;
typedef boost::shared_ptr<notice_connection_t> notice_ptr_t;
std::map<LLUICtrl*, notice_ptr_t > mNotices;
}; };
@@ -260,7 +265,7 @@ void HippoFloaterXml::execute(const std::string &cmds)
// ******************************************************************** // ********************************************************************
// generic notification callbacks // generic notification callbacks
static void notify(LLUICtrl *ctrl, void *data) static void notifyCallback(LLUICtrl *ctrl)
{ {
std::string msg = "NOTIFY:"; std::string msg = "NOTIFY:";
msg += ctrl->getName(); msg += ctrl->getName();
@@ -269,11 +274,6 @@ static void notify(LLUICtrl *ctrl, void *data)
send_chat_from_viewer(msg, CHAT_TYPE_WHISPER, CHANNEL); send_chat_from_viewer(msg, CHAT_TYPE_WHISPER, CHANNEL);
} }
static void notify(void *data)
{
notify(static_cast<LLUICtrl*>(data), 0);
}
void HippoFloaterXmlImpl::onClose(bool quitting) void HippoFloaterXmlImpl::onClose(bool quitting)
{ {
if (mIsNotifyOnClose) if (mIsNotifyOnClose)
@@ -324,16 +324,19 @@ bool HippoFloaterXmlImpl::execute(LLUICtrl *ctrl,
bool set = (value != "0"); bool set = (value != "0");
if (HippoFloaterXmlImpl *floater = dynamic_cast<HippoFloaterXmlImpl*>(ctrl)) { if (HippoFloaterXmlImpl *floater = dynamic_cast<HippoFloaterXmlImpl*>(ctrl)) {
floater->mIsNotifyOnClose = set; floater->mIsNotifyOnClose = set;
} else if (LLButton *button = dynamic_cast<LLButton*>(ctrl)) { } else if (LLButton *button = dynamic_cast<LLButton*>(ctrl))
{
if (set) if (set)
button->setClickedCallback(notify, ctrl); floater->mNotices[button] = notice_ptr_t(new notice_connection_t(button->setClickedCallback(boost::bind(&notifyCallback, ctrl))));
else else
button->setClickedCallback(0, 0); floater->mNotices.erase(button);
} else { }
else
{
if (set) if (set)
ctrl->setCommitCallback(notify); floater->mNotices[ctrl] = notice_ptr_t(new notice_connection_t(ctrl->setCommitCallback(boost::bind(&notifyCallback, ctrl))));
else else
ctrl->setCommitCallback(0); floater->mNotices.erase(ctrl);
} }
} }
} }

View File

@@ -267,12 +267,13 @@ BOOL LLFloaterAnimPreview::postBuild()
{ {
mPlayButton = new LLButton(std::string("play_btn"), LLRect(0,0,0,0)); mPlayButton = new LLButton(std::string("play_btn"), LLRect(0,0,0,0));
} }
mPlayButton->setClickedCallback(onBtnPlay); mPlayButton->setClickedCallback(boost::bind(&LLFloaterAnimPreview::onBtnPlay,this));
mPlayButton->setCallbackUserData(this);
mPlayButton->setImages(std::string("button_anim_play.tga"), mPlayButton->setImages(std::string("button_anim_play.tga"),
std::string("button_anim_play_selected.tga")); std::string("button_anim_play_selected.tga"));
mPlayButton->setDisabledImages(LLStringUtil::null,LLStringUtil::null);
mPlayButton->setImageDisabled(NULL);
mPlayButton->setImageDisabledSelected(NULL);
mPlayButton->setScaleImage(TRUE); mPlayButton->setScaleImage(TRUE);
@@ -281,12 +282,13 @@ BOOL LLFloaterAnimPreview::postBuild()
{ {
mStopButton = new LLButton(std::string("stop_btn"), LLRect(0,0,0,0)); mStopButton = new LLButton(std::string("stop_btn"), LLRect(0,0,0,0));
} }
mStopButton->setClickedCallback(onBtnStop); mStopButton->setClickedCallback(boost::bind(&LLFloaterAnimPreview::onBtnStop, this));
mStopButton->setCallbackUserData(this);
mStopButton->setImages(std::string("button_anim_stop.tga"), mStopButton->setImages(std::string("button_anim_stop.tga"),
std::string("button_anim_stop_selected.tga")); std::string("button_anim_stop_selected.tga"));
mStopButton->setDisabledImages(LLStringUtil::null,LLStringUtil::null);
mStopButton->setImageDisabled(NULL);
mStopButton->setImageDisabledSelected(NULL);
mStopButton->setScaleImage(TRUE); mStopButton->setScaleImage(TRUE);

View File

@@ -224,20 +224,17 @@ LLFloaterColorPicker::
postBuild() postBuild()
{ {
mCancelBtn = getChild<LLButton>( "cancel_btn" ); mCancelBtn = getChild<LLButton>( "cancel_btn" );
mCancelBtn->setClickedCallback ( onClickCancel ); mCancelBtn->setClickedCallback ( boost::bind(&LLFloaterColorPicker::onClickCancel,this) );
mCancelBtn->setCallbackUserData ( this );
mSelectBtn = getChild<LLButton>( "select_btn"); mSelectBtn = getChild<LLButton>( "select_btn");
mSelectBtn->setClickedCallback ( onClickSelect ); mSelectBtn->setClickedCallback ( boost::bind(&LLFloaterColorPicker::onClickSelect,this) );
mSelectBtn->setCallbackUserData ( this );
mSelectBtn->setFocus ( TRUE ); mSelectBtn->setFocus ( TRUE );
mPipetteBtn = getChild<LLButton>("color_pipette" ); mPipetteBtn = getChild<LLButton>("color_pipette" );
mPipetteBtn->setImages(std::string("eye_button_inactive.tga"), std::string("eye_button_active.tga")); mPipetteBtn->setImages(std::string("eye_button_inactive.tga"), std::string("eye_button_active.tga"));
mPipetteBtn->setClickedCallback( onClickPipette ); mPipetteBtn->setClickedCallback( boost::bind(&LLFloaterColorPicker::onClickPipette,this) );
mPipetteBtn->setCallbackUserData ( this );
mApplyImmediateCheck = getChild<LLCheckBoxCtrl>("apply_immediate"); mApplyImmediateCheck = getChild<LLCheckBoxCtrl>("apply_immediate");
mApplyImmediateCheck->set(gSavedSettings.getBOOL("ApplyColorImmediately")); mApplyImmediateCheck->set(gSavedSettings.getBOOL("ApplyColorImmediately"));

View File

@@ -1419,15 +1419,15 @@ LLScrollingPanelParam::LLScrollingPanelParam( const std::string& name,
childSetValue("min param text", min_name); childSetValue("min param text", min_name);
childSetValue("max param text", max_name); childSetValue("max param text", max_name);
mLess = getChild<LLButton>("less"); mLess = getChild<LLButton>("less");
mLess->setMouseDownCallback( LLScrollingPanelParam::onHintMinMouseDown ); mLess->setMouseDownCallback( boost::bind(&LLScrollingPanelParam::onHintMinMouseDown, this) );
mLess->setMouseUpCallback( LLScrollingPanelParam::onHintMinMouseUp ); mLess->setMouseUpCallback( boost::bind(LLScrollingPanelParam::onHintMinMouseUp, this) );
mLess->setHeldDownCallback( LLScrollingPanelParam::onHintMinHeldDown ); mLess->setHeldDownCallback( boost::bind(LLScrollingPanelParam::onHintMinHeldDown, this) );
mLess->setHeldDownDelay( PARAM_STEP_TIME_THRESHOLD ); mLess->setHeldDownDelay( PARAM_STEP_TIME_THRESHOLD );
mMore = getChild<LLButton>("more"); mMore = getChild<LLButton>("more");
mMore->setMouseDownCallback( LLScrollingPanelParam::onHintMaxMouseDown ); mMore->setMouseDownCallback( boost::bind(LLScrollingPanelParam::onHintMaxMouseDown, this) );
mMore->setMouseUpCallback( LLScrollingPanelParam::onHintMaxMouseUp ); mMore->setMouseUpCallback( boost::bind(LLScrollingPanelParam::onHintMaxMouseUp, this) );
mMore->setHeldDownCallback( LLScrollingPanelParam::onHintMaxHeldDown ); mMore->setHeldDownCallback( boost::bind(LLScrollingPanelParam::onHintMaxHeldDown, this) );
mMore->setHeldDownDelay( PARAM_STEP_TIME_THRESHOLD ); mMore->setHeldDownDelay( PARAM_STEP_TIME_THRESHOLD );
} }
else else

View File

@@ -147,25 +147,25 @@ void LLFloaterLagMeter::determineClient()
if (!gFocusMgr.getAppHasFocus()) if (!gFocusMgr.getAppHasFocus())
{ {
mClientButton->setImageUnselected(LAG_GOOD_IMAGE_NAME); mClientButton->setImageUnselected(LLUI::getUIImage(LAG_GOOD_IMAGE_NAME));
mClientText->setText( getString("client_frame_time_window_bg_msg", mStringArgs) ); mClientText->setText( getString("client_frame_time_window_bg_msg", mStringArgs) );
mClientCause->setText( LLStringUtil::null ); mClientCause->setText( LLStringUtil::null );
} }
else if(client_frame_time >= mClientFrameTimeCritical) else if(client_frame_time >= mClientFrameTimeCritical)
{ {
mClientButton->setImageUnselected(LAG_CRITICAL_IMAGE_NAME); mClientButton->setImageUnselected(LLUI::getUIImage(LAG_CRITICAL_IMAGE_NAME));
mClientText->setText( getString("client_frame_time_critical_msg", mStringArgs) ); mClientText->setText( getString("client_frame_time_critical_msg", mStringArgs) );
find_cause = true; find_cause = true;
} }
else if(client_frame_time >= mClientFrameTimeWarning) else if(client_frame_time >= mClientFrameTimeWarning)
{ {
mClientButton->setImageUnselected(LAG_WARNING_IMAGE_NAME); mClientButton->setImageUnselected(LLUI::getUIImage(LAG_WARNING_IMAGE_NAME));
mClientText->setText( getString("client_frame_time_warning_msg", mStringArgs) ); mClientText->setText( getString("client_frame_time_warning_msg", mStringArgs) );
find_cause = true; find_cause = true;
} }
else else
{ {
mClientButton->setImageUnselected(LAG_GOOD_IMAGE_NAME); mClientButton->setImageUnselected(LLUI::getUIImage(LAG_GOOD_IMAGE_NAME));
mClientText->setText( getString("client_frame_time_normal_msg", mStringArgs) ); mClientText->setText( getString("client_frame_time_normal_msg", mStringArgs) );
mClientCause->setText( LLStringUtil::null ); mClientCause->setText( LLStringUtil::null );
} }
@@ -206,13 +206,13 @@ void LLFloaterLagMeter::determineNetwork()
if(packet_loss >= mNetworkPacketLossCritical) if(packet_loss >= mNetworkPacketLossCritical)
{ {
mNetworkButton->setImageUnselected(LAG_CRITICAL_IMAGE_NAME); mNetworkButton->setImageUnselected(LLUI::getUIImage(LAG_CRITICAL_IMAGE_NAME));
mNetworkText->setText( getString("network_packet_loss_critical_msg", mStringArgs) ); mNetworkText->setText( getString("network_packet_loss_critical_msg", mStringArgs) );
find_cause_loss = true; find_cause_loss = true;
} }
else if(ping_time >= mNetworkPingCritical) else if(ping_time >= mNetworkPingCritical)
{ {
mNetworkButton->setImageUnselected(LAG_CRITICAL_IMAGE_NAME); mNetworkButton->setImageUnselected(LLUI::getUIImage(LAG_CRITICAL_IMAGE_NAME));
if (client_frame_time_ms < mNetworkPingCritical) if (client_frame_time_ms < mNetworkPingCritical)
{ {
mNetworkText->setText( getString("network_ping_critical_msg", mStringArgs) ); mNetworkText->setText( getString("network_ping_critical_msg", mStringArgs) );
@@ -221,13 +221,13 @@ void LLFloaterLagMeter::determineNetwork()
} }
else if(packet_loss >= mNetworkPacketLossWarning) else if(packet_loss >= mNetworkPacketLossWarning)
{ {
mNetworkButton->setImageUnselected(LAG_WARNING_IMAGE_NAME); mNetworkButton->setImageUnselected(LLUI::getUIImage(LAG_WARNING_IMAGE_NAME));
mNetworkText->setText( getString("network_packet_loss_warning_msg", mStringArgs) ); mNetworkText->setText( getString("network_packet_loss_warning_msg", mStringArgs) );
find_cause_loss = true; find_cause_loss = true;
} }
else if(ping_time >= mNetworkPingWarning) else if(ping_time >= mNetworkPingWarning)
{ {
mNetworkButton->setImageUnselected(LAG_WARNING_IMAGE_NAME); mNetworkButton->setImageUnselected(LLUI::getUIImage(LAG_WARNING_IMAGE_NAME));
if (client_frame_time_ms < mNetworkPingWarning) if (client_frame_time_ms < mNetworkPingWarning)
{ {
mNetworkText->setText( getString("network_ping_warning_msg", mStringArgs) ); mNetworkText->setText( getString("network_ping_warning_msg", mStringArgs) );
@@ -236,7 +236,7 @@ void LLFloaterLagMeter::determineNetwork()
} }
else else
{ {
mNetworkButton->setImageUnselected(LAG_GOOD_IMAGE_NAME); mNetworkButton->setImageUnselected(LLUI::getUIImage(LAG_GOOD_IMAGE_NAME));
mNetworkText->setText( getString("network_performance_normal_msg", mStringArgs) ); mNetworkText->setText( getString("network_performance_normal_msg", mStringArgs) );
} }
@@ -261,19 +261,19 @@ void LLFloaterLagMeter::determineServer()
if(sim_frame_time >= mServerFrameTimeCritical) if(sim_frame_time >= mServerFrameTimeCritical)
{ {
mServerButton->setImageUnselected(LAG_CRITICAL_IMAGE_NAME); mServerButton->setImageUnselected(LLUI::getUIImage(LAG_CRITICAL_IMAGE_NAME));
mServerText->setText( getString("server_frame_time_critical_msg", mStringArgs) ); mServerText->setText( getString("server_frame_time_critical_msg", mStringArgs) );
find_cause = true; find_cause = true;
} }
else if(sim_frame_time >= mServerFrameTimeWarning) else if(sim_frame_time >= mServerFrameTimeWarning)
{ {
mServerButton->setImageUnselected(LAG_WARNING_IMAGE_NAME); mServerButton->setImageUnselected(LLUI::getUIImage(LAG_WARNING_IMAGE_NAME));
mServerText->setText( getString("server_frame_time_warning_msg", mStringArgs) ); mServerText->setText( getString("server_frame_time_warning_msg", mStringArgs) );
find_cause = true; find_cause = true;
} }
else else
{ {
mServerButton->setImageUnselected(LAG_GOOD_IMAGE_NAME); mServerButton->setImageUnselected(LLUI::getUIImage(LAG_GOOD_IMAGE_NAME));
mServerText->setText( getString("server_frame_time_normal_msg", mStringArgs) ); mServerText->setText( getString("server_frame_time_normal_msg", mStringArgs) );
mServerCause->setText( LLStringUtil::null ); mServerCause->setText( LLStringUtil::null );
} }

View File

@@ -180,8 +180,41 @@ void* LLFloaterTools::createPanelLandInfo(void* data)
return floater->mPanelLandInfo; return floater->mPanelLandInfo;
} }
static const std::string toolNames[]={
"ToolCube",
"ToolPrism",
"ToolPyramid",
"ToolTetrahedron",
"ToolCylinder",
"ToolHemiCylinder",
"ToolCone",
"ToolHemiCone",
"ToolSphere",
"ToolHemiSphere",
"ToolTorus",
"ToolTube",
"ToolRing",
"ToolTree",
"ToolGrass"};
LLPCode toolData[]={
LL_PCODE_CUBE,
LL_PCODE_PRISM,
LL_PCODE_PYRAMID,
LL_PCODE_TETRAHEDRON,
LL_PCODE_CYLINDER,
LL_PCODE_CYLINDER_HEMI,
LL_PCODE_CONE,
LL_PCODE_CONE_HEMI,
LL_PCODE_SPHERE,
LL_PCODE_SPHERE_HEMI,
LL_PCODE_TORUS,
LLViewerObject::LL_VO_SQUARE_TORUS,
LLViewerObject::LL_VO_TRIANGLE_TORUS,
LL_PCODE_LEGACY_TREE,
LL_PCODE_LEGACY_GRASS};
BOOL LLFloaterTools::postBuild() BOOL LLFloaterTools::postBuild()
{ {
// Hide until tool selected // Hide until tool selected
setVisible(FALSE); setVisible(FALSE);
@@ -250,44 +283,12 @@ BOOL LLFloaterTools::postBuild()
// Create Buttons // Create Buttons
// //
static const std::string toolNames[]={
"ToolCube",
"ToolPrism",
"ToolPyramid",
"ToolTetrahedron",
"ToolCylinder",
"ToolHemiCylinder",
"ToolCone",
"ToolHemiCone",
"ToolSphere",
"ToolHemiSphere",
"ToolTorus",
"ToolTube",
"ToolRing",
"ToolTree",
"ToolGrass"};
void* toolData[]={
&LLToolPlacerPanel::sCube,
&LLToolPlacerPanel::sPrism,
&LLToolPlacerPanel::sPyramid,
&LLToolPlacerPanel::sTetrahedron,
&LLToolPlacerPanel::sCylinder,
&LLToolPlacerPanel::sCylinderHemi,
&LLToolPlacerPanel::sCone,
&LLToolPlacerPanel::sConeHemi,
&LLToolPlacerPanel::sSphere,
&LLToolPlacerPanel::sSphereHemi,
&LLToolPlacerPanel::sTorus,
&LLToolPlacerPanel::sSquareTorus,
&LLToolPlacerPanel::sTriangleTorus,
&LLToolPlacerPanel::sTree,
&LLToolPlacerPanel::sGrass};
for(size_t t=0; t<LL_ARRAY_SIZE(toolNames); ++t) for(size_t t=0; t<LL_ARRAY_SIZE(toolNames); ++t)
{ {
LLButton *found = getChild<LLButton>(toolNames[t]); LLButton *found = getChild<LLButton>(toolNames[t]);
if(found) if(found)
{ {
found->setClickedCallback(setObjectType,toolData[t]); found->setClickedCallback(boost::bind(&LLFloaterTools::setObjectType, toolData[t]));
mButtons.push_back( found ); mButtons.push_back( found );
} }
else else
@@ -737,15 +738,13 @@ void LLFloaterTools::updatePopup(LLCoordGL center, MASK mask)
else else
{ {
// Highlight the correct placer button // Highlight the correct placer button
for( std::vector<LLButton*>::size_type i = 0; i < mButtons.size(); i++ ) for( S32 t = 0; t < (S32)mButtons.size(); t++ )
{ {
LLPCode pcode = LLToolPlacer::getObjectType(); LLPCode pcode = LLToolPlacer::getObjectType();
void *userdata = mButtons[i]->getCallbackUserData(); LLPCode button_pcode = toolData[t];
LLPCode *cur = (LLPCode*) userdata; BOOL state = (pcode == button_pcode);
mButtons[t]->setToggleState( state );
BOOL state = (pcode == *cur); mButtons[t]->setVisible( create_visible );
mButtons[i]->setToggleState( state );
mButtons[i]->setVisible( create_visible );
} }
} }
@@ -1034,9 +1033,8 @@ void commit_grid_mode(LLUICtrl *ctrl, void *data)
} }
// static // static
void LLFloaterTools::setObjectType( void* data ) void LLFloaterTools::setObjectType( LLPCode pcode )
{ {
LLPCode pcode = *(LLPCode*) data;
LLToolPlacer::setObjectType( pcode ); LLToolPlacer::setObjectType( pcode );
gSavedSettings.setBOOL("CreateToolCopySelection", FALSE); gSavedSettings.setBOOL("CreateToolCopySelection", FALSE);
gFocusMgr.setMouseCapture(NULL); gFocusMgr.setMouseCapture(NULL);
@@ -1067,11 +1065,11 @@ void LLFloaterTools::onSelectTreesGrass(LLUICtrl*, void*)
{ {
const std::string &selected = gFloaterTools->mComboTreesGrass->getValue(); const std::string &selected = gFloaterTools->mComboTreesGrass->getValue();
LLPCode pcode = LLToolPlacer::getObjectType(); LLPCode pcode = LLToolPlacer::getObjectType();
if (pcode == LLToolPlacerPanel::sTree) if (pcode == LL_PCODE_LEGACY_TREE)
{ {
gSavedSettings.setString("LastTree", selected); gSavedSettings.setString("LastTree", selected);
} }
else if (pcode == LLToolPlacerPanel::sGrass) else if (pcode == LL_PCODE_LEGACY_GRASS)
{ {
gSavedSettings.setString("LastGrass", selected); gSavedSettings.setString("LastGrass", selected);
} }
@@ -1085,7 +1083,7 @@ void LLFloaterTools::updateTreeGrassCombo(bool visible)
LLPCode pcode = LLToolPlacer::getObjectType(); LLPCode pcode = LLToolPlacer::getObjectType();
std::map<std::string, S32>::iterator it, end; std::map<std::string, S32>::iterator it, end;
std::string selected; std::string selected;
if (pcode == LLToolPlacerPanel::sTree) if (pcode == LL_PCODE_LEGACY_TREE)
{ {
tree_grass_label->setVisible(visible); tree_grass_label->setVisible(visible);
LLButton* button = getChild<LLButton>("ToolTree"); LLButton* button = getChild<LLButton>("ToolTree");
@@ -1095,7 +1093,7 @@ void LLFloaterTools::updateTreeGrassCombo(bool visible)
it = LLVOTree::sSpeciesNames.begin(); it = LLVOTree::sSpeciesNames.begin();
end = LLVOTree::sSpeciesNames.end(); end = LLVOTree::sSpeciesNames.end();
} }
else if (pcode == LLToolPlacerPanel::sGrass) else if (pcode == LL_PCODE_LEGACY_GRASS)
{ {
tree_grass_label->setVisible(visible); tree_grass_label->setVisible(visible);
LLButton* button = getChild<LLButton>("ToolGrass"); LLButton* button = getChild<LLButton>("ToolGrass");

View File

@@ -103,10 +103,10 @@ public:
static void setEditTool(void* data); static void setEditTool(void* data);
void saveLastTool(); void saveLastTool();
private: private:
static void setObjectType( void* data );
void refresh(); void refresh();
static void setObjectType( LLPCode pcode );
static void onClickGridOptions(void* data); static void onClickGridOptions(void* data);
public: public:

View File

@@ -78,8 +78,7 @@ LLJoystick::LLJoystick(
mHeldDown(FALSE), mHeldDown(FALSE),
mHeldDownTimer() mHeldDownTimer()
{ {
setHeldDownCallback(&LLJoystick::onHeldDown); setHeldDownCallback(boost::bind(&LLJoystick::onHeldDownCallback,this));
setCallbackUserData(this);
} }
@@ -178,7 +177,7 @@ F32 LLJoystick::getElapsedHeldDownTime()
} }
// static // static
void LLJoystick::onHeldDown(void *userdata) void LLJoystick::onHeldDownCallback(void *userdata)
{ {
LLJoystick *self = (LLJoystick *)userdata; LLJoystick *self = (LLJoystick *)userdata;

View File

@@ -60,7 +60,7 @@ public:
virtual void onHeldDown() = 0; virtual void onHeldDown() = 0;
F32 getElapsedHeldDownTime(); F32 getElapsedHeldDownTime();
static void onHeldDown(void *userdata); // called by llbutton callback handler static void onHeldDownCallback(void *userdata); // called by llbutton callback handler
void setInitialQuadrant(EJoystickQuadrant initial) { mInitialQuadrant = initial; }; void setInitialQuadrant(EJoystickQuadrant initial) { mInitialQuadrant = initial; };
virtual LLXMLNodePtr getXML(bool save_children = true) const; virtual LLXMLNodePtr getXML(bool save_children = true) const;

View File

@@ -81,21 +81,21 @@ LLFloaterMove::LLFloaterMove(const LLSD& key)
mTurnLeftButton = getChild<LLButton>("turn left btn"); mTurnLeftButton = getChild<LLButton>("turn left btn");
mTurnLeftButton->setHeldDownDelay(MOVE_BUTTON_DELAY); mTurnLeftButton->setHeldDownDelay(MOVE_BUTTON_DELAY);
mTurnLeftButton->setHeldDownCallback( turnLeft ); mTurnLeftButton->setHeldDownCallback( boost::bind(&LLFloaterMove::turnLeft, this) );
mTurnRightButton = getChild<LLButton>("turn right btn"); mTurnRightButton = getChild<LLButton>("turn right btn");
mTurnRightButton->setHeldDownDelay(MOVE_BUTTON_DELAY); mTurnRightButton->setHeldDownDelay(MOVE_BUTTON_DELAY);
mTurnRightButton->setHeldDownCallback( turnRight ); mTurnRightButton->setHeldDownCallback( boost::bind(&LLFloaterMove::turnRight, this) );
mMoveUpButton = getChild<LLButton>("move up btn"); mMoveUpButton = getChild<LLButton>("move up btn");
childSetAction("move up btn",moveUp,NULL); childSetAction("move up btn",moveUp,NULL);
mMoveUpButton->setHeldDownDelay(MOVE_BUTTON_DELAY); mMoveUpButton->setHeldDownDelay(MOVE_BUTTON_DELAY);
mMoveUpButton->setHeldDownCallback( moveUp ); mMoveUpButton->setHeldDownCallback( boost::bind(&LLFloaterMove::moveUp, this) );
mMoveDownButton = getChild<LLButton>("move down btn"); mMoveDownButton = getChild<LLButton>("move down btn");
childSetAction("move down btn",moveDown,NULL); childSetAction("move down btn",moveDown,NULL);
mMoveDownButton->setHeldDownDelay(MOVE_BUTTON_DELAY); mMoveDownButton->setHeldDownDelay(MOVE_BUTTON_DELAY);
mMoveDownButton->setHeldDownCallback( moveDown ); mMoveDownButton->setHeldDownCallback( boost::bind(&LLFloaterMove::moveDown, this) );
} }
// virtual // virtual

View File

@@ -270,22 +270,18 @@ BOOL LLPanelClassified::postBuild()
mLocationEditor = getChild<LLLineEditor>("location_editor"); mLocationEditor = getChild<LLLineEditor>("location_editor");
mSetBtn = getChild<LLButton>( "set_location_btn"); mSetBtn = getChild<LLButton>( "set_location_btn");
mSetBtn->setClickedCallback(onClickSet); mSetBtn->setClickedCallback(boost::bind(&LLPanelClassified::onClickSet, this));
mSetBtn->setCallbackUserData(this);
mTeleportBtn = getChild<LLButton>( "classified_teleport_btn"); mTeleportBtn = getChild<LLButton>( "classified_teleport_btn");
mTeleportBtn->setClickedCallback(onClickTeleport); mTeleportBtn->setClickedCallback(boost::bind(&LLPanelClassified::onClickTeleport, this));
mTeleportBtn->setCallbackUserData(this);
mMapBtn = getChild<LLButton>( "classified_map_btn"); mMapBtn = getChild<LLButton>( "classified_map_btn");
mMapBtn->setClickedCallback(onClickMap); mMapBtn->setClickedCallback(boost::bind(&LLPanelClassified::onClickMap, this));
mMapBtn->setCallbackUserData(this);
if(mInFinder) if(mInFinder)
{ {
mProfileBtn = getChild<LLButton>( "classified_profile_btn"); mProfileBtn = getChild<LLButton>( "classified_profile_btn");
mProfileBtn->setClickedCallback(onClickProfile); mProfileBtn->setClickedCallback(boost::bind(&LLPanelClassified::onClickProfile, this));
mProfileBtn->setCallbackUserData(this);
} }
mCategoryCombo = getChild<LLComboBox>( "classified_category_combo"); mCategoryCombo = getChild<LLComboBox>( "classified_category_combo");
@@ -319,7 +315,7 @@ BOOL LLPanelClassified::postBuild()
} }
mUpdateBtn = getChild<LLButton>("classified_update_btn"); mUpdateBtn = getChild<LLButton>("classified_update_btn");
mUpdateBtn->setClickedCallback(onClickUpdate); mUpdateBtn->setClickedCallback(boost::bind(&LLPanelClassified::onClickUpdate, this));
mUpdateBtn->setCallbackUserData(this); mUpdateBtn->setCallbackUserData(this);
if (!mInFinder) if (!mInFinder)

View File

@@ -89,20 +89,16 @@ BOOL LLPanelEvent::postBuild()
mTBCover = getChild<LLTextBox>("event_cover"); mTBCover = getChild<LLTextBox>("event_cover");
mTeleportBtn = getChild<LLButton>( "teleport_btn"); mTeleportBtn = getChild<LLButton>( "teleport_btn");
mTeleportBtn->setClickedCallback(onClickTeleport); mTeleportBtn->setClickedCallback(boost::bind(&LLPanelEvent::onClickTeleport,this));
mTeleportBtn->setCallbackUserData(this);
mMapBtn = getChild<LLButton>( "map_btn"); mMapBtn = getChild<LLButton>( "map_btn");
mMapBtn->setClickedCallback(onClickMap); mMapBtn->setClickedCallback(boost::bind(&LLPanelEvent::onClickMap,this));
mMapBtn->setCallbackUserData(this);
mNotifyBtn = getChild<LLButton>( "notify_btn"); mNotifyBtn = getChild<LLButton>( "notify_btn");
mNotifyBtn->setClickedCallback(onClickNotify); mNotifyBtn->setClickedCallback(boost::bind(&LLPanelEvent::onClickNotify,this));
mNotifyBtn->setCallbackUserData(this);
mCreateEventBtn = getChild<LLButton>( "create_event_btn"); mCreateEventBtn = getChild<LLButton>( "create_event_btn");
mCreateEventBtn->setClickedCallback(onClickCreateEvent); mCreateEventBtn->setClickedCallback(boost::bind(&LLPanelEvent::onClickCreateEvent,this));
mCreateEventBtn->setCallbackUserData(this);
return TRUE; return TRUE;
} }

View File

@@ -72,8 +72,7 @@ BOOL LLPanelGroupTab::postBuild()
LLButton* button = getChild<LLButton>("help_button"); LLButton* button = getChild<LLButton>("help_button");
if (button) if (button)
{ {
button->setClickedCallback(onClickHelp); button->setClickedCallback(boost::bind(&LLPanelGroupTab::onClickHelp,this));
button->setCallbackUserData(this);
} }
mHelpText = getString("help_text"); mHelpText = getString("help_text");
@@ -267,23 +266,21 @@ BOOL LLPanelGroup::postBuild()
LLButton* button = getChild<LLButton>("btn_ok"); LLButton* button = getChild<LLButton>("btn_ok");
if (button) if (button)
{ {
button->setClickedCallback(onBtnOK); button->setClickedCallback(boost::bind(&LLPanelGroup::onBtnOK,this));
button->setCallbackUserData(this);
button->setVisible(mAllowEdit); button->setVisible(mAllowEdit);
} }
button = getChild<LLButton>("btn_cancel"); button = getChild<LLButton>("btn_cancel");
if (button) if (button)
{ {
button->setClickedCallback(onBtnCancel); button->setClickedCallback(boost::bind(&LLPanelGroup::onBtnCancel,this));
button->setCallbackUserData(this);
button->setVisible(mAllowEdit); button->setVisible(mAllowEdit);
} }
button = getChild<LLButton>("btn_apply"); button = getChild<LLButton>("btn_apply");
if (button) if (button)
{ {
button->setClickedCallback(onBtnApply); button->setClickedCallback(boost::bind(&LLPanelGroup::onBtnApply,this));
button->setVisible(mAllowEdit); button->setVisible(mAllowEdit);
button->setEnabled(FALSE); button->setEnabled(FALSE);
@@ -293,8 +290,7 @@ BOOL LLPanelGroup::postBuild()
button = getChild<LLButton>("btn_refresh"); button = getChild<LLButton>("btn_refresh");
if (button) if (button)
{ {
button->setClickedCallback(onBtnRefresh); button->setClickedCallback(boost::bind(&LLPanelGroup::onBtnRefresh,this));
button->setCallbackUserData(this);
button->setVisible(mAllowEdit); button->setVisible(mAllowEdit);
} }

View File

@@ -135,15 +135,13 @@ BOOL LLPanelGroupGeneral::postBuild()
mBtnJoinGroup = getChild<LLButton>("join_button", recurse); mBtnJoinGroup = getChild<LLButton>("join_button", recurse);
if ( mBtnJoinGroup ) if ( mBtnJoinGroup )
{ {
mBtnJoinGroup->setClickedCallback(onClickJoin); mBtnJoinGroup->setClickedCallback(boost::bind(&LLPanelGroupGeneral::onClickJoin, this));
mBtnJoinGroup->setCallbackUserData(this);
} }
mBtnInfo = getChild<LLButton>("info_button", recurse); mBtnInfo = getChild<LLButton>("info_button", recurse);
if ( mBtnInfo ) if ( mBtnInfo )
{ {
mBtnInfo->setClickedCallback(onClickInfo); mBtnInfo->setClickedCallback(boost::bind(&LLPanelGroupGeneral::onClickInfo, this));
mBtnInfo->setCallbackUserData(this);
} }
LLTextBox* founder = getChild<LLTextBox>("founder_name"); LLTextBox* founder = getChild<LLTextBox>("founder_name");
@@ -158,7 +156,7 @@ BOOL LLPanelGroupGeneral::postBuild()
mListVisibleMembers = getChild<LLNameListCtrl>("visible_members", recurse); mListVisibleMembers = getChild<LLNameListCtrl>("visible_members", recurse);
if (mListVisibleMembers) if (mListVisibleMembers)
{ {
mListVisibleMembers->setDoubleClickCallback(openProfile); mListVisibleMembers->setDoubleClickCallback(&LLPanelGroupGeneral::openProfile);
mListVisibleMembers->setCallbackUserData(this); mListVisibleMembers->setCallbackUserData(this);
} }
@@ -166,7 +164,7 @@ BOOL LLPanelGroupGeneral::postBuild()
mCtrlShowInGroupList = getChild<LLCheckBoxCtrl>("show_in_group_list", recurse); mCtrlShowInGroupList = getChild<LLCheckBoxCtrl>("show_in_group_list", recurse);
if (mCtrlShowInGroupList) if (mCtrlShowInGroupList)
{ {
mCtrlShowInGroupList->setCommitCallback(onCommitAny); mCtrlShowInGroupList->setCommitCallback(&LLPanelGroupGeneral::onCommitAny);
mCtrlShowInGroupList->setCallbackUserData(this); mCtrlShowInGroupList->setCallbackUserData(this);
} }

View File

@@ -527,17 +527,14 @@ BOOL LLPanelGroupInvite::postBuild()
{ {
// default to opening avatarpicker automatically // default to opening avatarpicker automatically
// (*impl::callbackClickAdd)((void*)this); // (*impl::callbackClickAdd)((void*)this);
button->setClickedCallback(impl::callbackClickAdd); button->setClickedCallback(boost::bind(&impl::callbackClickAdd, this));
button->setCallbackUserData(this);
} }
mImplementation->mRemoveButton = mImplementation->mRemoveButton =
getChild<LLButton>("remove_button", recurse); getChild<LLButton>("remove_button", recurse);
if ( mImplementation->mRemoveButton ) if ( mImplementation->mRemoveButton )
{ {
mImplementation->mRemoveButton-> mImplementation->mRemoveButton->setClickedCallback(boost::bind(&impl::callbackClickRemove, mImplementation));
setClickedCallback(impl::callbackClickRemove);
mImplementation->mRemoveButton->setCallbackUserData(mImplementation);
mImplementation->mRemoveButton->setEnabled(FALSE); mImplementation->mRemoveButton->setEnabled(FALSE);
} }
@@ -545,17 +542,14 @@ BOOL LLPanelGroupInvite::postBuild()
getChild<LLButton>("ok_button", recurse); getChild<LLButton>("ok_button", recurse);
if ( mImplementation->mOKButton ) if ( mImplementation->mOKButton )
{ {
mImplementation->mOKButton-> mImplementation->mOKButton->setClickedCallback(boost::bind(&impl::callbackClickOK, mImplementation));
setClickedCallback(impl::callbackClickOK);
mImplementation->mOKButton->setCallbackUserData(mImplementation);
mImplementation->mOKButton->setEnabled(FALSE); mImplementation->mOKButton->setEnabled(FALSE);
} }
button = getChild<LLButton>("cancel_button", recurse); button = getChild<LLButton>("cancel_button", recurse);
if ( button ) if ( button )
{ {
button->setClickedCallback(impl::callbackClickCancel); button->setClickedCallback(boost::bind(&impl::callbackClickCancel,mImplementation));
button->setCallbackUserData(mImplementation);
} }
mImplementation->mOwnerWarning = getString("confirm_invite_owner_str"); mImplementation->mOwnerWarning = getString("confirm_invite_owner_str");

View File

@@ -654,7 +654,7 @@ BOOL LLPanelGroupLandMoney::postBuild()
if ( mImplementationp->mMapButtonp ) if ( mImplementationp->mMapButtonp )
{ {
mImplementationp->mMapButtonp->setClickedCallback(LLPanelGroupLandMoney::impl::mapCallback, mImplementationp); mImplementationp->mMapButtonp->setClickedCallback(boost::bind(&LLPanelGroupLandMoney::impl::mapCallback, mImplementationp));
} }
if ( mImplementationp->mGroupOverLimitTextp ) if ( mImplementationp->mGroupOverLimitTextp )

View File

@@ -220,13 +220,11 @@ BOOL LLPanelGroupNotices::postBuild()
mNoticesList->setCallbackUserData(this); mNoticesList->setCallbackUserData(this);
mBtnNewMessage = getChild<LLButton>("create_new_notice",recurse); mBtnNewMessage = getChild<LLButton>("create_new_notice",recurse);
mBtnNewMessage->setClickedCallback(onClickNewMessage); mBtnNewMessage->setClickedCallback(boost::bind(&LLPanelGroupNotices::onClickNewMessage,this));
mBtnNewMessage->setCallbackUserData(this);
mBtnNewMessage->setEnabled(gAgent.hasPowerInGroup(mGroupID, GP_NOTICES_SEND)); mBtnNewMessage->setEnabled(gAgent.hasPowerInGroup(mGroupID, GP_NOTICES_SEND));
mBtnGetPastNotices = getChild<LLButton>("refresh_notices",recurse); mBtnGetPastNotices = getChild<LLButton>("refresh_notices",recurse);
mBtnGetPastNotices->setClickedCallback(onClickRefreshNotices); mBtnGetPastNotices->setClickedCallback(boost::bind(&LLPanelGroupNotices::onClickRefreshNotices,this));
mBtnGetPastNotices->setCallbackUserData(this);
// Create // Create
mCreateSubject = getChild<LLLineEditor>("create_subject",recurse); mCreateSubject = getChild<LLLineEditor>("create_subject",recurse);
@@ -240,12 +238,10 @@ BOOL LLPanelGroupNotices::postBuild()
mCreateInventoryIcon->setVisible(FALSE); mCreateInventoryIcon->setVisible(FALSE);
mBtnSendMessage = getChild<LLButton>("send_notice",recurse); mBtnSendMessage = getChild<LLButton>("send_notice",recurse);
mBtnSendMessage->setClickedCallback(onClickSendMessage); mBtnSendMessage->setClickedCallback(boost::bind(&LLPanelGroupNotices::onClickSendMessage,this));
mBtnSendMessage->setCallbackUserData(this);
mBtnRemoveAttachment = getChild<LLButton>("remove_attachment",recurse); mBtnRemoveAttachment = getChild<LLButton>("remove_attachment",recurse);
mBtnRemoveAttachment->setClickedCallback(onClickRemoveAttachment); mBtnRemoveAttachment->setClickedCallback(boost::bind(&LLPanelGroupNotices::onClickRemoveAttachment,this));
mBtnRemoveAttachment->setCallbackUserData(this);
mBtnRemoveAttachment->setEnabled(FALSE); mBtnRemoveAttachment->setEnabled(FALSE);
// View // View
@@ -261,8 +257,7 @@ BOOL LLPanelGroupNotices::postBuild()
mViewInventoryIcon->setVisible(FALSE); mViewInventoryIcon->setVisible(FALSE);
mBtnOpenAttachment = getChild<LLButton>("open_attachment",recurse); mBtnOpenAttachment = getChild<LLButton>("open_attachment",recurse);
mBtnOpenAttachment->setClickedCallback(onClickOpenAttachment); mBtnOpenAttachment->setClickedCallback(boost::bind(&LLPanelGroupNotices::onClickOpenAttachment,this));
mBtnOpenAttachment->setCallbackUserData(this);
mNoNoticesStr = getString("no_notices_text"); mNoNoticesStr = getString("no_notices_text");

View File

@@ -501,15 +501,13 @@ BOOL LLPanelGroupSubTab::postBuild()
mSearchButton = getChild<LLButton>("search_button", recurse); mSearchButton = getChild<LLButton>("search_button", recurse);
if (!mSearchButton) return FALSE; if (!mSearchButton) return FALSE;
mSearchButton->setClickedCallback(onClickSearch); mSearchButton->setClickedCallback(boost::bind(&LLPanelGroupSubTab::onClickSearch,this));
mSearchButton->setCallbackUserData(this);
mSearchButton->setEnabled(FALSE); mSearchButton->setEnabled(FALSE);
mShowAllButton = getChild<LLButton>("show_all_button", recurse); mShowAllButton = getChild<LLButton>("show_all_button", recurse);
if (!mShowAllButton) return FALSE; if (!mShowAllButton) return FALSE;
mShowAllButton->setClickedCallback(onClickShowAll); mShowAllButton->setClickedCallback(boost::bind(&LLPanelGroupSubTab::onClickShowAll,this));
mShowAllButton->setCallbackUserData(this);
mShowAllButton->setEnabled(FALSE); mShowAllButton->setEnabled(FALSE);
// Get icons for later use. // Get icons for later use.
@@ -665,8 +663,7 @@ bool LLPanelGroupSubTab::matchesActionSearchFilter(std::string action)
void LLPanelGroupSubTab::buildActionsList(LLScrollListCtrl* ctrl, void LLPanelGroupSubTab::buildActionsList(LLScrollListCtrl* ctrl,
U64 allowed_by_some, U64 allowed_by_some,
U64 allowed_by_all, U64 allowed_by_all,
icon_map_t& icons, LLUICtrl::commit_callback_t commit_callback,
void (*commit_callback)(LLUICtrl*,void*),
BOOL show_all, BOOL show_all,
BOOL filter, BOOL filter,
BOOL is_owner_role) BOOL is_owner_role)
@@ -686,7 +683,6 @@ void LLPanelGroupSubTab::buildActionsList(LLScrollListCtrl* ctrl,
allowed_by_some, allowed_by_some,
allowed_by_all, allowed_by_all,
(*ras_it), (*ras_it),
icons,
commit_callback, commit_callback,
show_all, show_all,
filter, filter,
@@ -698,8 +694,7 @@ void LLPanelGroupSubTab::buildActionCategory(LLScrollListCtrl* ctrl,
U64 allowed_by_some, U64 allowed_by_some,
U64 allowed_by_all, U64 allowed_by_all,
LLRoleActionSet* action_set, LLRoleActionSet* action_set,
icon_map_t& icons, LLUICtrl::commit_callback_t commit_callback,
void (*commit_callback)(LLUICtrl*,void*),
BOOL show_all, BOOL show_all,
BOOL filter, BOOL filter,
BOOL is_owner_role) BOOL is_owner_role)
@@ -712,10 +707,11 @@ void LLPanelGroupSubTab::buildActionCategory(LLScrollListCtrl* ctrl,
LLSD row; LLSD row;
row["columns"][0]["column"] = "icon"; row["columns"][0]["column"] = "icon";
icon_map_t::iterator iter = icons.find("folder"); row["columns"][0]["type"] = "icon";
if (iter != icons.end())
icon_map_t::iterator iter = mActionIcons.find("folder");
if (iter != mActionIcons.end())
{ {
row["columns"][0]["type"] = "icon";
row["columns"][0]["value"] = (*iter).second; row["columns"][0]["value"] = (*iter).second;
} }
@@ -777,8 +773,8 @@ void LLPanelGroupSubTab::buildActionCategory(LLScrollListCtrl* ctrl,
{ {
if (show_full_strength) if (show_full_strength)
{ {
icon_map_t::iterator iter = icons.find("full"); icon_map_t::iterator iter = mActionIcons.find("full");
if (iter != icons.end()) if (iter != mActionIcons.end())
{ {
row["columns"][column_index]["column"] = "checkbox"; row["columns"][column_index]["column"] = "checkbox";
row["columns"][column_index]["type"] = "icon"; row["columns"][column_index]["type"] = "icon";
@@ -788,8 +784,8 @@ void LLPanelGroupSubTab::buildActionCategory(LLScrollListCtrl* ctrl,
} }
else else
{ {
icon_map_t::iterator iter = icons.find("partial"); icon_map_t::iterator iter = mActionIcons.find("partial");
if (iter != icons.end()) if (iter != mActionIcons.end())
{ {
row["columns"][column_index]["column"] = "checkbox"; row["columns"][column_index]["column"] = "checkbox";
row["columns"][column_index]["type"] = "icon"; row["columns"][column_index]["type"] = "icon";
@@ -813,7 +809,6 @@ void LLPanelGroupSubTab::buildActionCategory(LLScrollListCtrl* ctrl,
LLCheckBoxCtrl* check = check_cell->getCheckBox(); LLCheckBoxCtrl* check = check_cell->getCheckBox();
check->setEnabled(can_change_actions); check->setEnabled(can_change_actions);
check->setCommitCallback(commit_callback); check->setCommitCallback(commit_callback);
check->setCallbackUserData(ctrl->getCallbackUserData());
check->setToolTip( check->getLabel() ); check->setToolTip( check->getLabel() );
if (show_all) if (show_all)
@@ -912,16 +907,14 @@ BOOL LLPanelGroupMembersSubTab::postBuildSubTab(LLView* root)
LLButton* button = parent->getChild<LLButton>("member_invite", recurse); LLButton* button = parent->getChild<LLButton>("member_invite", recurse);
if ( button ) if ( button )
{ {
button->setClickedCallback(onInviteMember); button->setClickedCallback(boost::bind(&LLPanelGroupMembersSubTab::onInviteMember,this));
button->setCallbackUserData(this);
button->setEnabled(gAgent.hasPowerInGroup(mGroupID, GP_MEMBER_INVITE)); button->setEnabled(gAgent.hasPowerInGroup(mGroupID, GP_MEMBER_INVITE));
} }
mEjectBtn = parent->getChild<LLButton>("member_eject", recurse); mEjectBtn = parent->getChild<LLButton>("member_eject", recurse);
if ( mEjectBtn ) if ( mEjectBtn )
{ {
mEjectBtn->setClickedCallback(onEjectMembers); mEjectBtn->setClickedCallback(boost::bind(&LLPanelGroupMembersSubTab::onEjectMembers,this));
mEjectBtn->setCallbackUserData(this);
mEjectBtn->setEnabled(FALSE); mEjectBtn->setEnabled(FALSE);
} }
@@ -956,7 +949,7 @@ void LLPanelGroupMembersSubTab::handleMemberSelect()
if (selection.empty()) return; if (selection.empty()) return;
// Build a vector of all selected members, and gather allowed actions. // Build a vector of all selected members, and gather allowed actions.
std::vector<LLUUID> selected_members; uuid_vec_t selected_members;
U64 allowed_by_all = 0xffffffffffffLL; U64 allowed_by_all = 0xffffffffffffLL;
U64 allowed_by_some = 0; U64 allowed_by_some = 0;
@@ -964,10 +957,12 @@ void LLPanelGroupMembersSubTab::handleMemberSelect()
for (itor = selection.begin(); for (itor = selection.begin();
itor != selection.end(); ++itor) itor != selection.end(); ++itor)
{ {
selected_members.push_back( (*itor)->getUUID() ); LLUUID member_id = (*itor)->getUUID();
selected_members.push_back( member_id );
// Get this member's power mask including any unsaved changes // Get this member's power mask including any unsaved changes
U64 powers = getAgentPowersBasedOnRoleChanges((*itor)->getUUID()); U64 powers = getAgentPowersBasedOnRoleChanges( member_id );
allowed_by_all &= powers; allowed_by_all &= powers;
allowed_by_some |= powers; allowed_by_some |= powers;
@@ -980,7 +975,6 @@ void LLPanelGroupMembersSubTab::handleMemberSelect()
buildActionsList(mAllowedActionsList, buildActionsList(mAllowedActionsList,
allowed_by_some, allowed_by_some,
allowed_by_all, allowed_by_all,
mActionIcons,
NULL, NULL,
FALSE, FALSE,
FALSE, FALSE,
@@ -1021,8 +1015,8 @@ void LLPanelGroupMembersSubTab::handleMemberSelect()
if (cb_enable && (count > 0) && role_id == gdatap->mOwnerRole) if (cb_enable && (count > 0) && role_id == gdatap->mOwnerRole)
{ {
// Check if any owners besides this agent are selected. // Check if any owners besides this agent are selected.
std::vector<LLUUID>::const_iterator member_iter; uuid_vec_t::const_iterator member_iter;
std::vector<LLUUID>::const_iterator member_end = uuid_vec_t::const_iterator member_end =
selected_members.end(); selected_members.end();
for (member_iter = selected_members.begin(); for (member_iter = selected_members.begin();
member_iter != member_end; member_iter != member_end;
@@ -1048,7 +1042,7 @@ void LLPanelGroupMembersSubTab::handleMemberSelect()
//now see if there are any role changes for the selected //now see if there are any role changes for the selected
//members and remember to include them //members and remember to include them
std::vector<LLUUID>::iterator sel_mem_iter = selected_members.begin(); uuid_vec_t::iterator sel_mem_iter = selected_members.begin();
for (; sel_mem_iter != selected_members.end(); sel_mem_iter++) for (; sel_mem_iter != selected_members.end(); sel_mem_iter++)
{ {
LLRoleMemberChangeType type; LLRoleMemberChangeType type;
@@ -1106,7 +1100,7 @@ void LLPanelGroupMembersSubTab::handleMemberSelect()
check->setTentative( check->setTentative(
(0 != count) (0 != count)
&& (selected_members.size() != && (selected_members.size() !=
(std::vector<LLUUID>::size_type)count)); (uuid_vec_t::size_type)count));
//NOTE: as of right now a user can break the group //NOTE: as of right now a user can break the group
//by removing himself from a role if he is the //by removing himself from a role if he is the
@@ -1281,7 +1275,6 @@ void LLPanelGroupMembersSubTab::handleRoleCheck(const LLUUID& role_id,
buildActionsList(mAllowedActionsList, buildActionsList(mAllowedActionsList,
powers_some_have, powers_some_have,
powers_all_have, powers_all_have,
mActionIcons,
NULL, NULL,
FALSE, FALSE,
FALSE, FALSE,
@@ -1778,8 +1771,7 @@ BOOL LLPanelGroupRolesSubTab::postBuildSubTab(LLView* root)
parent->getChild<LLButton>("role_create", recurse); parent->getChild<LLButton>("role_create", recurse);
if ( mCreateRoleButton ) if ( mCreateRoleButton )
{ {
mCreateRoleButton->setCallbackUserData(this); mCreateRoleButton->setClickedCallback(boost::bind(&LLPanelGroupRolesSubTab::onCreateRole,this));
mCreateRoleButton->setClickedCallback(onCreateRole);
mCreateRoleButton->setEnabled(FALSE); mCreateRoleButton->setEnabled(FALSE);
} }
@@ -1787,8 +1779,7 @@ BOOL LLPanelGroupRolesSubTab::postBuildSubTab(LLView* root)
parent->getChild<LLButton>("role_delete", recurse); parent->getChild<LLButton>("role_delete", recurse);
if ( mDeleteRoleButton ) if ( mDeleteRoleButton )
{ {
mDeleteRoleButton->setCallbackUserData(this); mDeleteRoleButton->setClickedCallback(boost::bind(&LLPanelGroupRolesSubTab::onDeleteRole,this));
mDeleteRoleButton->setClickedCallback(onDeleteRole);
mDeleteRoleButton->setEnabled(FALSE); mDeleteRoleButton->setEnabled(FALSE);
} }
@@ -2062,8 +2053,7 @@ void LLPanelGroupRolesSubTab::handleRoleSelect()
buildActionsList(mAllowedActionsList, buildActionsList(mAllowedActionsList,
rd.mRolePowers, rd.mRolePowers,
0LL, 0LL,
mActionIcons, boost::bind(&LLPanelGroupRolesSubTab::handleActionCheck, this, _1, false),
onActionCheck,
TRUE, TRUE,
FALSE, FALSE,
is_owner_role); is_owner_role);
@@ -2160,24 +2150,18 @@ void LLPanelGroupRolesSubTab::buildMembersList()
} }
} }
// static
void LLPanelGroupRolesSubTab::onActionCheck(LLUICtrl* ctrl, void* user_data)
{
LLPanelGroupRolesSubTab* self = static_cast<LLPanelGroupRolesSubTab*>(user_data);
LLCheckBoxCtrl* check = static_cast<LLCheckBoxCtrl*>(ctrl);
if (!check || !self) return;
self->handleActionCheck(check);
}
struct ActionCBData struct ActionCBData
{ {
LLPanelGroupRolesSubTab* mSelf; LLPanelGroupRolesSubTab* mSelf;
LLCheckBoxCtrl* mCheck; LLCheckBoxCtrl* mCheck;
}; };
void LLPanelGroupRolesSubTab::handleActionCheck(LLCheckBoxCtrl* check, bool force) void LLPanelGroupRolesSubTab::handleActionCheck(LLUICtrl* ctrl, bool force)
{ {
LLCheckBoxCtrl* check = dynamic_cast<LLCheckBoxCtrl*>(ctrl);
if (!check)
return;
lldebugs << "LLPanelGroupRolesSubTab::handleActionSelect()" << llendl; lldebugs << "LLPanelGroupRolesSubTab::handleActionSelect()" << llendl;
LLGroupMgrGroupData* gdatap = LLGroupMgr::getInstance()->getGroupData(mGroupID); LLGroupMgrGroupData* gdatap = LLGroupMgr::getInstance()->getGroupData(mGroupID);
@@ -2473,7 +2457,7 @@ BOOL LLPanelGroupActionsSubTab::postBuildSubTab(LLView* root)
mActionList->setCallbackUserData(this); mActionList->setCallbackUserData(this);
mActionList->setCommitOnSelectionChange(TRUE); mActionList->setCommitOnSelectionChange(TRUE);
mActionList->setCommitCallback(onActionSelect); mActionList->setCommitCallback(boost::bind(&LLPanelGroupActionsSubTab::handleActionSelect, this));
mActionMembers->setCallbackUserData(this); mActionMembers->setCallbackUserData(this);
mActionRoles->setCallbackUserData(this); mActionRoles->setCallbackUserData(this);
@@ -2529,20 +2513,12 @@ void LLPanelGroupActionsSubTab::update(LLGroupChange gc)
buildActionsList(mActionList, buildActionsList(mActionList,
GP_ALL_POWERS, GP_ALL_POWERS,
GP_ALL_POWERS, GP_ALL_POWERS,
mActionIcons,
NULL, NULL,
FALSE, FALSE,
TRUE, TRUE,
FALSE); FALSE);
} }
// static
void LLPanelGroupActionsSubTab::onActionSelect(LLUICtrl* scroll, void* data)
{
LLPanelGroupActionsSubTab* self = static_cast<LLPanelGroupActionsSubTab*>(data);
self->handleActionSelect();
}
void LLPanelGroupActionsSubTab::handleActionSelect() void LLPanelGroupActionsSubTab::handleActionSelect()
{ {
mActionMembers->deleteAllItems(); mActionMembers->deleteAllItems();

View File

@@ -130,8 +130,7 @@ public:
void buildActionsList(LLScrollListCtrl* ctrl, void buildActionsList(LLScrollListCtrl* ctrl,
U64 allowed_by_some, U64 allowed_by_some,
U64 allowed_by_all, U64 allowed_by_all,
icon_map_t& icons, LLUICtrl::commit_callback_t commit_callback,
void (*commit_callback)(LLUICtrl*,void*),
BOOL show_all, BOOL show_all,
BOOL filter, BOOL filter,
BOOL is_owner_role); BOOL is_owner_role);
@@ -139,8 +138,7 @@ public:
U64 allowed_by_some, U64 allowed_by_some,
U64 allowed_by_all, U64 allowed_by_all,
LLRoleActionSet* action_set, LLRoleActionSet* action_set,
icon_map_t& icons, LLUICtrl::commit_callback_t commit_callback,
void (*commit_callback)(LLUICtrl*,void*),
BOOL show_all, BOOL show_all,
BOOL filter, BOOL filter,
BOOL is_owner_role); BOOL is_owner_role);
@@ -248,8 +246,6 @@ public:
void handleRoleSelect(); void handleRoleSelect();
void buildMembersList(); void buildMembersList();
static void onActionCheck(LLUICtrl*, void*);
void handleActionCheck(LLCheckBoxCtrl*, bool force=false);
bool addActionCB(const LLSD& notification, const LLSD& response, LLCheckBoxCtrl* check); bool addActionCB(const LLSD& notification, const LLSD& response, LLCheckBoxCtrl* check);
static void onPropertiesKey(LLLineEditor*, void*); static void onPropertiesKey(LLLineEditor*, void*);
@@ -268,10 +264,8 @@ public:
void saveRoleChanges(); void saveRoleChanges();
protected: protected:
LLSD createRoleItem(const LLUUID& role_id, void handleActionCheck(LLUICtrl* ctrl, bool force);
std::string name, LLSD createRoleItem(const LLUUID& role_id, std::string name, std::string title, S32 members);
std::string title,
S32 members);
LLScrollListCtrl* mRolesList; LLScrollListCtrl* mRolesList;
LLNameListCtrl* mAssignedMembersList; LLNameListCtrl* mAssignedMembersList;
@@ -306,7 +300,6 @@ public:
virtual bool apply(std::string& mesg); virtual bool apply(std::string& mesg);
virtual void update(LLGroupChange gc); virtual void update(LLGroupChange gc);
static void onActionSelect(LLUICtrl*, void*);
void handleActionSelect(); void handleActionSelect();
protected: protected:
LLScrollListCtrl* mActionList; LLScrollListCtrl* mActionList;

View File

@@ -1575,35 +1575,25 @@ BOOL LLPanelGroupVoting::postBuild()
mImpl->mVotesHistory->setDoubleClickCallback(impl::onDoubleClickHistoryItem); mImpl->mVotesHistory->setDoubleClickCallback(impl::onDoubleClickHistoryItem);
mImpl->mVotesHistory->setCallbackUserData(mImpl); mImpl->mVotesHistory->setCallbackUserData(mImpl);
mImpl->mBtnAbstain->setClickedCallback(impl::onClickAbstain); mImpl->mBtnAbstain->setClickedCallback(boost::bind(&impl::onClickAbstain,mImpl));
mImpl->mBtnAbstain->setCallbackUserData(mImpl);
mImpl->mBtnNo->setClickedCallback(impl::onClickNo); mImpl->mBtnNo->setClickedCallback(boost::bind(&impl::onClickNo,mImpl));
mImpl->mBtnNo->setCallbackUserData(mImpl);
mImpl->mBtnYes->setClickedCallback(impl::onClickYes); mImpl->mBtnYes->setClickedCallback(boost::bind(&impl::onClickYes,mImpl));
mImpl->mBtnYes->setCallbackUserData(mImpl);
mImpl->mBtnCreateProposal->setClickedCallback(impl::onClickCreateProposal); mImpl->mBtnCreateProposal->setClickedCallback(boost::bind(&impl::onClickCreateProposal,mImpl));
mImpl->mBtnCreateProposal->setCallbackUserData(mImpl);
mImpl->mBtnSubmitProposal->setClickedCallback(impl::onClickSubmitProposal); mImpl->mBtnSubmitProposal->setClickedCallback(boost::bind(&impl::onClickSubmitProposal,mImpl));
mImpl->mBtnSubmitProposal->setCallbackUserData(mImpl);
mImpl->mBtnCancelProposal->setClickedCallback(impl::onClickCancelProposal); mImpl->mBtnCancelProposal->setClickedCallback(boost::bind(&impl::onClickCancelProposal,mImpl));
mImpl->mBtnCancelProposal->setCallbackUserData(mImpl);
mImpl->mBtnViewProposalList->setClickedCallback(impl::onClickViewProposalList); mImpl->mBtnViewProposalList->setClickedCallback(boost::bind(&impl::onClickViewProposalList,mImpl));
mImpl->mBtnViewProposalList->setCallbackUserData(mImpl);
mImpl->mBtnViewProposalItem->setClickedCallback(impl::onClickViewProposalItem); mImpl->mBtnViewProposalItem->setClickedCallback(boost::bind(&impl::onClickViewProposalItem,mImpl));
mImpl->mBtnViewProposalItem->setCallbackUserData(mImpl);
mImpl->mBtnViewHistoryList->setClickedCallback(impl::onClickViewHistoryList); mImpl->mBtnViewHistoryList->setClickedCallback(boost::bind(&impl::onClickViewHistoryList,mImpl));
mImpl->mBtnViewHistoryList->setCallbackUserData(mImpl);
mImpl->mBtnViewHistoryItem->setClickedCallback(impl::onClickViewHistoryItem); mImpl->mBtnViewHistoryItem->setClickedCallback(boost::bind(&impl::onClickViewHistoryItem,mImpl));
mImpl->mBtnViewHistoryItem->setCallbackUserData(mImpl);
gMessageSystem->setHandlerFuncFast(_PREHASH_GroupActiveProposalItemReply, gMessageSystem->setHandlerFuncFast(_PREHASH_GroupActiveProposalItemReply,
impl::processGroupActiveProposalItemReply); impl::processGroupActiveProposalItemReply);

View File

@@ -129,20 +129,20 @@ BOOL LLPanelMediaHUD::postBuild()
LLButton* scroll_up_btn = getChild<LLButton>("scrollup"); LLButton* scroll_up_btn = getChild<LLButton>("scrollup");
scroll_up_btn->setClickedCallback(onScrollUp, this); scroll_up_btn->setClickedCallback(onScrollUp, this);
scroll_up_btn->setHeldDownCallback(onScrollUpHeld); scroll_up_btn->setHeldDownCallback(onScrollUpHeld, this);
scroll_up_btn->setMouseUpCallback(onScrollStop); scroll_up_btn->setMouseUpCallback(onScrollStop, this);
LLButton* scroll_left_btn = getChild<LLButton>("scrollleft"); LLButton* scroll_left_btn = getChild<LLButton>("scrollleft");
scroll_left_btn->setClickedCallback(onScrollLeft, this); scroll_left_btn->setClickedCallback(onScrollLeft, this);
scroll_left_btn->setHeldDownCallback(onScrollLeftHeld); scroll_left_btn->setHeldDownCallback(onScrollLeftHeld, this);
scroll_left_btn->setMouseUpCallback(onScrollStop); scroll_left_btn->setMouseUpCallback(onScrollStop, this);
LLButton* scroll_right_btn = getChild<LLButton>("scrollright"); LLButton* scroll_right_btn = getChild<LLButton>("scrollright");
scroll_right_btn->setClickedCallback(onScrollRight, this); scroll_right_btn->setClickedCallback(onScrollRight, this);
scroll_right_btn->setHeldDownCallback(onScrollLeftHeld); scroll_right_btn->setHeldDownCallback(onScrollLeftHeld, this);
scroll_right_btn->setMouseUpCallback(onScrollStop); scroll_right_btn->setMouseUpCallback(onScrollStop, this);
LLButton* scroll_down_btn = getChild<LLButton>("scrolldown"); LLButton* scroll_down_btn = getChild<LLButton>("scrolldown");
scroll_down_btn->setClickedCallback(onScrollDown, this); scroll_down_btn->setClickedCallback(onScrollDown, this);
scroll_down_btn->setHeldDownCallback(onScrollDownHeld); scroll_down_btn->setHeldDownCallback(onScrollDownHeld, this);
scroll_down_btn->setMouseUpCallback(onScrollStop); scroll_down_btn->setMouseUpCallback(onScrollStop, this);
mMouseInactiveTime = gSavedSettings.getF32("MediaControlTimeout"); mMouseInactiveTime = gSavedSettings.getF32("MediaControlTimeout");
mControlFadeTime = gSavedSettings.getF32("MediaControlFadeTime"); mControlFadeTime = gSavedSettings.getF32("MediaControlFadeTime");

View File

@@ -160,16 +160,13 @@ BOOL LLPanelPick::postBuild()
mLocationEditor = getChild<LLLineEditor>("location_editor"); mLocationEditor = getChild<LLLineEditor>("location_editor");
mSetBtn = getChild<LLButton>( "set_location_btn"); mSetBtn = getChild<LLButton>( "set_location_btn");
mSetBtn->setClickedCallback(onClickSet); mSetBtn->setClickedCallback(boost::bind(&LLPanelPick::onClickSet,this));
mSetBtn->setCallbackUserData(this);
mTeleportBtn = getChild<LLButton>( "pick_teleport_btn"); mTeleportBtn = getChild<LLButton>( "pick_teleport_btn");
mTeleportBtn->setClickedCallback(onClickTeleport); mTeleportBtn->setClickedCallback(boost::bind(&LLPanelPick::onClickTeleport,this));
mTeleportBtn->setCallbackUserData(this);
mMapBtn = getChild<LLButton>( "pick_map_btn"); mMapBtn = getChild<LLButton>( "pick_map_btn");
mMapBtn->setClickedCallback(onClickMap); mMapBtn->setClickedCallback(boost::bind(&LLPanelPick::onClickMap,this));
mMapBtn->setCallbackUserData(this);
mSortOrderText = getChild<LLTextBox>("sort_order_text"); mSortOrderText = getChild<LLTextBox>("sort_order_text");

View File

@@ -106,20 +106,16 @@ BOOL LLPanelPlace::postBuild()
mLocationDisplay = getChild<LLTextBox>("location_editor"); mLocationDisplay = getChild<LLTextBox>("location_editor");
mTeleportBtn = getChild<LLButton>( "teleport_btn"); mTeleportBtn = getChild<LLButton>( "teleport_btn");
mTeleportBtn->setClickedCallback(onClickTeleport); mTeleportBtn->setClickedCallback(boost::bind(&LLPanelPlace::onClickTeleport,this));
mTeleportBtn->setCallbackUserData(this);
mMapBtn = getChild<LLButton>( "map_btn"); mMapBtn = getChild<LLButton>( "map_btn");
mMapBtn->setClickedCallback(onClickMap); mMapBtn->setClickedCallback(boost::bind(&LLPanelPlace::onClickMap,this));
mMapBtn->setCallbackUserData(this);
//mLandmarkBtn = getChild<LLButton>( "landmark_btn"); //mLandmarkBtn = getChild<LLButton>( "landmark_btn");
//mLandmarkBtn->setClickedCallback(onClickLandmark); //mLandmarkBtn->setClickedCallback(boost::bind(&LLPanelPlace::onClickLandmark,this));
//mLandmarkBtn->setCallbackUserData(this);
mAuctionBtn = getChild<LLButton>( "auction_btn"); mAuctionBtn = getChild<LLButton>( "auction_btn");
mAuctionBtn->setClickedCallback(onClickAuction); mAuctionBtn->setClickedCallback(boost::bind(&LLPanelPlace::onClickAuction,this));
mAuctionBtn->setCallbackUserData(this);
// Default to no auction button. We'll show it if we get an auction id // Default to no auction button. We'll show it if we get an auction id
mAuctionBtn->setVisible(FALSE); mAuctionBtn->setVisible(FALSE);

View File

@@ -126,9 +126,9 @@ void LLPanelSkins::refresh()
"textures"+gDirUtilp->getDirDelimiter()+ "textures"+gDirUtilp->getDirDelimiter()+
imagename); imagename);
b->setImages(imageprev,imageprev); b->setImages(imageprev,imageprev);
b->setHoverImages(imageprev,imageprev); b->setImageHoverSelected(LLUI::getUIImage(imageprev));
b->setScaleImage(TRUE); b->setImageHoverUnselected(LLUI::getUIImage(imageprev));
//<button scale_image="true" image_selected="skin_thumbnail_default.png" //<button scale_image="true" image_selected="skin_thumbnail_default.png"
//image_unselected="skin_thumbnail_default.png" //image_unselected="skin_thumbnail_default.png"
// image_hover_selected="skin_thumbnail_default.png" // image_hover_selected="skin_thumbnail_default.png"

View File

@@ -438,26 +438,22 @@ BOOL LLPreviewGesture::postBuild()
mLibraryList = list; mLibraryList = list;
btn = getChild<LLButton>( "add_btn"); btn = getChild<LLButton>( "add_btn");
btn->setClickedCallback(onClickAdd); btn->setClickedCallback(boost::bind(&LLPreviewGesture::onClickAdd,this));
btn->setCallbackUserData(this);
btn->setEnabled(FALSE); btn->setEnabled(FALSE);
mAddBtn = btn; mAddBtn = btn;
btn = getChild<LLButton>( "up_btn"); btn = getChild<LLButton>( "up_btn");
btn->setClickedCallback(onClickUp); btn->setClickedCallback(boost::bind(&LLPreviewGesture::onClickUp,this));
btn->setCallbackUserData(this);
btn->setEnabled(FALSE); btn->setEnabled(FALSE);
mUpBtn = btn; mUpBtn = btn;
btn = getChild<LLButton>( "down_btn"); btn = getChild<LLButton>( "down_btn");
btn->setClickedCallback(onClickDown); btn->setClickedCallback(boost::bind(&LLPreviewGesture::onClickDown,this));
btn->setCallbackUserData(this);
btn->setEnabled(FALSE); btn->setEnabled(FALSE);
mDownBtn = btn; mDownBtn = btn;
btn = getChild<LLButton>( "delete_btn"); btn = getChild<LLButton>( "delete_btn");
btn->setClickedCallback(onClickDelete); btn->setClickedCallback(boost::bind(&LLPreviewGesture::onClickDelete,this));
btn->setCallbackUserData(this);
btn->setEnabled(FALSE); btn->setEnabled(FALSE);
mDeleteBtn = btn; mDeleteBtn = btn;
@@ -529,12 +525,12 @@ BOOL LLPreviewGesture::postBuild()
mActiveCheck = check; mActiveCheck = check;
btn = getChild<LLButton>( "save_btn"); btn = getChild<LLButton>( "save_btn");
btn->setClickedCallback(onClickSave); btn->setClickedCallback(boost::bind(&LLPreviewGesture::onClickSave,this));
btn->setCallbackUserData(this); btn->setCallbackUserData(this);
mSaveBtn = btn; mSaveBtn = btn;
btn = getChild<LLButton>( "preview_btn"); btn = getChild<LLButton>( "preview_btn");
btn->setClickedCallback(onClickPreview); btn->setClickedCallback(boost::bind(&LLPreviewGesture::onClickPreview,this));
btn->setCallbackUserData(this); btn->setCallbackUserData(this);
mPreviewBtn = btn; mPreviewBtn = btn;

View File

@@ -84,7 +84,7 @@ BOOL LLProgressView::postBuild()
mProgressBar = getChild<LLProgressBar>("login_progress_bar"); mProgressBar = getChild<LLProgressBar>("login_progress_bar");
mCancelBtn = getChild<LLButton>("cancel_btn"); mCancelBtn = getChild<LLButton>("cancel_btn");
mCancelBtn->setClickedCallback( LLProgressView::onCancelButtonClicked ); mCancelBtn->setClickedCallback( boost::bind(&LLProgressView::onCancelButtonClicked) );
mFadeTimer.stop(); mFadeTimer.stop();
getChild<LLTextBox>("title_text")->setText(LLStringExplicit(LLAppViewer::instance()->getSecondLifeTitle())); getChild<LLTextBox>("title_text")->setText(LLStringExplicit(LLAppViewer::instance()->getSecondLifeTitle()));
@@ -224,7 +224,7 @@ void LLProgressView::setCancelButtonVisible(BOOL b, const std::string& label)
} }
// static // static
void LLProgressView::onCancelButtonClicked(void*) void LLProgressView::onCancelButtonClicked()
{ {
if (gAgent.getTeleportState() == LLAgent::TELEPORT_NONE) if (gAgent.getTeleportState() == LLAgent::TELEPORT_NONE)
{ {

View File

@@ -62,7 +62,7 @@ public:
void setCancelButtonVisible(BOOL b, const std::string& label); void setCancelButtonVisible(BOOL b, const std::string& label);
static void onCancelButtonClicked( void* ); static void onCancelButtonClicked();
static void onClickMessage(void*); static void onClickMessage(void*);
protected: protected:

View File

@@ -588,23 +588,6 @@ void LLToolPlacer::handleDeselect()
////////////////////////////////////////////////////// //////////////////////////////////////////////////////
// LLToolPlacerPanel // LLToolPlacerPanel
// static
LLPCode LLToolPlacerPanel::sCube = LL_PCODE_CUBE;
LLPCode LLToolPlacerPanel::sPrism = LL_PCODE_PRISM;
LLPCode LLToolPlacerPanel::sPyramid = LL_PCODE_PYRAMID;
LLPCode LLToolPlacerPanel::sTetrahedron = LL_PCODE_TETRAHEDRON;
LLPCode LLToolPlacerPanel::sCylinder = LL_PCODE_CYLINDER;
LLPCode LLToolPlacerPanel::sCylinderHemi= LL_PCODE_CYLINDER_HEMI;
LLPCode LLToolPlacerPanel::sCone = LL_PCODE_CONE;
LLPCode LLToolPlacerPanel::sConeHemi = LL_PCODE_CONE_HEMI;
LLPCode LLToolPlacerPanel::sTorus = LL_PCODE_TORUS;
LLPCode LLToolPlacerPanel::sSquareTorus = LLViewerObject::LL_VO_SQUARE_TORUS;
LLPCode LLToolPlacerPanel::sTriangleTorus = LLViewerObject::LL_VO_TRIANGLE_TORUS;
LLPCode LLToolPlacerPanel::sSphere = LL_PCODE_SPHERE;
LLPCode LLToolPlacerPanel::sSphereHemi = LL_PCODE_SPHERE_HEMI;
LLPCode LLToolPlacerPanel::sTree = LL_PCODE_LEGACY_TREE;
LLPCode LLToolPlacerPanel::sGrass = LL_PCODE_LEGACY_GRASS;
S32 LLToolPlacerPanel::sButtonsAdded = 0; S32 LLToolPlacerPanel::sButtonsAdded = 0;
LLButton* LLToolPlacerPanel::sButtons[ TOOL_PLACER_NUM_BUTTONS ]; LLButton* LLToolPlacerPanel::sButtons[ TOOL_PLACER_NUM_BUTTONS ];
@@ -612,22 +595,6 @@ LLToolPlacerPanel::LLToolPlacerPanel(const std::string& name, const LLRect& rect
: :
LLPanel( name, rect ) LLPanel( name, rect )
{ {
/* DEPRECATED - JC
addButton( "UIImgCubeUUID", "UIImgCubeSelectedUUID", &LLToolPlacerPanel::sCube );
addButton( "UIImgPrismUUID", "UIImgPrismSelectedUUID", &LLToolPlacerPanel::sPrism );
addButton( "UIImgPyramidUUID", "UIImgPyramidSelectedUUID", &LLToolPlacerPanel::sPyramid );
addButton( "UIImgTetrahedronUUID", "UIImgTetrahedronSelectedUUID", &LLToolPlacerPanel::sTetrahedron );
addButton( "UIImgCylinderUUID", "UIImgCylinderSelectedUUID", &LLToolPlacerPanel::sCylinder );
addButton( "UIImgHalfCylinderUUID", "UIImgHalfCylinderSelectedUUID",&LLToolPlacerPanel::sCylinderHemi );
addButton( "UIImgConeUUID", "UIImgConeSelectedUUID", &LLToolPlacerPanel::sCone );
addButton( "UIImgHalfConeUUID", "UIImgHalfConeSelectedUUID", &LLToolPlacerPanel::sConeHemi );
addButton( "UIImgSphereUUID", "UIImgSphereSelectedUUID", &LLToolPlacerPanel::sSphere );
addButton( "UIImgHalfSphereUUID", "UIImgHalfSphereSelectedUUID", &LLToolPlacerPanel::sSphereHemi );
addButton( "UIImgTreeUUID", "UIImgTreeSelectedUUID", &LLToolPlacerPanel::sTree );
addButton( "UIImgGrassUUID", "UIImgGrassSelectedUUID", &LLToolPlacerPanel::sGrass );
addButton( "ObjectTorusImageID", "ObjectTorusActiveImageID", &LLToolPlacerPanel::sTorus );
addButton( "ObjectTubeImageID", "ObjectTubeActiveImageID", &LLToolPlacerPanel::sSquareTorus );
*/
} }
void LLToolPlacerPanel::addButton( const std::string& up_state, const std::string& down_state, LLPCode* pcode ) void LLToolPlacerPanel::addButton( const std::string& up_state, const std::string& down_state, LLPCode* pcode )

View File

@@ -83,22 +83,6 @@ public:
static void setObjectType( void* data ); static void setObjectType( void* data );
static LLPCode sCube;
static LLPCode sPrism;
static LLPCode sPyramid;
static LLPCode sTetrahedron;
static LLPCode sCylinder;
static LLPCode sCylinderHemi;
static LLPCode sCone;
static LLPCode sConeHemi;
static LLPCode sTorus;
static LLPCode sSquareTorus;
static LLPCode sTriangleTorus;
static LLPCode sSphere;
static LLPCode sSphereHemi;
static LLPCode sTree;
static LLPCode sGrass;
private: private:
void addButton( const std::string& up_state, const std::string& down_state, LLPCode* pcode ); void addButton( const std::string& up_state, const std::string& down_state, LLPCode* pcode );

View File

@@ -69,17 +69,15 @@ LLVoiceRemoteCtrl::~LLVoiceRemoteCtrl()
BOOL LLVoiceRemoteCtrl::postBuild() BOOL LLVoiceRemoteCtrl::postBuild()
{ {
mTalkBtn = getChild<LLButton>("push_to_talk"); mTalkBtn = getChild<LLButton>("push_to_talk");
mTalkBtn->setClickedCallback(onBtnTalkClicked); mTalkBtn->setClickedCallback(boost::bind(&LLVoiceRemoteCtrl::onBtnTalkClicked));
mTalkBtn->setHeldDownCallback(onBtnTalkHeld); mTalkBtn->setHeldDownCallback(boost::bind(&LLVoiceRemoteCtrl::onBtnTalkHeld));
mTalkBtn->setMouseUpCallback(onBtnTalkReleased); mTalkBtn->setMouseUpCallback(boost::bind(&LLVoiceRemoteCtrl::onBtnTalkReleased));
mTalkLockBtn = getChild<LLButton>("ptt_lock"); mTalkLockBtn = getChild<LLButton>("ptt_lock");
mTalkLockBtn->setClickedCallback(onBtnLock); mTalkLockBtn->setClickedCallback(boost::bind(&LLVoiceRemoteCtrl::onBtnLock,this));
mTalkLockBtn->setCallbackUserData(this);
mSpeakersBtn = getChild<LLButton>("speakers_btn"); mSpeakersBtn = getChild<LLButton>("speakers_btn");
mSpeakersBtn->setClickedCallback(onClickSpeakers); mSpeakersBtn->setClickedCallback(boost::bind(&LLVoiceRemoteCtrl::onClickSpeakers));
mSpeakersBtn->setCallbackUserData(this);
childSetAction("show_channel", onClickPopupBtn, this); childSetAction("show_channel", onClickPopupBtn, this);
childSetAction("end_call_btn", onClickEndCall, this); childSetAction("end_call_btn", onClickEndCall, this);
@@ -216,7 +214,7 @@ void LLVoiceRemoteCtrl::draw()
LLPanel::draw(); LLPanel::draw();
} }
void LLVoiceRemoteCtrl::onBtnTalkClicked(void *user_data) void LLVoiceRemoteCtrl::onBtnTalkClicked()
{ {
// when in toggle mode, clicking talk button turns mic on/off // when in toggle mode, clicking talk button turns mic on/off
if (gSavedSettings.getBOOL("PushToTalkToggle")) if (gSavedSettings.getBOOL("PushToTalkToggle"))
@@ -225,7 +223,7 @@ void LLVoiceRemoteCtrl::onBtnTalkClicked(void *user_data)
} }
} }
void LLVoiceRemoteCtrl::onBtnTalkHeld(void *user_data) void LLVoiceRemoteCtrl::onBtnTalkHeld()
{ {
// when not in toggle mode, holding down talk button turns on mic // when not in toggle mode, holding down talk button turns on mic
if (!gSavedSettings.getBOOL("PushToTalkToggle")) if (!gSavedSettings.getBOOL("PushToTalkToggle"))
@@ -234,7 +232,7 @@ void LLVoiceRemoteCtrl::onBtnTalkHeld(void *user_data)
} }
} }
void LLVoiceRemoteCtrl::onBtnTalkReleased(void* user_data) void LLVoiceRemoteCtrl::onBtnTalkReleased()
{ {
// when not in toggle mode, releasing talk button turns off mic // when not in toggle mode, releasing talk button turns off mic
if (!gSavedSettings.getBOOL("PushToTalkToggle")) if (!gSavedSettings.getBOOL("PushToTalkToggle"))
@@ -279,7 +277,7 @@ void LLVoiceRemoteCtrl::onClickEndCall(void* user_data)
} }
void LLVoiceRemoteCtrl::onClickSpeakers(void *user_data) void LLVoiceRemoteCtrl::onClickSpeakers()
{ {
LLFloaterActiveSpeakers::toggleInstance(LLSD()); LLFloaterActiveSpeakers::toggleInstance(LLSD());
} }

View File

@@ -47,10 +47,10 @@ public:
/*virtual*/ void draw(); /*virtual*/ void draw();
static void onBtnLock(void* user_data); static void onBtnLock(void* user_data);
static void onBtnTalkHeld(void *user_data); static void onBtnTalkHeld();
static void onBtnTalkReleased(void* user_data); static void onBtnTalkReleased();
static void onBtnTalkClicked(void* user_data); static void onBtnTalkClicked();
static void onClickSpeakers(void *user_data); static void onClickSpeakers();
static void onClickPopupBtn(void* user_data); static void onClickPopupBtn(void* user_data);
static void onClickVoiceChannel(void* user_data); static void onClickVoiceChannel(void* user_data);
static void onClickEndCall(void* user_data); static void onClickEndCall(void* user_data);