From 88de1b28a200cdf53b1e40b99863adf58e20aa48 Mon Sep 17 00:00:00 2001 From: Lirusaito Date: Thu, 3 Jan 2013 13:59:14 -0500 Subject: [PATCH 01/37] Add MoyMiniMapCustomColor swatch to Vanity Preferences. Fixed spacing of MoyMiniMapCustomColor in settings_ascent_coa.xml and removed it from settings_per_account.xml TODO: Make MoyMiniMapCustomColor more flexible. -Added ColorCustomChat checkbox, pref code, and setting commented out. --- .../newview/app_settings/settings_ascent_coa.xml | 16 +++++++++++++++- .../app_settings/settings_per_account.xml | 16 ---------------- indra/newview/ascentprefsvan.cpp | 6 ++++-- indra/newview/ascentprefsvan.h | 2 ++ .../en-us/panel_preferences_ascent_vanity.xml | 2 ++ 5 files changed, 23 insertions(+), 19 deletions(-) diff --git a/indra/newview/app_settings/settings_ascent_coa.xml b/indra/newview/app_settings/settings_ascent_coa.xml index f9cf9e010..2cb809679 100644 --- a/indra/newview/app_settings/settings_ascent_coa.xml +++ b/indra/newview/app_settings/settings_ascent_coa.xml @@ -31,7 +31,7 @@ 1 - MoyMiniMapCustomColor + MoyMiniMapCustomColor Comment Custom minimap color you wish to have. @@ -256,6 +256,20 @@ IsCOA 1 + AscentReportClientUUID Comment diff --git a/indra/newview/app_settings/settings_per_account.xml b/indra/newview/app_settings/settings_per_account.xml index b422fae32..d30cb4343 100644 --- a/indra/newview/app_settings/settings_per_account.xml +++ b/indra/newview/app_settings/settings_per_account.xml @@ -357,22 +357,6 @@ This is an autoresponse! - MoyMiniMapCustomColor - - Comment - Custom minimap color you wish to have. - Persist - 1 - Type - Color4 - Value - - 0.375 - 1.0 - 1.0 - 1.0 - - rkeastInventoryPreviousCount diff --git a/indra/newview/ascentprefsvan.cpp b/indra/newview/ascentprefsvan.cpp index e80be45d3..824566c78 100644 --- a/indra/newview/ascentprefsvan.cpp +++ b/indra/newview/ascentprefsvan.cpp @@ -211,11 +211,12 @@ void LLPrefsAscentVan::refreshValues() mEstateOwnerColor = gSavedSettings.getColor4("AscentEstateOwnerColor"); mLindenColor = gSavedSettings.getColor4("AscentLindenColor"); mMutedColor = gSavedSettings.getColor4("AscentMutedColor"); - //mCustomColor = gSavedSettings.getColor4("MoyMiniMapCustomColor"); + mCustomColor = gSavedSettings.getColor4("MoyMiniMapCustomColor"); mColorFriendChat = gSavedSettings.getBOOL("ColorFriendChat"); mColorEOChat = gSavedSettings.getBOOL("ColorEstateOwnerChat"); mColorLindenChat = gSavedSettings.getBOOL("ColorLindenChat"); mColorMutedChat = gSavedSettings.getBOOL("ColorMutedChat"); +// mColorCustomChat = gSavedSettings.getBOOL("ColorCustomChat"); //Body Dynamics -------------------------------------------------------------------------- mBreastPhysicsToggle = gSavedSettings.getBOOL("EmeraldBreastPhysicsToggle"); @@ -293,11 +294,12 @@ void LLPrefsAscentVan::cancel() gSavedSettings.setColor4("AscentEstateOwnerColor", mEstateOwnerColor); gSavedSettings.setColor4("AscentLindenColor", mLindenColor); gSavedSettings.setColor4("AscentMutedColor", mMutedColor); -// gSavedSettings.setColor4("MoyMiniMapCustomColor", mCustomColor); + gSavedSettings.setColor4("MoyMiniMapCustomColor", mCustomColor); gSavedSettings.setBOOL("ColorFriendChat", mColorFriendChat); gSavedSettings.setBOOL("ColorEstateOwnerChat", mColorEOChat); gSavedSettings.setBOOL("ColorLindenChat", mColorLindenChat); gSavedSettings.setBOOL("ColorMutedChat", mColorMutedChat); +// gSavedSettings.setBOOL("ColorCustomChat", mColorCustomChat); //Body Dynamics -------------------------------------------------------------------------- gSavedSettings.setBOOL("EmeraldBreastPhysicsToggle", mBreastPhysicsToggle); diff --git a/indra/newview/ascentprefsvan.h b/indra/newview/ascentprefsvan.h index 0c84ce432..62600a264 100644 --- a/indra/newview/ascentprefsvan.h +++ b/indra/newview/ascentprefsvan.h @@ -82,10 +82,12 @@ protected: LLColor4 mEstateOwnerColor; LLColor4 mLindenColor; LLColor4 mMutedColor; + LLColor4 mCustomColor; bool mColorFriendChat; bool mColorEOChat; bool mColorLindenChat; bool mColorMutedChat; +// bool mColorCustomChat; //Body Dynamics BOOL mBreastPhysicsToggle; F32 mBoobMass; diff --git a/indra/newview/skins/default/xui/en-us/panel_preferences_ascent_vanity.xml b/indra/newview/skins/default/xui/en-us/panel_preferences_ascent_vanity.xml index bba6be356..0d730c4bb 100644 --- a/indra/newview/skins/default/xui/en-us/panel_preferences_ascent_vanity.xml +++ b/indra/newview/skins/default/xui/en-us/panel_preferences_ascent_vanity.xml @@ -42,11 +42,13 @@ + Use colors for chat: + From c3829485e4b7238636c3dd2541685387abdf3309 Mon Sep 17 00:00:00 2001 From: Lirusaito Date: Thu, 3 Jan 2013 14:08:39 -0500 Subject: [PATCH 02/37] Fixed LLCompileQueue messages via update to v-d in parts. Script resets now output properly~ --- indra/newview/llcompilequeue.cpp | 114 ++++++++++++++----------------- indra/newview/llcompilequeue.h | 18 ++--- indra/newview/llstartup.cpp | 2 +- 3 files changed, 59 insertions(+), 75 deletions(-) diff --git a/indra/newview/llcompilequeue.cpp b/indra/newview/llcompilequeue.cpp index 858c26909..26d3aa0a9 100644 --- a/indra/newview/llcompilequeue.cpp +++ b/indra/newview/llcompilequeue.cpp @@ -55,6 +55,7 @@ #include "llviewerobject.h" #include "llviewerregion.h" #include "llresmgr.h" + #include "llbutton.h" #include "lldir.h" #include "llnotificationsutil.h" @@ -207,8 +208,7 @@ BOOL LLFloaterScriptQueue::start() args["[COUNT]"] = llformat ("%d", mObjectIDs.count()); buffer = getString ("Starting", args); - LLScrollListCtrl* list = getChild("queue output"); - list->setCommentText(buffer); + getChild("queue output")->addSimpleElement(buffer, ADD_BOTTOM); return nextObject(); } @@ -240,12 +240,9 @@ BOOL LLFloaterScriptQueue::nextObject() } while((mObjectIDs.count() > 0) && !successful_start); if(isDone() && !mDone) { - - LLScrollListCtrl* list = getChild("queue output"); - - mDone = TRUE; - list->setCommentText(getString("Done")); - childSetEnabled("close",TRUE); + mDone = true; + getChild("queue output")->addSimpleElement(getString("Done"), ADD_BOTTOM); + getChildView("close")->setEnabled(TRUE); } return successful_start; } @@ -283,6 +280,40 @@ BOOL LLFloaterScriptQueue::popNext() /// Class LLFloaterCompileQueue ///---------------------------------------------------------------------------- +class LLCompileFloaterUploadQueueSupplier : public LLAssetUploadQueueSupplier +{ +public: + + LLCompileFloaterUploadQueueSupplier(const LLUUID& queue_id) : + mQueueId(queue_id) + { + } + + virtual LLAssetUploadQueue* get() const + { + LLFloaterCompileQueue* queue = (LLFloaterCompileQueue*) LLFloaterScriptQueue::findInstance(mQueueId); + if(NULL == queue) + { + return NULL; + } + return queue->getUploadQueue(); + } + + virtual void log(std::string message) const + { + LLFloaterCompileQueue* queue = (LLFloaterCompileQueue*) LLFloaterScriptQueue::findInstance(mQueueId); + if(NULL == queue) + { + return; + } + + queue->getChild("queue output")->addSimpleElement(message, ADD_BOTTOM); + } + +private: + LLUUID mQueueId; +}; + // static LLFloaterCompileQueue* LLFloaterCompileQueue::create(BOOL mono) { @@ -291,48 +322,8 @@ LLFloaterCompileQueue* LLFloaterCompileQueue::create(BOOL mono) LLRect rect = gSavedSettings.getRect("CompileOutputRect"); rect.translate(left - rect.mLeft, top - rect.mTop); LLFloaterCompileQueue* new_queue = new LLFloaterCompileQueue("queue", rect); - - class LLCompileFloaterUploadQueueSupplier : public LLAssetUploadQueueSupplier - { - public: - - LLCompileFloaterUploadQueueSupplier(const LLUUID& queue_id) : - mQueueId(queue_id) - { - } - - virtual LLAssetUploadQueue* get() const - { - LLFloaterCompileQueue* queue = - (LLFloaterCompileQueue*) LLFloaterScriptQueue::findInstance(mQueueId); - - if(NULL == queue) - { - return NULL; - } - - return queue->mUploadQueue; - } - virtual void log(std::string message) const - { - LLFloaterCompileQueue* queue = - (LLFloaterCompileQueue*) LLFloaterScriptQueue::findInstance(mQueueId); - - if(NULL == queue) - { - return; - } - - LLScrollListCtrl* list = queue->getChild("queue output"); - list->setCommentText(message.c_str()); - } - - private: - LLUUID mQueueId; - }; - - new_queue->mUploadQueue = new LLAssetUploadQueue(new LLCompileFloaterUploadQueueSupplier(new_queue->getID())); + new_queue->mUploadQueue = new LLAssetUploadQueue(new LLCompileFloaterUploadQueueSupplier(new_queue->getID())); new_queue->mMono = mono; new_queue->open(); return new_queue; @@ -414,8 +405,8 @@ void LLFloaterCompileQueue::scriptArrived(LLVFS *vfs, const LLUUID& asset_id, llinfos << "LLFloaterCompileQueue::scriptArrived()" << llendl; LLScriptQueueData* data = (LLScriptQueueData*)user_data; if(!data) return; - LLFloaterCompileQueue* queue = static_cast - (LLFloaterScriptQueue::findInstance(data->mQueueID)); + LLFloaterCompileQueue* queue = static_cast (LLFloaterScriptQueue::findInstance(data->mQueueID)); + std::string buffer; if(queue && (0 == status)) { @@ -519,8 +510,7 @@ void LLFloaterCompileQueue::scriptArrived(LLVFS *vfs, const LLUUID& asset_id, } if(queue && (buffer.size() > 0)) { - LLScrollListCtrl* list = queue->getChild("queue output"); - list->setCommentText(buffer); + queue->getChild("queue output")->addSimpleElement(buffer, ADD_BOTTOM); } delete data; } @@ -543,8 +533,7 @@ void LLFloaterCompileQueue::onSaveBytecodeComplete(const LLUUID& asset_id, void* { llinfos << "LLFloaterCompileQueue::onSaveBytecodeComplete()" << llendl; LLCompileQueueData* data = (LLCompileQueueData*)user_data; - LLFloaterCompileQueue* queue = static_cast - (LLFloaterScriptQueue::findInstance(data->mQueueID)); + LLFloaterCompileQueue* queue = static_cast (LLFloaterScriptQueue::findInstance(data->mQueueID)); if(queue && (0 == status) && data) { queue->saveItemByItemID(data->mItemId); @@ -692,7 +681,7 @@ void LLFloaterResetQueue::handleInventory(LLViewerObject* viewer_obj, // find all of the lsl, leaving off duplicates. We'll remove // all matching asset uuids on compilation success. LLDynamicArray names; - + LLInventoryObject::object_list_t::const_iterator it = inv->begin(); LLInventoryObject::object_list_t::const_iterator end = inv->end(); for ( ; it != end; ++it) @@ -704,10 +693,9 @@ void LLFloaterResetQueue::handleInventory(LLViewerObject* viewer_obj, if (object) { LLInventoryItem* item = (LLInventoryItem*)((LLInventoryObject*)(*it)); - LLScrollListCtrl* list = getChild("queue output"); std::string buffer; buffer = getString("Resetting") + LLTrans::getString(":") + " " + item->getName(); - list->setCommentText(buffer); + getChild("queue output")->addSimpleElement(buffer, ADD_BOTTOM); LLMessageSystem* msg = gMessageSystem; msg->newMessageFast(_PREHASH_ScriptReset); msg->nextBlockFast(_PREHASH_AgentData); @@ -754,7 +742,7 @@ void LLFloaterRunQueue::handleInventory(LLViewerObject* viewer_obj, // find all of the lsl, leaving off duplicates. We'll remove // all matching asset uuids on compilation success. LLDynamicArray names; - + LLInventoryObject::object_list_t::const_iterator it = inv->begin(); LLInventoryObject::object_list_t::const_iterator end = inv->end(); for ( ; it != end; ++it) @@ -769,7 +757,7 @@ void LLFloaterRunQueue::handleInventory(LLViewerObject* viewer_obj, LLScrollListCtrl* list = getChild("queue output"); std::string buffer; buffer = getString("Running") + LLTrans::getString(":") + " " + item->getName(); - list->setCommentText(buffer); + list->addSimpleElement(buffer, ADD_BOTTOM); LLMessageSystem* msg = gMessageSystem; msg->newMessageFast(_PREHASH_SetScriptRunning); @@ -818,7 +806,7 @@ void LLFloaterNotRunQueue::handleInventory(LLViewerObject* viewer_obj, // find all of the lsl, leaving off duplicates. We'll remove // all matching asset uuids on compilation success. LLDynamicArray names; - + LLInventoryObject::object_list_t::const_iterator it = inv->begin(); LLInventoryObject::object_list_t::const_iterator end = inv->end(); for ( ; it != end; ++it) @@ -833,8 +821,8 @@ void LLFloaterNotRunQueue::handleInventory(LLViewerObject* viewer_obj, LLScrollListCtrl* list = getChild("queue output"); std::string buffer; buffer = getString("NotRunning") + LLTrans::getString(":") + " " + item->getName(); - list->setCommentText(buffer); - + list->addSimpleElement(buffer, ADD_BOTTOM); + LLMessageSystem* msg = gMessageSystem; msg->newMessageFast(_PREHASH_SetScriptRunning); msg->nextBlockFast(_PREHASH_AgentData); diff --git a/indra/newview/llcompilequeue.h b/indra/newview/llcompilequeue.h index e4bccff52..ee49ac574 100644 --- a/indra/newview/llcompilequeue.h +++ b/indra/newview/llcompilequeue.h @@ -79,7 +79,7 @@ protected: LLInventoryObject::object_list_t* inv, S32 serial_num, void* queue); - + // This is called by inventoryChanged virtual void handleInventory(LLViewerObject* viewer_obj, LLInventoryObject::object_list_t* inv) = 0; @@ -105,7 +105,7 @@ protected: // Object Queue LLDynamicArray mObjectIDs; LLUUID mCurrentObjectID; - BOOL mDone; + bool mDone; LLUUID mID; static LLMap sInstances; @@ -143,6 +143,8 @@ public: // remove any object in mScriptScripts with the matching uuid. void removeItemByItemID(const LLUUID& item_id); + LLAssetUploadQueue* getUploadQueue() { return mUploadQueue; } + protected: LLFloaterCompileQueue(const std::string& name, const LLRect& rect); virtual ~LLFloaterCompileQueue(); @@ -200,12 +202,10 @@ public: protected: LLFloaterResetQueue(const std::string& name, const LLRect& rect); virtual ~LLFloaterResetQueue(); - + // This is called by inventoryChanged virtual void handleInventory(LLViewerObject* viewer_obj, - LLInventoryObject::object_list_t* inv); - -protected: + LLInventoryObject::object_list_t* inv); }; //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -224,12 +224,10 @@ public: protected: LLFloaterRunQueue(const std::string& name, const LLRect& rect); virtual ~LLFloaterRunQueue(); - + // This is called by inventoryChanged virtual void handleInventory(LLViewerObject* viewer_obj, LLInventoryObject::object_list_t* inv); - -protected: }; //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -252,8 +250,6 @@ protected: // This is called by inventoryChanged virtual void handleInventory(LLViewerObject* viewer_obj, LLInventoryObject::object_list_t* inv); - -protected: }; #endif // LL_LLCOMPILEQUEUE_H diff --git a/indra/newview/llstartup.cpp b/indra/newview/llstartup.cpp index 6d1e2d92c..1c5b2cacd 100644 --- a/indra/newview/llstartup.cpp +++ b/indra/newview/llstartup.cpp @@ -1076,7 +1076,7 @@ bool idle_startup() gSavedSettings.getControl("_NACL_AntiSpamAmount")->getSignal()->connect(boost::bind(&NACLAntiSpamRegistry::handleNaclAntiSpamAmountChanged, _2)); // NaCl End - //good as place as any to create user windlight directories + //good a place as any to create user windlight directories std::string user_windlight_path_name(gDirUtilp->getExpandedFilename( LL_PATH_USER_SETTINGS , "windlight", "")); LLFile::mkdir(user_windlight_path_name.c_str()); From 9498375e75569cb12342d567baa469b992538eeb Mon Sep 17 00:00:00 2001 From: Lirusaito Date: Thu, 3 Jan 2013 17:20:57 -0500 Subject: [PATCH 03/37] Update LLFloaterSettingsDebug to match up with v-d. Adds boost::bind and makes the floater a singleton. --- indra/newview/llfloatersettingsdebug.cpp | 135 +++++++----------- indra/newview/llfloatersettingsdebug.h | 15 +- indra/newview/llviewermenu.cpp | 4 +- .../xui/en-us/floater_settings_debug.xml | 2 +- 4 files changed, 63 insertions(+), 93 deletions(-) diff --git a/indra/newview/llfloatersettingsdebug.cpp b/indra/newview/llfloatersettingsdebug.cpp index 2d7ce1da4..c7330e3d2 100644 --- a/indra/newview/llfloatersettingsdebug.cpp +++ b/indra/newview/llfloatersettingsdebug.cpp @@ -34,27 +34,25 @@ #include "llfloatersettingsdebug.h" #include "llfloater.h" #include "lluictrlfactory.h" -#include "llfirstuse.h" +//#include "llfirstuse.h" #include "llcombobox.h" #include "llspinctrl.h" #include "llcolorswatch.h" #include "llviewercontrol.h" +#include "lltexteditor.h" // [RLVa:KB] #include "rlvhandler.h" #include "rlvextensions.h" // [/RLVa:KB] -LLFloaterSettingsDebug* LLFloaterSettingsDebug::sInstance = NULL; - -LLFloaterSettingsDebug::LLFloaterSettingsDebug() : LLFloater(std::string("Configuration Editor")) +LLFloaterSettingsDebug::LLFloaterSettingsDebug() +: LLFloater(std::string("Configuration Editor")) { } LLFloaterSettingsDebug::~LLFloaterSettingsDebug() -{ - sInstance = NULL; -} +{} BOOL LLFloaterSettingsDebug::postBuild() { @@ -78,25 +76,17 @@ BOOL LLFloaterSettingsDebug::postBuild() gColors.applyToAll(&func); settings_combo->sortByName(); - settings_combo->setCommitCallback(onSettingSelect); - settings_combo->setCallbackUserData(this); + settings_combo->setCommitCallback(boost::bind(&LLFloaterSettingsDebug::onSettingSelect, this, settings_combo)); settings_combo->updateSelection(); - childSetCommitCallback("val_spinner_1", onCommitSettings); - childSetUserData("val_spinner_1", this); - childSetCommitCallback("val_spinner_2", onCommitSettings); - childSetUserData("val_spinner_2", this); - childSetCommitCallback("val_spinner_3", onCommitSettings); - childSetUserData("val_spinner_3", this); - childSetCommitCallback("val_spinner_4", onCommitSettings); - childSetUserData("val_spinner_4", this); - childSetCommitCallback("val_text", onCommitSettings); - childSetUserData("val_text", this); - childSetCommitCallback("boolean_combo", onCommitSettings); - childSetUserData("boolean_combo", this); - childSetCommitCallback("color_swatch", onCommitSettings); - childSetUserData("color_swatch", this); - childSetAction("default_btn", onClickDefault, this); + getChild("val_spinner_1")->setCommitCallback(boost::bind(&LLFloaterSettingsDebug::onCommitSettings, this)); + getChild("val_spinner_2")->setCommitCallback(boost::bind(&LLFloaterSettingsDebug::onCommitSettings, this)); + getChild("val_spinner_3")->setCommitCallback(boost::bind(&LLFloaterSettingsDebug::onCommitSettings, this)); + getChild("val_spinner_4")->setCommitCallback(boost::bind(&LLFloaterSettingsDebug::onCommitSettings, this)); + getChild("val_text")->setCommitCallback(boost::bind(&LLFloaterSettingsDebug::onCommitSettings, this)); + getChild("boolean_combo")->setCommitCallback(boost::bind(&LLFloaterSettingsDebug::onCommitSettings, this)); + getChild("color_swatch")->setCommitCallback(boost::bind(&LLFloaterSettingsDebug::onCommitSettings, this)); + getChild("default_btn")->setCommitCallback(boost::bind(&LLFloaterSettingsDebug::onClickDefault, this)); mComment = getChild("comment_text"); return TRUE; } @@ -110,35 +100,17 @@ void LLFloaterSettingsDebug::draw() LLFloater::draw(); } -//static -void LLFloaterSettingsDebug::show(void*) +void LLFloaterSettingsDebug::onSettingSelect(LLUICtrl* ctrl) { - if (sInstance == NULL) - { - sInstance = new LLFloaterSettingsDebug(); - - LLUICtrlFactory::getInstance()->buildFloater(sInstance, "floater_settings_debug.xml"); - } - - sInstance->open(); /* Flawfinder: ignore */ -} - -//static -void LLFloaterSettingsDebug::onSettingSelect(LLUICtrl* ctrl, void* user_data) -{ - LLFloaterSettingsDebug* floaterp = (LLFloaterSettingsDebug*)user_data; LLComboBox* combo_box = static_cast(ctrl); LLControlVariable* controlp = static_cast(combo_box->getCurrentUserdata()); - floaterp->updateControl(controlp ? controlp->getCOAActive() : NULL); + updateControl(controlp ? controlp->getCOAActive() : NULL); } -//static -void LLFloaterSettingsDebug::onCommitSettings(LLUICtrl* ctrl, void* user_data) +void LLFloaterSettingsDebug::onCommitSettings() { - LLFloaterSettingsDebug* floaterp = (LLFloaterSettingsDebug*)user_data; - - LLComboBox* settings_combo = floaterp->getChild("settings_combo"); + LLComboBox* settings_combo = getChild("settings_combo"); LLControlVariable* controlp = static_cast(settings_combo->getCurrentUserdata()); controlp = controlp ? controlp->getCOAActive() : NULL; if(!controlp)//Uh oh! @@ -155,55 +127,55 @@ void LLFloaterSettingsDebug::onCommitSettings(LLUICtrl* ctrl, void* user_data) switch(controlp->type()) { case TYPE_U32: - controlp->set(floaterp->childGetValue("val_spinner_1")); + controlp->set(getChild("val_spinner_1")->getValue()); break; case TYPE_S32: - controlp->set(floaterp->childGetValue("val_spinner_1")); + controlp->set(getChild("val_spinner_1")->getValue()); break; case TYPE_F32: - controlp->set(LLSD(floaterp->childGetValue("val_spinner_1").asReal())); + controlp->set(LLSD(getChild("val_spinner_1")->getValue().asReal())); break; case TYPE_BOOLEAN: - controlp->set(floaterp->childGetValue("boolean_combo")); + controlp->set(getChild("boolean_combo")->getValue()); break; case TYPE_STRING: - controlp->set(LLSD(floaterp->childGetValue("val_text").asString())); + controlp->set(LLSD(getChild("val_text")->getValue().asString())); break; case TYPE_VEC3: - vector.mV[VX] = (F32)floaterp->childGetValue("val_spinner_1").asReal(); - vector.mV[VY] = (F32)floaterp->childGetValue("val_spinner_2").asReal(); - vector.mV[VZ] = (F32)floaterp->childGetValue("val_spinner_3").asReal(); + vector.mV[VX] = (F32)getChild("val_spinner_1")->getValue().asReal(); + vector.mV[VY] = (F32)getChild("val_spinner_2")->getValue().asReal(); + vector.mV[VZ] = (F32)getChild("val_spinner_3")->getValue().asReal(); controlp->set(vector.getValue()); break; case TYPE_VEC3D: - vectord.mdV[VX] = floaterp->childGetValue("val_spinner_1").asReal(); - vectord.mdV[VY] = floaterp->childGetValue("val_spinner_2").asReal(); - vectord.mdV[VZ] = floaterp->childGetValue("val_spinner_3").asReal(); + vectord.mdV[VX] = getChild("val_spinner_1")->getValue().asReal(); + vectord.mdV[VY] = getChild("val_spinner_2")->getValue().asReal(); + vectord.mdV[VZ] = getChild("val_spinner_3")->getValue().asReal(); controlp->set(vectord.getValue()); break; case TYPE_RECT: - rect.mLeft = floaterp->childGetValue("val_spinner_1").asInteger(); - rect.mRight = floaterp->childGetValue("val_spinner_2").asInteger(); - rect.mBottom = floaterp->childGetValue("val_spinner_3").asInteger(); - rect.mTop = floaterp->childGetValue("val_spinner_4").asInteger(); + rect.mLeft = getChild("val_spinner_1")->getValue().asInteger(); + rect.mRight = getChild("val_spinner_2")->getValue().asInteger(); + rect.mBottom = getChild("val_spinner_3")->getValue().asInteger(); + rect.mTop = getChild("val_spinner_4")->getValue().asInteger(); controlp->set(rect.getValue()); break; case TYPE_COL4: - col3.setValue(floaterp->childGetValue("color_swatch")); - col4 = LLColor4(col3, (F32)floaterp->childGetValue("val_spinner_4").asReal()); + col3.setValue(getChild("val_color_swatch")->getValue()); + col4 = LLColor4(col3, (F32)getChild("val_spinner_4")->getValue().asReal()); controlp->set(col4.getValue()); break; case TYPE_COL3: - controlp->set(floaterp->childGetValue("color_swatch")); - //col3.mV[VRED] = (F32)floaterp->childGetValue("val_spinner_1").asC(); - //col3.mV[VGREEN] = (F32)floaterp->childGetValue("val_spinner_2").asReal(); - //col3.mV[VBLUE] = (F32)floaterp->childGetValue("val_spinner_3").asReal(); + controlp->set(getChild("val_color_swatch")->getValue()); + //col3.mV[VRED] = (F32)floaterp->getChild("val_spinner_1")->getValue().asC(); + //col3.mV[VGREEN] = (F32)floaterp->getChild("val_spinner_2")->getValue().asReal(); + //col3.mV[VBLUE] = (F32)floaterp->getChild("val_spinner_3")->getValue().asReal(); //controlp->set(col3.getValue()); break; case TYPE_COL4U: - col3.setValue(floaterp->childGetValue("color_swatch")); + col3.setValue(getChild("val_color_swatch")->getValue()); col4U.setVecScaleClamp(col3); - col4U.mV[VALPHA] = floaterp->childGetValue("val_spinner_4").asInteger(); + col4U.mV[VALPHA] = getChild("val_spinner_4")->getValue().asInteger(); controlp->set(col4U.getValue()); break; default: @@ -212,17 +184,16 @@ void LLFloaterSettingsDebug::onCommitSettings(LLUICtrl* ctrl, void* user_data) } // static -void LLFloaterSettingsDebug::onClickDefault(void* user_data) +void LLFloaterSettingsDebug::onClickDefault() { - LLFloaterSettingsDebug* floaterp = (LLFloaterSettingsDebug*)user_data; - LLComboBox* settings_combo = floaterp->getChild("settings_combo"); + LLComboBox* settings_combo = getChild("settings_combo"); LLControlVariable* controlp = (LLControlVariable*)settings_combo->getCurrentUserdata(); if (controlp) { controlp = controlp->getCOAActive(); controlp->resetToDefault(true); - floaterp->updateControl(controlp); + updateControl(controlp); } } @@ -233,7 +204,7 @@ void LLFloaterSettingsDebug::updateControl(LLControlVariable* controlp) LLSpinCtrl* spinner2 = getChild("val_spinner_2"); LLSpinCtrl* spinner3 = getChild("val_spinner_3"); LLSpinCtrl* spinner4 = getChild("val_spinner_4"); - LLColorSwatchCtrl* color_swatch = getChild("color_swatch"); + LLColorSwatchCtrl* color_swatch = getChild("val_color_swatch"); if (!spinner1 || !spinner2 || !spinner3 || !spinner4 || !color_swatch) { @@ -247,7 +218,7 @@ void LLFloaterSettingsDebug::updateControl(LLControlVariable* controlp) spinner3->setVisible(FALSE); spinner4->setVisible(FALSE); color_swatch->setVisible(FALSE); - childSetVisible("val_text", FALSE); + getChildView("val_text")->setVisible( FALSE); mComment->setText(LLStringUtil::null); if (controlp) @@ -282,7 +253,7 @@ void LLFloaterSettingsDebug::updateControl(LLControlVariable* controlp) eControlType type = controlp->type(); //hide combo box only for non booleans, otherwise this will result in the combo box closing every frame - childSetVisible("boolean_combo", type == TYPE_BOOLEAN); + getChildView("boolean_combo")->setVisible(type == TYPE_BOOLEAN); mComment->setText(controlp->getComment()); @@ -348,23 +319,23 @@ void LLFloaterSettingsDebug::updateControl(LLControlVariable* controlp) } break; case TYPE_BOOLEAN: - if (!childHasFocus("boolean_combo")) + if (!getChild("boolean_combo")->hasFocus()) { if (sd.asBoolean()) { - childSetValue("boolean_combo", LLSD("true")); + getChild("boolean_combo")->setValue(LLSD("true")); } else { - childSetValue("boolean_combo", LLSD("")); + getChild("boolean_combo")->setValue(LLSD("")); } } break; case TYPE_STRING: - childSetVisible("val_text", TRUE); - if (!childHasFocus("val_text")) + getChildView("val_text")->setVisible( TRUE); + if (!getChild("val_text")->hasFocus()) { - childSetValue("val_text", sd); + getChild("val_text")->setValue(sd); } break; case TYPE_VEC3: diff --git a/indra/newview/llfloatersettingsdebug.h b/indra/newview/llfloatersettingsdebug.h index e08e6b5d7..334399caa 100644 --- a/indra/newview/llfloatersettingsdebug.h +++ b/indra/newview/llfloatersettingsdebug.h @@ -35,9 +35,10 @@ #include "llcontrol.h" #include "llfloater.h" -#include "lltexteditor.h" -class LLFloaterSettingsDebug : public LLFloater +class LLFloaterSettingsDebug +: public LLFloater +, public LLSingleton { public: LLFloaterSettingsDebug(); @@ -48,14 +49,12 @@ public: void updateControl(LLControlVariable* control); - static void show(void*); - static void onSettingSelect(LLUICtrl* ctrl, void* user_data); - static void onCommitSettings(LLUICtrl* ctrl, void* user_data); - static void onClickDefault(void* user_data); + void onSettingSelect(LLUICtrl* ctrl); + void onCommitSettings(); + void onClickDefault(); protected: - static LLFloaterSettingsDebug* sInstance; - LLTextEditor* mComment; + class LLTextEditor* mComment; }; #endif //LLFLOATERDEBUGSETTINGS_H diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp index c8fa64f01..7781f8a82 100644 --- a/indra/newview/llviewermenu.cpp +++ b/indra/newview/llviewermenu.cpp @@ -880,7 +880,7 @@ void init_menus() menu = new LLMenuGL(CLIENT_MENU_NAME); menu->setCanTearOff(FALSE); - menu->addChild(new LLMenuItemCallGL("Debug Settings...", LLFloaterSettingsDebug::show, NULL, NULL)); + menu->addChild(new LLMenuItemCallGL("Debug Settings...", handle_singleton_toggle, NULL, NULL)); gLoginMenuBarView->addChild(menu); menu->updateParent(LLMenuGL::sMenuContainer); @@ -1223,7 +1223,7 @@ void init_client_menu(LLMenuGL* menu) &menu_check_control, (void*)"SaveMinidump")); - menu->addChild(new LLMenuItemCallGL("Debug Settings...", LLFloaterSettingsDebug::show, NULL, NULL)); + menu->addChild(new LLMenuItemCallGL("Debug Settings...", handle_singleton_toggle, NULL, NULL)); menu->addChild(new LLMenuItemCheckGL("View Admin Options", &handle_admin_override_toggle, NULL, &check_admin_override, NULL, 'V', MASK_CONTROL | MASK_ALT)); menu->addChild(new LLMenuItemCallGL("Request Admin Status", diff --git a/indra/newview/skins/default/xui/en-us/floater_settings_debug.xml b/indra/newview/skins/default/xui/en-us/floater_settings_debug.xml index a8c0840a1..6875e35fb 100644 --- a/indra/newview/skins/default/xui/en-us/floater_settings_debug.xml +++ b/indra/newview/skins/default/xui/en-us/floater_settings_debug.xml @@ -17,7 +17,7 @@ + name="val_color_swatch" visible="true" width="37" /> Date: Sat, 5 Jan 2013 01:43:17 -0500 Subject: [PATCH 04/37] Zi Ree's Debug Setting Floater awesomeness (Search!!) Made to work with Singularity, and also be a bit better.. Alphabetizes includes. Switches settings combobox to a scrolllist, and Boolean combobox to a radiogroup. Makes floater resizable, aligns a lot of the UI, and prepares it all for proper resize behavior. Adds Copy button for copying the name of the debug setting. Yay, verbosity! Also adds FloaterDebugSettingsRect to keep track of the floater's size. Also somehow the getInstance line snuck out of last commit... tossed it in here. --- indra/newview/app_settings/settings.xml | 16 ++ indra/newview/llfloatersettingsdebug.cpp | 265 ++++++++++++------ indra/newview/llfloatersettingsdebug.h | 29 +- .../xui/en-us/floater_settings_debug.xml | 44 +-- 4 files changed, 236 insertions(+), 118 deletions(-) diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index 423207776..33c8d0f0f 100644 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -6178,6 +6178,22 @@ This should be as low as possible, but too low may break functionality 0 + FloaterDebugSettingsRect + + Comment + Rectangle for the Debug Settings floater + Persist + 1 + Type + Rect + Value + + 0 + 300 + 245 + 0 + + FloaterEnvRect Comment diff --git a/indra/newview/llfloatersettingsdebug.cpp b/indra/newview/llfloatersettingsdebug.cpp index c7330e3d2..45b2c5c45 100644 --- a/indra/newview/llfloatersettingsdebug.cpp +++ b/indra/newview/llfloatersettingsdebug.cpp @@ -31,15 +31,18 @@ */ #include "llviewerprecompiledheaders.h" + #include "llfloatersettingsdebug.h" -#include "llfloater.h" -#include "lluictrlfactory.h" -//#include "llfirstuse.h" -#include "llcombobox.h" -#include "llspinctrl.h" + #include "llcolorswatch.h" -#include "llviewercontrol.h" +//#include "llfirstuse.h" +#include "llfloater.h" +#include "llscrolllistctrl.h" +#include "llspinctrl.h" #include "lltexteditor.h" +#include "lluictrlfactory.h" +#include "llviewercontrol.h" +#include "llwindow.h" // [RLVa:KB] #include "rlvhandler.h" @@ -48,36 +51,53 @@ LLFloaterSettingsDebug::LLFloaterSettingsDebug() : LLFloater(std::string("Configuration Editor")) +, mCurrentControlVariable(NULL) +, mOldControlVariable(NULL) +, mOldSearchTerm(std::string("---")) { + LLUICtrlFactory::getInstance()->buildFloater(this, "floater_settings_debug.xml"); } LLFloaterSettingsDebug::~LLFloaterSettingsDebug() -{} +{ + if (mOldControlVariable) + mOldControlVariable->getCommitSignal()->disconnect(boost::bind(&LLFloaterSettingsDebug::onSettingSelect, this)); +} BOOL LLFloaterSettingsDebug::postBuild() { - LLComboBox* settings_combo = getChild("settings_combo"); + mSettingsScrollList = getChild("settings_scroll_list"); struct f : public LLControlGroup::ApplyFunctor { - LLComboBox* combo; - f(LLComboBox* c) : combo(c) {} + settings_map_t* map; + f(settings_map_t* m) : map(m) {} virtual void apply(const std::string& name, LLControlVariable* control) { if (!control->isHiddenFromSettingsEditor()) { - combo->add(name, (void*)control); + (*map)[name]=control; } } - } func(settings_combo); + } func(&mSettingsMap); gSavedSettings.applyToAll(&func); gSavedPerAccountSettings.applyToAll(&func); gColors.applyToAll(&func); - settings_combo->sortByName(); - settings_combo->setCommitCallback(boost::bind(&LLFloaterSettingsDebug::onSettingSelect, this, settings_combo)); - settings_combo->updateSelection(); + // Populate the list + { + for(settings_map_t::iterator it = mSettingsMap.begin(); it != mSettingsMap.end(); it++) + { + LLSD item; + item["columns"][0]["value"] = it->second->getName(); + mSettingsScrollList->addElement(item, ADD_BOTTOM, it->second); + } + } + mSettingsScrollList->sortByColumnIndex(0, true); + mSettingsScrollList->setCommitCallback(boost::bind(&LLFloaterSettingsDebug::onSettingSelect, this)); + + llinfos << mSettingsScrollList->getItemCount() << " total debug settings displayed." << llendl; getChild("val_spinner_1")->setCommitCallback(boost::bind(&LLFloaterSettingsDebug::onCommitSettings, this)); getChild("val_spinner_2")->setCommitCallback(boost::bind(&LLFloaterSettingsDebug::onCommitSettings, this)); @@ -86,34 +106,54 @@ BOOL LLFloaterSettingsDebug::postBuild() getChild("val_text")->setCommitCallback(boost::bind(&LLFloaterSettingsDebug::onCommitSettings, this)); getChild("boolean_combo")->setCommitCallback(boost::bind(&LLFloaterSettingsDebug::onCommitSettings, this)); getChild("color_swatch")->setCommitCallback(boost::bind(&LLFloaterSettingsDebug::onCommitSettings, this)); + getChild("copy_btn")->setCommitCallback(boost::bind(&LLFloaterSettingsDebug::onCopyToClipboard, this)); getChild("default_btn")->setCommitCallback(boost::bind(&LLFloaterSettingsDebug::onClickDefault, this)); + getChild("search_settings_input")->setSearchCallback(onUpdateFilter, this); mComment = getChild("comment_text"); return TRUE; } void LLFloaterSettingsDebug::draw() { - LLComboBox* settings_combo = getChild("settings_combo"); - LLControlVariable* controlp = static_cast(settings_combo->getCurrentUserdata()); - updateControl(controlp ? controlp->getCOAActive() : NULL); + // check for changes in control visibility, like RLVa does + if(mCurrentControlVariable && mCurrentControlVariable->isHiddenFromSettingsEditor() != mOldVisibility) + updateControl(); LLFloater::draw(); } -void LLFloaterSettingsDebug::onSettingSelect(LLUICtrl* ctrl) +LLControlVariable* LLFloaterSettingsDebug::getControlVariable() { - LLComboBox* combo_box = static_cast(ctrl); - LLControlVariable* controlp = static_cast(combo_box->getCurrentUserdata()); + LLScrollListItem* item = mSettingsScrollList->getFirstSelected(); + if (!item) return NULL; - updateControl(controlp ? controlp->getCOAActive() : NULL); + LLControlVariable* controlp = static_cast(item->getUserdata()); + + return controlp ? controlp->getCOAActive() : NULL; +} + +void LLFloaterSettingsDebug::onSettingSelect() +{ + mCurrentControlVariable = getControlVariable(); + + if (mOldControlVariable == mCurrentControlVariable) return; + + // unbind change control signal from previously selected control + if(mOldControlVariable) + mOldControlVariable->getCommitSignal()->disconnect(boost::bind(&LLFloaterSettingsDebug::onSettingSelect, this)); + + // bind change control signal, so we can see updates to the current control in realtime + if(mCurrentControlVariable) + mCurrentControlVariable->getCommitSignal()->connect(boost::bind(&LLFloaterSettingsDebug::onSettingSelect, this)); + + mOldControlVariable = mCurrentControlVariable; + + updateControl(); } void LLFloaterSettingsDebug::onCommitSettings() { - LLComboBox* settings_combo = getChild("settings_combo"); - LLControlVariable* controlp = static_cast(settings_combo->getCurrentUserdata()); - controlp = controlp ? controlp->getCOAActive() : NULL; - if(!controlp)//Uh oh! + if (!mCurrentControlVariable) return; LLVector3 vector; @@ -124,87 +164,89 @@ void LLFloaterSettingsDebug::onCommitSettings() LLColor4U col4U; LLColor4 color_with_alpha; - switch(controlp->type()) + switch(mCurrentControlVariable->type()) { case TYPE_U32: - controlp->set(getChild("val_spinner_1")->getValue()); + mCurrentControlVariable->set(getChild("val_spinner_1")->getValue()); break; case TYPE_S32: - controlp->set(getChild("val_spinner_1")->getValue()); + mCurrentControlVariable->set(getChild("val_spinner_1")->getValue()); break; case TYPE_F32: - controlp->set(LLSD(getChild("val_spinner_1")->getValue().asReal())); + mCurrentControlVariable->set(LLSD(getChild("val_spinner_1")->getValue().asReal())); break; case TYPE_BOOLEAN: - controlp->set(getChild("boolean_combo")->getValue()); + mCurrentControlVariable->set(getChild("boolean_combo")->getValue()); break; case TYPE_STRING: - controlp->set(LLSD(getChild("val_text")->getValue().asString())); + mCurrentControlVariable->set(LLSD(getChild("val_text")->getValue().asString())); break; case TYPE_VEC3: vector.mV[VX] = (F32)getChild("val_spinner_1")->getValue().asReal(); vector.mV[VY] = (F32)getChild("val_spinner_2")->getValue().asReal(); vector.mV[VZ] = (F32)getChild("val_spinner_3")->getValue().asReal(); - controlp->set(vector.getValue()); + mCurrentControlVariable->set(vector.getValue()); break; case TYPE_VEC3D: vectord.mdV[VX] = getChild("val_spinner_1")->getValue().asReal(); vectord.mdV[VY] = getChild("val_spinner_2")->getValue().asReal(); vectord.mdV[VZ] = getChild("val_spinner_3")->getValue().asReal(); - controlp->set(vectord.getValue()); + mCurrentControlVariable->set(vectord.getValue()); break; case TYPE_RECT: rect.mLeft = getChild("val_spinner_1")->getValue().asInteger(); rect.mRight = getChild("val_spinner_2")->getValue().asInteger(); rect.mBottom = getChild("val_spinner_3")->getValue().asInteger(); rect.mTop = getChild("val_spinner_4")->getValue().asInteger(); - controlp->set(rect.getValue()); + mCurrentControlVariable->set(rect.getValue()); break; case TYPE_COL4: col3.setValue(getChild("val_color_swatch")->getValue()); col4 = LLColor4(col3, (F32)getChild("val_spinner_4")->getValue().asReal()); - controlp->set(col4.getValue()); + mCurrentControlVariable->set(col4.getValue()); break; case TYPE_COL3: - controlp->set(getChild("val_color_swatch")->getValue()); - //col3.mV[VRED] = (F32)floaterp->getChild("val_spinner_1")->getValue().asC(); - //col3.mV[VGREEN] = (F32)floaterp->getChild("val_spinner_2")->getValue().asReal(); - //col3.mV[VBLUE] = (F32)floaterp->getChild("val_spinner_3")->getValue().asReal(); - //controlp->set(col3.getValue()); + mCurrentControlVariable->set(getChild("val_color_swatch")->getValue()); + //col3.mV[VRED] = (F32)getChild("val_spinner_1")->getValue().asC(); + //col3.mV[VGREEN] = (F32)getChild("val_spinner_2")->getValue().asReal(); + //col3.mV[VBLUE] = (F32)getChild("val_spinner_3")->getValue().asReal(); + //mCurrentControlVariable->set(col3.getValue()); break; case TYPE_COL4U: col3.setValue(getChild("val_color_swatch")->getValue()); col4U.setVecScaleClamp(col3); col4U.mV[VALPHA] = getChild("val_spinner_4")->getValue().asInteger(); - controlp->set(col4U.getValue()); + mCurrentControlVariable->set(col4U.getValue()); break; default: break; } } -// static void LLFloaterSettingsDebug::onClickDefault() { - LLComboBox* settings_combo = getChild("settings_combo"); - LLControlVariable* controlp = (LLControlVariable*)settings_combo->getCurrentUserdata(); - - if (controlp) + if (mCurrentControlVariable) { - controlp = controlp->getCOAActive(); - controlp->resetToDefault(true); - updateControl(controlp); + mCurrentControlVariable->resetToDefault(true); + updateControl(); } } -// we've switched controls, or doing per-frame update, so update spinners, etc. -void LLFloaterSettingsDebug::updateControl(LLControlVariable* controlp) +void LLFloaterSettingsDebug::onCopyToClipboard() +{ + if (mCurrentControlVariable) + getWindow()->copyTextToClipboard(utf8str_to_wstring(mCurrentControlVariable->getName())); +} + +// we've switched controls, so update spinners, etc. +void LLFloaterSettingsDebug::updateControl() { LLSpinCtrl* spinner1 = getChild("val_spinner_1"); LLSpinCtrl* spinner2 = getChild("val_spinner_2"); LLSpinCtrl* spinner3 = getChild("val_spinner_3"); LLSpinCtrl* spinner4 = getChild("val_spinner_4"); LLColorSwatchCtrl* color_swatch = getChild("val_color_swatch"); + LLUICtrl* bool_ctrl = getChild("boolean_combo"); if (!spinner1 || !spinner2 || !spinner3 || !spinner4 || !color_swatch) { @@ -220,43 +262,31 @@ void LLFloaterSettingsDebug::updateControl(LLControlVariable* controlp) color_swatch->setVisible(FALSE); getChildView("val_text")->setVisible( FALSE); mComment->setText(LLStringUtil::null); + childSetEnabled("copy_btn", false); + childSetEnabled("default_btn", false); + bool_ctrl->setVisible(false); - if (controlp) + if (mCurrentControlVariable) { -// [RLVa:KB] - Checked: 2009-07-10 (RLVa-1.0.0g) | Modified: RLVa-0.2.1d - if (rlv_handler_t::isEnabled()) - { - // Don't allow changing DBG_WRITE debug settings under @setdebug=n - bool fEnable = !( (gRlvHandler.hasBehaviour(RLV_BHVR_SETDEBUG)) && - (RlvExtGetSet::getDebugSettingFlags(controlp->getName()) & RlvExtGetSet::DBG_WRITE) ); - // Don't allow toggling "Basic Shaders" and/or "Atmopsheric Shaders" through the debug settings under @setenv=n - fEnable &= !((gRlvHandler.hasBehaviour(RLV_BHVR_SETENV)) && - (("VertexShaderEnable" == controlp->getName()) || ("WindLightUseAtmosShaders" == controlp->getName()))); - #ifdef RLV_EXTENSION_STARTLOCATION - // Don't allow toggling RLVaLoginLastLocation - fEnable &= !(RLV_SETTING_LOGINLASTLOCATION == controlp->getName()); - #endif // RLV_EXTENSION_STARTLOCATION - - // NOTE: this runs per-frame so there's no need to explictly handle onCommitSettings() or onClickDefault() - spinner1->setEnabled(fEnable); - spinner2->setEnabled(fEnable); - spinner3->setEnabled(fEnable); - spinner4->setEnabled(fEnable); - color_swatch->setEnabled(fEnable); - childSetEnabled("val_text", fEnable); - childSetEnabled("boolean_combo", fEnable); - childSetEnabled("default_btn", fEnable); - } +// [RLVa:KB] - Checked: 2011-05-28 (RLVa-1.4.0a) | Modified: RLVa-1.4.0a + // If "HideFromEditor" was toggled while the floater is open then we need to manually disable access to the control + mOldVisibility = mCurrentControlVariable->isHiddenFromSettingsEditor(); + spinner1->setEnabled(!mOldVisibility); + spinner2->setEnabled(!mOldVisibility); + spinner3->setEnabled(!mOldVisibility); + spinner4->setEnabled(!mOldVisibility); + color_swatch->setEnabled(!mOldVisibility); + childSetEnabled("val_text", !mOldVisibility); + bool_ctrl->setEnabled(!mOldVisibility); + childSetEnabled("default_btn", !mOldVisibility); // [/RLVa:KB] - controlp = controlp->getCOAActive(); - eControlType type = controlp->type(); + childSetEnabled("copy_btn", true); - //hide combo box only for non booleans, otherwise this will result in the combo box closing every frame - getChildView("boolean_combo")->setVisible(type == TYPE_BOOLEAN); - + eControlType type = mCurrentControlVariable->type(); + + mComment->setText(mCurrentControlVariable->getName() + std::string(": ") + mCurrentControlVariable->getComment()); - mComment->setText(controlp->getComment()); spinner1->setMaxValue(F32_MAX); spinner2->setMaxValue(F32_MAX); spinner3->setMaxValue(F32_MAX); @@ -282,7 +312,7 @@ void LLFloaterSettingsDebug::updateControl(LLControlVariable* controlp) spinner4->setIncrement(0.1f); } - LLSD sd = controlp->get(); + LLSD sd = mCurrentControlVariable->get(); switch(type) { case TYPE_U32: @@ -319,16 +349,10 @@ void LLFloaterSettingsDebug::updateControl(LLControlVariable* controlp) } break; case TYPE_BOOLEAN: - if (!getChild("boolean_combo")->hasFocus()) + bool_ctrl->setVisible(true); + if (!bool_ctrl->hasFocus()) { - if (sd.asBoolean()) - { - getChild("boolean_combo")->setValue(LLSD("true")); - } - else - { - getChild("boolean_combo")->setValue(LLSD("")); - } + bool_ctrl->setValue(sd.asInteger()); } break; case TYPE_STRING: @@ -501,3 +525,58 @@ void LLFloaterSettingsDebug::updateControl(LLControlVariable* controlp) } } + +void LLFloaterSettingsDebug::onUpdateFilter(const std::string& searchTerm, void*) +{ + LLFloaterSettingsDebug::getInstance()->updateFilter(searchTerm); +} + +void LLFloaterSettingsDebug::updateFilter(std::string searchTerm) +{ + // make sure not to reselect the first item in the list on focus restore + if (searchTerm == mOldSearchTerm) return; + + mOldSearchTerm = searchTerm; + + LLStringUtil::toLower(searchTerm); + + mSettingsScrollList->deleteAllItems(); + + for(settings_map_t::iterator it = mSettingsMap.begin(); it != mSettingsMap.end(); it++) + { + bool addItem = searchTerm.empty(); + if (!addItem) + { + std::string itemValue = it->second->getName(); + + LLStringUtil::toLower(itemValue); + + if (itemValue.find(searchTerm, 0) != std::string::npos) + { + addItem = true; + } + else // performance: broken out to save toLower calls on comments + { + std::string itemComment = it->second->getComment(); + LLStringUtil::toLower(itemComment); + if (itemComment.find(searchTerm, 0) != std::string::npos) + addItem = true; + } + } + + if (addItem) + { + LLSD item; + item["columns"][0]["value"] = it->second->getName(); + mSettingsScrollList->addElement(item, ADD_BOTTOM, it->second); + } + } + mSettingsScrollList->sortByColumnIndex(0, true); + + // if at least one match was found, highlight and select the topmost entry in the list + // but only if actually a search term was given + if (mSettingsScrollList->getItemCount() && !searchTerm.empty()) + mSettingsScrollList->selectFirstItem(); + + onSettingSelect(); +} diff --git a/indra/newview/llfloatersettingsdebug.h b/indra/newview/llfloatersettingsdebug.h index 334399caa..cce8fa481 100644 --- a/indra/newview/llfloatersettingsdebug.h +++ b/indra/newview/llfloatersettingsdebug.h @@ -36,6 +36,9 @@ #include "llcontrol.h" #include "llfloater.h" +class LLScrollListCtrl; +class LLTextEditor; + class LLFloaterSettingsDebug : public LLFloater , public LLSingleton @@ -47,15 +50,33 @@ public: virtual BOOL postBuild(); virtual void draw(); - void updateControl(LLControlVariable* control); + void updateControl(); - void onSettingSelect(LLUICtrl* ctrl); + // updates control filter to display in the controls list on keystroke + static void onUpdateFilter(const std::string& searchTerm, void*); + void updateFilter(std::string searchTerm); + + void onSettingSelect(); void onCommitSettings(); void onClickDefault(); + void onCopyToClipboard(); + +private: + // returns a pointer to the currently selected control variable, or NULL + LLControlVariable* getControlVariable(); protected: - class LLTextEditor* mComment; + typedef std::map settings_map_t; + + settings_map_t mSettingsMap; + + std::string mOldSearchTerm; + LLControlVariable* mCurrentControlVariable; + LLControlVariable* mOldControlVariable; + bool mOldVisibility; + + LLScrollListCtrl* mSettingsScrollList; + LLTextEditor* mComment; }; #endif //LLFLOATERDEBUGSETTINGS_H - diff --git a/indra/newview/skins/default/xui/en-us/floater_settings_debug.xml b/indra/newview/skins/default/xui/en-us/floater_settings_debug.xml index 6875e35fb..61cf756e8 100644 --- a/indra/newview/skins/default/xui/en-us/floater_settings_debug.xml +++ b/indra/newview/skins/default/xui/en-us/floater_settings_debug.xml @@ -1,31 +1,33 @@ - - + + + - - - TRUE - - - FALSE - - - + + True + + + False + + + - + - - - -