Merge branch 'master' into meshupload

This commit is contained in:
Drake Arconis
2013-01-08 14:37:25 -05:00
15 changed files with 343 additions and 203 deletions

View File

@@ -111,10 +111,10 @@ template<typename T> struct AIAccess;
template<typename T> struct AISTAccessConst; template<typename T> struct AISTAccessConst;
template<typename T> struct AISTAccess; template<typename T> struct AISTAccess;
// This helper class is needed because offsetof is only allowed on POD types.
template<typename T> template<typename T>
class AIThreadSafeBits struct AIThreadSafeBitsPOD
{ {
private:
// AIThreadSafe is a wrapper around an instance of T. // AIThreadSafe is a wrapper around an instance of T.
// Because T might not have a default constructor, it is constructed // Because T might not have a default constructor, it is constructed
// 'in place', with placement new, in the memory reserved here. // 'in place', with placement new, in the memory reserved here.
@@ -122,7 +122,11 @@ private:
// Make sure that the memory that T will be placed in is properly // Make sure that the memory that T will be placed in is properly
// aligned by using an array of long's. // aligned by using an array of long's.
long mMemory[(sizeof(T) + sizeof(long) - 1) / sizeof(long)]; long mMemory[(sizeof(T) + sizeof(long) - 1) / sizeof(long)];
};
template<typename T>
class AIThreadSafeBits : private AIThreadSafeBitsPOD<T>
{
public: public:
// The wrapped objects are constructed in-place with placement new *outside* // The wrapped objects are constructed in-place with placement new *outside*
// of this object (by AITHREADSAFE macro(s) or derived classes). // of this object (by AITHREADSAFE macro(s) or derived classes).
@@ -130,20 +134,20 @@ public:
~AIThreadSafeBits() { ptr()->~T(); } ~AIThreadSafeBits() { ptr()->~T(); }
// Only for use by AITHREADSAFE, see below. // Only for use by AITHREADSAFE, see below.
void* memory() const { return const_cast<long*>(&mMemory[0]); } void* memory() const { return const_cast<long*>(&AIThreadSafeBitsPOD<T>::mMemory[0]); }
// Cast a T* back to AIThreadSafeBits<T>. This is the inverse of memory(). // Cast a T* back to AIThreadSafeBits<T>. This is the inverse of memory().
template<typename T2> template<typename T2>
static AIThreadSafeBits<T2>* wrapper_cast(T2* ptr) static AIThreadSafeBits<T2>* wrapper_cast(T2* ptr)
{ return reinterpret_cast<AIThreadSafeBits<T2>*>(reinterpret_cast<char*>(ptr) - offsetof(AIThreadSafeBits<T2>, mMemory[0])); } { return static_cast<AIThreadSafeBits<T2>*>(reinterpret_cast<AIThreadSafeBitsPOD<T2>*>(reinterpret_cast<char*>(ptr) - offsetof(AIThreadSafeBitsPOD<T2>, mMemory[0]))); }
template<typename T2> template<typename T2>
static AIThreadSafeBits<T2> const* wrapper_cast(T2 const* ptr) static AIThreadSafeBits<T2> const* wrapper_cast(T2 const* ptr)
{ return reinterpret_cast<AIThreadSafeBits<T2> const*>(reinterpret_cast<char const*>(ptr) - offsetof(AIThreadSafeBits<T2>, mMemory[0])); } { return static_cast<AIThreadSafeBits<T2> const*>(reinterpret_cast<AIThreadSafeBitsPOD<T2> const*>(reinterpret_cast<char const*>(ptr) - offsetof(AIThreadSafeBitsPOD<T2>, mMemory[0]))); }
protected: protected:
// Accessors. // Accessors.
T const* ptr() const { return reinterpret_cast<T const*>(mMemory); } T const* ptr() const { return reinterpret_cast<T const*>(AIThreadSafeBitsPOD<T>::mMemory); }
T* ptr() { return reinterpret_cast<T*>(mMemory); } T* ptr() { return reinterpret_cast<T*>(AIThreadSafeBitsPOD<T>::mMemory); }
}; };
/** /**

View File

@@ -124,6 +124,25 @@ const int LL_ERR_PRICE_MISMATCH = -23018;
#define llverify(func) do {if (func) {}} while(0) #define llverify(func) do {if (func) {}} while(0)
#endif #endif
// This can be used for function parameters that are only used by llassert.
// The ellipsis is needed in case the parameter contains comma's (ie, as part of the type,
// or trailing comma). The first version can be used as first (or only) parameter of a function,
// or as parameter in the middle when adding a trailing comma, while the second version can be
// used as last parameter.
//
// Example usage:
//
// void foo(ASSERT_ONLY(int x));
// void foo(x, ASSERT_ONLY(int y,) int z);
// void foo(x/*,*/ ASSERT_ONLY_COMMA(int y)); // The optional /*,*/ makes it just a bit better readable.
#ifdef SHOW_ASSERT
#define ASSERT_ONLY(type_param,...) type_param,##__VA_ARGS__
#define ASSERT_ONLY_COMMA(type_param,...) , type_param,##__VA_ARGS__
#else
#define ASSERT_ONLY(type_param,...)
#define ASSERT_ONLY_COMMA(type_param,...)
#endif
// handy compile-time assert - enforce those template parameters! // handy compile-time assert - enforce those template parameters!
#define cassert(expn) typedef char __C_ASSERT__[(expn)?1:-1] /* Flawfinder: ignore */ #define cassert(expn) typedef char __C_ASSERT__[(expn)?1:-1] /* Flawfinder: ignore */
//XXX: used in two places in llcommon/llskipmap.h //XXX: used in two places in llcommon/llskipmap.h

View File

