From 89315b7e2649015845b7649133a5a19cbba717ac Mon Sep 17 00:00:00 2001 From: McCabe Maxsted Date: Sun, 29 Aug 2010 10:38:03 -0700 Subject: Tidied up the sky/water editors (both use a flyout_button to save now). Still some non-trivial bugs to fix, specifically: #474 and #475. Both have repros --- linden/indra/newview/app_settings/logcontrol.xml | 1 + linden/indra/newview/llfloaterwater.cpp | 118 +++--- linden/indra/newview/llfloaterwater.h | 5 +- linden/indra/newview/llfloaterwindlight.cpp | 116 +++-- linden/indra/newview/llfloaterwindlight.h | 5 +- .../skins/default/xui/en-us/floater_water.xml | 24 +- .../xui/en-us/floater_windlight_options.xml | 466 +++++++++++---------- 7 files changed, 361 insertions(+), 374 deletions(-) diff --git a/linden/indra/newview/app_settings/logcontrol.xml b/linden/indra/newview/app_settings/logcontrol.xml index 4d3288f..4e0b582 100644 --- a/linden/indra/newview/app_settings/logcontrol.xml +++ b/linden/indra/newview/app_settings/logcontrol.xml @@ -77,6 +77,7 @@ + diff --git a/linden/indra/newview/llfloaterwater.cpp b/linden/indra/newview/llfloaterwater.cpp index f08beea..05bc001 100644 --- a/linden/indra/newview/llfloaterwater.cpp +++ b/linden/indra/newview/llfloaterwater.cpp @@ -160,9 +160,8 @@ void LLFloaterWater::initCallbacks(void) { //childSetAction("WaterLoadPreset", onLoadPreset, comboBox); childSetAction("WaterNewPreset", onNewPreset, comboBox); - childSetAction("WaterSavePreset", onSavePreset, comboBox); - childSetAction("WaterSaveNotecard", onSaveNotecard, comboBox); childSetAction("WaterDeletePreset", onDeletePreset, comboBox); + childSetCommitCallback("WaterSavePreset", onSavePreset, this); // wave direction childSetCommitCallback("WaterWave1DirX", onVector2ControlXMoved, ¶m_mgr->mWave1Dir); @@ -623,39 +622,23 @@ void LLFloaterWater::onNewPreset(void* userData) LLNotifications::instance().add("NewWaterPreset", LLSD(), LLSD(), newPromptCallback); } -void LLFloaterWater::onSavePreset(void* userData) -{ - // get the name - LLComboBox* comboBox = sWaterMenu->getChild("WaterPresetsCombo"); - - // don't save the empty name - if(comboBox->getSelectedItemLabel() == "") - { - return; - } - - LLWaterParamManager::instance()->mCurParams.mName = - comboBox->getSelectedItemLabel(); - - // check to see if it's a default and shouldn't be overwritten - std::set::iterator sIt = sDefaultPresets.find( - comboBox->getSelectedItemLabel()); - if(sIt != sDefaultPresets.end() && !gSavedSettings.getBOOL("WaterEditPresets")) - { - LLNotifications::instance().add("WLNoEditDefault"); - return; - } - - LLNotifications::instance().add("WLSavePresetAlert", LLSD(), LLSD(), saveAlertCallback); -} - class KVFloaterWaterNotecardCreatedCallback : public LLInventoryCallback { public: void fire(const LLUUID& inv_item); }; -void LLFloaterWater::onSaveNotecard(void* userData) +void KVFloaterWaterNotecardCreatedCallback::fire(const LLUUID& inv_item) +{ + LLWaterParamManager * param_mgr = LLWaterParamManager::instance(); + param_mgr->setParamSet(param_mgr->mCurParams.mName, param_mgr->mCurParams); + param_mgr->mParamList[param_mgr->mCurParams.mName].mInventoryID = inv_item; + param_mgr->mCurParams.mInventoryID = inv_item; + LL_INFOS("WindLight") << "Created inventory item " << inv_item << LL_ENDL; + param_mgr->savePresetToNotecard(param_mgr->mCurParams.mName); +} + +void LLFloaterWater::onSavePreset(LLUICtrl* ctrl, void* userData) { // get the name LLComboBox* comboBox = sWaterMenu->getChild("WaterPresetsCombo"); @@ -665,47 +648,56 @@ void LLFloaterWater::onSaveNotecard(void* userData) { return; } - - // Check if this is already a notecard. - if(LLWaterParamManager::instance()->mCurParams.mInventoryID.notNull()) + + if (ctrl->getValue().asString() == "save_disk_item") { - LLNotifications::instance().add("KittyWLSaveNotecardAlert", LLSD(), LLSD(), saveNotecardCallback); + LLWaterParamManager::instance()->mCurParams.mName = + comboBox->getSelectedItemLabel(); + + // check to see if it's a default and shouldn't be overwritten + std::set::iterator sIt = sDefaultPresets.find( + comboBox->getSelectedItemLabel()); + if(sIt != sDefaultPresets.end() && !gSavedSettings.getBOOL("WaterEditPresets")) + { + LLNotifications::instance().add("WLNoEditDefault"); + return; + } + + LLNotifications::instance().add("WLSavePresetAlert", LLSD(), LLSD(), saveAlertCallback); } - else - { - // Make sure we have a ".ww" extension. - std::string name = comboBox->getSelectedItemLabel(); - if(name.length() > 2 && name.compare(name.length() - 3, 3, ".ww") != 0) + else if (ctrl->getValue().asString() == "save_inventory_item") + { + // Check if this is already a notecard. + if(LLWaterParamManager::instance()->mCurParams.mInventoryID.notNull()) { - name += ".ww"; + LLNotifications::instance().add("KittyWLSaveNotecardAlert", LLSD(), LLSD(), saveNotecardCallback); + } + else + { + // Make sure we have a ".ww" extension. + std::string name = comboBox->getSelectedItemLabel(); + if(name.length() > 2 && name.compare(name.length() - 3, 3, ".ww") != 0) + { + name += ".ww"; + } + LLPointer cb = new KVFloaterWaterNotecardCreatedCallback(); + // Create a notecard and then save it. + create_inventory_item(gAgent.getID(), + gAgent.getSessionID(), + LLUUID::null, + LLTransactionID::tnull, + name, + "Water settings (Imprudence compatible)", + LLAssetType::AT_NOTECARD, + LLInventoryType::IT_NOTECARD, + NOT_WEARABLE, + PERM_ITEM_UNRESTRICTED, + cb); + } - LLPointer cb = new KVFloaterWaterNotecardCreatedCallback(); - // Create a notecard and then save it. - create_inventory_item(gAgent.getID(), - gAgent.getSessionID(), - LLUUID::null, - LLTransactionID::tnull, - name, - "Water settings (Kitty Viewer compatible)", - LLAssetType::AT_NOTECARD, - LLInventoryType::IT_NOTECARD, - NOT_WEARABLE, - PERM_ITEM_UNRESTRICTED, - cb); - } } -void KVFloaterWaterNotecardCreatedCallback::fire(const LLUUID& inv_item) -{ - LLWaterParamManager * param_mgr = LLWaterParamManager::instance(); - param_mgr->setParamSet(param_mgr->mCurParams.mName, param_mgr->mCurParams); - param_mgr->mParamList[param_mgr->mCurParams.mName].mInventoryID = inv_item; - param_mgr->mCurParams.mInventoryID = inv_item; - LL_INFOS("WindLight") << "Created inventory item " << inv_item << LL_ENDL; - param_mgr->savePresetToNotecard(param_mgr->mCurParams.mName); -} - bool LLFloaterWater::saveNotecardCallback(const LLSD& notification, const LLSD& response) { S32 option = LLNotification::getSelectedOption(notification, response); diff --git a/linden/indra/newview/llfloaterwater.h b/linden/indra/newview/llfloaterwater.h index 0a47627..cd9eb13 100644 --- a/linden/indra/newview/llfloaterwater.h +++ b/linden/indra/newview/llfloaterwater.h @@ -95,10 +95,7 @@ public: static void onNewPreset(void* userData); /// when user hits the save preset button - static void onSavePreset(void* userData); - - /// when user hits the save to inventory button - static void onSaveNotecard(void* userData); + static void onSavePreset(LLUICtrl* ctrl, void* userData); /// prompts a user when overwriting a preset notecard static bool saveNotecardCallback(const LLSD& notification, const LLSD& response); diff --git a/linden/indra/newview/llfloaterwindlight.cpp b/linden/indra/newview/llfloaterwindlight.cpp index 8cdc634..ae94d3a 100644 --- a/linden/indra/newview/llfloaterwindlight.cpp +++ b/linden/indra/newview/llfloaterwindlight.cpp @@ -225,9 +225,8 @@ void LLFloaterWindLight::initCallbacks(void) { //childSetAction("WLLoadPreset", onLoadPreset, comboBox); childSetAction("WLNewPreset", onNewPreset, comboBox); - childSetAction("WLSavePreset", onSavePreset, comboBox); - childSetAction("WLSaveNotecard", onSaveNotecard, comboBox); childSetAction("WLDeletePreset", onDeletePreset, comboBox); + childSetCommitCallback("WLSavePreset", onSavePreset, this); comboBox->setCommitCallback(onChangePresetName); @@ -816,39 +815,23 @@ void LLFloaterWindLight::onNewPreset(void* userData) LLNotifications::instance().add("NewSkyPreset", LLSD(), LLSD(), newPromptCallback); } -void LLFloaterWindLight::onSavePreset(void* userData) -{ - // get the name - LLComboBox* comboBox = sWindLight->getChild( - "WLPresetsCombo"); - - // don't save the empty name - if(comboBox->getSelectedItemLabel() == "") - { - return; - } - - // check to see if it's a default and shouldn't be overwritten - std::set::iterator sIt = sDefaultPresets.find( - comboBox->getSelectedItemLabel()); - if(sIt != sDefaultPresets.end() && !gSavedSettings.getBOOL("SkyEditPresets")) - { - LLNotifications::instance().add("WLNoEditDefault"); - return; - } - - LLWLParamManager::instance()->mCurParams.mName = - comboBox->getSelectedItemLabel(); - - LLNotifications::instance().add("WLSavePresetAlert", LLSD(), LLSD(), saveAlertCallback); -} class KVFloaterWindLightNotecardCreatedCallback : public LLInventoryCallback { public: void fire(const LLUUID& inv_item); }; -void LLFloaterWindLight::onSaveNotecard(void* userData) +void KVFloaterWindLightNotecardCreatedCallback::fire(const LLUUID& inv_item) +{ + LLWLParamManager * param_mgr = LLWLParamManager::instance(); + param_mgr->setParamSet(param_mgr->mCurParams.mName, param_mgr->mCurParams); + param_mgr->mParamList[param_mgr->mCurParams.mName].mInventoryID = inv_item; + param_mgr->mCurParams.mInventoryID = inv_item; + LL_INFOS("WindLight") << "Created inventory item " << inv_item << LL_ENDL; + param_mgr->savePresetToNotecard(param_mgr->mCurParams.mName); +} + +void LLFloaterWindLight::onSavePreset(LLUICtrl* ctrl, void* userData) { // get the name LLComboBox* comboBox = sWindLight->getChild( @@ -859,47 +842,56 @@ void LLFloaterWindLight::onSaveNotecard(void* userData) { return; } - - // Check if this is already a notecard. - if(LLWLParamManager::instance()->mCurParams.mInventoryID.notNull()) + + if (ctrl->getValue().asString() == "save_disk_item") { - LLNotifications::instance().add("KittyWLSaveNotecardAlert", LLSD(), LLSD(), saveNotecardCallback); + // check to see if it's a default and shouldn't be overwritten + std::set::iterator sIt = sDefaultPresets.find( + comboBox->getSelectedItemLabel()); + if(sIt != sDefaultPresets.end() && !gSavedSettings.getBOOL("SkyEditPresets")) + { + LLNotifications::instance().add("WLNoEditDefault"); + return; + } + + LLWLParamManager::instance()->mCurParams.mName = + comboBox->getSelectedItemLabel(); + + LLNotifications::instance().add("WLSavePresetAlert", LLSD(), LLSD(), saveAlertCallback); } - else + else if (ctrl->getValue().asString() == "save_inventory_item") { - // Make sure we have a ".wl" extension. - std::string name = comboBox->getSelectedItemLabel(); - if(name.length() > 2 && name.compare(name.length() - 3, 3, ".wl") != 0) + // Check if this is already a notecard. + if(LLWLParamManager::instance()->mCurParams.mInventoryID.notNull()) { - name += ".wl"; + LLNotifications::instance().add("KittyWLSaveNotecardAlert", LLSD(), LLSD(), saveNotecardCallback); + } + else + { + // Make sure we have a ".wl" extension. + std::string name = comboBox->getSelectedItemLabel(); + if(name.length() > 2 && name.compare(name.length() - 3, 3, ".wl") != 0) + { + name += ".wl"; + } + LLPointer cb = new KVFloaterWindLightNotecardCreatedCallback(); + // Create a notecard and then save it. + create_inventory_item(gAgent.getID(), + gAgent.getSessionID(), + LLUUID::null, + LLTransactionID::tnull, + name, + "WindLight settings (Imprudence compatible)", + LLAssetType::AT_NOTECARD, + LLInventoryType::IT_NOTECARD, + NOT_WEARABLE, + PERM_ITEM_UNRESTRICTED, + cb); + } - LLPointer cb = new KVFloaterWindLightNotecardCreatedCallback(); - // Create a notecard and then save it. - create_inventory_item(gAgent.getID(), - gAgent.getSessionID(), - LLUUID::null, - LLTransactionID::tnull, - name, - "WindLight settings (Kitty Viewer compatible)", - LLAssetType::AT_NOTECARD, - LLInventoryType::IT_NOTECARD, - NOT_WEARABLE, - PERM_ITEM_UNRESTRICTED, - cb); - } } -void KVFloaterWindLightNotecardCreatedCallback::fire(const LLUUID& inv_item) -{ - LLWLParamManager * param_mgr = LLWLParamManager::instance(); - param_mgr->setParamSet(param_mgr->mCurParams.mName, param_mgr->mCurParams); - param_mgr->mParamList[param_mgr->mCurParams.mName].mInventoryID = inv_item; - param_mgr->mCurParams.mInventoryID = inv_item; - LL_INFOS("WindLight") << "Created inventory item " << inv_item << LL_ENDL; - param_mgr->savePresetToNotecard(param_mgr->mCurParams.mName); -} - bool LLFloaterWindLight::saveNotecardCallback(const LLSD& notification, const LLSD& response) { S32 option = LLNotification::getSelectedOption(notification, response); diff --git a/linden/indra/newview/llfloaterwindlight.h b/linden/indra/newview/llfloaterwindlight.h index 9656803..b9e5311 100644 --- a/linden/indra/newview/llfloaterwindlight.h +++ b/linden/indra/newview/llfloaterwindlight.h @@ -92,10 +92,7 @@ public: static void onNewPreset(void* userData); /// when user hits the save to file button - static void onSavePreset(void* userData); - - /// when user hits the save to inventory button - static void onSaveNotecard(void* userData); + static void onSavePreset(LLUICtrl* ctrl, void* userData); /// prompts a user when overwriting a preset notecard static bool saveNotecardCallback(const LLSD& notification, const LLSD& response); diff --git a/linden/indra/newview/skins/default/xui/en-us/floater_water.xml b/linden/indra/newview/skins/default/xui/en-us/floater_water.xml index fd0c131..441ce7b 100644 --- a/linden/indra/newview/skins/default/xui/en-us/floater_water.xml +++ b/linden/indra/newview/skins/default/xui/en-us/floater_water.xml @@ -21,17 +21,21 @@ label="" label_selected="" left_delta="180" image_overlay="arrow_right.tga" mouse_opaque="true" name="next" scale_image="true" width="20" />