From b4f0b29035a7ced627d97ec43783115f37a785cb Mon Sep 17 00:00:00 2001 From: Lirusaito Date: Sun, 23 Jun 2013 19:00:49 -0400 Subject: [PATCH] Switched the Ascent Prefs callbacks over to modern boost::bind It's simple to compile fix, but I'll handle any necessary merge conflicts, if necessary. Hunspell stuff needs revisiting still, works as poorly as it always did. --- indra/newview/ascentprefschat.cpp | 189 ++++++++++++------------------ indra/newview/ascentprefschat.h | 18 ++- indra/newview/ascentprefssys.cpp | 177 +++++++++++++--------------- indra/newview/ascentprefssys.h | 8 +- indra/newview/ascentprefsvan.cpp | 108 +++++++---------- indra/newview/ascentprefsvan.h | 9 +- 6 files changed, 209 insertions(+), 300 deletions(-) diff --git a/indra/newview/ascentprefschat.cpp b/indra/newview/ascentprefschat.cpp index cf60bb715..242865bff 100644 --- a/indra/newview/ascentprefschat.cpp +++ b/indra/newview/ascentprefschat.cpp @@ -51,14 +51,14 @@ LLPrefsAscentChat::LLPrefsAscentChat() { LLUICtrlFactory::getInstance()->buildPanel(this, "panel_preferences_ascent_chat.xml"); - childSetCommitCallback("SpellBase", onSpellBaseComboBoxCommit, this); - childSetAction("EmSpell_EditCustom", onSpellEditCustom, this); - childSetAction("EmSpell_GetMore", onSpellGetMore, this); - childSetAction("EmSpell_Add", onSpellAdd, this); - childSetAction("EmSpell_Remove", onSpellRemove, this); + getChild("SpellBase")->setCommitCallback(boost::bind(&LLPrefsAscentChat::onSpellBaseComboBoxCommit, this, _2)); + getChild("EmSpell_EditCustom")->setCommitCallback(boost::bind(&LLPrefsAscentChat::onSpellEditCustom, this)); + getChild("EmSpell_GetMore")->setCommitCallback(boost::bind(&lggHunSpell_Wrapper::getMoreButton, glggHunSpell, this)); + getChild("EmSpell_Add")->setCommitCallback(boost::bind(&LLPrefsAscentChat::onSpellAdd, this)); + getChild("EmSpell_Remove")->setCommitCallback(boost::bind(&LLPrefsAscentChat::onSpellRemove, this)); - childSetCommitCallback("time_format_combobox", onCommitTimeDate, this); - childSetCommitCallback("date_format_combobox", onCommitTimeDate, this); + getChild("time_format_combobox")->setCommitCallback(boost::bind(&LLPrefsAscentChat::onCommitTimeDate, this, _1)); + getChild("date_format_combobox")->setCommitCallback(boost::bind(&LLPrefsAscentChat::onCommitTimeDate, this, _1)); bool started = (LLStartUp::getStartupState() == STATE_STARTED); if (!started) // Disable autoresponse when not logged in @@ -87,19 +87,19 @@ LLPrefsAscentChat::LLPrefsAscentChat() childSetValue("BusyModeResponseShow", gSavedPerAccountSettings.getBOOL("BusyModeResponseShow")); childSetEnabled("reset_antispam", started); - childSetCommitCallback("reset_antispam", onCommitResetAS, this); - childSetCommitCallback("enable_as", onCommitEnableAS, this); - childSetCommitCallback("antispam_checkbox", onCommitDialogBlock, this); - childSetCommitCallback("Group Invites", onCommitDialogBlock, this); + getChild("reset_antispam")->setCommitCallback(boost::bind(NACLAntiSpamRegistry::purgeAllQueues)); + getChild("enable_as")->setCommitCallback(boost::bind(&LLPrefsAscentChat::onCommitEnableAS, this, _2)); + getChild("antispam_checkbox")->setCommitCallback(boost::bind(&LLPrefsAscentChat::onCommitDialogBlock, this, _1, _2)); + getChild("Group Invites")->setCommitCallback(boost::bind(&LLPrefsAscentChat::onCommitDialogBlock, this, _1, _2)); - childSetCommitCallback("KeywordsOn", onCommitKeywords, this); - childSetCommitCallback("KeywordsList", onCommitKeywords, this); - childSetCommitCallback("KeywordsSound", onCommitKeywords, this); - childSetCommitCallback("KeywordsInChat", onCommitKeywords, this); - childSetCommitCallback("KeywordsInIM", onCommitKeywords, this); - childSetCommitCallback("KeywordsChangeColor", onCommitKeywords, this); - childSetCommitCallback("KeywordsColor", onCommitKeywords, this); - childSetCommitCallback("KeywordsPlaySound", onCommitKeywords, this); + getChild("KeywordsOn")->setCommitCallback(boost::bind(&LLPrefsAscentChat::onCommitKeywords, this, _1)); + getChild("KeywordsList")->setCommitCallback(boost::bind(&LLPrefsAscentChat::onCommitKeywords, this, _1)); + getChild("KeywordsSound")->setCommitCallback(boost::bind(&LLPrefsAscentChat::onCommitKeywords, this, _1)); + getChild("KeywordsInChat")->setCommitCallback(boost::bind(&LLPrefsAscentChat::onCommitKeywords, this, _1)); + getChild("KeywordsInIM")->setCommitCallback(boost::bind(&LLPrefsAscentChat::onCommitKeywords, this, _1)); + getChild("KeywordsChangeColor")->setCommitCallback(boost::bind(&LLPrefsAscentChat::onCommitKeywords, this, _1)); + getChild("KeywordsColor")->setCommitCallback(boost::bind(&LLPrefsAscentChat::onCommitKeywords, this, _1)); + getChild("KeywordsPlaySound")->setCommitCallback(boost::bind(&LLPrefsAscentChat::onCommitKeywords, this, _1)); refreshValues(); refresh(); @@ -109,73 +109,43 @@ LLPrefsAscentChat::~LLPrefsAscentChat() { } -//static -void LLPrefsAscentChat::onSpellAdd(void* data) +void LLPrefsAscentChat::onSpellAdd() { - LLPrefsAscentChat* self = (LLPrefsAscentChat*)data; - - if(self) - { - glggHunSpell->addButton(self->childGetValue("EmSpell_Avail").asString()); - } - - self->refresh(); + glggHunSpell->addButton(childGetValue("EmSpell_Avail").asString()); + refresh(); } -//static -void LLPrefsAscentChat::onSpellRemove(void* data) +void LLPrefsAscentChat::onSpellRemove() { - LLPrefsAscentChat* self = (LLPrefsAscentChat*)data; - - if(self) - { - glggHunSpell->removeButton(self->childGetValue("EmSpell_Installed").asString()); - } - - self->refresh(); + glggHunSpell->removeButton(childGetValue("EmSpell_Installed").asString()); + refresh(); } -//static -void LLPrefsAscentChat::onSpellGetMore(void* data) +void LLPrefsAscentChat::onSpellEditCustom() { - glggHunSpell->getMoreButton(data); + glggHunSpell->editCustomButton(); } -//static -void LLPrefsAscentChat::onSpellEditCustom(void* data) +void LLPrefsAscentChat::onSpellBaseComboBoxCommit(const LLSD& value) { - glggHunSpell->editCustomButton(); + glggHunSpell->newDictSelection(value.asString()); } -//static -void LLPrefsAscentChat::onSpellBaseComboBoxCommit(LLUICtrl* ctrl, void* userdata) +void LLPrefsAscentChat::onCommitTimeDate(LLUICtrl* ctrl) { - LLComboBox* box = (LLComboBox*)ctrl; - - if (box) - { - glggHunSpell->newDictSelection(box->getValue().asString()); - } -} - -//static -void LLPrefsAscentChat::onCommitTimeDate(LLUICtrl* ctrl, void* userdata) -{ - LLPrefsAscentChat* self = (LLPrefsAscentChat*)userdata; - - LLComboBox* combo = (LLComboBox*)ctrl; + LLComboBox* combo = static_cast(ctrl); if (ctrl->getName() == "time_format_combobox") { - self->tempTimeFormat = combo->getCurrentIndex(); + tempTimeFormat = combo->getCurrentIndex(); } else if (ctrl->getName() == "date_format_combobox") { - self->tempDateFormat = combo->getCurrentIndex(); + tempDateFormat = combo->getCurrentIndex(); } std::string short_date, long_date, short_time, long_time, timestamp; - if (self->tempTimeFormat == 0) + if (tempTimeFormat == 0) { short_time = "%H:%M"; long_time = "%H:%M:%S"; @@ -188,13 +158,13 @@ void LLPrefsAscentChat::onCommitTimeDate(LLUICtrl* ctrl, void* userdata) timestamp = " %I:%M %p"; } - if (self->tempDateFormat == 0) + if (tempDateFormat == 0) { short_date = "%Y-%m-%d"; long_date = "%A %d %B %Y"; timestamp = "%a %d %b %Y" + timestamp; } - else if (self->tempDateFormat == 1) + else if (tempDateFormat == 1) { short_date = "%d/%m/%Y"; long_date = "%A %d %B %Y"; @@ -214,70 +184,57 @@ void LLPrefsAscentChat::onCommitTimeDate(LLUICtrl* ctrl, void* userdata) gSavedSettings.setString("TimestampFormat", timestamp); } -//static -void LLPrefsAscentChat::onCommitResetAS(LLUICtrl*, void*) +void LLPrefsAscentChat::onCommitEnableAS(const LLSD& value) { - NACLAntiSpamRegistry::purgeAllQueues(); + bool enabled = value.asBoolean(); + childSetEnabled("spammsg_checkbox", enabled); + childSetEnabled("antispamtime", enabled); + childSetEnabled("antispamamount", enabled); + childSetEnabled("antispamsoundmulti", enabled); + childSetEnabled("antispamsoundpreloadmulti", enabled); + childSetEnabled("antispamnewlines", enabled); + childSetEnabled("Notify On Spam", enabled); } -//static -void LLPrefsAscentChat::onCommitEnableAS(LLUICtrl* ctrl, void* user_data) +void LLPrefsAscentChat::onCommitDialogBlock(LLUICtrl* ctrl, const LLSD& value) { - LLPrefsAscentChat* self = (LLPrefsAscentChat*)user_data; - bool enabled = ctrl->getValue().asBoolean(); - self->childSetEnabled("spammsg_checkbox", enabled); - self->childSetEnabled("antispamtime", enabled); - self->childSetEnabled("antispamamount", enabled); - self->childSetEnabled("antispamsoundmulti", enabled); - self->childSetEnabled("antispamsoundpreloadmulti", enabled); - self->childSetEnabled("antispamnewlines", enabled); - self->childSetEnabled("Notify On Spam", enabled); -} - -//static -void LLPrefsAscentChat::onCommitDialogBlock(LLUICtrl* ctrl, void* user_data) -{ - LLPrefsAscentChat* self = (LLPrefsAscentChat*)user_data; - self->childSetEnabled("Group Fee Invites", !self->childGetValue("antispam_checkbox").asBoolean() && !self->childGetValue("Group Invites").asBoolean()); - bool enabled = ctrl->getValue().asBoolean(); + childSetEnabled("Group Fee Invites", !childGetValue("antispam_checkbox").asBoolean() && !childGetValue("Group Invites").asBoolean()); + bool enabled = value.asBoolean(); if (ctrl->getName() == "antispam_checkbox") { - self->childSetEnabled("Block All Dialogs From", !enabled); - self->childSetEnabled("Alerts", !enabled); - self->childSetEnabled("Friendship Offers", !enabled); - self->childSetEnabled("Group Invites", !enabled); - self->childSetEnabled("Group Notices", !enabled); - self->childSetEnabled("Item Offers", !enabled); - self->childSetEnabled("Scripts", !enabled); - self->childSetEnabled("Teleport Offers", !enabled); + childSetEnabled("Block All Dialogs From", !enabled); + childSetEnabled("Alerts", !enabled); + childSetEnabled("Friendship Offers", !enabled); + childSetEnabled("Group Invites", !enabled); + childSetEnabled("Group Notices", !enabled); + childSetEnabled("Item Offers", !enabled); + childSetEnabled("Scripts", !enabled); + childSetEnabled("Teleport Offers", !enabled); } } -//static -void LLPrefsAscentChat::onCommitKeywords(LLUICtrl* ctrl, void* user_data) +void LLPrefsAscentChat::onCommitKeywords(LLUICtrl* ctrl) { - LLPrefsAscentChat* self = (LLPrefsAscentChat*)user_data; - if (ctrl->getName() == "KeywordsOn") { - bool enabled = self->childGetValue("KeywordsOn").asBoolean(); - self->childSetEnabled("KeywordsList", enabled); - self->childSetEnabled("KeywordsInChat", enabled); - self->childSetEnabled("KeywordsInIM", enabled); - self->childSetEnabled("KeywordsChangeColor", enabled); - self->childSetEnabled("KeywordsColor", enabled); - self->childSetEnabled("KeywordsPlaySound", enabled); - self->childSetEnabled("KeywordsSound", enabled); + bool enabled = childGetValue("KeywordsOn").asBoolean(); + childSetEnabled("KeywordsList", enabled); + childSetEnabled("KeywordsInChat", enabled); + childSetEnabled("KeywordsInIM", enabled); + childSetEnabled("KeywordsChangeColor", enabled); + childSetEnabled("KeywordsColor", enabled); + childSetEnabled("KeywordsPlaySound", enabled); + childSetEnabled("KeywordsSound", enabled); } - gSavedPerAccountSettings.setBOOL("KeywordsOn", self->childGetValue("KeywordsOn")); - gSavedPerAccountSettings.setString("KeywordsList", self->childGetValue("KeywordsList")); - gSavedPerAccountSettings.setBOOL("KeywordsInChat", self->childGetValue("KeywordsInChat")); - gSavedPerAccountSettings.setBOOL("KeywordsInIM", self->childGetValue("KeywordsInIM")); - gSavedPerAccountSettings.setBOOL("KeywordsChangeColor", self->childGetValue("KeywordsChangeColor")); - gSavedPerAccountSettings.setColor4("KeywordsColor", self->childGetValue("KeywordsColor")); - gSavedPerAccountSettings.setBOOL("KeywordsPlaySound", self->childGetValue("KeywordsPlaySound")); - gSavedPerAccountSettings.setString("KeywordsSound", self->childGetValue("KeywordsSound")); + gSavedPerAccountSettings.setBOOL("KeywordsOn", childGetValue("KeywordsOn")); + gSavedPerAccountSettings.setString("KeywordsList", childGetValue("KeywordsList")); + gSavedPerAccountSettings.setBOOL("KeywordsInChat", childGetValue("KeywordsInChat")); + gSavedPerAccountSettings.setBOOL("KeywordsInIM", childGetValue("KeywordsInIM")); + gSavedPerAccountSettings.setBOOL("KeywordsChangeColor", childGetValue("KeywordsChangeColor")); + gSavedPerAccountSettings.setColor4("KeywordsColor", childGetValue("KeywordsColor")); + gSavedPerAccountSettings.setBOOL("KeywordsPlaySound", childGetValue("KeywordsPlaySound")); + gSavedPerAccountSettings.setString("KeywordsSound", childGetValue("KeywordsSound")); } // Store current settings for cancel diff --git a/indra/newview/ascentprefschat.h b/indra/newview/ascentprefschat.h index aa0b91d9d..ee067bbaa 100644 --- a/indra/newview/ascentprefschat.h +++ b/indra/newview/ascentprefschat.h @@ -47,16 +47,14 @@ public: void refreshValues(); protected: - static void onSpellAdd(void* data); - static void onSpellRemove(void* data); - static void onSpellGetMore(void* data); - static void onSpellEditCustom(void* data); - static void onSpellBaseComboBoxCommit(LLUICtrl* ctrl, void* userdata); - static void onCommitTimeDate(LLUICtrl* ctrl, void *userdata); - static void onCommitResetAS(LLUICtrl*,void*); - static void onCommitEnableAS(LLUICtrl*, void*); - static void onCommitDialogBlock(LLUICtrl*, void*); - static void onCommitKeywords(LLUICtrl* ctrl, void* user_data); + void onSpellAdd(); + void onSpellRemove(); + void onSpellEditCustom(); + void onSpellBaseComboBoxCommit(const LLSD& value); + void onCommitTimeDate(LLUICtrl* ctrl); + void onCommitEnableAS(const LLSD& value); + void onCommitDialogBlock(LLUICtrl* ctrl, const LLSD& value); + void onCommitKeywords(LLUICtrl* ctrl); //Chat/IM ----------------------------------------------------------------------------- BOOL mIMAnnounceIncoming; diff --git a/indra/newview/ascentprefssys.cpp b/indra/newview/ascentprefssys.cpp index fc2bc1a62..d57736bb5 100644 --- a/indra/newview/ascentprefssys.cpp +++ b/indra/newview/ascentprefssys.cpp @@ -51,41 +51,41 @@ LLPrefsAscentSys::LLPrefsAscentSys() LLUICtrlFactory::getInstance()->buildPanel(this, "panel_preferences_ascent_system.xml"); //General ----------------------------------------------------------------------------- - childSetCommitCallback("speed_rez_check", onCommitCheckBox, this); - childSetCommitCallback("double_click_teleport_check", onCommitCheckBox, this); - childSetCommitCallback("system_folder_check", onCommitCheckBox, this); - childSetCommitCallback("show_look_at_check", onCommitCheckBox, this); - childSetCommitCallback("enable_clouds", onCommitCheckBox, this); - childSetCommitCallback("power_user_check", onCommitCheckBox, this); - childSetCommitCallback("power_user_confirm_check", onCommitCheckBox, this); + getChild("speed_rez_check")->setCommitCallback(boost::bind(&LLPrefsAscentSys::onCommitCheckBox, this, _1, _2)); + getChild("double_click_teleport_check")->setCommitCallback(boost::bind(&LLPrefsAscentSys::onCommitCheckBox, this, _1, _2)); + getChild("system_folder_check")->setCommitCallback(boost::bind(&LLPrefsAscentSys::onCommitCheckBox, this, _1, _2)); + getChild("show_look_at_check")->setCommitCallback(boost::bind(&LLPrefsAscentSys::onCommitCheckBox, this, _1, _2)); + getChild("enable_clouds")->setCommitCallback(boost::bind(&LLPrefsAscentSys::onCommitCheckBox, this, _1, _2)); + getChild("power_user_check")->setCommitCallback(boost::bind(&LLPrefsAscentSys::onCommitCheckBox, this, _1, _2)); + getChild("power_user_confirm_check")->setCommitCallback(boost::bind(&LLPrefsAscentSys::onCommitCheckBox, this, _1, _2)); //Command Line ------------------------------------------------------------------------ - childSetCommitCallback("chat_cmd_toggle", onCommitCmdLine, this); - childSetCommitCallback("AscentCmdLinePos", onCommitCmdLine, this); - childSetCommitCallback("AscentCmdLineGround", onCommitCmdLine, this); - childSetCommitCallback("AscentCmdLineHeight", onCommitCmdLine, this); - childSetCommitCallback("AscentCmdLineTeleportHome", onCommitCmdLine, this); - childSetCommitCallback("AscentCmdLineRezPlatform", onCommitCmdLine, this); - childSetCommitCallback("AscentCmdLineCalc", onCommitCmdLine, this); - childSetCommitCallback("AscentCmdLineClearChat", onCommitCmdLine, this); - childSetCommitCallback("AscentCmdLineDrawDistance", onCommitCmdLine, this); - childSetCommitCallback("AscentCmdTeleportToCam", onCommitCmdLine, this); - childSetCommitCallback("AscentCmdLineKeyToName", onCommitCmdLine, this); - childSetCommitCallback("AscentCmdLineOfferTp", onCommitCmdLine, this); - childSetCommitCallback("AscentCmdLineMapTo", onCommitCmdLine, this); - childSetCommitCallback("AscentCmdLineTP2", onCommitCmdLine, this); - childSetCommitCallback("SinguCmdLineAway", onCommitCmdLine, this); + getChild("chat_cmd_toggle")->setCommitCallback(boost::bind(&LLPrefsAscentSys::onCommitCmdLine, this, _1, _2)); + getChild("AscentCmdLinePos")->setCommitCallback(boost::bind(&LLPrefsAscentSys::onCommitCmdLine, this, _1, _2)); + getChild("AscentCmdLineGround")->setCommitCallback(boost::bind(&LLPrefsAscentSys::onCommitCmdLine, this, _1, _2)); + getChild("AscentCmdLineHeight")->setCommitCallback(boost::bind(&LLPrefsAscentSys::onCommitCmdLine, this, _1, _2)); + getChild("AscentCmdLineTeleportHome")->setCommitCallback(boost::bind(&LLPrefsAscentSys::onCommitCmdLine, this, _1, _2)); + getChild("AscentCmdLineRezPlatform")->setCommitCallback(boost::bind(&LLPrefsAscentSys::onCommitCmdLine, this, _1, _2)); + getChild("AscentCmdLineCalc")->setCommitCallback(boost::bind(&LLPrefsAscentSys::onCommitCmdLine, this, _1, _2)); + getChild("AscentCmdLineClearChat")->setCommitCallback(boost::bind(&LLPrefsAscentSys::onCommitCmdLine, this, _1, _2)); + getChild("AscentCmdLineDrawDistance")->setCommitCallback(boost::bind(&LLPrefsAscentSys::onCommitCmdLine, this, _1, _2)); + getChild("AscentCmdTeleportToCam")->setCommitCallback(boost::bind(&LLPrefsAscentSys::onCommitCmdLine, this, _1, _2)); + getChild("AscentCmdLineKeyToName")->setCommitCallback(boost::bind(&LLPrefsAscentSys::onCommitCmdLine, this, _1, _2)); + getChild("AscentCmdLineOfferTp")->setCommitCallback(boost::bind(&LLPrefsAscentSys::onCommitCmdLine, this, _1, _2)); + getChild("AscentCmdLineMapTo")->setCommitCallback(boost::bind(&LLPrefsAscentSys::onCommitCmdLine, this, _1, _2)); + getChild("AscentCmdLineTP2")->setCommitCallback(boost::bind(&LLPrefsAscentSys::onCommitCmdLine, this, _1, _2)); + getChild("SinguCmdLineAway")->setCommitCallback(boost::bind(&LLPrefsAscentSys::onCommitCmdLine, this, _1, _2)); //Security ---------------------------------------------------------------------------- - childSetCommitCallback("disable_click_sit_check", onCommitCheckBox, this); + getChild("disable_click_sit_check")->setCommitCallback(boost::bind(&LLPrefsAscentSys::onCommitCheckBox, this, _1, _2)); //Build ------------------------------------------------------------------------------- - childSetCommitCallback("next_owner_copy", onCommitCheckBox, this); + getChild("next_owner_copy")->setCommitCallback(boost::bind(&LLPrefsAscentSys::onCommitCheckBox, this, _1, _2)); childSetEnabled("next_owner_transfer", gSavedSettings.getBOOL("NextOwnerCopy")); - childSetCommitCallback("material", onCommitComboBox, this); - childSetCommitCallback("combobox shininess", onCommitComboBox, this); + getChild("material")->setCommitCallback(boost::bind(&LLPrefsAscentSys::onCommitComboBox, this, _1, _2)); + getChild("combobox shininess")->setCommitCallback(boost::bind(&LLPrefsAscentSys::onCommitComboBox, this, _1, _2)); getChild("texture control")->setDefaultImageAssetID(LLUUID(gSavedSettings.getString("EmeraldBuildPrefs_Texture"))); - childSetCommitCallback("texture control", onCommitTexturePicker, this); + getChild("texture control")->setCommitCallback(boost::bind(&LLPrefsAscentSys::onCommitTexturePicker, this, _1)); refreshValues(); refresh(); @@ -95,37 +95,34 @@ LLPrefsAscentSys::~LLPrefsAscentSys() { } -//static -void LLPrefsAscentSys::onCommitCheckBox(LLUICtrl* ctrl, void* user_data) +void LLPrefsAscentSys::onCommitCheckBox(LLUICtrl* ctrl, const LLSD& value) { - LLPrefsAscentSys* self = static_cast(user_data); - // llinfos << "Change to " << ctrl->getControlName() << " aka " << ctrl->getName() << llendl; const std::string name = ctrl->getName(); - bool enabled = ctrl->getValue().asBoolean(); + bool enabled = value.asBoolean(); if (name == "speed_rez_check") { - self->childSetEnabled("speed_rez_interval", enabled); - self->childSetEnabled("speed_rez_seconds", enabled); + childSetEnabled("speed_rez_interval", enabled); + childSetEnabled("speed_rez_seconds", enabled); } else if (name == "double_click_teleport_check") { - self->childSetEnabled("center_after_teleport_check", enabled); - self->childSetEnabled("offset_teleport_check", enabled); + childSetEnabled("center_after_teleport_check", enabled); + childSetEnabled("offset_teleport_check", enabled); } else if (name == "system_folder_check") { - self->childSetEnabled("temp_in_system_check", enabled); + childSetEnabled("temp_in_system_check", enabled); } else if (name == "enable_clouds") { - self->childSetEnabled("enable_classic_clouds", enabled); + childSetEnabled("enable_classic_clouds", enabled); } else if (name == "power_user_check") { - self->childSetEnabled("power_user_confirm_check", enabled); - self->childSetValue("power_user_confirm_check", false); + childSetEnabled("power_user_confirm_check", enabled); + childSetValue("power_user_confirm_check", false); } else if (name == "power_user_confirm_check") { @@ -143,79 +140,65 @@ void LLPrefsAscentSys::onCommitCheckBox(LLUICtrl* ctrl, void* user_data) } else if (name == "disable_click_sit_check") { - self->childSetEnabled("disable_click_sit_own_check", !enabled); + childSetEnabled("disable_click_sit_own_check", !enabled); } else if (name == "next_owner_copy") { if (!enabled) gSavedSettings.setBOOL("NextOwnerTransfer", true); - self->childSetEnabled("next_owner_transfer", enabled); + childSetEnabled("next_owner_transfer", enabled); } } -//static -void LLPrefsAscentSys::onCommitCmdLine(LLUICtrl* ctrl, void* user_data) +void LLPrefsAscentSys::onCommitCmdLine(LLUICtrl* ctrl, const LLSD& value) { - LLPrefsAscentSys* self = (LLPrefsAscentSys*)user_data; - - if (ctrl->getName() == "chat_cmd_toggle") + const std::string& name = ctrl->getName(); + if (name == "chat_cmd_toggle") { - bool enabled = self->childGetValue("chat_cmd_toggle").asBoolean(); - self->childSetEnabled("cmd_line_text_2", enabled); - self->childSetEnabled("cmd_line_text_3", enabled); - self->childSetEnabled("cmd_line_text_4", enabled); - self->childSetEnabled("cmd_line_text_5", enabled); - self->childSetEnabled("cmd_line_text_6", enabled); - self->childSetEnabled("cmd_line_text_7", enabled); - self->childSetEnabled("cmd_line_text_8", enabled); - self->childSetEnabled("cmd_line_text_9", enabled); - self->childSetEnabled("cmd_line_text_10", enabled); - self->childSetEnabled("cmd_line_text_11", enabled); - self->childSetEnabled("cmd_line_text_12", enabled); - self->childSetEnabled("cmd_line_text_13", enabled); - self->childSetEnabled("cmd_line_text_15", enabled); - self->childSetEnabled("AscentCmdLinePos", enabled); - self->childSetEnabled("AscentCmdLineGround", enabled); - self->childSetEnabled("AscentCmdLineHeight", enabled); - self->childSetEnabled("AscentCmdLineTeleportHome", enabled); - self->childSetEnabled("AscentCmdLineRezPlatform", enabled); - self->childSetEnabled("AscentPlatformSize", enabled); - self->childSetEnabled("AscentCmdLineCalc", enabled); - self->childSetEnabled("AscentCmdLineClearChat", enabled); - self->childSetEnabled("AscentCmdLineDrawDistance", enabled); - self->childSetEnabled("AscentCmdTeleportToCam", enabled); - self->childSetEnabled("AscentCmdLineKeyToName", enabled); - self->childSetEnabled("AscentCmdLineOfferTp", enabled); - self->childSetEnabled("AscentCmdLineMapTo", enabled); - self->childSetEnabled("map_to_keep_pos", enabled); - self->childSetEnabled("AscentCmdLineTP2", enabled); - self->childSetEnabled("SinguCmdLineAway", enabled); + bool enabled = value.asBoolean(); + childSetEnabled("cmd_line_text_2", enabled); + childSetEnabled("cmd_line_text_3", enabled); + childSetEnabled("cmd_line_text_4", enabled); + childSetEnabled("cmd_line_text_5", enabled); + childSetEnabled("cmd_line_text_6", enabled); + childSetEnabled("cmd_line_text_7", enabled); + childSetEnabled("cmd_line_text_8", enabled); + childSetEnabled("cmd_line_text_9", enabled); + childSetEnabled("cmd_line_text_10", enabled); + childSetEnabled("cmd_line_text_11", enabled); + childSetEnabled("cmd_line_text_12", enabled); + childSetEnabled("cmd_line_text_13", enabled); + childSetEnabled("cmd_line_text_15", enabled); + childSetEnabled("AscentCmdLinePos", enabled); + childSetEnabled("AscentCmdLineGround", enabled); + childSetEnabled("AscentCmdLineHeight", enabled); + childSetEnabled("AscentCmdLineTeleportHome", enabled); + childSetEnabled("AscentCmdLineRezPlatform", enabled); + childSetEnabled("AscentPlatformSize", enabled); + childSetEnabled("AscentCmdLineCalc", enabled); + childSetEnabled("AscentCmdLineClearChat", enabled); + childSetEnabled("AscentCmdLineDrawDistance", enabled); + childSetEnabled("AscentCmdTeleportToCam", enabled); + childSetEnabled("AscentCmdLineKeyToName", enabled); + childSetEnabled("AscentCmdLineOfferTp", enabled); + childSetEnabled("AscentCmdLineMapTo", enabled); + childSetEnabled("map_to_keep_pos", enabled); + childSetEnabled("AscentCmdLineTP2", enabled); + childSetEnabled("SinguCmdLineAway", enabled); } - - gSavedSettings.setString("AscentCmdLinePos", self->childGetValue("AscentCmdLinePos")); - gSavedSettings.setString("AscentCmdLineGround", self->childGetValue("AscentCmdLineGround")); - gSavedSettings.setString("AscentCmdLineHeight", self->childGetValue("AscentCmdLineHeight")); - gSavedSettings.setString("AscentCmdLineTeleportHome", self->childGetValue("AscentCmdLineTeleportHome")); - gSavedSettings.setString("AscentCmdLineRezPlatform", self->childGetValue("AscentCmdLineRezPlatform")); - gSavedSettings.setString("AscentCmdLineCalc", self->childGetValue("AscentCmdLineCalc")); - gSavedSettings.setString("AscentCmdLineClearChat", self->childGetValue("AscentCmdLineClearChat")); - gSavedSettings.setString("AscentCmdLineDrawDistance", self->childGetValue("AscentCmdLineDrawDistance")); - gSavedSettings.setString("AscentCmdTeleportToCam", self->childGetValue("AscentCmdTeleportToCam")); - gSavedSettings.setString("AscentCmdLineKeyToName", self->childGetValue("AscentCmdLineKeyToName")); - gSavedSettings.setString("AscentCmdLineOfferTp", self->childGetValue("AscentCmdLineOfferTp")); - gSavedSettings.setString("AscentCmdLineMapTo", self->childGetValue("AscentCmdLineMapTo")); - gSavedSettings.setString("AscentCmdLineTP2", self->childGetValue("AscentCmdLineTP2")); - gSavedSettings.setString("SinguCmdLineAway", self->childGetValue("SinguCmdLineAway")); + else + { + gSavedSettings.setString(name, value); // Singu Note: Keep commandline settings using the same name as their settings + } } -void LLPrefsAscentSys::onCommitComboBox(LLUICtrl* ctrl, void* userdata) +void LLPrefsAscentSys::onCommitComboBox(LLUICtrl* ctrl, const LLSD& value) { - LLComboBox* box = (LLComboBox*)ctrl; - if(box) gSavedSettings.setString(box->getControlName(), box->getValue().asString()); + gSavedSettings.setString(ctrl->getControlName(), value.asString()); } -void LLPrefsAscentSys::onCommitTexturePicker(LLUICtrl* ctrl, void* userdata) +void LLPrefsAscentSys::onCommitTexturePicker(LLUICtrl* ctrl) { - LLTextureCtrl* image_ctrl = (LLTextureCtrl*)ctrl; + LLTextureCtrl* image_ctrl = static_cast(ctrl); if(image_ctrl) gSavedSettings.setString("EmeraldBuildPrefs_Texture", image_ctrl->getImageAssetID().asString()); } diff --git a/indra/newview/ascentprefssys.h b/indra/newview/ascentprefssys.h index 2ecacb43e..706c7114e 100644 --- a/indra/newview/ascentprefssys.h +++ b/indra/newview/ascentprefssys.h @@ -47,10 +47,10 @@ public: void refreshValues(); protected: - static void onCommitCheckBox(LLUICtrl* ctrl, void* user_data); - static void onCommitCmdLine(LLUICtrl* ctrl, void* user_data); - static void onCommitComboBox(LLUICtrl* ctrl, void* user_data); - static void onCommitTexturePicker(LLUICtrl* ctrl, void* user_data); + void onCommitCheckBox(LLUICtrl* ctrl, const LLSD& value); + void onCommitCmdLine(LLUICtrl* ctrl, const LLSD& value); + void onCommitComboBox(LLUICtrl* ctrl, const LLSD& value); + void onCommitTexturePicker(LLUICtrl* ctrl); //General ----------------------------------------------------------------------------- BOOL mDoubleClickTeleport; diff --git a/indra/newview/ascentprefsvan.cpp b/indra/newview/ascentprefsvan.cpp index 1423808d1..869b4026a 100644 --- a/indra/newview/ascentprefsvan.cpp +++ b/indra/newview/ascentprefsvan.cpp @@ -59,22 +59,18 @@ LLPrefsAscentVan::LLPrefsAscentVan() childSetVisible("announce_stream_metadata", gAudiop && gAudiop->getStreamingAudioImpl() && gAudiop->getStreamingAudioImpl()->supportsMetaData()); - childSetCommitCallback("tag_spoofing_combobox", onCommitClientTag, this); + getChild("tag_spoofing_combobox")->setCommitCallback(boost::bind(&LLPrefsAscentVan::onCommitClientTag, this, _1)); - childSetCommitCallback("show_my_tag_check", onCommitCheckBox, this); - childSetCommitCallback("show_self_tag_check", onCommitCheckBox, this); - childSetCommitCallback("show_self_tag_color_check", onCommitCheckBox, this); - childSetCommitCallback("customize_own_tag_check", onCommitCheckBox, this); - childSetCommitCallback("show_friend_tag_check", onCommitCheckBox, this); - childSetCommitCallback("use_status_check", onCommitCheckBox, this); + getChild("show_my_tag_check")->setCommitCallback(boost::bind(&LLPrefsAscentVan::onCommitCheckBox, this, _1, _2)); + getChild("show_self_tag_check")->setCommitCallback(boost::bind(&LLPrefsAscentVan::onCommitCheckBox, this, _1, _2)); + getChild("show_self_tag_color_check")->setCommitCallback(boost::bind(&LLPrefsAscentVan::onCommitCheckBox, this, _1, _2)); + getChild("customize_own_tag_check")->setCommitCallback(boost::bind(&LLPrefsAscentVan::onCommitCheckBox, this, _1, _2)); + getChild("show_friend_tag_check")->setCommitCallback(boost::bind(&LLPrefsAscentVan::onCommitCheckBox, this, _1, _2)); + getChild("use_status_check")->setCommitCallback(boost::bind(&LLPrefsAscentVan::onCommitCheckBox, this, _1, _2)); - childSetCommitCallback("custom_tag_label_box", onCommitTextModified, this); + getChild("custom_tag_label_box")->setCommitCallback(boost::bind(&LLPrefsAscentVan::onCommitTextModified, this, _1, _2)); - childSetCommitCallback("X Modifier", onCommitUpdateAvatarOffsets); - childSetCommitCallback("Y Modifier", onCommitUpdateAvatarOffsets); - childSetCommitCallback("Z Modifier", onCommitUpdateAvatarOffsets); - - childSetAction("update_clientdefs", onManualClientUpdate, this); + getChild("update_clientdefs")->setCommitCallback(boost::bind(LLPrefsAscentVan::onManualClientUpdate)); refreshValues(); refresh(); @@ -84,57 +80,40 @@ LLPrefsAscentVan::~LLPrefsAscentVan() { } -//static -void LLPrefsAscentVan::onCommitClientTag(LLUICtrl* ctrl, void* userdata) +void LLPrefsAscentVan::onCommitClientTag(LLUICtrl* ctrl) { std::string client_uuid; U32 client_index; - LLPrefsAscentVan* self = (LLPrefsAscentVan*)userdata; - LLComboBox* combo = (LLComboBox*)ctrl; + LLComboBox* combo = static_cast(ctrl); - if (combo) - { - client_index = combo->getCurrentIndex(); - //Don't rebake if it's not neccesary. - if (client_index != self->mSelectedClient) - { - client_uuid = combo->getSelectedValue().asString(); - gSavedSettings.setString("AscentReportClientUUID", client_uuid); - gSavedSettings.setU32("AscentReportClientIndex", client_index); + client_index = combo->getCurrentIndex(); + //Don't rebake if it's not neccesary. + if (client_index != mSelectedClient) + { + client_uuid = combo->getSelectedValue().asString(); + gSavedSettings.setString("AscentReportClientUUID", client_uuid); + gSavedSettings.setU32("AscentReportClientIndex", client_index); - if (gAgentAvatarp) - { - // Slam pending upload count to "unstick" things - bool slam_for_debug = true; - gAgentAvatarp->forceBakeAllTextures(slam_for_debug); - } - } - } + if (gAgentAvatarp) + { + // Slam pending upload count to "unstick" things + bool slam_for_debug = true; + gAgentAvatarp->forceBakeAllTextures(slam_for_debug); + } + } } -//static -void LLPrefsAscentVan::onCommitUpdateAvatarOffsets(LLUICtrl* ctrl, void* userdata) +void LLPrefsAscentVan::onCommitTextModified(LLUICtrl* ctrl, const LLSD& value) { - //if (!gAgent.getID().isNull()) - //{ - // gAgent.sendAgentSetAppearance(); - //} -} - -//static -void LLPrefsAscentVan::onCommitTextModified(LLUICtrl* ctrl, void* userdata) -{ - LLPrefsAscentVan* self = (LLPrefsAscentVan*)userdata; - if (ctrl->getName() == "custom_tag_label_box") { - gSavedSettings.setString("AscentCustomTagLabel", self->childGetValue("custom_tag_label_box")); + gSavedSettings.setString("AscentCustomTagLabel", value); } } //static -void LLPrefsAscentVan::onManualClientUpdate(void* data) +void LLPrefsAscentVan::onManualClientUpdate() { LLChat chat("Definitions already up-to-date."); chat.mSourceType = CHAT_SOURCE_SYSTEM; @@ -148,33 +127,26 @@ void LLPrefsAscentVan::onManualClientUpdate(void* data) LLFloaterChat::addChat(chat); } -//static -void LLPrefsAscentVan::onCommitCheckBox(LLUICtrl* ctrl, void* user_data) +void LLPrefsAscentVan::onCommitCheckBox(LLUICtrl* ctrl, const LLSD& value) { - LLPrefsAscentVan* self = (LLPrefsAscentVan*)user_data; - // llinfos << "Control named " << ctrl->getControlName() << llendl; if (ctrl->getName() == "use_status_check") { - bool showCustomColors = gSavedSettings.getBOOL("AscentUseStatusColors"); - self->childSetEnabled("friends_color_textbox", showCustomColors); - bool frColors = gSavedSettings.getBOOL("ColorFriendChat"); - self->childSetEnabled("friend_color_swatch", showCustomColors || frColors); - bool eoColors = gSavedSettings.getBOOL("ColorEstateOwnerChat"); - self->childSetEnabled("estate_owner_color_swatch", showCustomColors || eoColors); - bool lindColors = gSavedSettings.getBOOL("ColorLindenChat"); - self->childSetEnabled("linden_color_swatch", showCustomColors || lindColors); - bool muteColors = gSavedSettings.getBOOL("ColorMutedChat"); - self->childSetEnabled("muted_color_swatch", showCustomColors || muteColors); + bool showCustomColors = value.asBoolean(); + childSetEnabled("friends_color_textbox", showCustomColors); + childSetEnabled("friend_color_swatch", showCustomColors || gSavedSettings.getBOOL("ColorFriendChat")); + childSetEnabled("estate_owner_color_swatch", showCustomColors || gSavedSettings.getBOOL("ColorEstateOwnerChat")); + childSetEnabled("linden_color_swatch", showCustomColors || gSavedSettings.getBOOL("ColorLindenChat")); + childSetEnabled("muted_color_swatch", showCustomColors || gSavedSettings.getBOOL("ColorMutedChat")); } else if (ctrl->getName() == "customize_own_tag_check") { - BOOL showCustomOptions = gSavedSettings.getBOOL("AscentUseCustomTag"); - self->childSetEnabled("custom_tag_label_text", showCustomOptions); - self->childSetEnabled("custom_tag_label_box", showCustomOptions); - self->childSetEnabled("custom_tag_color_text", showCustomOptions); - self->childSetEnabled("custom_tag_color_swatch", showCustomOptions); + bool showCustomOptions = value.asBoolean(); + childSetEnabled("custom_tag_label_text", showCustomOptions); + childSetEnabled("custom_tag_label_box", showCustomOptions); + childSetEnabled("custom_tag_color_text", showCustomOptions); + childSetEnabled("custom_tag_color_swatch", showCustomOptions); } } diff --git a/indra/newview/ascentprefsvan.h b/indra/newview/ascentprefsvan.h index a13f1d05f..5ec08c605 100644 --- a/indra/newview/ascentprefsvan.h +++ b/indra/newview/ascentprefsvan.h @@ -47,11 +47,10 @@ public: void refreshValues(); protected: - static void onCommitClientTag(LLUICtrl* ctrl, void* userdata); - static void onCommitUpdateAvatarOffsets(LLUICtrl* ctrl, void* userdata); - static void onCommitCheckBox(LLUICtrl* ctrl, void* user_data); - static void onCommitTextModified(LLUICtrl* ctrl, void* userdata); - static void onManualClientUpdate(void* data); + void onCommitClientTag(LLUICtrl* ctrl); + void onCommitCheckBox(LLUICtrl* ctrl, const LLSD& value); + void onCommitTextModified(LLUICtrl* ctrl, const LLSD& value); + static void onManualClientUpdate(); //Main BOOL mUseAccountSettings; BOOL mShowTPScreen;