diff options
author | Denis Serdjuk <dserduk@productengine.com> | 2009-12-28 17:44:54 +0200 |
---|---|---|
committer | Denis Serdjuk <dserduk@productengine.com> | 2009-12-28 17:44:54 +0200 |
commit | d89793616e32cace99b5b76e47d51d141b20c7f2 (patch) | |
tree | f03c883f185d77951699d71c06b52c9103649f4e /indra/newview | |
parent | 79fba14bd4ba88dfe71546f5f679ed79fdeff66a (diff) |
implemented minor task EXT-3454 Code improvements: Replace old-style calback with boost::function in the LLFloaterAvatarPicker
--HG--
branch : product-engine
Diffstat (limited to 'indra/newview')
-rw-r--r-- | indra/newview/llfloateravatarpicker.cpp | 108 | ||||
-rw-r--r-- | indra/newview/llfloateravatarpicker.h | 28 | ||||
-rw-r--r-- | indra/newview/llfloaterfriends.cpp | 5 | ||||
-rw-r--r-- | indra/newview/llfloaterfriends.h | 2 | ||||
-rw-r--r-- | indra/newview/llfloatergodtools.cpp | 12 | ||||
-rw-r--r-- | indra/newview/llfloatergodtools.h | 2 | ||||
-rw-r--r-- | indra/newview/llfloaterland.cpp | 33 | ||||
-rw-r--r-- | indra/newview/llfloaterland.h | 9 | ||||
-rw-r--r-- | indra/newview/llfloaterregioninfo.cpp | 55 | ||||
-rw-r--r-- | indra/newview/llfloaterregioninfo.h | 12 | ||||
-rw-r--r-- | indra/newview/llfloaterreporter.cpp | 20 | ||||
-rw-r--r-- | indra/newview/llfloaterreporter.h | 4 | ||||
-rw-r--r-- | indra/newview/llfloatersellland.cpp | 26 | ||||
-rw-r--r-- | indra/newview/llpanelblockedlist.cpp | 5 | ||||
-rw-r--r-- | indra/newview/llpanelblockedlist.h | 2 | ||||
-rw-r--r-- | indra/newview/llpanelgroupinvite.cpp | 4 | ||||
-rw-r--r-- | indra/newview/llpanelpeople.cpp | 5 | ||||
-rw-r--r-- | indra/newview/llpanelpeople.h | 3 |
18 files changed, 140 insertions, 195 deletions
diff --git a/indra/newview/llfloateravatarpicker.cpp b/indra/newview/llfloateravatarpicker.cpp index 6e3d5499a2..a0b2de85f0 100644 --- a/indra/newview/llfloateravatarpicker.cpp +++ b/indra/newview/llfloateravatarpicker.cpp @@ -51,8 +51,7 @@ #include "lluictrlfactory.h" #include "message.h" -LLFloaterAvatarPicker* LLFloaterAvatarPicker::show(callback_t callback, - void* userdata, +LLFloaterAvatarPicker* LLFloaterAvatarPicker::show(select_callback_t callback, BOOL allow_multiple, BOOL closeOnSelect) { @@ -60,8 +59,7 @@ LLFloaterAvatarPicker* LLFloaterAvatarPicker::show(callback_t callback, LLFloaterAvatarPicker* floater = LLFloaterReg::showTypedInstance<LLFloaterAvatarPicker>("avatar_picker"); - floater->mCallback = callback; - floater->mCallbackUserdata = userdata; + floater->mSelectionCallback = callback; floater->setAllowMultiple(allow_multiple); floater->mNearMeListComplete = FALSE; floater->mCloseOnSelect = closeOnSelect; @@ -82,8 +80,6 @@ LLFloaterAvatarPicker* LLFloaterAvatarPicker::show(callback_t callback, LLFloaterAvatarPicker::LLFloaterAvatarPicker(const LLSD& key) : LLFloater(key), mNumResultsReturned(0), - mCallback(NULL), - mCallbackUserdata(NULL), mNearMeListComplete(FALSE), mCloseOnSelect(FALSE) { @@ -93,29 +89,29 @@ LLFloaterAvatarPicker::LLFloaterAvatarPicker(const LLSD& key) BOOL LLFloaterAvatarPicker::postBuild() { - getChild<LLLineEditor>("Edit")->setKeystrokeCallback(editKeystroke, this); + getChild<LLLineEditor>("Edit")->setKeystrokeCallback( boost::bind(&LLFloaterAvatarPicker::editKeystroke, this, _1, _2),NULL); - childSetAction("Find", onBtnFind, this); + childSetAction("Find", boost::bind(&LLFloaterAvatarPicker::onBtnFind, this)); childDisable("Find"); - childSetAction("Refresh", onBtnRefresh, this); - childSetCommitCallback("near_me_range", onRangeAdjust, this); + childSetAction("Refresh", boost::bind(&LLFloaterAvatarPicker::onBtnRefresh, this)); + getChild<LLUICtrl>("near_me_range")->setCommitCallback(boost::bind(&LLFloaterAvatarPicker::onRangeAdjust, this)); LLScrollListCtrl* searchresults = getChild<LLScrollListCtrl>("SearchResults"); - searchresults->setDoubleClickCallback(onBtnSelect, this); - childSetCommitCallback("SearchResults", onList, this); + searchresults->setDoubleClickCallback( boost::bind(&LLFloaterAvatarPicker::onBtnSelect, this)); + searchresults->setCommitCallback(boost::bind(&LLFloaterAvatarPicker::onList, this)); childDisable("SearchResults"); LLScrollListCtrl* nearme = getChild<LLScrollListCtrl>("NearMe"); - nearme->setDoubleClickCallback(onBtnSelect, this); - childSetCommitCallback("NearMe", onList, this); + nearme->setDoubleClickCallback(boost::bind(&LLFloaterAvatarPicker::onBtnSelect, this)); + nearme->setCommitCallback(boost::bind(&LLFloaterAvatarPicker::onList, this)); LLScrollListCtrl* friends = getChild<LLScrollListCtrl>("Friends"); - friends->setDoubleClickCallback(onBtnSelect, this); - childSetCommitCallback("Friends", onList, this); + friends->setDoubleClickCallback(boost::bind(&LLFloaterAvatarPicker::onBtnSelect, this)); + getChild<LLUICtrl>("Friends")->setCommitCallback(boost::bind(&LLFloaterAvatarPicker::onList, this)); - childSetAction("ok_btn", onBtnSelect, this); + childSetAction("ok_btn", boost::bind(&LLFloaterAvatarPicker::onBtnSelect, this)); childDisable("ok_btn"); - childSetAction("cancel_btn", onBtnClose, this); + childSetAction("cancel_btn", boost::bind(&LLFloaterAvatarPicker::onBtnClose, this)); childSetFocus("Edit"); @@ -156,10 +152,9 @@ LLFloaterAvatarPicker::~LLFloaterAvatarPicker() gFocusMgr.releaseFocusIfNeeded( this ); } -void LLFloaterAvatarPicker::onBtnFind(void* userdata) +void LLFloaterAvatarPicker::onBtnFind() { - LLFloaterAvatarPicker* self = (LLFloaterAvatarPicker*)userdata; - if(self) self->find(); + find(); } static void getSelectedAvatarData(const LLScrollListCtrl* from, std::vector<std::string>& avatar_names, std::vector<LLUUID>& avatar_ids) @@ -176,34 +171,33 @@ static void getSelectedAvatarData(const LLScrollListCtrl* from, std::vector<std: } } -void LLFloaterAvatarPicker::onBtnSelect(void* userdata) +void LLFloaterAvatarPicker::onBtnSelect() { - LLFloaterAvatarPicker* self = (LLFloaterAvatarPicker*)userdata; // If select btn not enabled then do not callback - if (!self || !self->isSelectBtnEnabled()) + if (!isSelectBtnEnabled()) return; - if(self->mCallback) + if(mSelectionCallback) { std::string acvtive_panel_name; LLScrollListCtrl* list = NULL; - LLPanel* active_panel = self->childGetVisibleTab("ResidentChooserTabs"); + LLPanel* active_panel = childGetVisibleTab("ResidentChooserTabs"); if(active_panel) { acvtive_panel_name = active_panel->getName(); } if(acvtive_panel_name == "SearchPanel") { - list = self->getChild<LLScrollListCtrl>("SearchResults"); + list = getChild<LLScrollListCtrl>("SearchResults"); } else if(acvtive_panel_name == "NearMePanel") { - list =self->getChild<LLScrollListCtrl>("NearMe"); + list = getChild<LLScrollListCtrl>("NearMe"); } else if (acvtive_panel_name == "FriendsPanel") { - list =self->getChild<LLScrollListCtrl>("Friends"); + list = getChild<LLScrollListCtrl>("Friends"); } if(list) @@ -211,50 +205,39 @@ void LLFloaterAvatarPicker::onBtnSelect(void* userdata) std::vector<std::string> avatar_names; std::vector<LLUUID> avatar_ids; getSelectedAvatarData(list, avatar_names, avatar_ids); - self->mCallback(avatar_names, avatar_ids, self->mCallbackUserdata); + mSelectionCallback(avatar_names, avatar_ids); } } - self->getChild<LLScrollListCtrl>("SearchResults")->deselectAllItems(TRUE); - self->getChild<LLScrollListCtrl>("NearMe")->deselectAllItems(TRUE); - self->getChild<LLScrollListCtrl>("Friends")->deselectAllItems(TRUE); - if(self->mCloseOnSelect) + getChild<LLScrollListCtrl>("SearchResults")->deselectAllItems(TRUE); + getChild<LLScrollListCtrl>("NearMe")->deselectAllItems(TRUE); + getChild<LLScrollListCtrl>("Friends")->deselectAllItems(TRUE); + if(mCloseOnSelect) { - self->mCloseOnSelect = FALSE; - self->closeFloater(); + mCloseOnSelect = FALSE; + closeFloater(); } } -void LLFloaterAvatarPicker::onBtnRefresh(void* userdata) +void LLFloaterAvatarPicker::onBtnRefresh() { - LLFloaterAvatarPicker* self = (LLFloaterAvatarPicker*)userdata; - if (!self) - { - return; - } - - self->getChild<LLScrollListCtrl>("NearMe")->deleteAllItems(); - self->getChild<LLScrollListCtrl>("NearMe")->setCommentText(self->getString("searching")); - self->mNearMeListComplete = FALSE; + getChild<LLScrollListCtrl>("NearMe")->deleteAllItems(); + getChild<LLScrollListCtrl>("NearMe")->setCommentText(getString("searching")); + mNearMeListComplete = FALSE; } -void LLFloaterAvatarPicker::onBtnClose(void* userdata) +void LLFloaterAvatarPicker::onBtnClose() { - LLFloaterAvatarPicker* self = (LLFloaterAvatarPicker*)userdata; - if(self) self->closeFloater(); + closeFloater(); } -void LLFloaterAvatarPicker::onRangeAdjust(LLUICtrl* source, void* data) +void LLFloaterAvatarPicker::onRangeAdjust() { - LLFloaterAvatarPicker::onBtnRefresh(data); + onBtnRefresh(); } -void LLFloaterAvatarPicker::onList(LLUICtrl* ctrl, void* userdata) +void LLFloaterAvatarPicker::onList() { - LLFloaterAvatarPicker* self = (LLFloaterAvatarPicker*)userdata; - if (self) - { - self->childSetEnabled("ok_btn", self->isSelectBtnEnabled()); - } + childSetEnabled("ok_btn", isSelectBtnEnabled()); } void LLFloaterAvatarPicker::populateNearMe() @@ -297,7 +280,7 @@ void LLFloaterAvatarPicker::populateNearMe() childEnable("NearMe"); childEnable("ok_btn"); near_me_scroller->selectFirstItem(); - onList(near_me_scroller, this); + onList(); near_me_scroller->setFocus(TRUE); } @@ -451,7 +434,7 @@ void LLFloaterAvatarPicker::processAvatarPickerReply(LLMessageSystem* msg, void* { floater->childEnable("ok_btn"); search_results->selectFirstItem(); - floater->onList(search_results, floater); + floater->onList(); search_results->setFocus(TRUE); } } @@ -459,8 +442,7 @@ void LLFloaterAvatarPicker::processAvatarPickerReply(LLMessageSystem* msg, void* //static void LLFloaterAvatarPicker::editKeystroke(LLLineEditor* caller, void* user_data) { - LLFloaterAvatarPicker* self = (LLFloaterAvatarPicker*)user_data; - self->childSetEnabled("Find", caller->getText().size() >= 3); + childSetEnabled("Find", caller->getText().size() >= 3); } // virtual @@ -470,11 +452,11 @@ BOOL LLFloaterAvatarPicker::handleKeyHere(KEY key, MASK mask) { if (childHasFocus("Edit")) { - onBtnFind(this); + onBtnFind(); } else { - onBtnSelect(this); + onBtnSelect(); } return TRUE; } diff --git a/indra/newview/llfloateravatarpicker.h b/indra/newview/llfloateravatarpicker.h index 13e491834e..e35466cec8 100644 --- a/indra/newview/llfloateravatarpicker.h +++ b/indra/newview/llfloateravatarpicker.h @@ -43,11 +43,10 @@ public: typedef boost::signals2::signal<bool(const std::vector<LLUUID>&), boost_boolean_combiner> validate_signal_t; typedef validate_signal_t::slot_type validate_callback_t; - // Call this to select an avatar. // The callback function will be called with an avatar name and UUID. - typedef void(*callback_t)(const std::vector<std::string>&, const std::vector<LLUUID>&, void*); - static LLFloaterAvatarPicker* show(callback_t callback, - void* userdata, + typedef boost::function<void (const std::vector<std::string>&, const std::vector<LLUUID>&)> select_callback_t; + // Call this to select an avatar. + static LLFloaterAvatarPicker* show(select_callback_t callback, BOOL allow_multiple = FALSE, BOOL closeOnSelect = FALSE); @@ -61,16 +60,16 @@ public: static void processAvatarPickerReply(class LLMessageSystem* msg, void**); private: - static void editKeystroke(class LLLineEditor* caller, void* user_data); + void editKeystroke(class LLLineEditor* caller, void* user_data); - static void onBtnFind(void* userdata); - static void onBtnSelect(void* userdata); - static void onBtnRefresh(void* userdata); - static void onRangeAdjust(LLUICtrl* source, void* data); - static void onBtnClose(void* userdata); - static void onList(class LLUICtrl* ctrl, void* userdata); - void onTabChanged(); - bool isSelectBtnEnabled(); + void onBtnFind(); + void onBtnSelect(); + void onBtnRefresh(); + void onRangeAdjust(); + void onBtnClose(); + void onList(); + void onTabChanged(); + bool isSelectBtnEnabled(); void populateNearMe(); void populateFriend(); @@ -87,9 +86,8 @@ private: BOOL mNearMeListComplete; BOOL mCloseOnSelect; - void (*mCallback)(const std::vector<std::string>& name, const std::vector<LLUUID>& id, void* userdata); - void* mCallbackUserdata; validate_signal_t mOkButtonValidateSignal; + select_callback_t mSelectionCallback; }; #endif diff --git a/indra/newview/llfloaterfriends.cpp b/indra/newview/llfloaterfriends.cpp index 56291c57a6..ccc5cab85a 100644 --- a/indra/newview/llfloaterfriends.cpp +++ b/indra/newview/llfloaterfriends.cpp @@ -572,8 +572,7 @@ void LLPanelFriends::onClickIM(void* user_data) // static void LLPanelFriends::onPickAvatar(const std::vector<std::string>& names, - const std::vector<LLUUID>& ids, - void* ) + const std::vector<LLUUID>& ids) { if (names.empty()) return; if (ids.empty()) return; @@ -585,7 +584,7 @@ void LLPanelFriends::onClickAddFriend(void* user_data) { LLPanelFriends* panelp = (LLPanelFriends*)user_data; LLFloater* root_floater = gFloaterView->getParentFloater(panelp); - LLFloaterAvatarPicker* picker = LLFloaterAvatarPicker::show(onPickAvatar, user_data, FALSE, TRUE); + LLFloaterAvatarPicker* picker = LLFloaterAvatarPicker::show(boost::bind(&LLPanelFriends::onPickAvatar, _1,_2), FALSE, TRUE); if (root_floater) { root_floater->addDependentFloater(picker); diff --git a/indra/newview/llfloaterfriends.h b/indra/newview/llfloaterfriends.h index 9c6660c0dc..0042da48d3 100644 --- a/indra/newview/llfloaterfriends.h +++ b/indra/newview/llfloaterfriends.h @@ -116,7 +116,7 @@ private: static void onSelectName(LLUICtrl* ctrl, void* user_data); static bool callbackAddFriend(const LLSD& notification, const LLSD& response); static bool callbackAddFriendWithMessage(const LLSD& notification, const LLSD& response); - static void onPickAvatar(const std::vector<std::string>& names, const std::vector<LLUUID>& ids, void* user_data); + static void onPickAvatar(const std::vector<std::string>& names, const std::vector<LLUUID>& ids); static void onMaximumSelect(); static void onClickIM(void* user_data); diff --git a/indra/newview/llfloatergodtools.cpp b/indra/newview/llfloatergodtools.cpp index e1409b8ad5..c2b0bd18fa 100644 --- a/indra/newview/llfloatergodtools.cpp +++ b/indra/newview/llfloatergodtools.cpp @@ -1165,7 +1165,7 @@ bool LLPanelObjectTools::callbackSimWideDeletes( const LLSD& notification, const void LLPanelObjectTools::onClickSet() { // grandparent is a floater, which can have a dependent - gFloaterView->getParentFloater(this)->addDependentFloater(LLFloaterAvatarPicker::show(callbackAvatarID, this)); + gFloaterView->getParentFloater(this)->addDependentFloater(LLFloaterAvatarPicker::show(boost::bind(&LLPanelObjectTools::callbackAvatarID, this, _1,_2))); } void LLPanelObjectTools::onClickSetBySelection(void* data) @@ -1189,14 +1189,12 @@ void LLPanelObjectTools::onClickSetBySelection(void* data) panelp->childSetValue("target_avatar_name", name); } -// static -void LLPanelObjectTools::callbackAvatarID(const std::vector<std::string>& names, const std::vector<LLUUID>& ids, void* data) +void LLPanelObjectTools::callbackAvatarID(const std::vector<std::string>& names, const std::vector<LLUUID>& ids) { - LLPanelObjectTools* object_tools = (LLPanelObjectTools*) data; if (ids.empty() || names.empty()) return; - object_tools->mTargetAvatar = ids[0]; - object_tools->childSetValue("target_avatar_name", names[0]); - object_tools->refresh(); + mTargetAvatar = ids[0]; + childSetValue("target_avatar_name", names[0]); + refresh(); } void LLPanelObjectTools::onChangeAnything() diff --git a/indra/newview/llfloatergodtools.h b/indra/newview/llfloatergodtools.h index ebab1fde11..ef5ce02749 100644 --- a/indra/newview/llfloatergodtools.h +++ b/indra/newview/llfloatergodtools.h @@ -234,7 +234,7 @@ public: void onChangeAnything(); void onApplyChanges(); void onClickSet(); - static void callbackAvatarID(const std::vector<std::string>& names, const std::vector<LLUUID>& ids, void* data); + void callbackAvatarID(const std::vector<std::string>& names, const std::vector<LLUUID>& ids); void onClickDeletePublicOwnedBy(); void onClickDeleteAllScriptedOwnedBy(); void onClickDeleteAllOwnedBy(); diff --git a/indra/newview/llfloaterland.cpp b/indra/newview/llfloaterland.cpp index 02884575b0..598a13de15 100644 --- a/indra/newview/llfloaterland.cpp +++ b/indra/newview/llfloaterland.cpp @@ -2284,9 +2284,9 @@ BOOL LLPanelLandAccess::postBuild() childSetCommitCallback("PriceSpin", onCommitAny, this); childSetCommitCallback("HoursSpin", onCommitAny, this); - childSetAction("add_allowed", onClickAddAccess, this); + childSetAction("add_allowed", boost::bind(&LLPanelLandAccess::onClickAddAccess, this)); childSetAction("remove_allowed", onClickRemoveAccess, this); - childSetAction("add_banned", onClickAddBanned, this); + childSetAction("add_banned", boost::bind(&LLPanelLandAccess::onClickAddBanned, this)); childSetAction("remove_banned", onClickRemoveBanned, this); mListAccess = getChild<LLNameListCtrl>("AccessList"); @@ -2694,29 +2694,22 @@ void LLPanelLandAccess::onCommitAny(LLUICtrl *ctrl, void *userdata) self->refresh(); } -// static -void LLPanelLandAccess::onClickAddAccess(void* data) +void LLPanelLandAccess::onClickAddAccess() { - LLPanelLandAccess* panelp = (LLPanelLandAccess*)data; - if (panelp) - { - gFloaterView->getParentFloater(panelp)->addDependentFloater(LLFloaterAvatarPicker::show(callbackAvatarCBAccess, data) ); - } + gFloaterView->getParentFloater(this)->addDependentFloater(LLFloaterAvatarPicker::show(boost::bind(&LLPanelLandAccess::callbackAvatarCBAccess, this, _1,_2)) ); } -// static -void LLPanelLandAccess::callbackAvatarCBAccess(const std::vector<std::string>& names, const std::vector<LLUUID>& ids, void* userdata) +void LLPanelLandAccess::callbackAvatarCBAccess(const std::vector<std::string>& names, const std::vector<LLUUID>& ids) { - LLPanelLandAccess* panelp = (LLPanelLandAccess*)userdata; if (!names.empty() && !ids.empty()) { LLUUID id = ids[0]; - LLParcel* parcel = panelp->mParcel->getParcel(); + LLParcel* parcel = mParcel->getParcel(); if (parcel) { parcel->addToAccessList(id, 0); LLViewerParcelMgr::getInstance()->sendParcelAccessListUpdate(AL_ACCESS); - panelp->refresh(); + refresh(); } } } @@ -2745,25 +2738,23 @@ void LLPanelLandAccess::onClickRemoveAccess(void* data) } // static -void LLPanelLandAccess::onClickAddBanned(void* data) +void LLPanelLandAccess::onClickAddBanned() { - LLPanelLandAccess* panelp = (LLPanelLandAccess*)data; - gFloaterView->getParentFloater(panelp)->addDependentFloater(LLFloaterAvatarPicker::show(callbackAvatarCBBanned, data) ); + gFloaterView->getParentFloater(this)->addDependentFloater(LLFloaterAvatarPicker::show(boost::bind(&LLPanelLandAccess::callbackAvatarCBBanned, this, _1,_2))); } // static -void LLPanelLandAccess::callbackAvatarCBBanned(const std::vector<std::string>& names, const std::vector<LLUUID>& ids, void* userdata) +void LLPanelLandAccess::callbackAvatarCBBanned(const std::vector<std::string>& names, const std::vector<LLUUID>& ids) { - LLPanelLandAccess* panelp = (LLPanelLandAccess*)userdata; if (!names.empty() && !ids.empty()) { LLUUID id = ids[0]; - LLParcel* parcel = panelp->mParcel->getParcel(); + LLParcel* parcel = mParcel->getParcel(); if (parcel) { parcel->addToBanList(id, 0); LLViewerParcelMgr::getInstance()->sendParcelAccessListUpdate(AL_BAN); - panelp->refresh(); + refresh(); } } } diff --git a/indra/newview/llfloaterland.h b/indra/newview/llfloaterland.h index eb47fbe15b..d7d02ba1a3 100644 --- a/indra/newview/llfloaterland.h +++ b/indra/newview/llfloaterland.h @@ -367,14 +367,15 @@ public: static void onCommitPublicAccess(LLUICtrl* ctrl, void *userdata); static void onCommitAny(LLUICtrl* ctrl, void *userdata); - static void onClickAddAccess(void*); - static void callbackAvatarCBAccess(const std::vector<std::string>& names, const std::vector<LLUUID>& ids, void* userdata); static void onClickRemoveAccess(void*); - static void onClickAddBanned(void*); - static void callbackAvatarCBBanned(const std::vector<std::string>& names, const std::vector<LLUUID>& ids, void* userdata); static void onClickRemoveBanned(void*); virtual BOOL postBuild(); + + void onClickAddAccess(); + void onClickAddBanned(); + void callbackAvatarCBBanned(const std::vector<std::string>& names, const std::vector<LLUUID>& ids); + void callbackAvatarCBAccess(const std::vector<std::string>& names, const std::vector<LLUUID>& ids); protected: LLNameListCtrl* mListAccess; diff --git a/indra/newview/llfloaterregioninfo.cpp b/indra/newview/llfloaterregioninfo.cpp index 496fa62d05..c4b87c1b2d 100644 --- a/indra/newview/llfloaterregioninfo.cpp +++ b/indra/newview/llfloaterregioninfo.cpp @@ -586,7 +586,7 @@ BOOL LLPanelRegionGeneralInfo::postBuild() initCtrl("restrict_pushobject"); initCtrl("block_parcel_search_check"); - childSetAction("kick_btn", onClickKick, this); + childSetAction("kick_btn", boost::bind(&LLPanelRegionGeneralInfo::onClickKick, this)); childSetAction("kick_all_btn", onClickKickAll, this); childSetAction("im_btn", onClickMessage, this); // childSetAction("manage_telehub_btn", onClickManageTelehub, this); @@ -594,27 +594,22 @@ BOOL LLPanelRegionGeneralInfo::postBuild() return LLPanelRegionInfo::postBuild(); } -// static -void LLPanelRegionGeneralInfo::onClickKick(void* userdata) +void LLPanelRegionGeneralInfo::onClickKick() { llinfos << "LLPanelRegionGeneralInfo::onClickKick" << llendl; - LLPanelRegionGeneralInfo* panelp = (LLPanelRegionGeneralInfo*)userdata; // this depends on the grandparent view being a floater // in order to set up floater dependency - LLFloater* parent_floater = gFloaterView->getParentFloater(panelp); - LLFloater* child_floater = LLFloaterAvatarPicker::show(onKickCommit, userdata, FALSE, TRUE); + LLFloater* parent_floater = gFloaterView->getParentFloater(this); + LLFloater* child_floater = LLFloaterAvatarPicker::show(boost::bind(&LLPanelRegionGeneralInfo::onKickCommit, this, _1,_2), FALSE, TRUE); parent_floater->addDependentFloater(child_floater); } -// static -void LLPanelRegionGeneralInfo::onKickCommit(const std::vector<std::string>& names, const std::vector<LLUUID>& ids, void* userdata) +void LLPanelRegionGeneralInfo::onKickCommit(const std::vector<std::string>& names, const std::vector<LLUUID>& ids) { if (names.empty() || ids.empty()) return; if(ids[0].notNull()) { - LLPanelRegionGeneralInfo* self = (LLPanelRegionGeneralInfo*)userdata; - if(!self) return; strings_t strings; // [0] = our agent id // [1] = target agent id @@ -626,7 +621,7 @@ void LLPanelRegionGeneralInfo::onKickCommit(const std::vector<std::string>& name strings.push_back(strings_t::value_type(buffer)); LLUUID invoice(LLFloaterRegionInfo::getLastInvoice()); - self->sendEstateOwnerMessage(gMessageSystem, "teleporthomeuser", invoice, strings); + sendEstateOwnerMessage(gMessageSystem, "teleporthomeuser", invoice, strings); } } @@ -790,7 +785,7 @@ BOOL LLPanelRegionDebugInfo::postBuild() initCtrl("disable_collisions_check"); initCtrl("disable_physics_check"); - childSetAction("choose_avatar_btn", onClickChooseAvatar, this); + childSetAction("choose_avatar_btn", boost::bind(&LLPanelRegionDebugInfo::onClickChooseAvatar, this)); childSetAction("return_btn", onClickReturn, this); childSetAction("top_colliders_btn", onClickTopColliders, this); childSetAction("top_scripts_btn", onClickTopScripts, this); @@ -842,19 +837,18 @@ BOOL LLPanelRegionDebugInfo::sendUpdate() return TRUE; } -void LLPanelRegionDebugInfo::onClickChooseAvatar(void* data) +void LLPanelRegionDebugInfo::onClickChooseAvatar() { - LLFloaterAvatarPicker::show(callbackAvatarID, data, FALSE, TRUE); + LLFloaterAvatarPicker::show(boost::bind(&LLPanelRegionDebugInfo::callbackAvatarID, this, _1, _2), FALSE, TRUE); } -// static -void LLPanelRegionDebugInfo::callbackAvatarID(const std::vector<std::string>& names, const std::vector<LLUUID>& ids, void* data) + +void LLPanelRegionDebugInfo::callbackAvatarID(const std::vector<std::string>& names, const std::vector<LLUUID>& ids) { - LLPanelRegionDebugInfo* self = (LLPanelRegionDebugInfo*) data; if (ids.empty() || names.empty()) return; - self->mTargetAvatar = ids[0]; - self->childSetValue("target_avatar_name", LLSD(names[0])); - self->refreshFromRegion( gAgent.getRegion() ); + mTargetAvatar = ids[0]; + childSetValue("target_avatar_name", LLSD(names[0])); + refreshFromRegion( gAgent.getRegion() ); } // static @@ -1528,18 +1522,16 @@ struct LLKickFromEstateInfo LLUUID mAgentID; }; -void LLPanelEstateInfo::onClickKickUser(void *user_data) +void LLPanelEstateInfo::onClickKickUser() { - LLPanelEstateInfo* panelp = (LLPanelEstateInfo*)user_data; - // this depends on the grandparent view being a floater // in order to set up floater dependency - LLFloater* parent_floater = gFloaterView->getParentFloater(panelp); - LLFloater* child_floater = LLFloaterAvatarPicker::show(LLPanelEstateInfo::onKickUserCommit, user_data, FALSE, TRUE); + LLFloater* parent_floater = gFloaterView->getParentFloater(this); + LLFloater* child_floater = LLFloaterAvatarPicker::show(boost::bind(&LLPanelEstateInfo::onKickUserCommit, this, _1, _2), FALSE, TRUE); parent_floater->addDependentFloater(child_floater); } -void LLPanelEstateInfo::onKickUserCommit(const std::vector<std::string>& names, const std::vector<LLUUID>& ids, void* userdata) +void LLPanelEstateInfo::onKickUserCommit(const std::vector<std::string>& names, const std::vector<LLUUID>& ids) { if (names.empty() || ids.empty()) return; @@ -1550,12 +1542,9 @@ void LLPanelEstateInfo::onKickUserCommit(const std::vector<std::string>& names, return; } - LLPanelEstateInfo* self = (LLPanelEstateInfo*)userdata; - if(!self) return; - //keep track of what user they want to kick and other misc info LLKickFromEstateInfo *kick_info = new LLKickFromEstateInfo(); - kick_info->mEstatePanelp = self; + kick_info->mEstatePanelp = this; kick_info->mAgentID = ids[0]; //Bring up a confirmation dialog @@ -1563,7 +1552,7 @@ void LLPanelEstateInfo::onKickUserCommit(const std::vector<std::string>& names, args["EVIL_USER"] = names[0]; LLSD payload; payload["agent_id"] = ids[0]; - LLNotificationsUtil::add("EstateKickUser", args, payload, boost::bind(&LLPanelEstateInfo::kickUserConfirm, self, _1, _2)); + LLNotificationsUtil::add("EstateKickUser", args, payload, boost::bind(&LLPanelEstateInfo::kickUserConfirm, this, _1, _2)); } @@ -1727,7 +1716,7 @@ bool LLPanelEstateInfo::accessAddCore2(const LLSD& notification, const LLSD& res LLEstateAccessChangeInfo* change_info = new LLEstateAccessChangeInfo(notification["payload"]); // avatar picker yes multi-select, yes close-on-select - LLFloaterAvatarPicker::show(accessAddCore3, (void*)change_info, TRUE, TRUE); + LLFloaterAvatarPicker::show(boost::bind(&LLPanelEstateInfo::accessAddCore3, _1, _2, (void*)change_info), TRUE, TRUE); return false; } @@ -2107,7 +2096,7 @@ BOOL LLPanelEstateInfo::postBuild() childSetAction("add_estate_manager_btn", onClickAddEstateManager, this); childSetAction("remove_estate_manager_btn", onClickRemoveEstateManager, this); childSetAction("message_estate_btn", onClickMessageEstate, this); - childSetAction("kick_user_from_estate_btn", onClickKickUser, this); + childSetAction("kick_user_from_estate_btn", boost::bind(&LLPanelEstateInfo::onClickKickUser, this)); childSetAction("WLEditSky", onClickEditSky, this); childSetAction("WLEditDayCycle", onClickEditDayCycle, this); diff --git a/indra/newview/llfloaterregioninfo.h b/indra/newview/llfloaterregioninfo.h index a21b96bf16..8d315bdb78 100644 --- a/indra/newview/llfloaterregioninfo.h +++ b/indra/newview/llfloaterregioninfo.h @@ -167,8 +167,8 @@ public: protected: virtual BOOL sendUpdate(); - static void onClickKick(void* userdata); - static void onKickCommit(const std::vector<std::string>& names, const std::vector<LLUUID>& ids, void* userdata); + void onClickKick(); + void onKickCommit(const std::vector<std::string>& names, const std::vector<LLUUID>& ids); static void onClickKickAll(void* userdata); bool onKickAllCommit(const LLSD& notification, const LLSD& response); static void onClickMessage(void* userdata); @@ -192,8 +192,8 @@ public: protected: virtual BOOL sendUpdate(); - static void onClickChooseAvatar(void*); - static void callbackAvatarID(const std::vector<std::string>& names, const std::vector<LLUUID>& ids, void* data); + void onClickChooseAvatar(); + void callbackAvatarID(const std::vector<std::string>& names, const std::vector<LLUUID>& ids); static void onClickReturn(void *); bool callbackReturn(const LLSD& notification, const LLSD& response); static void onClickTopColliders(void*); @@ -275,7 +275,7 @@ public: static void onClickRemoveBannedAgent(void* user_data); static void onClickAddEstateManager(void* user_data); static void onClickRemoveEstateManager(void* user_data); - static void onClickKickUser(void* userdata); + void onClickKickUser(); // Group picker callback is different, can't use core methods below bool addAllowedGroup(const LLSD& notification, const LLSD& response); @@ -296,7 +296,7 @@ public: // Send the actual EstateOwnerRequest "estateaccessdelta" message static void sendEstateAccessDelta(U32 flags, const LLUUID& agent_id); - static void onKickUserCommit(const std::vector<std::string>& names, const std::vector<LLUUID>& ids, void* userdata); + void onKickUserCommit(const std::vector<std::string>& names, const std::vector<LLUUID>& ids); static void onClickMessageEstate(void* data); bool onMessageCommit(const LLSD& notification, const LLSD& response); diff --git a/indra/newview/llfloaterreporter.cpp b/indra/newview/llfloaterreporter.cpp index c0825dc694..e0f2fca580 100644 --- a/indra/newview/llfloaterreporter.cpp +++ b/indra/newview/llfloaterreporter.cpp @@ -172,7 +172,7 @@ BOOL LLFloaterReporter::postBuild() std::string("tool_face_active.tga") ); childSetAction("pick_btn", onClickObjPicker, this); - childSetAction("select_abuser", onClickSelectAbuser, this); + childSetAction("select_abuser", boost::bind(&LLFloaterReporter::onClickSelectAbuser, this)); childSetAction("send_btn", onClickSend, this); childSetAction("cancel_btn", onClickCancel, this); @@ -306,26 +306,20 @@ void LLFloaterReporter::getObjectInfo(const LLUUID& object_id) } -// static -void LLFloaterReporter::onClickSelectAbuser(void *userdata) +void LLFloaterReporter::onClickSelectAbuser() { - LLFloaterReporter *self = (LLFloaterReporter *)userdata; - - gFloaterView->getParentFloater(self)->addDependentFloater(LLFloaterAvatarPicker::show(callbackAvatarID, userdata, FALSE, TRUE )); + gFloaterView->getParentFloater(this)->addDependentFloater(LLFloaterAvatarPicker::show(boost::bind(&LLFloaterReporter::callbackAvatarID, this, _1, _2), FALSE, TRUE )); } -// static -void LLFloaterReporter::callbackAvatarID(const std::vector<std::string>& names, const std::vector<LLUUID>& ids, void* data) +void LLFloaterReporter::callbackAvatarID(const std::vector<std::string>& names, const std::vector<LLUUID>& ids) { - LLFloaterReporter* self = (LLFloaterReporter*) data; - if (ids.empty() || names.empty()) return; - self->childSetText("abuser_name_edit", names[0] ); + childSetText("abuser_name_edit", names[0] ); - self->mAbuserID = ids[0]; + mAbuserID = ids[0]; - self->refresh(); + refresh(); } diff --git a/indra/newview/llfloaterreporter.h b/indra/newview/llfloaterreporter.h index a3776f3d27..cc2dfb2f98 100644 --- a/indra/newview/llfloaterreporter.h +++ b/indra/newview/llfloaterreporter.h @@ -97,7 +97,7 @@ public: static void onClickSend (void *userdata); static void onClickCancel (void *userdata); static void onClickObjPicker (void *userdata); - static void onClickSelectAbuser (void *userdata); + void onClickSelectAbuser (); static void closePickTool (void *userdata); static void uploadDoneCallback(const LLUUID &uuid, void* user_data, S32 result, LLExtStat ext_status); static void addDescription(const std::string& description, LLMeanCollisionData *mcd = NULL); @@ -120,7 +120,7 @@ private: void setPosBox(const LLVector3d &pos); void enableControls(BOOL own_avatar); void getObjectInfo(const LLUUID& object_id); - static void callbackAvatarID(const std::vector<std::string>& names, const std::vector<LLUUID>& ids, void* data); + void callbackAvatarID(const std::vector<std::string>& names, const std::vector<LLUUID>& ids); private: EReportType mReportType; diff --git a/indra/newview/llfloatersellland.cpp b/indra/newview/llfloatersellland.cpp index e5260aa7b9..e2b0c4b66f 100644 --- a/indra/newview/llfloatersellland.cpp +++ b/indra/newview/llfloatersellland.cpp @@ -89,14 +89,14 @@ private: void setBadge(const char* id, Badge badge); static void onChangeValue(LLUICtrl *ctrl, void *userdata); - static void doSelectAgent(void *userdata); + void doSelectAgent(); static void doCancel(void *userdata); static void doSellLand(void *userdata); bool onConfirmSale(const LLSD& notification, const LLSD& response); static void doShowObjects(void *userdata); static bool callbackHighlightTransferable(const LLSD& notification, const LLSD& response); - static void callbackAvatarPick(const std::vector<std::string>& names, const std::vector<LLUUID>& ids, void* data); + void callbackAvatarPick(const std::vector<std::string>& names, const std::vector<LLUUID>& ids); public: virtual BOOL postBuild(); @@ -165,7 +165,7 @@ BOOL LLFloaterSellLandUI::postBuild() childSetCommitCallback("price", onChangeValue, this); childSetPrevalidate("price", LLLineEditor::prevalidateNonNegativeS32); childSetCommitCallback("sell_objects", onChangeValue, this); - childSetAction("sell_to_select_agent", doSelectAgent, this); + childSetAction("sell_to_select_agent", boost::bind( &LLFloaterSellLandUI::doSelectAgent, this)); childSetAction("cancel_btn", doCancel, this); childSetAction("sell_btn", doSellLand, this); childSetAction("show_objects", doShowObjects, this); @@ -361,7 +361,7 @@ void LLFloaterSellLandUI::onChangeValue(LLUICtrl *ctrl, void *userdata) self->mSellToBuyer = true; if (self->mAuthorizedBuyer.isNull()) { - doSelectAgent(self); + self->doSelectAgent(); } } else if (sell_to == "anyone") @@ -384,30 +384,26 @@ void LLFloaterSellLandUI::onChangeValue(LLUICtrl *ctrl, void *userdata) self->refreshUI(); } -// static -void LLFloaterSellLandUI::doSelectAgent(void *userdata) +void LLFloaterSellLandUI::doSelectAgent() { - LLFloaterSellLandUI* floaterp = (LLFloaterSellLandUI*)userdata; // grandparent is a floater, in order to set up dependency - floaterp->addDependentFloater(LLFloaterAvatarPicker::show(callbackAvatarPick, floaterp, FALSE, TRUE)); + addDependentFloater(LLFloaterAvatarPicker::show(boost::bind(&LLFloaterSellLandUI::callbackAvatarPick, this, _1, _2), FALSE, TRUE)); } -// static -void LLFloaterSellLandUI::callbackAvatarPick(const std::vector<std::string>& names, const std::vector<LLUUID>& ids, void* data) +void LLFloaterSellLandUI::callbackAvatarPick(const std::vector<std::string>& names, const std::vector<LLUUID>& ids) { - LLFloaterSellLandUI* floaterp = (LLFloaterSellLandUI*)data; - LLParcel* parcel = floaterp->mParcelSelection->getParcel(); + LLParcel* parcel = mParcelSelection->getParcel(); if (names.empty() || ids.empty()) return; LLUUID id = ids[0]; parcel->setAuthorizedBuyerID(id); - floaterp->mAuthorizedBuyer = ids[0]; + mAuthorizedBuyer = ids[0]; - floaterp->childSetText("sell_to_agent", names[0]); + childSetText("sell_to_agent", names[0]); - floaterp->refreshUI(); + refreshUI(); } // static diff --git a/indra/newview/llpanelblockedlist.cpp b/indra/newview/llpanelblockedlist.cpp index ae703ebd8e..362657a458 100644 --- a/indra/newview/llpanelblockedlist.cpp +++ b/indra/newview/llpanelblockedlist.cpp @@ -171,7 +171,7 @@ void LLPanelBlockedList::onPickBtnClick() { const BOOL allow_multiple = FALSE; const BOOL close_on_select = TRUE; - /*LLFloaterAvatarPicker* picker = */LLFloaterAvatarPicker::show(callbackBlockPicked, this, allow_multiple, close_on_select); + /*LLFloaterAvatarPicker* picker = */LLFloaterAvatarPicker::show(boost::bind(&LLPanelBlockedList::callbackBlockPicked, this, _1, _2), allow_multiple, close_on_select); // *TODO: mantipov: should LLFloaterAvatarPicker be closed when panel is closed? // old Floater dependency is not enable in panel @@ -183,8 +183,7 @@ void LLPanelBlockedList::onBlockByNameClick() LLFloaterGetBlockedObjectName::show(&LLPanelBlockedList::callbackBlockByName); } -//static -void LLPanelBlockedList::callbackBlockPicked(const std::vector<std::string>& names, const std::vector<LLUUID>& ids, void* user_data) +void LLPanelBlockedList::callbackBlockPicked(const std::vector<std::string>& names, const std::vector<LLUUID>& ids) { if (names.empty() || ids.empty()) return; LLMute mute(ids[0], names[0], LLMute::AGENT); diff --git a/indra/newview/llpanelblockedlist.h b/indra/newview/llpanelblockedlist.h index 0993f46f79..1ef16a02f4 100644 --- a/indra/newview/llpanelblockedlist.h +++ b/indra/newview/llpanelblockedlist.h @@ -78,7 +78,7 @@ private: void onPickBtnClick(); void onBlockByNameClick(); - static void callbackBlockPicked(const std::vector<std::string>& names, const std::vector<LLUUID>& ids, void* user_data); + void callbackBlockPicked(const std::vector<std::string>& names, const std::vector<LLUUID>& ids); static void callbackBlockByName(const std::string& text); private: diff --git a/indra/newview/llpanelgroupinvite.cpp b/indra/newview/llpanelgroupinvite.cpp index 375ee0fdc4..06a682c905 100644 --- a/indra/newview/llpanelgroupinvite.cpp +++ b/indra/newview/llpanelgroupinvite.cpp @@ -292,8 +292,8 @@ void LLPanelGroupInvite::impl::callbackClickAdd(void* userdata) LLFloater* parentp; parentp = gFloaterView->getParentFloater(panelp); - parentp->addDependentFloater(LLFloaterAvatarPicker::show(callbackAddUsers, - panelp->mImplementation, + parentp->addDependentFloater(LLFloaterAvatarPicker::show(boost::bind(impl::callbackAddUsers, _1, _2, + panelp->mImplementation), TRUE)); } } diff --git a/indra/newview/llpanelpeople.cpp b/indra/newview/llpanelpeople.cpp index 5cc4d4aec6..249a9ca1a0 100644 --- a/indra/newview/llpanelpeople.cpp +++ b/indra/newview/llpanelpeople.cpp @@ -1069,7 +1069,7 @@ bool LLPanelPeople::isItemsFreeOfFriends(const std::vector<LLUUID>& uuids) void LLPanelPeople::onAddFriendWizButtonClicked() { // Show add friend wizard. - LLFloaterAvatarPicker* picker = LLFloaterAvatarPicker::show(onAvatarPicked, NULL, FALSE, TRUE); + LLFloaterAvatarPicker* picker = LLFloaterAvatarPicker::show(boost::bind(&LLPanelPeople::onAvatarPicked, _1, _2), FALSE, TRUE); // Need to disable 'ok' button when friend occurs in selection if (picker) picker->setOkBtnEnableCb(boost::bind(&LLPanelPeople::isItemsFreeOfFriends, this, _1)); LLFloater* root_floater = gFloaterView->getParentFloater(this); @@ -1130,8 +1130,7 @@ void LLPanelPeople::onActivateButtonClicked() // static void LLPanelPeople::onAvatarPicked( const std::vector<std::string>& names, - const std::vector<LLUUID>& ids, - void*) + const std::vector<LLUUID>& ids) { if (!names.empty() && !ids.empty()) LLAvatarActions::requestFriendshipDialog(ids[0], names[0]); diff --git a/indra/newview/llpanelpeople.h b/indra/newview/llpanelpeople.h index 0d2bae1baf..da2c0e368c 100644 --- a/indra/newview/llpanelpeople.h +++ b/indra/newview/llpanelpeople.h @@ -129,8 +129,7 @@ private: // misc callbacks static void onAvatarPicked( const std::vector<std::string>& names, - const std::vector<LLUUID>& ids, - void*); + const std::vector<LLUUID>& ids); void onFriendsAccordionExpandedCollapsed(LLUICtrl* ctrl, const LLSD& param, LLAvatarList* avatar_list); |