@@ -39,7 +39,7 @@
#include <hash_map> #include <hash_map>
#include <algorithm> #include <algorithm>
#elif LL_DARWIN || LL_LINUX #elif LL_DARWIN || LL_LINUX
#if GCC_VERSION >= 40300 || LL_ICC// gcc 4.3 or icc 11 and up #if GCC_VERSION >= 40300 || LL_ICC || LL_CLANG// gcc 4.3 or icc 11 and up
# include <backward/hashtable.h> # include <backward/hashtable.h>
#elif GCC_VERSION >= 30400 // gcc 3.4 and up #elif GCC_VERSION >= 30400 // gcc 3.4 and up
# include <ext/hashtable.h> # include <ext/hashtable.h>

View File

@@ -794,7 +794,7 @@ private:
LLPI_SET_INFO_INT(eModel, "model"); LLPI_SET_INFO_INT(eModel, "model");
S32 family; S32 family = 0;
if (!cpuinfo["cpu family"].empty() if (!cpuinfo["cpu family"].empty()
&& LLStringUtil::convertToS32(cpuinfo["cpu family"], family)) && LLStringUtil::convertToS32(cpuinfo["cpu family"], family))
{ {

View File

@@ -33,7 +33,7 @@
#ifndef LL_LLTHREAD_H #ifndef LL_LLTHREAD_H
#define LL_LLTHREAD_H #define LL_LLTHREAD_H
#if (defined(__GNUC__) && !defined(__clang__)) #ifdef __GNUC__
// Needed for is_main_thread() when compiling with optimization (relwithdebinfo). // Needed for is_main_thread() when compiling with optimization (relwithdebinfo).
// It doesn't hurt to just always specify it though. // It doesn't hurt to just always specify it though.
#pragma interface #pragma interface

View File

@@ -290,7 +290,7 @@ enum refresh_t {
class CurlSocketInfo class CurlSocketInfo
{ {
public: public:
CurlSocketInfo(MultiHandle& multi_handle, CURL* easy, curl_socket_t s, int action, ThreadSafeBufferedCurlEasyRequest* lockobj); CurlSocketInfo(MultiHandle& multi_handle, ASSERT_ONLY(CURL* easy,) curl_socket_t s, int action, ThreadSafeBufferedCurlEasyRequest* lockobj);
~CurlSocketInfo(); ~CurlSocketInfo();
void set_action(int action); void set_action(int action);
@@ -300,7 +300,6 @@ class CurlSocketInfo
private: private:
MultiHandle& mMultiHandle; MultiHandle& mMultiHandle;
CURL const* mEasy;
curl_socket_t mSocketFd; curl_socket_t mSocketFd;
int mAction; int mAction;
bool mDead; bool mDead;
@@ -669,12 +668,10 @@ class MergeIterator
private: private:
PollSet* mReadPollSet; PollSet* mReadPollSet;
PollSet* mWritePollSet; PollSet* mWritePollSet;
int readIndx;
int writeIndx;
}; };
MergeIterator::MergeIterator(PollSet* readPollSet, PollSet* writePollSet) : MergeIterator::MergeIterator(PollSet* readPollSet, PollSet* writePollSet) :
mReadPollSet(readPollSet), mWritePollSet(writePollSet), readIndx(0), writeIndx(0) mReadPollSet(readPollSet), mWritePollSet(writePollSet)
{ {
mReadPollSet->reset(); mReadPollSet->reset();
mWritePollSet->reset(); mWritePollSet->reset();
@@ -766,8 +763,8 @@ std::ostream& operator<<(std::ostream& os, DebugFdSet const& s)
} }
#endif #endif
CurlSocketInfo::CurlSocketInfo(MultiHandle& multi_handle, CURL* easy, curl_socket_t s, int action, ThreadSafeBufferedCurlEasyRequest* lockobj) : CurlSocketInfo::CurlSocketInfo(MultiHandle& multi_handle, ASSERT_ONLY(CURL* easy,) curl_socket_t s, int action, ThreadSafeBufferedCurlEasyRequest* lockobj) :
mMultiHandle(multi_handle), mEasy(easy), mSocketFd(s), mAction(CURL_POLL_NONE), mDead(false), mEasyRequest(lockobj) mMultiHandle(multi_handle), mSocketFd(s), mAction(CURL_POLL_NONE), mDead(false), mEasyRequest(lockobj)
{ {
llassert(*AICurlEasyRequest_wat(*mEasyRequest) == easy); llassert(*AICurlEasyRequest_wat(*mEasyRequest) == easy);
mMultiHandle.assign(s, this); mMultiHandle.assign(s, this);

View File

@@ -174,7 +174,7 @@ bool AIHTTPReceivedHeaders::equal(std::string const& key1, std::string const& ke
} }
for (std::string::const_iterator i1 = key1.begin(), i2 = key2.begin(); i1 != key1.end(); ++i1, ++i2) for (std::string::const_iterator i1 = key1.begin(), i2 = key2.begin(); i1 != key1.end(); ++i1, ++i2)
{ {
if ((*i1 ^ *i2) & 0xdf != 0) if (((*i1 ^ *i2) & 0xdf) != 0)
{ {
return false; return false;
} }

View File

@@ -780,7 +780,7 @@ Found in Advanced->Rendering->Info Displays</string>
<key>Type</key> <key>Type</key>
<string>Boolean</string> <string>Boolean</string>
<key>Value</key> <key>Value</key>
<integer>0</integer> <integer>1</integer>
</map> </map>
<key>MarketImporterUpdateFreq</key> <key>MarketImporterUpdateFreq</key>
<map> <map>
@@ -6189,6 +6189,22 @@ This should be as low as possible, but too low may break functionality</string>
<integer>0</integer> <integer>0</integer>
</array> </array>
</map> </map>
<key>FloaterDebugSettingsRect</key>
<map>
<key>Comment</key>
<string>Rectangle for the Debug Settings floater</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
<string>Rect</string>
<key>Value</key>
<array>
<integer>0</integer>
<integer>300</integer>
<integer>245</integer>
<integer>0</integer>
</array>
</map>
<key>FloaterEnvRect</key> <key>FloaterEnvRect</key>
<map> <map>
<key>Comment</key> <key>Comment</key>

View File

@@ -31,117 +31,129 @@
*/ */
#include "llviewerprecompiledheaders.h" #include "llviewerprecompiledheaders.h"
#include "llfloatersettingsdebug.h" #include "llfloatersettingsdebug.h"
#include "llfloater.h"
#include "lluictrlfactory.h"
#include "llfirstuse.h"
#include "llcombobox.h"
#include "llspinctrl.h"
#include "llcolorswatch.h" #include "llcolorswatch.h"
//#include "llfirstuse.h"
#include "llfloater.h"
#include "llscrolllistctrl.h"
#include "llspinctrl.h"
#include "lltexteditor.h"
#include "lluictrlfactory.h"
#include "llviewercontrol.h" #include "llviewercontrol.h"
#include "llwindow.h"
// [RLVa:KB] // [RLVa:KB]
#include "rlvhandler.h" #include "rlvhandler.h"
#include "rlvextensions.h" #include "rlvextensions.h"
// [/RLVa:KB] // [/RLVa:KB]
LLFloaterSettingsDebug* LLFloaterSettingsDebug::sInstance = NULL; LLFloaterSettingsDebug::LLFloaterSettingsDebug()
: LLFloater(std::string("Configuration Editor"))
LLFloaterSettingsDebug::LLFloaterSettingsDebug() : LLFloater(std::string("Configuration Editor")) , mCurrentControlVariable(NULL)
, mOldControlVariable(NULL)
, mOldSearchTerm(std::string("---"))
{ {
LLUICtrlFactory::getInstance()->buildFloater(this, "floater_settings_debug.xml");
} }
LLFloaterSettingsDebug::~LLFloaterSettingsDebug() LLFloaterSettingsDebug::~LLFloaterSettingsDebug()
{ {
sInstance = NULL; if (mOldControlVariable)
mOldControlVariable->getCommitSignal()->disconnect(boost::bind(&LLFloaterSettingsDebug::onSettingSelect, this));
} }
BOOL LLFloaterSettingsDebug::postBuild() BOOL LLFloaterSettingsDebug::postBuild()
{ {
LLComboBox* settings_combo = getChild<LLComboBox>("settings_combo"); mSettingsScrollList = getChild<LLScrollListCtrl>("settings_scroll_list");
struct f : public LLControlGroup::ApplyFunctor struct f : public LLControlGroup::ApplyFunctor
{ {
LLComboBox* combo; settings_map_t* map;
f(LLComboBox* c) : combo(c) {} f(settings_map_t* m) : map(m) {}
virtual void apply(const std::string& name, LLControlVariable* control) virtual void apply(const std::string& name, LLControlVariable* control)
{ {
if (!control->isHiddenFromSettingsEditor()) if (!control->isHiddenFromSettingsEditor())
{ {
combo->add(name, (void*)control); (*map)[name]=control;
} }
} }
} func(settings_combo); } func(&mSettingsMap);
gSavedSettings.applyToAll(&func); gSavedSettings.applyToAll(&func);
gSavedPerAccountSettings.applyToAll(&func); gSavedPerAccountSettings.applyToAll(&func);
gColors.applyToAll(&func); gColors.applyToAll(&func);
settings_combo->sortByName(); // Populate the list
settings_combo->setCommitCallback(onSettingSelect); {
settings_combo->setCallbackUserData(this); for(settings_map_t::iterator it = mSettingsMap.begin(); it != mSettingsMap.end(); it++)
settings_combo->updateSelection(); {
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));
childSetCommitCallback("val_spinner_1", onCommitSettings); llinfos << mSettingsScrollList->getItemCount() << " total debug settings displayed." << llendl;
childSetUserData("val_spinner_1", this);
childSetCommitCallback("val_spinner_2", onCommitSettings); getChild<LLUICtrl>("val_spinner_1")->setCommitCallback(boost::bind(&LLFloaterSettingsDebug::onCommitSettings, this));
childSetUserData("val_spinner_2", this); getChild<LLUICtrl>("val_spinner_2")->setCommitCallback(boost::bind(&LLFloaterSettingsDebug::onCommitSettings, this));
childSetCommitCallback("val_spinner_3", onCommitSettings); getChild<LLUICtrl>("val_spinner_3")->setCommitCallback(boost::bind(&LLFloaterSettingsDebug::onCommitSettings, this));
childSetUserData("val_spinner_3", this); getChild<LLUICtrl>("val_spinner_4")->setCommitCallback(boost::bind(&LLFloaterSettingsDebug::onCommitSettings, this));
childSetCommitCallback("val_spinner_4", onCommitSettings); getChild<LLUICtrl>("val_text")->setCommitCallback(boost::bind(&LLFloaterSettingsDebug::onCommitSettings, this));
childSetUserData("val_spinner_4", this); getChild<LLUICtrl>("boolean_combo")->setCommitCallback(boost::bind(&LLFloaterSettingsDebug::onCommitSettings, this));
childSetCommitCallback("val_text", onCommitSettings); getChild<LLUICtrl>("color_swatch")->setCommitCallback(boost::bind(&LLFloaterSettingsDebug::onCommitSettings, this));
childSetUserData("val_text", this); getChild<LLUICtrl>("copy_btn")->setCommitCallback(boost::bind(&LLFloaterSettingsDebug::onCopyToClipboard, this));
childSetCommitCallback("boolean_combo", onCommitSettings); getChild<LLUICtrl>("default_btn")->setCommitCallback(boost::bind(&LLFloaterSettingsDebug::onClickDefault, this));
childSetUserData("boolean_combo", this); getChild<LLSearchEditor>("search_settings_input")->setSearchCallback(onUpdateFilter, this);
childSetCommitCallback("color_swatch", onCommitSettings);
childSetUserData("color_swatch", this);
childSetAction("default_btn", onClickDefault, this);
mComment = getChild<LLTextEditor>("comment_text"); mComment = getChild<LLTextEditor>("comment_text");
return TRUE; return TRUE;
} }
void LLFloaterSettingsDebug::draw() void LLFloaterSettingsDebug::draw()
{ {
LLComboBox* settings_combo = getChild<LLComboBox>("settings_combo"); // check for changes in control visibility, like RLVa does
LLControlVariable* controlp = static_cast<LLControlVariable*>(settings_combo->getCurrentUserdata()); if(mCurrentControlVariable && mCurrentControlVariable->isHiddenFromSettingsEditor() != mOldVisibility)
updateControl(controlp ? controlp->getCOAActive() : NULL); updateControl();
LLFloater::draw(); LLFloater::draw();
} }
//static LLControlVariable* LLFloaterSettingsDebug::getControlVariable()
void LLFloaterSettingsDebug::show(void*)
{ {
if (sInstance == NULL) LLScrollListItem* item = mSettingsScrollList->getFirstSelected();
{ if (!item) return NULL;
sInstance = new LLFloaterSettingsDebug();
LLUICtrlFactory::getInstance()->buildFloater(sInstance, "floater_settings_debug.xml"); LLControlVariable* controlp = static_cast<LLControlVariable*>(item->getUserdata());
}
sInstance->open(); /* Flawfinder: ignore */ return controlp ? controlp->getCOAActive() : NULL;
} }
//static void LLFloaterSettingsDebug::onSettingSelect()
void LLFloaterSettingsDebug::onSettingSelect(LLUICtrl* ctrl, void* user_data)
{ {
LLFloaterSettingsDebug* floaterp = (LLFloaterSettingsDebug*)user_data; mCurrentControlVariable = getControlVariable();
LLComboBox* combo_box = static_cast<LLComboBox*>(ctrl);
LLControlVariable* controlp = static_cast<LLControlVariable*>(combo_box->getCurrentUserdata());
floaterp->updateControl(controlp ? controlp->getCOAActive() : NULL); 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();
} }
//static void LLFloaterSettingsDebug::onCommitSettings()
void LLFloaterSettingsDebug::onCommitSettings(LLUICtrl* ctrl, void* user_data)
{ {
LLFloaterSettingsDebug* floaterp = (LLFloaterSettingsDebug*)user_data; if (!mCurrentControlVariable)
LLComboBox* settings_combo = floaterp->getChild<LLComboBox>("settings_combo");
LLControlVariable* controlp = static_cast<LLControlVariable*>(settings_combo->getCurrentUserdata());
controlp = controlp ? controlp->getCOAActive() : NULL;
if(!controlp)//Uh oh!
return; return;
LLVector3 vector; LLVector3 vector;
@@ -152,88 +164,89 @@ void LLFloaterSettingsDebug::onCommitSettings(LLUICtrl* ctrl, void* user_data)
LLColor4U col4U; LLColor4U col4U;
LLColor4 color_with_alpha; LLColor4 color_with_alpha;
switch(controlp->type()) switch(mCurrentControlVariable->type())
{ {
case TYPE_U32: case TYPE_U32:
controlp->set(floaterp->childGetValue("val_spinner_1")); mCurrentControlVariable->set(getChild<LLUICtrl>("val_spinner_1")->getValue());
break; break;
case TYPE_S32: case TYPE_S32:
controlp->set(floaterp->childGetValue("val_spinner_1")); mCurrentControlVariable->set(getChild<LLUICtrl>("val_spinner_1")->getValue());
break; break;
case TYPE_F32: case TYPE_F32:
controlp->set(LLSD(floaterp->childGetValue("val_spinner_1").asReal())); mCurrentControlVariable->set(LLSD(getChild<LLUICtrl>("val_spinner_1")->getValue().asReal()));
break; break;
case TYPE_BOOLEAN: case TYPE_BOOLEAN:
controlp->set(floaterp->childGetValue("boolean_combo")); mCurrentControlVariable->set(getChild<LLUICtrl>("boolean_combo")->getValue());
break; break;
case TYPE_STRING: case TYPE_STRING:
controlp->set(LLSD(floaterp->childGetValue("val_text").asString())); mCurrentControlVariable->set(LLSD(getChild<LLUICtrl>("val_text")->getValue().asString()));
break; break;
case TYPE_VEC3: case TYPE_VEC3:
vector.mV[VX] = (F32)floaterp->childGetValue("val_spinner_1").asReal(); vector.mV[VX] = (F32)getChild<LLUICtrl>("val_spinner_1")->getValue().asReal();
vector.mV[VY] = (F32)floaterp->childGetValue("val_spinner_2").asReal(); vector.mV[VY] = (F32)getChild<LLUICtrl>("val_spinner_2")->getValue().asReal();
vector.mV[VZ] = (F32)floaterp->childGetValue("val_spinner_3").asReal(); vector.mV[VZ] = (F32)getChild<LLUICtrl>("val_spinner_3")->getValue().asReal();
controlp->set(vector.getValue()); mCurrentControlVariable->set(vector.getValue());
break; break;
case TYPE_VEC3D: case TYPE_VEC3D:
vectord.mdV[VX] = floaterp->childGetValue("val_spinner_1").asReal(); vectord.mdV[VX] = getChild<LLUICtrl>("val_spinner_1")->getValue().asReal();
vectord.mdV[VY] = floaterp->childGetValue("val_spinner_2").asReal(); vectord.mdV[VY] = getChild<LLUICtrl>("val_spinner_2")->getValue().asReal();
vectord.mdV[VZ] = floaterp->childGetValue("val_spinner_3").asReal(); vectord.mdV[VZ] = getChild<LLUICtrl>("val_spinner_3")->getValue().asReal();
controlp->set(vectord.getValue()); mCurrentControlVariable->set(vectord.getValue());
break; break;
case TYPE_RECT: case TYPE_RECT:
rect.mLeft = floaterp->childGetValue("val_spinner_1").asInteger(); rect.mLeft = getChild<LLUICtrl>("val_spinner_1")->getValue().asInteger();
rect.mRight = floaterp->childGetValue("val_spinner_2").asInteger(); rect.mRight = getChild<LLUICtrl>("val_spinner_2")->getValue().asInteger();
rect.mBottom = floaterp->childGetValue("val_spinner_3").asInteger(); rect.mBottom = getChild<LLUICtrl>("val_spinner_3")->getValue().asInteger();
rect.mTop = floaterp->childGetValue("val_spinner_4").asInteger(); rect.mTop = getChild<LLUICtrl>("val_spinner_4")->getValue().asInteger();
controlp->set(rect.getValue()); mCurrentControlVariable->set(rect.getValue());
break; break;
case TYPE_COL4: case TYPE_COL4:
col3.setValue(floaterp->childGetValue("color_swatch")); col3.setValue(getChild<LLUICtrl>("val_color_swatch")->getValue());
col4 = LLColor4(col3, (F32)floaterp->childGetValue("val_spinner_4").asReal()); col4 = LLColor4(col3, (F32)getChild<LLUICtrl>("val_spinner_4")->getValue().asReal());
controlp->set(col4.getValue()); mCurrentControlVariable->set(col4.getValue());
break; break;
case TYPE_COL3: case TYPE_COL3:
controlp->set(floaterp->childGetValue("color_swatch")); mCurrentControlVariable->set(getChild<LLUICtrl>("val_color_swatch")->getValue());
//col3.mV[VRED] = (F32)floaterp->childGetValue("val_spinner_1").asC(); //col3.mV[VRED] = (F32)getChild<LLUICtrl>("val_spinner_1")->getValue().asC();
//col3.mV[VGREEN] = (F32)floaterp->childGetValue("val_spinner_2").asReal(); //col3.mV[VGREEN] = (F32)getChild<LLUICtrl>("val_spinner_2")->getValue().asReal();
//col3.mV[VBLUE] = (F32)floaterp->childGetValue("val_spinner_3").asReal(); //col3.mV[VBLUE] = (F32)getChild<LLUICtrl>("val_spinner_3")->getValue().asReal();
//controlp->set(col3.getValue()); //mCurrentControlVariable->set(col3.getValue());
break; break;
case TYPE_COL4U: case TYPE_COL4U:
col3.setValue(floaterp->childGetValue("color_swatch")); col3.setValue(getChild<LLUICtrl>("val_color_swatch")->getValue());
col4U.setVecScaleClamp(col3); col4U.setVecScaleClamp(col3);
col4U.mV[VALPHA] = floaterp->childGetValue("val_spinner_4").asInteger(); col4U.mV[VALPHA] = getChild<LLUICtrl>("val_spinner_4")->getValue().asInteger();
controlp->set(col4U.getValue()); mCurrentControlVariable->set(col4U.getValue());
break; break;
default: default:
break; break;
} }
} }
// static void LLFloaterSettingsDebug::onClickDefault()
void LLFloaterSettingsDebug::onClickDefault(void* user_data)
{ {
LLFloaterSettingsDebug* floaterp = (LLFloaterSettingsDebug*)user_data; if (mCurrentControlVariable)
LLComboBox* settings_combo = floaterp->getChild<LLComboBox>("settings_combo");
LLControlVariable* controlp = (LLControlVariable*)settings_combo->getCurrentUserdata();
if (controlp)
{ {
controlp = controlp->getCOAActive(); mCurrentControlVariable->resetToDefault(true);
controlp->resetToDefault(true); updateControl();
floaterp->updateControl(controlp);
} }
} }
// we've switched controls, or doing per-frame update, so update spinners, etc. void LLFloaterSettingsDebug::onCopyToClipboard()
void LLFloaterSettingsDebug::updateControl(LLControlVariable* controlp) {
if (mCurrentControlVariable)
getWindow()->copyTextToClipboard(utf8str_to_wstring(mCurrentControlVariable->getName()));
}
// we've switched controls, so update spinners, etc.
void LLFloaterSettingsDebug::updateControl()
{ {
LLSpinCtrl* spinner1 = getChild<LLSpinCtrl>("val_spinner_1"); LLSpinCtrl* spinner1 = getChild<LLSpinCtrl>("val_spinner_1");
LLSpinCtrl* spinner2 = getChild<LLSpinCtrl>("val_spinner_2"); LLSpinCtrl* spinner2 = getChild<LLSpinCtrl>("val_spinner_2");
LLSpinCtrl* spinner3 = getChild<LLSpinCtrl>("val_spinner_3"); LLSpinCtrl* spinner3 = getChild<LLSpinCtrl>("val_spinner_3");
LLSpinCtrl* spinner4 = getChild<LLSpinCtrl>("val_spinner_4"); LLSpinCtrl* spinner4 = getChild<LLSpinCtrl>("val_spinner_4");
LLColorSwatchCtrl* color_swatch = getChild<LLColorSwatchCtrl>("color_swatch"); LLColorSwatchCtrl* color_swatch = getChild<LLColorSwatchCtrl>("val_color_swatch");
LLUICtrl* bool_ctrl = getChild<LLUICtrl>("boolean_combo");
if (!spinner1 || !spinner2 || !spinner3 || !spinner4 || !color_swatch) if (!spinner1 || !spinner2 || !spinner3 || !spinner4 || !color_swatch)
{ {
@@ -247,45 +260,33 @@ void LLFloaterSettingsDebug::updateControl(LLControlVariable* controlp)
spinner3->setVisible(FALSE); spinner3->setVisible(FALSE);
spinner4->setVisible(FALSE); spinner4->setVisible(FALSE);
color_swatch->setVisible(FALSE); color_swatch->setVisible(FALSE);
childSetVisible("val_text", FALSE); getChildView("val_text")->setVisible( FALSE);
mComment->setText(LLStringUtil::null); 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 // [RLVa:KB] - Checked: 2011-05-28 (RLVa-1.4.0a) | Modified: RLVa-1.4.0a
if (rlv_handler_t::isEnabled()) // If "HideFromEditor" was toggled while the floater is open then we need to manually disable access to the control
{ mOldVisibility = mCurrentControlVariable->isHiddenFromSettingsEditor();
// Don't allow changing DBG_WRITE debug settings under @setdebug=n spinner1->setEnabled(!mOldVisibility);
bool fEnable = !( (gRlvHandler.hasBehaviour(RLV_BHVR_SETDEBUG)) && spinner2->setEnabled(!mOldVisibility);
(RlvExtGetSet::getDebugSettingFlags(controlp->getName()) & RlvExtGetSet::DBG_WRITE) ); spinner3->setEnabled(!mOldVisibility);
// Don't allow toggling "Basic Shaders" and/or "Atmopsheric Shaders" through the debug settings under @setenv=n spinner4->setEnabled(!mOldVisibility);
fEnable &= !((gRlvHandler.hasBehaviour(RLV_BHVR_SETENV)) && color_swatch->setEnabled(!mOldVisibility);
(("VertexShaderEnable" == controlp->getName()) || ("WindLightUseAtmosShaders" == controlp->getName()))); childSetEnabled("val_text", !mOldVisibility);
#ifdef RLV_EXTENSION_STARTLOCATION bool_ctrl->setEnabled(!mOldVisibility);
// Don't allow toggling RLVaLoginLastLocation childSetEnabled("default_btn", !mOldVisibility);
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] // [/RLVa:KB]
controlp = controlp->getCOAActive(); childSetEnabled("copy_btn", true);
eControlType type = controlp->type();
//hide combo box only for non booleans, otherwise this will result in the combo box closing every frame eControlType type = mCurrentControlVariable->type();
childSetVisible("boolean_combo", type == TYPE_BOOLEAN);
mComment->setText(mCurrentControlVariable->getName() + std::string(": ") + mCurrentControlVariable->getComment());
mComment->setText(controlp->getComment());
spinner1->setMaxValue(F32_MAX); spinner1->setMaxValue(F32_MAX);
spinner2->setMaxValue(F32_MAX); spinner2->setMaxValue(F32_MAX);
spinner3->setMaxValue(F32_MAX); spinner3->setMaxValue(F32_MAX);
@@ -311,7 +312,7 @@ void LLFloaterSettingsDebug::updateControl(LLControlVariable* controlp)
spinner4->setIncrement(0.1f); spinner4->setIncrement(0.1f);
} }
LLSD sd = controlp->get(); LLSD sd = mCurrentControlVariable->get();
switch(type) switch(type)
{ {
case TYPE_U32: case TYPE_U32:
@@ -348,23 +349,17 @@ void LLFloaterSettingsDebug::updateControl(LLControlVariable* controlp)
} }
break; break;
case TYPE_BOOLEAN: case TYPE_BOOLEAN:
if (!childHasFocus("boolean_combo")) bool_ctrl->setVisible(true);
if (!bool_ctrl->hasFocus())
{ {
if (sd.asBoolean()) bool_ctrl->setValue(sd.asInteger());
{
childSetValue("boolean_combo", LLSD("true"));
}
else
{
childSetValue("boolean_combo", LLSD(""));
}
} }
break; break;
case TYPE_STRING: case TYPE_STRING:
childSetVisible("val_text", TRUE); getChildView("val_text")->setVisible( TRUE);
if (!childHasFocus("val_text")) if (!getChild<LLUICtrl>("val_text")->hasFocus())
{ {
childSetValue("val_text", sd); getChild<LLUICtrl>("val_text")->setValue(sd);
} }
break; break;
case TYPE_VEC3: case TYPE_VEC3:
@@ -530,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();
}

View File

@@ -35,9 +35,13 @@
#include "llcontrol.h" #include "llcontrol.h"
#include "llfloater.h" #include "llfloater.h"
#include "lltexteditor.h"
class LLFloaterSettingsDebug : public LLFloater class LLScrollListCtrl;
class LLTextEditor;
class LLFloaterSettingsDebug
: public LLFloater
, public LLSingleton<LLFloaterSettingsDebug>
{ {
public: public:
LLFloaterSettingsDebug(); LLFloaterSettingsDebug();
@@ -46,17 +50,33 @@ public:
virtual BOOL postBuild(); virtual BOOL postBuild();
virtual void draw(); virtual void draw();
void updateControl(LLControlVariable* control); void updateControl();
static void show(void*); // updates control filter to display in the controls list on keystroke
static void onSettingSelect(LLUICtrl* ctrl, void* user_data); static void onUpdateFilter(const std::string& searchTerm, void*);
static void onCommitSettings(LLUICtrl* ctrl, void* user_data); void updateFilter(std::string searchTerm);
static void onClickDefault(void* user_data);
void onSettingSelect();
void onCommitSettings();
void onClickDefault();
void onCopyToClipboard();
private:
// returns a pointer to the currently selected control variable, or NULL
LLControlVariable* getControlVariable();
protected: protected:
static LLFloaterSettingsDebug* sInstance; typedef std::map<std::string,LLControlVariable*> settings_map_t;
settings_map_t mSettingsMap;
std::string mOldSearchTerm;
LLControlVariable* mCurrentControlVariable;
LLControlVariable* mOldControlVariable;
bool mOldVisibility;
LLScrollListCtrl* mSettingsScrollList;
LLTextEditor* mComment; LLTextEditor* mComment;
}; };
#endif //LLFLOATERDEBUGSETTINGS_H #endif //LLFLOATERDEBUGSETTINGS_H

View File

@@ -385,7 +385,7 @@ void LLPanelAvatarFirstLife::onClickImage(void* data)
S32 left, top; S32 left, top;
gFloaterView->getNewFloaterPosition(&left, &top); gFloaterView->getNewFloaterPosition(&left, &top);
LLRect rect = gSavedSettings.getRect("PreviewTextureRect"); LLRect rect = gSavedSettings.getRect("PreviewTextureRect");
rect.translate( left - rect.mLeft, top - rect.mTop ); rect.translate( left - rect.mLeft, rect.mTop - top ); // Changed to avoid textures being sunken below the window border.
LLPreviewTexture* preview = new LLPreviewTexture("preview task texture", LLPreviewTexture* preview = new LLPreviewTexture("preview task texture",
rect, rect,
std::string("Profile First Life Picture"), std::string("Profile First Life Picture"),
@@ -433,7 +433,7 @@ void LLPanelAvatarSecondLife::onClickImage(void* data)
S32 left, top; S32 left, top;
gFloaterView->getNewFloaterPosition(&left, &top); gFloaterView->getNewFloaterPosition(&left, &top);
LLRect rect = gSavedSettings.getRect("PreviewTextureRect"); LLRect rect = gSavedSettings.getRect("PreviewTextureRect");
rect.translate( left - rect.mLeft, top - rect.mTop ); rect.translate( left - rect.mLeft, rect.mTop - top ); // Changed to avoid textures being sunken below the window border.
LLPreviewTexture* preview = new LLPreviewTexture("preview task texture", LLPreviewTexture* preview = new LLPreviewTexture("preview task texture",
rect, rect,
std::string("Profile Picture: ") + name_text, std::string("Profile Picture: ") + name_text,

View File

@@ -217,6 +217,7 @@ protected:
BOOL mNoCopyTextureSelected; BOOL mNoCopyTextureSelected;
F32 mContextConeOpacity; F32 mContextConeOpacity;
LLSaveFolderState mSavedFolderState; LLSaveFolderState mSavedFolderState;
BOOL mSelectedItemPinned;
LLScrollListCtrl* mLocalScrollCtrl; // tag: vaa emerald local_asset_browser LLScrollListCtrl* mLocalScrollCtrl; // tag: vaa emerald local_asset_browser
}; };
@@ -249,7 +250,8 @@ LLFloaterTexturePicker::LLFloaterTexturePicker(
mSearchEdit(NULL), mSearchEdit(NULL),
mImmediateFilterPermMask(immediate_filter_perm_mask), mImmediateFilterPermMask(immediate_filter_perm_mask),
mNonImmediateFilterPermMask(non_immediate_filter_perm_mask), mNonImmediateFilterPermMask(non_immediate_filter_perm_mask),
mContextConeOpacity(0.f) mContextConeOpacity(0.f),
mSelectedItemPinned(FALSE)
{ {
mCanApplyImmediately = can_apply_immediately; mCanApplyImmediately = can_apply_immediately;
LLUICtrlFactory::getInstance()->buildFloater(this,"floater_texture_ctrl.xml"); LLUICtrlFactory::getInstance()->buildFloater(this,"floater_texture_ctrl.xml");
@@ -506,8 +508,13 @@ BOOL LLFloaterTexturePicker::postBuild()
mInventoryPanel->setShowFolderState(LLInventoryFilter::SHOW_NON_EMPTY_FOLDERS); mInventoryPanel->setShowFolderState(LLInventoryFilter::SHOW_NON_EMPTY_FOLDERS);
mInventoryPanel->setAllowMultiSelect(FALSE); mInventoryPanel->setAllowMultiSelect(FALSE);
// store this filter as the default one // Disable auto selecting first filtered item because it takes away
mInventoryPanel->getRootFolder()->getFilter()->markDefault(); // selection from the item set by LLTextureCtrl owning this floater.
mInventoryPanel->getRootFolder()->setAutoSelectOverride(TRUE);
// Commented out to scroll to currently selected texture. See EXT-5403.
// // store this filter as the default one
// mInventoryPanel->getRootFolder()->getFilter()->markDefault();
// Commented out to stop opening all folders with textures // Commented out to stop opening all folders with textures
// mInventoryPanel->openDefaultFolderForType(LLAssetType::AT_TEXTURE); // mInventoryPanel->openDefaultFolderForType(LLAssetType::AT_TEXTURE);
@@ -675,6 +682,31 @@ void LLFloaterTexturePicker::draw()
// Draw X // Draw X
gl_draw_x(interior, LLColor4::black ); gl_draw_x(interior, LLColor4::black );
} }
if (mSelectedItemPinned) return;
LLFolderView* folder_view = mInventoryPanel->getRootFolder();
if (!folder_view) return;
LLInventoryFilter* filter = folder_view->getFilter();
if (!filter) return;
bool is_filter_active = folder_view->getCompletedFilterGeneration() < filter->getCurrentGeneration() &&
filter->isNotDefault();
// After inventory panel filter is applied we have to update
// constraint rect for the selected item because of folder view
// AutoSelectOverride set to TRUE. We force PinningSelectedItem
// flag to FALSE state and setting filter "dirty" to update
// scroll container to show selected item (see LLFolderView::doIdle()).
if (!is_filter_active && !mSelectedItemPinned)
{
folder_view->setPinningSelectedItem(mSelectedItemPinned);
folder_view->dirtyFilter();
folder_view->arrangeFromRoot();
mSelectedItemPinned = TRUE;
}
} }
} }

View File

@@ -880,7 +880,7 @@ void init_menus()
menu = new LLMenuGL(CLIENT_MENU_NAME); menu = new LLMenuGL(CLIENT_MENU_NAME);
menu->setCanTearOff(FALSE); menu->setCanTearOff(FALSE);
menu->addChild(new LLMenuItemCallGL("Debug Settings...", LLFloaterSettingsDebug::show, NULL, NULL)); menu->addChild(new LLMenuItemCallGL("Debug Settings...", handle_singleton_toggle<LLFloaterSettingsDebug>, NULL, NULL));
gLoginMenuBarView->addChild(menu); gLoginMenuBarView->addChild(menu);
menu->updateParent(LLMenuGL::sMenuContainer); menu->updateParent(LLMenuGL::sMenuContainer);
@@ -1223,7 +1223,7 @@ void init_client_menu(LLMenuGL* menu)
&menu_check_control, &menu_check_control,
(void*)"SaveMinidump")); (void*)"SaveMinidump"));
menu->addChild(new LLMenuItemCallGL("Debug Settings...", LLFloaterSettingsDebug::show, NULL, NULL)); menu->addChild(new LLMenuItemCallGL("Debug Settings...", handle_singleton_toggle<LLFloaterSettingsDebug>, 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 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", menu->addChild(new LLMenuItemCallGL("Request Admin Status",

View File

@@ -1,31 +1,33 @@
<?xml version="1.0" encoding="utf-8" standalone="yes" ?> <?xml version="1.0" encoding="utf-8" standalone="yes" ?>
<floater can_close="true" can_drag_on_left="false" can_minimize="false" <floater can_close="true" can_drag_on_left="false" can_minimize="false"
can_resize="false" height="215" name="settings_debug" can_resize="true" height="220" name="settings_debug" min_height="220" min_width="285"
title="Debug Settings" width="350"> title="Debug Settings" width="300" rect_control="FloaterDebugSettingsRect">
<combo_box allow_text_entry="true" bottom="-50" follows="top|left" font="SansSerifSmall" <search_editor bottom="-40" follows="top|left|right" height="20" label="Search" left="10" right="-10" max_chars="255" name="search_settings_input" tool_tip="Type the search term you are interested in here. Results will be displayed for partial fulltext matches within the setting's name or comment."/>
height="20" left="15" max_chars="255" name="settings_combo" /> <scroll_list height="20" bottom_delta="-24" follows="all" left="10" right="-10" name="settings_scroll_list" />
<text_editor bottom_delta="-75" enabled="false" height="60" width="320" hide_scrollbar="true" <text_editor follows="left|right" bottom_delta="-64" enabled="false" height="60" width="320" left="10" right="-10" hide_scrollbar="true"
name="comment_text" word_wrap="true" /> name="comment_text" word_wrap="true" />
<combo_box bottom_delta="-30" follows="top|left" font="SansSerifSmall" height="20" <radio_group bottom_delta="-48" draw_border="false" follows="bottom|left|right" height="36"
left="15" name="boolean_combo" visible="false"> left="15" name="boolean_combo" visible="false">
<combo_item name="TRUE" value="true"> <radio_item bottom="-18" height="15" name="TRUE" value="1">
TRUE True
</combo_item> </radio_item>
<combo_item name="FALSE" value=""> <radio_item bottom="-36" height="15" name="FALSE" value="0">
FALSE False
</combo_item> </radio_item>
</combo_box> </radio_group>
<line_editor bottom_delta="0" height="20" name="val_text" visible="false" width="300" /> <line_editor follows="bottom|left|right" bottom="52" left="15" right="-15" height="20" name="val_text" visible="false" width="300" />
<color_swatch bottom="30" can_apply_immediately="true" height="55" label="Color" <color_swatch bottom="30" can_apply_immediately="true" height="55" label="Color"
name="color_swatch" visible="true" width="37" /> name="val_color_swatch" visible="false" width="37" />
<spinner bottom_delta="25" height="20" label="x" label_width="40" max_val="10000000" <spinner bottom_delta="31" height="24" label="x" label_width="40" max_val="10000000"
name="val_spinner_1" visible="false" width="120" /> name="val_spinner_1" visible="false" width="120" />
<spinner bottom_delta="0" height="20" label="x" label_width="40" left_delta="135" <spinner bottom_delta="0" height="24" label="x" label_width="40" left_delta="135"
max_val="10000000" name="val_spinner_2" visible="false" width="120" /> max_val="10000000" name="val_spinner_2" visible="false" width="120" />
<spinner bottom_delta="-20" height="20" label="x" label_width="40" left="15" <spinner bottom_delta="-23" height="24" label="x" label_width="40" left="15"
max_val="10000000" name="val_spinner_3" visible="false" width="120" /> max_val="10000000" name="val_spinner_3" visible="false" width="120" />
<spinner bottom_delta="0" height="20" label="x" label_width="40" left_delta="135" <spinner bottom_delta="0" height="24" label="x" label_width="40" left_delta="135"
max_val="10000000" name="val_spinner_4" visible="false" width="120" /> max_val="10000000" name="val_spinner_4" visible="false" width="120" />
<button bottom="5" height="20" label="Reset to default" left="15" name="default_btn" <button bottom="10" height="20" label="Copy Name" left="10" name="copy_btn" tool_tip="Copy the name of this setting."
width="150" /> width="130" />
<button follows="right" bottom_delta="0" height="20" label="Reset to default" right="-10" name="default_btn"
width="130" />
</floater> </floater>

View File

@@ -582,7 +582,7 @@
<on_enable function="World.EnableBuyLand" /> <on_enable function="World.EnableBuyLand" />
</menu_item_call> </menu_item_call>
<menu_item_call bottom="-308" enabled="true" height="19" label="Region/Estate..." left="0" <menu_item_call bottom="-308" enabled="true" height="19" label="Region/Estate..." left="0"
mouse_opaque="true" name="Region/Estate..." width="185"> mouse_opaque="true" name="Region/Estate..." shortcut="alt|R" width="185">
<on_click function="ShowFloater" userdata="about region" /> <on_click function="ShowFloater" userdata="about region" />
</menu_item_call> </menu_item_call>
<menu_item_separator bottom="-316" enabled="true" height="8" label="-----------" left="0" <menu_item_separator bottom="-316" enabled="true" height="8" label="-----------" left="0"