summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Goetze <cg@lindenlab.com>2007-10-10 00:01:43 +0000
committerChristian Goetze <cg@lindenlab.com>2007-10-10 00:01:43 +0000
commit5ec8bbbe2244ea70d8aa74b5c572351632699425 (patch)
tree12a4e92720c531105a21ef4f9f363b8572d72a3a
parentb3b62c3b9ef32c4dbcae51cd3ef582734d5717bb (diff)
svn merge -r71238:71367 svn+ssh://svn/svn/linden/branches/maint-ui-qa3
-rw-r--r--indra/llcharacter/llvisualparam.h6
-rw-r--r--indra/llcommon/llstring.h14
-rw-r--r--indra/llimage/llimage.h2
-rw-r--r--indra/llinventory/llparcel.cpp43
-rw-r--r--indra/llinventory/llparcel.h26
-rw-r--r--indra/llinventory/llpermissions.cpp6
-rw-r--r--indra/llinventory/llpermissions.h1
-rw-r--r--indra/llmessage/lltransfertargetfile.h2
-rw-r--r--indra/llprimitive/llprimitive.cpp46
-rw-r--r--indra/llprimitive/llprimitive.h3
-rw-r--r--indra/llui/llbutton.cpp12
-rw-r--r--indra/llui/llbutton.h26
-rw-r--r--indra/llui/llcheckboxctrl.cpp4
-rw-r--r--indra/llui/llcheckboxctrl.h4
-rw-r--r--indra/llui/llcombobox.cpp18
-rw-r--r--indra/llui/llcombobox.h6
-rw-r--r--indra/llui/lllineeditor.cpp23
-rw-r--r--indra/llui/lllineeditor.h14
-rw-r--r--indra/llui/llmenugl.cpp4
-rw-r--r--indra/llui/llmenugl.h6
-rw-r--r--indra/llui/llpanel.cpp8
-rw-r--r--indra/llui/llpanel.h8
-rw-r--r--indra/llui/llscrolllistctrl.cpp2
-rw-r--r--indra/llui/llscrolllistctrl.h10
-rw-r--r--indra/llui/llsliderctrl.cpp6
-rw-r--r--indra/llui/llsliderctrl.h4
-rw-r--r--indra/llui/llspinctrl.cpp2
-rw-r--r--indra/llui/llspinctrl.h2
-rw-r--r--indra/llui/lltextbox.cpp6
-rw-r--r--indra/llui/lltextbox.h6
-rw-r--r--indra/llui/lltexteditor.cpp6
-rw-r--r--indra/llui/lltexteditor.h2
-rw-r--r--indra/llui/lluictrl.cpp4
-rw-r--r--indra/llui/lluictrl.h4
-rw-r--r--indra/llui/lluictrlfactory.cpp3
-rw-r--r--indra/llui/llview.cpp7
-rw-r--r--indra/llui/llview.h2
-rw-r--r--indra/llxml/llxmlnode.h4
-rw-r--r--indra/newview/llagent.cpp16
-rw-r--r--indra/newview/llagent.h2
-rw-r--r--indra/newview/llcallingcard.cpp2
-rw-r--r--indra/newview/llcompilequeue.cpp4
-rw-r--r--indra/newview/llcurrencyuimanager.cpp17
-rw-r--r--indra/newview/llcurrencyuimanager.h3
-rw-r--r--indra/newview/lldebugmessagebox.cpp24
-rw-r--r--indra/newview/lldrawpoolbump.h2
-rw-r--r--indra/newview/llfloaterabout.cpp10
-rw-r--r--indra/newview/llfloateranimpreview.cpp20
-rw-r--r--indra/newview/llfloaterauction.cpp2
-rw-r--r--indra/newview/llfloaterbuy.cpp24
-rw-r--r--indra/newview/llfloaterbuycontents.cpp9
-rw-r--r--indra/newview/llfloaterbuycurrency.cpp3
-rw-r--r--indra/newview/llfloaterbuyland.cpp11
-rw-r--r--indra/newview/llfloatercolorpicker.cpp11
-rw-r--r--indra/newview/llfloaterfriends.cpp4
-rw-r--r--indra/newview/llfloatergodtools.cpp4
-rw-r--r--indra/newview/llfloatergodtools.h2
-rw-r--r--indra/newview/llfloaterinspect.cpp54
-rw-r--r--indra/newview/llfloaterland.cpp327
-rw-r--r--indra/newview/llfloaterland.h1
-rw-r--r--indra/newview/llfloateropenobject.cpp2
-rw-r--r--indra/newview/llfloaterpostcard.cpp3
-rw-r--r--indra/newview/llfloaterproperties.cpp68
-rw-r--r--indra/newview/llfloaterreporter.cpp10
-rw-r--r--indra/newview/llfloaterreporter.h2
-rw-r--r--indra/newview/llfloatersnapshot.cpp7
-rw-r--r--indra/newview/llfloatertelehub.cpp7
-rw-r--r--indra/newview/llfloatertools.cpp48
-rw-r--r--indra/newview/llfloatertools.h4
-rw-r--r--indra/newview/llfloaterworldmap.cpp4
-rw-r--r--indra/newview/llfolderview.cpp6
-rw-r--r--indra/newview/llfolderview.h2
-rw-r--r--indra/newview/llglsandbox.cpp20
-rw-r--r--indra/newview/llgroupmgr.cpp3
-rw-r--r--indra/newview/llimpanel.cpp2
-rw-r--r--indra/newview/llimview.cpp5
-rw-r--r--indra/newview/llinventorybridge.cpp7
-rw-r--r--indra/newview/llmanip.cpp16
-rw-r--r--indra/newview/llmanip.h7
-rw-r--r--indra/newview/llmaniprotate.cpp55
-rw-r--r--indra/newview/llmaniprotate.h6
-rw-r--r--indra/newview/llmanipscale.cpp68
-rw-r--r--indra/newview/llmanipscale.h7
-rw-r--r--indra/newview/llmaniptranslate.cpp50
-rw-r--r--indra/newview/llmaniptranslate.h5
-rw-r--r--indra/newview/llmutelist.h2
-rw-r--r--indra/newview/llnamebox.cpp2
-rw-r--r--indra/newview/llnamelistctrl.cpp3
-rw-r--r--indra/newview/lloverlaybar.cpp5
-rw-r--r--indra/newview/llpanelavatar.cpp51
-rw-r--r--indra/newview/llpanelclassified.cpp10
-rw-r--r--indra/newview/llpanelcontents.cpp14
-rw-r--r--indra/newview/llpanelface.cpp418
-rw-r--r--indra/newview/llpanelface.h16
-rw-r--r--indra/newview/llpanelgroup.h2
-rw-r--r--indra/newview/llpanelgroupinvite.cpp6
-rw-r--r--indra/newview/llpanelgrouplandmoney.cpp202
-rw-r--r--indra/newview/llpanelgrouplandmoney.h86
-rw-r--r--indra/newview/llpanelgroupnotices.cpp4
-rw-r--r--indra/newview/llpanelland.cpp4
-rw-r--r--indra/newview/llpanellogin.cpp21
-rw-r--r--indra/newview/llpanellogin.h4
-rw-r--r--indra/newview/llpanelobject.cpp20
-rw-r--r--indra/newview/llpanelpermissions.cpp55
-rw-r--r--indra/newview/llpanelpick.cpp10
-rw-r--r--indra/newview/llpanelplace.cpp35
-rw-r--r--indra/newview/llpreviewgesture.cpp40
-rw-r--r--indra/newview/llpreviewnotecard.cpp10
-rw-r--r--indra/newview/llpreviewscript.cpp42
-rw-r--r--indra/newview/llselectmgr.cpp3171
-rw-r--r--indra/newview/llselectmgr.h377
-rw-r--r--indra/newview/llstartup.cpp42
-rw-r--r--indra/newview/llstatusbar.cpp12
-rw-r--r--indra/newview/lltexturectrl.cpp8
-rw-r--r--indra/newview/lltextureview.cpp18
-rw-r--r--indra/newview/lltoolbrush.cpp3
-rw-r--r--indra/newview/lltoolcomp.cpp6
-rw-r--r--indra/newview/lltoolfocus.cpp6
-rw-r--r--indra/newview/lltoolgrab.cpp3
-rw-r--r--indra/newview/lltoolindividual.cpp7
-rw-r--r--indra/newview/lltoolmgr.cpp11
-rw-r--r--indra/newview/lltoolpie.cpp9
-rw-r--r--indra/newview/lltoolplacer.cpp3
-rw-r--r--indra/newview/lltoolselectland.cpp3
-rw-r--r--indra/newview/lltoolview.cpp3
-rw-r--r--indra/newview/llviewercontrol.cpp34
-rw-r--r--indra/newview/llviewerdisplay.cpp4
-rw-r--r--indra/newview/llviewermenu.cpp796
-rw-r--r--indra/newview/llviewermessage.cpp23
-rw-r--r--indra/newview/llviewerobjectlist.cpp15
-rw-r--r--indra/newview/llviewerparcelmgr.cpp2
-rw-r--r--indra/newview/llviewerparcelmgr.h2
-rw-r--r--indra/newview/llviewerregion.cpp2
-rw-r--r--indra/newview/llviewertexteditor.h2
-rw-r--r--indra/newview/llviewerwindow.cpp71
-rw-r--r--indra/newview/llviewerwindow.h2
-rw-r--r--indra/newview/llvoiceclient.h3
-rw-r--r--indra/newview/llwearable.h8
-rw-r--r--indra/newview/llwearablelist.cpp4
-rw-r--r--indra/newview/llwearablelist.h2
-rw-r--r--indra/newview/llworldmapview.h2
-rw-r--r--indra/newview/pipeline.cpp19
142 files changed, 3083 insertions, 3970 deletions
diff --git a/indra/llcharacter/llvisualparam.h b/indra/llcharacter/llvisualparam.h
index 16319ef621..43911f4ed7 100644
--- a/indra/llcharacter/llvisualparam.h
+++ b/indra/llcharacter/llvisualparam.h
@@ -119,9 +119,9 @@ public:
const LLString& getMaxDisplayName() const { return mInfo->mMaxName; }
const LLString& getMinDisplayName() const { return mInfo->mMinName; }
- void setDisplayName(const char* s) { mInfo->mDisplayName = s; }
- void setMaxDisplayName(const char* s) { mInfo->mMaxName = s; }
- void setMinDisplayName(const char* s) { mInfo->mMinName = s; }
+ void setDisplayName(const LLString& s) { mInfo->mDisplayName = s; }
+ void setMaxDisplayName(const LLString& s) { mInfo->mMaxName = s; }
+ void setMinDisplayName(const LLString& s) { mInfo->mMinName = s; }
EVisualParamGroup getGroup() { return mInfo->mGroup; }
F32 getMinWeight() { return mInfo->mMinWeight; }
diff --git a/indra/llcommon/llstring.h b/indra/llcommon/llstring.h
index 649fcd41a6..70f7d5483e 100644
--- a/indra/llcommon/llstring.h
+++ b/indra/llcommon/llstring.h
@@ -321,6 +321,18 @@ template<class T> LLStringBase<T> LLStringBase<T>::null;
typedef LLStringBase<char> LLString;
typedef LLStringBase<llwchar> LLWString;
+//@ Use this where we want to disallow input in the form of "foo"
+// This is used to catch places where english text is embedded in the code
+// instead of in a translatable XUI file.
+class LLStringExplicit : public LLString
+{
+public:
+ explicit LLStringExplicit(const char* s) : LLString(s) {}
+ LLStringExplicit(const LLString& s) : LLString(s) {}
+ LLStringExplicit(const std::string& s) : LLString(s) {}
+ LLStringExplicit(const std::string& s, size_type pos, size_type n = std::string::npos) : LLString(s, pos, n) {}
+};
+
struct LLDictionaryLess
{
public:
@@ -336,7 +348,7 @@ public:
*/
/**
- * @breif chop off the trailing characters in a string.
+ * @brief chop off the trailing characters in a string.
*
* This function works on bytes rather than glyphs, so this will
* incorrectly truncate non-single byte strings.
diff --git a/indra/llimage/llimage.h b/indra/llimage/llimage.h
index ae5f5eb55f..65a7c54a50 100644
--- a/indra/llimage/llimage.h
+++ b/indra/llimage/llimage.h
@@ -114,7 +114,7 @@ protected:
public:
static const LLString& getLastError() {return sLastErrorMessage;};
static void resetLastError() {sLastErrorMessage = LLString("No Error"); };
- static BOOL setLastError(const LLString& message, const LLString& filename = ""); // returns FALSE
+ static BOOL setLastError(const LLString& message, const LLString& filename = LLString()); // returns FALSE
static void generateMip(const U8 *indata, U8* mipdata, int width, int height, S32 nchannels);
diff --git a/indra/llinventory/llparcel.cpp b/indra/llinventory/llparcel.cpp
index 92049c068b..3a67385030 100644
--- a/indra/llinventory/llparcel.cpp
+++ b/indra/llinventory/llparcel.cpp
@@ -259,42 +259,25 @@ void LLParcel::overrideParcelFlags(U32 flags)
mParcelFlags = flags;
}
-void set_std_string(const char* src, std::string& dest)
-{
- if(src)
- {
- dest.assign(src);
- }
- else
- {
-#if (LL_LINUX && __GNUC__ < 3)
- dest.assign(std::string(""));
-#else
- dest.clear();
-#endif
- }
-}
-
-void LLParcel::setName(const char* name)
+void LLParcel::setName(const LLString& name)
{
// The escaping here must match the escaping in the database
// abstraction layer.
- set_std_string(name, mName);
+ mName = name;
LLStringFn::replace_nonprintable(mName, LL_UNKNOWN_CHAR);
}
-void LLParcel::setDesc(const char* desc)
+void LLParcel::setDesc(const LLString& desc)
{
// The escaping here must match the escaping in the database
// abstraction layer.
- set_std_string(desc, mDesc);
+ mDesc = desc;
mDesc = rawstr_to_utf8(mDesc);
}
-void LLParcel::setMusicURL(const char* url)
+void LLParcel::setMusicURL(const LLString& url)
{
- set_std_string(url, mMusicURL);
-
+ mMusicURL = url;
// The escaping here must match the escaping in the database
// abstraction layer.
// This should really filter the url in some way. Other than
@@ -302,10 +285,9 @@ void LLParcel::setMusicURL(const char* url)
LLStringFn::replace_nonprintable(mMusicURL, LL_UNKNOWN_CHAR);
}
-void LLParcel::setMediaURL(const char* url)
+void LLParcel::setMediaURL(const LLString& url)
{
- set_std_string(url, mMediaURL);
-
+ mMediaURL = url;
// The escaping here must match the escaping in the database
// abstraction layer if it's ever added.
// This should really filter the url in some way. Other than
@@ -571,19 +553,19 @@ BOOL LLParcel::importStream(std::istream& input_stream)
}
else if ("name" == keyword)
{
- setName( value.c_str() );
+ setName( value );
}
else if ("desc" == keyword)
{
- setDesc( value.c_str() );
+ setDesc( value );
}
else if ("music_url" == keyword)
{
- setMusicURL( value.c_str() );
+ setMusicURL( value );
}
else if ("media_url" == keyword)
{
- setMediaURL( value.c_str() );
+ setMediaURL( value );
}
else if ("media_id" == keyword)
{
@@ -1838,3 +1820,4 @@ LLParcel::ECategory category_ui_string_to_category(const char* s)
return LLParcel::C_ANY;
}
+
diff --git a/indra/llinventory/llparcel.h b/indra/llinventory/llparcel.h
index efabde3358..9c6300811b 100644
--- a/indra/llinventory/llparcel.h
+++ b/indra/llinventory/llparcel.h
@@ -203,10 +203,10 @@ public:
// MANIPULATORS
void generateNewID() { mID.generate(); }
- void setName(const char* name);
- void setDesc(const char* desc);
- void setMusicURL(const char* url);
- void setMediaURL(const char* url);
+ void setName(const LLString& name);
+ void setDesc(const LLString& desc);
+ void setMusicURL(const LLString& url);
+ void setMediaURL(const LLString& url);
void setMediaID(const LLUUID& id) { mMediaID = id; }
void setMediaAutoScale ( U8 flagIn ) { mMediaAutoScale = flagIn; }
virtual void setLocalID(S32 local_id);
@@ -256,7 +256,7 @@ public:
void setDrawDistance(F32 dist) { mDrawDistance = dist; }
void setSalePrice(S32 price) { mSalePrice = price; }
void setGroupID(const LLUUID& id) { mGroupID = id; }
- //void setGroupName(const char* s) { mGroupName.assign(s); }
+ //void setGroupName(const LLString& s) { mGroupName.assign(s); }
void setPassPrice(S32 price) { mPassPrice = price; }
void setPassHours(F32 hours) { mPassHours = hours; }
@@ -292,10 +292,10 @@ public:
// ACCESSORS
const LLUUID& getID() const { return mID; }
- const char* getName() const { return mName.c_str(); }
- const char* getDesc() const { return mDesc.c_str(); }
- const char* getMusicURL() const { return mMusicURL.c_str(); }
- const char* getMediaURL() const { return mMediaURL.c_str(); }
+ const LLString& getName() const { return mName; }
+ const LLString& getDesc() const { return mDesc; }
+ const LLString& getMusicURL() const { return mMusicURL; }
+ const LLString& getMediaURL() const { return mMediaURL; }
const LLUUID& getMediaID() const { return mMediaID; }
U8 getMediaAutoScale() const { return mMediaAutoScale; }
S32 getLocalID() const { return mLocalID; }
@@ -567,10 +567,10 @@ protected:
F32 mDrawDistance;
U32 mParcelFlags;
S32 mSalePrice; // linden dollars
- std::string mName;
- std::string mDesc;
- std::string mMusicURL;
- std::string mMediaURL;
+ LLString mName;
+ LLString mDesc;
+ LLString mMusicURL;
+ LLString mMediaURL;
U8 mMediaAutoScale;
LLUUID mMediaID;
S32 mPassPrice;
diff --git a/indra/llinventory/llpermissions.cpp b/indra/llinventory/llpermissions.cpp
index 4b44fc24f6..8f9f73d0bd 100644
--- a/indra/llinventory/llpermissions.cpp
+++ b/indra/llinventory/llpermissions.cpp
@@ -1143,6 +1143,12 @@ void mask_to_string(U32 mask, char* str)
*str = '\0';
}
+std::string mask_to_string(U32 mask)
+{
+ char str[16];
+ mask_to_string(mask, str);
+ return std::string(str);
+}
///----------------------------------------------------------------------------
/// exported functions
diff --git a/indra/llinventory/llpermissions.h b/indra/llinventory/llpermissions.h
index ab12abb9ed..9370d6480b 100644
--- a/indra/llinventory/llpermissions.h
+++ b/indra/llinventory/llpermissions.h
@@ -41,6 +41,7 @@
// prototypes
class LLMessageSystem;
extern void mask_to_string(U32 mask, char* str);
+extern std::string mask_to_string(U32 mask);
template<class T> class LLMetaClassT;
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
diff --git a/indra/llmessage/lltransfertargetfile.h b/indra/llmessage/lltransfertargetfile.h
index 6b30aa2941..18b44e2611 100644
--- a/indra/llmessage/lltransfertargetfile.h
+++ b/indra/llmessage/lltransfertargetfile.h
@@ -40,7 +40,7 @@ class LLTransferTargetParamsFile : public LLTransferTargetParams
{
public:
LLTransferTargetParamsFile() : LLTransferTargetParams(LLTTT_FILE) {}
- void setFilename(const char *filename) { mFilename = filename; }
+ void setFilename(const LLString& filename) { mFilename = filename; }
void setCallback(LLTTFCompleteCallback cb, void *user_data) { mCompleteCallback = cb; mUserData = user_data; }
friend class LLTransferTargetFile;
diff --git a/indra/llprimitive/llprimitive.cpp b/indra/llprimitive/llprimitive.cpp
index e3718fe578..628f7f8cc8 100644
--- a/indra/llprimitive/llprimitive.cpp
+++ b/indra/llprimitive/llprimitive.cpp
@@ -1660,6 +1660,52 @@ void LLPrimitive::setTextureList(LLTextureEntry *listp)
//============================================================================
+// Moved from llselectmgr.cpp
+// BUG: Only works for boxes.
+// Face numbering for flex boxes as of 1.14.2
+
+// static
+bool LLPrimitive::getTESTAxes(const U8 face, U32* s_axis, U32* t_axis)
+{
+ if (face == 0)
+ {
+ *s_axis = VX; *t_axis = VY;
+ return true;
+ }
+ else if (face == 1)
+ {
+ *s_axis = VX; *t_axis = VZ;
+ return true;
+ }
+ else if (face == 2)
+ {
+ *s_axis = VY; *t_axis = VZ;
+ return true;
+ }
+ else if (face == 3)
+ {
+ *s_axis = VX; *t_axis = VZ;
+ return true;
+ }
+ else if (face == 4)
+ {
+ *s_axis = VY; *t_axis = VZ;
+ return true;
+ }
+ else if (face == 5)
+ {
+ *s_axis = VX; *t_axis = VY;
+ return true;
+ }
+ else
+ {
+ // unknown face
+ return false;
+ }
+}
+
+//============================================================================
+
//static
BOOL LLNetworkData::isValid(U16 param_type, U32 size)
{
diff --git a/indra/llprimitive/llprimitive.h b/indra/llprimitive/llprimitive.h
index 98b70a47d8..53b17bc2ef 100644
--- a/indra/llprimitive/llprimitive.h
+++ b/indra/llprimitive/llprimitive.h
@@ -362,7 +362,8 @@ public:
static const char *pCodeToString(const LLPCode pcode);
static LLPCode legacyToPCode(const U8 legacy);
static U8 pCodeToLegacy(const LLPCode pcode);
-
+ static bool getTESTAxes(const U8 face, U32* s_axis, U32* t_axis);
+
inline static BOOL isPrimitive(const LLPCode pcode);
inline static BOOL isApp(const LLPCode pcode);
diff --git a/indra/llui/llbutton.cpp b/indra/llui/llbutton.cpp
index 5c9b49c5a8..65cbcf3634 100644
--- a/indra/llui/llbutton.cpp
+++ b/indra/llui/llbutton.cpp
@@ -776,36 +776,36 @@ LLSD LLButton::getValue() const
return mToggleState;
}
-void LLButton::setLabel( const LLString& label )
+void LLButton::setLabel( const LLStringExplicit& label )
{
setLabelUnselected(label);
setLabelSelected(label);
}
//virtual
-BOOL LLButton::setLabelArg( const LLString& key, const LLString& text )
+BOOL LLButton::setLabelArg( const LLString& key, const LLStringExplicit& text )
{
mUnselectedLabel.setArg(key, text);
mSelectedLabel.setArg(key, text);
return TRUE;
}
-void LLButton::setLabelUnselected( const LLString& label )
+void LLButton::setLabelUnselected( const LLStringExplicit& label )
{
mUnselectedLabel = label;
}
-void LLButton::setLabelSelected( const LLString& label )
+void LLButton::setLabelSelected( const LLStringExplicit& label )
{
mSelectedLabel = label;
}
-void LLButton::setDisabledLabel( const LLString& label )
+void LLButton::setDisabledLabel( const LLStringExplicit& label )
{
mDisabledLabel = label;
}
-void LLButton::setDisabledSelectedLabel( const LLString& label )
+void LLButton::setDisabledSelectedLabel( const LLStringExplicit& label )
{
mDisabledSelectedLabel = label;
}
diff --git a/indra/llui/llbutton.h b/indra/llui/llbutton.h
index 74926f2b52..5f7d917b4e 100644
--- a/indra/llui/llbutton.h
+++ b/indra/llui/llbutton.h
@@ -68,7 +68,7 @@ class LLButton
{
public:
// simple button with text label
- LLButton(const LLString& name, const LLRect &rect, const LLString& control_name = "",
+ LLButton(const LLString& name, const LLRect &rect, const LLString& control_name = LLString(),
void (*on_click)(void*) = NULL, void *data = NULL);
LLButton(const LLString& name, const LLRect& rect,
@@ -152,12 +152,12 @@ public:
virtual void setValue(const LLSD& value );
virtual LLSD getValue() const;
- void setLabel( const LLString& label);
- virtual BOOL setLabelArg( const LLString& key, const LLString& text );
- void setLabelUnselected(const LLString& label);
- void setLabelSelected(const LLString& label);
- void setDisabledLabel(const LLString& disabled_label);
- void setDisabledSelectedLabel(const LLString& disabled_label);
+ void setLabel( const LLStringExplicit& label);
+ virtual BOOL setLabelArg( const LLString& key, const LLStringExplicit& text );
+ void setLabelUnselected(const LLStringExplicit& label);
+ void setLabelSelected(const LLStringExplicit& label);
+ void setDisabledLabel(const LLStringExplicit& disabled_label);
+ void setDisabledSelectedLabel(const LLStringExplicit& disabled_label);
void setDisabledLabelColor( const LLColor4& c ) { mDisabledLabelColor = c; }
void setFont(const LLFontGL *font)
@@ -288,12 +288,12 @@ class LLSquareButton
{
public:
LLSquareButton(const LLString& name, const LLRect& rect,
- const LLString& label,
- const LLFontGL *font = NULL,
- const LLString& control_name = "",
- void (*click_callback)(void*) = NULL,
- void *callback_data = NULL,
- const LLString& selected_label = LLString::null );
+ const LLString& label,
+ const LLFontGL *font = NULL,
+ const LLString& control_name = LLString(),
+ void (*click_callback)(void*) = NULL,
+ void *callback_data = NULL,
+ const LLString& selected_label = LLString::null );
};
// Helpful functions
diff --git a/indra/llui/llcheckboxctrl.cpp b/indra/llui/llcheckboxctrl.cpp
index 08ebfafa53..504b342003 100644
--- a/indra/llui/llcheckboxctrl.cpp
+++ b/indra/llui/llcheckboxctrl.cpp
@@ -242,7 +242,7 @@ LLSD LLCheckBoxCtrl::getValue() const
return mButton->getToggleState();
}
-void LLCheckBoxCtrl::setLabel( const LLString& label )
+void LLCheckBoxCtrl::setLabel( const LLStringExplicit& label )
{
mLabel->setText( label );
reshape(getRect().getWidth(), getRect().getHeight(), FALSE);
@@ -253,7 +253,7 @@ LLString LLCheckBoxCtrl::getLabel() const
return mLabel->getText();
}
-BOOL LLCheckBoxCtrl::setLabelArg( const LLString& key, const LLString& text )
+BOOL LLCheckBoxCtrl::setLabelArg( const LLString& key, const LLStringExplicit& text )
{
BOOL res = mLabel->setTextArg(key, text);
reshape(getRect().getWidth(), getRect().getHeight(), FALSE);
diff --git a/indra/llui/llcheckboxctrl.h b/indra/llui/llcheckboxctrl.h
index 37e689173b..513b2930e1 100644
--- a/indra/llui/llcheckboxctrl.h
+++ b/indra/llui/llcheckboxctrl.h
@@ -94,7 +94,7 @@ public:
virtual void setTentative(BOOL b) { mButton->setTentative(b); }
virtual BOOL getTentative() const { return mButton->getTentative(); }
- virtual BOOL setLabelArg( const LLString& key, const LLString& text );
+ virtual BOOL setLabelArg( const LLString& key, const LLStringExplicit& text );
virtual void clear();
virtual void onCommit();
@@ -105,7 +105,7 @@ public:
void setEnabledColor( const LLColor4 &color ) { mTextEnabledColor = color; }
void setDisabledColor( const LLColor4 &color ) { mTextDisabledColor = color; }
- void setLabel( const LLString& label );
+ void setLabel( const LLStringExplicit& label );
LLString getLabel() const;
virtual void setControlName(const LLString& control_name, LLView* context);
diff --git a/indra/llui/llcombobox.cpp b/indra/llui/llcombobox.cpp
index 7ed3d3efbd..5f76cfc94b 100644
--- a/indra/llui/llcombobox.cpp
+++ b/indra/llui/llcombobox.cpp
@@ -229,12 +229,12 @@ void LLComboBox::clear()
{
if (mTextEntry)
{
- mTextEntry->setText("");
+ mTextEntry->setText(LLString::null);
}
- mButton->setLabelSelected("");
- mButton->setLabelUnselected("");
- mButton->setDisabledLabel("");
- mButton->setDisabledSelectedLabel("");
+ mButton->setLabelSelected(LLString::null);
+ mButton->setLabelUnselected(LLString::null);
+ mButton->setDisabledLabel(LLString::null);
+ mButton->setDisabledSelectedLabel(LLString::null);
mList->deselectAllItems();
}
@@ -309,7 +309,7 @@ void LLComboBox::sortByName()
// Choose an item with a given name in the menu.
// Returns TRUE if the item was found.
-BOOL LLComboBox::setSimple(const LLString& name)
+BOOL LLComboBox::setSimple(const LLStringExplicit& name)
{
BOOL found = mList->selectSimpleItem(name, FALSE);
@@ -371,7 +371,7 @@ LLSD LLComboBox::getValue() const
}
}
-void LLComboBox::setLabel(const LLString& name)
+void LLComboBox::setLabel(const LLStringExplicit& name)
{
if ( mAllowTextEntry )
{
@@ -803,7 +803,7 @@ void LLComboBox::setAllowTextEntry(BOOL allow, S32 max_chars, BOOL set_tentative
// clear label on button
LLString cur_label = mButton->getLabelSelected();
- setLabel("");
+ setLabel(LLString::null);
if (!mTextEntry)
{
LLRect text_entry_rect(0, mRect.getHeight(), mRect.getWidth(), 0);
@@ -852,7 +852,7 @@ void LLComboBox::setAllowTextEntry(BOOL allow, S32 max_chars, BOOL set_tentative
mTextEntryTentative = set_tentative;
}
-void LLComboBox::setTextEntry(const LLString& text)
+void LLComboBox::setTextEntry(const LLStringExplicit& text)
{
if (mTextEntry)
{
diff --git a/indra/llui/llcombobox.h b/indra/llui/llcombobox.h
index 9b47bfcabb..ff17d2874f 100644
--- a/indra/llui/llcombobox.h
+++ b/indra/llui/llcombobox.h
@@ -105,7 +105,7 @@ public:
virtual LLSD getValue() const;
void setAllowTextEntry(BOOL allow, S32 max_chars = 50, BOOL make_tentative = TRUE);
- void setTextEntry(const LLString& text);
+ void setTextEntry(const LLStringExplicit& text);
void add(const LLString& name, EAddPosition pos = ADD_BOTTOM, BOOL enabled = TRUE); // add item "name" to menu
void add(const LLString& name, const LLUUID& id, EAddPosition pos = ADD_BOTTOM, BOOL enabled = TRUE);
@@ -117,7 +117,7 @@ public:
void sortByName(); // Sort the entries in the combobox by name
// Select current item by name using selectSimpleItem. Returns FALSE if not found.
- BOOL setSimple(const LLString& name);
+ BOOL setSimple(const LLStringExplicit& name);
// Get name of current item. Returns an empty string if not found.
const LLString& getSimple() const;
// Get contents of column x of selected row
@@ -125,7 +125,7 @@ public:
// Sets the label, which doesn't have to exist in the label.
// This is probably a UI abuse.
- void setLabel(const LLString& name);
+ void setLabel(const LLStringExplicit& name);
BOOL remove(const LLString& name); // remove item "name", return TRUE if found and removed
diff --git a/indra/llui/lllineeditor.cpp b/indra/llui/lllineeditor.cpp
index 13947d0605..37ee4c46ba 100644
--- a/indra/llui/lllineeditor.cpp
+++ b/indra/llui/lllineeditor.cpp
@@ -320,12 +320,12 @@ void LLLineEditor::setBorderWidth(S32 left, S32 right)
mMaxHPixels = mRect.getWidth() - mMinHPixels - mBorderThickness - mBorderRight;
}
-void LLLineEditor::setLabel(const LLString &new_label)
+void LLLineEditor::setLabel(const LLStringExplicit &new_label)
{
mLabel = new_label;
}
-void LLLineEditor::setText(const LLString &new_text)
+void LLLineEditor::setText(const LLStringExplicit &new_text)
{
// If new text is identical, don't copy and don't move insertion point
if (mText.getString() == new_text)
@@ -2322,13 +2322,13 @@ LLSD LLLineEditor::getValue() const
return ret;
}
-BOOL LLLineEditor::setTextArg( const LLString& key, const LLString& text )
+BOOL LLLineEditor::setTextArg( const LLString& key, const LLStringExplicit& text )
{
mText.setArg(key, text);
return TRUE;
}
-BOOL LLLineEditor::setLabelArg( const LLString& key, const LLString& text )
+BOOL LLLineEditor::setLabelArg( const LLString& key, const LLStringExplicit& text )
{
mLabel.setArg(key, text);
return TRUE;
@@ -2353,8 +2353,7 @@ LLSearchEditor::LLSearchEditor(const LLString& name,
onSearchEdit,
NULL,
this);
- // TODO: this should be translatable
- mSearchEdit->setLabel("Type here to search");
+
mSearchEdit->setFollowsAll();
mSearchEdit->setSelectAllonFocusReceived(TRUE);
@@ -2409,13 +2408,13 @@ LLSD LLSearchEditor::getValue() const
}
//virtual
-BOOL LLSearchEditor::setTextArg( const LLString& key, const LLString& text )
+BOOL LLSearchEditor::setTextArg( const LLString& key, const LLStringExplicit& text )
{
return mSearchEdit->setTextArg(key, text);
}
//virtual
-BOOL LLSearchEditor::setLabelArg( const LLString& key, const LLString& text )
+BOOL LLSearchEditor::setLabelArg( const LLString& key, const LLStringExplicit& text )
{
return mSearchEdit->setLabelArg(key, text);
}
@@ -2437,7 +2436,7 @@ void LLSearchEditor::draw()
LLUICtrl::draw();
}
-void LLSearchEditor::setText(const LLString &new_text)
+void LLSearchEditor::setText(const LLStringExplicit &new_text)
{
mSearchEdit->setText(new_text);
}
@@ -2483,6 +2482,12 @@ LLView* LLSearchEditor::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFacto
max_text_length,
NULL, NULL);
+ LLString label;
+ if(node->getAttributeString("label", label))
+ {
+ search_editor->mSearchEdit->setLabel(label);
+ }
+
search_editor->setText(text);
search_editor->initFromXML(node, parent);
diff --git a/indra/llui/lllineeditor.h b/indra/llui/lllineeditor.h
index 0d1ec08ab2..2cd2ebf9fe 100644
--- a/indra/llui/lllineeditor.h
+++ b/indra/llui/lllineeditor.h
@@ -136,11 +136,11 @@ public:
// assumes UTF8 text
virtual void setValue(const LLSD& value );
virtual LLSD getValue() const;
- virtual BOOL setTextArg( const LLString& key, const LLString& text );
- virtual BOOL setLabelArg( const LLString& key, const LLString& text );
+ virtual BOOL setTextArg( const LLString& key, const LLStringExplicit& text );
+ virtual BOOL setLabelArg( const LLString& key, const LLStringExplicit& text );
- void setLabel(const LLString &new_label);
- void setText(const LLString &new_text);
+ void setLabel(const LLStringExplicit &new_label);
+ void setText(const LLStringExplicit &new_text);
const LLString& getText() const { return mText.getString(); }
const LLWString& getWText() const { return mText.getWString(); }
@@ -312,15 +312,15 @@ public:
virtual LLString getWidgetTag() const;
static LLView* fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *factory);
- void setText(const LLString &new_text);
+ void setText(const LLStringExplicit &new_text);
void setSearchCallback(void (*search_callback)(const LLString& search_string, void* user_data), void* data) { mSearchCallback = search_callback; mCallbackUserData = data; }
// LLUICtrl interface
virtual void setValue(const LLSD& value );
virtual LLSD getValue() const;
- virtual BOOL setTextArg( const LLString& key, const LLString& text );
- virtual BOOL setLabelArg( const LLString& key, const LLString& text );
+ virtual BOOL setTextArg( const LLString& key, const LLStringExplicit& text );
+ virtual BOOL setLabelArg( const LLString& key, const LLStringExplicit& text );
virtual void clear();
diff --git a/indra/llui/llmenugl.cpp b/indra/llui/llmenugl.cpp
index b8cdd52deb..9b4a2a168c 100644
--- a/indra/llui/llmenugl.cpp
+++ b/indra/llui/llmenugl.cpp
@@ -373,7 +373,7 @@ void LLMenuItemGL::setHighlightFGColor( const LLColor4& color )
// change the label
-void LLMenuItemGL::setLabel( const LLString& label )
+void LLMenuItemGL::setLabel( const LLStringExplicit& label )
{
mLabel = label;
}
@@ -598,7 +598,7 @@ void LLMenuItemGL::draw( void )
mGotHover = FALSE;
}
-BOOL LLMenuItemGL::setLabelArg( const LLString& key, const LLString& text )
+BOOL LLMenuItemGL::setLabelArg( const LLString& key, const LLStringExplicit& text )
{
mLabel.setArg(key, text);
return TRUE;
diff --git a/indra/llui/llmenugl.h b/indra/llui/llmenugl.h
index 6e5ac7482e..6dc9282ba6 100644
--- a/indra/llui/llmenugl.h
+++ b/indra/llui/llmenugl.h
@@ -127,8 +127,8 @@ public:
LLString getLabel( void ) const { return mLabel.getString(); }
// change the label
- void setLabel( const LLString& label );
- virtual BOOL setLabelArg( const LLString& key, const LLString& text );
+ void setLabel( const LLStringExplicit& label );
+ virtual BOOL setLabelArg( const LLString& key, const LLStringExplicit& text );
// Get the parent menu for this item
virtual LLMenuGL* getMenu();
@@ -443,7 +443,7 @@ public:
// return the name label
const LLString& getLabel( void ) const { return mLabel.getString(); }
- void setLabel(const LLString& label) { mLabel = label; }
+ void setLabel(const LLStringExplicit& label) { mLabel = label; }
static void setDefaultBackgroundColor( const LLColor4& color );
void setBackgroundColor( const LLColor4& color );
diff --git a/indra/llui/llpanel.cpp b/indra/llui/llpanel.cpp
index 8ff047efa7..3a0ee9b013 100644
--- a/indra/llui/llpanel.cpp
+++ b/indra/llui/llpanel.cpp
@@ -962,7 +962,7 @@ LLSD LLPanel::childGetValue(const LLString& id) const
return LLSD();
}
-BOOL LLPanel::childSetTextArg(const LLString& id, const LLString& key, const LLString& text)
+BOOL LLPanel::childSetTextArg(const LLString& id, const LLString& key, const LLStringExplicit& text)
{
LLUICtrl* child = (LLUICtrl*)getChildByName(id, true);
if (child)
@@ -972,7 +972,7 @@ BOOL LLPanel::childSetTextArg(const LLString& id, const LLString& key, const LLS
return FALSE;
}
-BOOL LLPanel::childSetLabelArg(const LLString& id, const LLString& key, const LLString& text)
+BOOL LLPanel::childSetLabelArg(const LLString& id, const LLString& key, const LLStringExplicit& text)
{
LLView* child = getChildByName(id, true);
if (child)
@@ -1033,7 +1033,7 @@ void LLPanel::childSetTabChangeCallback(const LLString& id, const LLString& tabn
}
}
-void LLPanel::childSetText(const LLString& id, const LLString& text)
+void LLPanel::childSetText(const LLString& id, const LLStringExplicit& text)
{
childSetValue(id, LLSD(text));
}
@@ -1106,7 +1106,7 @@ void LLPanel::childSetControlName(const LLString& id, const LLString& control_na
LLView* LLPanel::getChildByName(const LLString& name, BOOL recurse) const
{
LLView* view = LLUICtrl::getChildByName(name, recurse);
- if (!view)
+ if (!view && !recurse)
{
childNotFound(name);
}
diff --git a/indra/llui/llpanel.h b/indra/llui/llpanel.h
index 318c278be0..dfd7a51529 100644
--- a/indra/llui/llpanel.h
+++ b/indra/llui/llpanel.h
@@ -119,7 +119,7 @@ public:
void setBackgroundOpaque(BOOL b) { mBgOpaque = b; }
void setDefaultBtn(LLButton* btn = NULL);
void setDefaultBtn(const LLString& id);
- void setLabel(LLString label) { mLabel = label; }
+ void setLabel(const LLStringExplicit& label) { mLabel = label; }
LLString getLabel() const { return mLabel; }
void setRectControl(const LLString& rect_control) { mRectControl.assign(rect_control); }
@@ -192,8 +192,8 @@ public:
// For setting text / label replacement params, e.g. "Hello [NAME]"
// Not implemented for all types, defaults to noop, returns FALSE if not applicaple
- BOOL childSetTextArg(const LLString& id, const LLString& key, const LLString& text);
- BOOL childSetLabelArg(const LLString& id, const LLString& key, const LLString& text);
+ BOOL childSetTextArg(const LLString& id, const LLString& key, const LLStringExplicit& text);
+ BOOL childSetLabelArg(const LLString& id, const LLString& key, const LLStringExplicit& text);
// LLSlider / LLSpinCtrl
void childSetMinValue(const LLString& id, LLSD min_value);
@@ -208,7 +208,7 @@ public:
void childSetWrappedText(const LLString& id, const LLString& text, bool visible = true);
// LLTextBox/LLTextEditor/LLLineEditor
- void childSetText(const LLString& id, const LLString& text);
+ void childSetText(const LLString& id, const LLStringExplicit& text);
LLString childGetText(const LLString& id);
// LLLineEditor
diff --git a/indra/llui/llscrolllistctrl.cpp b/indra/llui/llscrolllistctrl.cpp
index 048cfa7e9d..f5eef29dcb 100644
--- a/indra/llui/llscrolllistctrl.cpp
+++ b/indra/llui/llscrolllistctrl.cpp
@@ -232,7 +232,7 @@ void LLScrollListText::setColor(const LLColor4& color)
*mColor = color;
}
-void LLScrollListText::setText(const LLString& text)
+void LLScrollListText::setText(const LLStringExplicit& text)
{
mText = text;
}
diff --git a/indra/llui/llscrolllistctrl.h b/indra/llui/llscrolllistctrl.h
index 78f34a2ed2..5ceee2e1f6 100644
--- a/indra/llui/llscrolllistctrl.h
+++ b/indra/llui/llscrolllistctrl.h
@@ -101,7 +101,7 @@ public:
virtual const LLString& getText() const { return mText.getString(); }
virtual BOOL getVisible() const { return mVisible; }
virtual void highlightText(S32 offset, S32 num_chars) {mHighlightOffset = offset; mHighlightCount = num_chars;}
- void setText(const LLString& text);
+ void setText(const LLStringExplicit& text);
virtual void setColor(const LLColor4&);
virtual BOOL isText() { return TRUE; }
@@ -169,10 +169,10 @@ class LLScrollListColumn
public:
// Default constructor
LLScrollListColumn() :
- mName(""),
- mSortingColumn(""),
- mSortAscending(TRUE),
- mLabel(""),
+ mName(),
+ mSortingColumn(),
+ mSortAscending(TRUE),
+ mLabel(),
mWidth(-1),
mRelWidth(-1.0),
mDynamicWidth(FALSE),
diff --git a/indra/llui/llsliderctrl.cpp b/indra/llui/llsliderctrl.cpp
index c46ec2252f..dd4a9941c5 100644
--- a/indra/llui/llsliderctrl.cpp
+++ b/indra/llui/llsliderctrl.cpp
@@ -170,7 +170,7 @@ void LLSliderCtrl::setValue(F32 v, BOOL from_event)
updateText();
}
-BOOL LLSliderCtrl::setLabelArg( const LLString& key, const LLString& text )
+BOOL LLSliderCtrl::setLabelArg( const LLString& key, const LLStringExplicit& text )
{
BOOL res = FALSE;
if (mLabelBox)
@@ -200,11 +200,11 @@ void LLSliderCtrl::clear()
setValue(0.0f);
if( mEditor )
{
- mEditor->setText( "" );
+ mEditor->setText( LLString::null );
}
if( mTextBox )
{
- mTextBox->setText( "" );
+ mTextBox->setText( LLString::null );
}
}
diff --git a/indra/llui/llsliderctrl.h b/indra/llui/llsliderctrl.h
index d5485e6a63..fa6c0bccae 100644
--- a/indra/llui/llsliderctrl.h
+++ b/indra/llui/llsliderctrl.h
@@ -80,7 +80,7 @@ public:
virtual void setValue(const LLSD& value ) { setValue((F32)value.asReal(), TRUE); }
virtual LLSD getValue() const { return LLSD(getValueF32()); }
- virtual BOOL setLabelArg( const LLString& key, const LLString& text );
+ virtual BOOL setLabelArg( const LLString& key, const LLStringExplicit& text );
virtual void setMinValue(LLSD min_value) { setMinValue((F32)min_value.asReal()); }
virtual void setMaxValue(LLSD max_value) { setMaxValue((F32)max_value.asReal()); }
@@ -97,7 +97,7 @@ public:
F32 getMinValue() { return mSlider->getMinValue(); }
F32 getMaxValue() { return mSlider->getMaxValue(); }
- void setLabel(const LLString& label) { if (mLabelBox) mLabelBox->setText(label); }
+ void setLabel(const LLStringExplicit& label) { if (mLabelBox) mLabelBox->setText(label); }
void setLabelColor(const LLColor4& c) { mTextEnabledColor = c; }
void setDisabledLabelColor(const LLColor4& c) { mTextDisabledColor = c; }
diff --git a/indra/llui/llspinctrl.cpp b/indra/llui/llspinctrl.cpp
index 4e7218e141..2be2814080 100644
--- a/indra/llui/llspinctrl.cpp
+++ b/indra/llui/llspinctrl.cpp
@@ -385,7 +385,7 @@ void LLSpinCtrl::setPrecision(S32 precision)
updateEditor();
}
-void LLSpinCtrl::setLabel(const LLString& label)
+void LLSpinCtrl::setLabel(const LLStringExplicit& label)
{
if (mLabelBox)
{
diff --git a/indra/llui/llspinctrl.h b/indra/llui/llspinctrl.h
index 7795e26719..f2c7b40cfe 100644
--- a/indra/llui/llspinctrl.h
+++ b/indra/llui/llspinctrl.h
@@ -96,7 +96,7 @@ public:
virtual void setMaxValue(F32 max) { mMaxValue = max; }
virtual void setIncrement(F32 inc) { mIncrement = inc; }
- void setLabel(const LLString& label);
+ void setLabel(const LLStringExplicit& label);
void setLabelColor(const LLColor4& c) { mTextEnabledColor = c; }
void setDisabledLabelColor(const LLColor4& c) { mTextDisabledColor = c; }
diff --git a/indra/llui/lltextbox.cpp b/indra/llui/lltextbox.cpp
index 4251f81322..c0b0788c0b 100644
--- a/indra/llui/lltextbox.cpp
+++ b/indra/llui/lltextbox.cpp
@@ -161,7 +161,7 @@ BOOL LLTextBox::handleMouseUp(S32 x, S32 y, MASK mask)
return handled;
}
-void LLTextBox::setText(const LLString& text)
+void LLTextBox::setText(const LLStringExplicit& text)
{
mText.assign(text);
setLineLengths();
@@ -194,7 +194,7 @@ void LLTextBox::setLineLengths()
}
}
-void LLTextBox::setWrappedText(const LLString& in_text, F32 max_width)
+void LLTextBox::setWrappedText(const LLStringExplicit& in_text, F32 max_width)
{
if (max_width < 0.0)
{
@@ -286,7 +286,7 @@ LLSD LLTextBox::getValue() const
return LLSD(getText());
}
-BOOL LLTextBox::setTextArg( const LLString& key, const LLString& text )
+BOOL LLTextBox::setTextArg( const LLString& key, const LLStringExplicit& text )
{
mText.setArg(key, text);
setLineLengths();
diff --git a/indra/llui/lltextbox.h b/indra/llui/lltextbox.h
index 24ad4d7aae..7e7018ac52 100644
--- a/indra/llui/lltextbox.h
+++ b/indra/llui/lltextbox.h
@@ -71,8 +71,8 @@ public:
void setDisabledColor( const LLColor4& c) { mDisabledColor = c; }
void setBackgroundColor( const LLColor4& c) { mBackgroundColor = c; }
void setBorderColor( const LLColor4& c) { mBorderColor = c; }
- void setText( const LLString& text );
- void setWrappedText(const LLString& text, F32 max_width = -1.0);
+ void setText( const LLStringExplicit& text );
+ void setWrappedText(const LLStringExplicit& text, F32 max_width = -1.0);
// default width means use existing control width
void setBackgroundVisible(BOOL visible) { mBackgroundVisible = visible; }
@@ -97,7 +97,7 @@ public:
virtual void setValue(const LLSD& value );
virtual LLSD getValue() const;
- virtual BOOL setTextArg( const LLString& key, const LLString& text );
+ virtual BOOL setTextArg( const LLString& key, const LLStringExplicit& text );
protected:
void setLineLengths();
diff --git a/indra/llui/lltexteditor.cpp b/indra/llui/lltexteditor.cpp
index cede015016..12ad339886 100644
--- a/indra/llui/lltexteditor.cpp
+++ b/indra/llui/lltexteditor.cpp
@@ -520,7 +520,7 @@ void LLTextEditor::truncate()
}
}
-void LLTextEditor::setText(const LLString &utf8str)
+void LLTextEditor::setText(const LLStringExplicit &utf8str)
{
// LLString::removeCRLF(utf8str);
mUTF8Text = utf8str_removeCRLF(utf8str);
@@ -3068,7 +3068,7 @@ void LLTextEditor::onTabInto()
void LLTextEditor::clear()
{
- setText("");
+ setText(LLString::null);
}
// Start or stop the editor from accepting text-editing keystrokes
@@ -3949,7 +3949,7 @@ BOOL LLTextEditor::importBuffer(const LLString& buffer )
if( success )
{
// Actually set the text
- setText( text );
+ setText( LLStringExplicit(text) );
}
delete[] text;
diff --git a/indra/llui/lltexteditor.h b/indra/llui/lltexteditor.h
index f3d03ab1d6..55aba57551 100644
--- a/indra/llui/lltexteditor.h
+++ b/indra/llui/lltexteditor.h
@@ -231,7 +231,7 @@ public:
const LLString& getText() const;
// Non-undoable
- void setText(const LLString &utf8str);
+ void setText(const LLStringExplicit &utf8str);
void setWText(const LLWString &wtext);
S32 getMaxLength() const { return mMaxTextLength; }
diff --git a/indra/llui/lluictrl.cpp b/indra/llui/lluictrl.cpp
index ea1b53502e..7d354753d3 100644
--- a/indra/llui/lluictrl.cpp
+++ b/indra/llui/lluictrl.cpp
@@ -99,13 +99,13 @@ void LLUICtrl::onCommit()
}
// virtual
-BOOL LLUICtrl::setTextArg( const LLString& key, const LLString& text )
+BOOL LLUICtrl::setTextArg( const LLString& key, const LLStringExplicit& text )
{
return FALSE;
}
// virtual
-BOOL LLUICtrl::setLabelArg( const LLString& key, const LLString& text )
+BOOL LLUICtrl::setLabelArg( const LLString& key, const LLStringExplicit& text )
{
return FALSE;
}
diff --git a/indra/llui/lluictrl.h b/indra/llui/lluictrl.h
index 0227157636..00f78748a7 100644
--- a/indra/llui/lluictrl.h
+++ b/indra/llui/lluictrl.h
@@ -72,10 +72,10 @@ public:
virtual LLSD getValue() const { return LLSD(); }
// Defaults to no-op
- virtual BOOL setTextArg( const LLString& key, const LLString& text );
+ virtual BOOL setTextArg( const LLString& key, const LLStringExplicit& text );
// Defaults to no-op
- virtual BOOL setLabelArg( const LLString& key, const LLString& text );
+ virtual BOOL setLabelArg( const LLString& key, const LLStringExplicit& text );
// Defaults to return NULL
virtual LLCtrlSelectionInterface* getSelectionInterface();
diff --git a/indra/llui/lluictrlfactory.cpp b/indra/llui/lluictrlfactory.cpp
index 503b83bca2..4b4c4636d5 100644
--- a/indra/llui/lluictrlfactory.cpp
+++ b/indra/llui/lluictrlfactory.cpp
@@ -473,7 +473,7 @@ LLPieMenu *LLUICtrlFactory::buildPieMenu(const LLString &filename, LLView* paren
// root must be called panel
if( !root->hasName( LL_PIE_MENU_TAG ))
{
- llwarns << "Root node should be named " LL_PIE_MENU_TAG " in : " << filename << llendl;
+ llwarns << "Root node should be named " << LL_PIE_MENU_TAG << " in : " << filename << llendl;
return NULL;
}
@@ -808,3 +808,4 @@ void LLUICtrlFactory::registerCreator(LLString ctrlname, creator_function_t func
mCreatorFunctions[ctrlname] = function;
}
+
diff --git a/indra/llui/llview.cpp b/indra/llui/llview.cpp
index 192ba1f1ab..ef91d9c85e 100644
--- a/indra/llui/llview.cpp
+++ b/indra/llui/llview.cpp
@@ -786,7 +786,7 @@ void LLView::setHidden(BOOL hidden)
}
// virtual
-BOOL LLView::setLabelArg(const LLString& key, const LLString& text)
+BOOL LLView::setLabelArg(const LLString& key, const LLStringExplicit& text)
{
return FALSE;
}
@@ -1712,7 +1712,8 @@ BOOL LLView::hasChild(const LLString& childname, BOOL recurse) const
//-----------------------------------------------------------------------------
LLView* LLView::getChildByName(const LLString& name, BOOL recurse) const
{
- if(name.empty()) return NULL;
+ if(name.empty())
+ return NULL;
child_list_const_iter_t child_it;
// Look for direct children *first*
for ( child_it = mChildList.begin(); child_it != mChildList.end(); ++child_it)
@@ -1725,7 +1726,7 @@ LLView* LLView::getChildByName(const LLString& name, BOOL recurse) const
}
if (recurse)
{
- // Look inside the child as well.
+ // Look inside each child as well.
for ( child_it = mChildList.begin(); child_it != mChildList.end(); ++child_it)
{
LLView* childp = *child_it;
diff --git a/indra/llui/llview.h b/indra/llui/llview.h
index 91351612db..63c1efc296 100644
--- a/indra/llui/llview.h
+++ b/indra/llui/llview.h
@@ -290,7 +290,7 @@ public:
virtual void setHidden(BOOL hidden); // Never show (replacement text)
// by default, does nothing and returns false
- virtual BOOL setLabelArg( const LLString& key, const LLString& text );
+ virtual BOOL setLabelArg( const LLString& key, const LLStringExplicit& text );
virtual void onVisibilityChange ( BOOL curVisibilityIn );
diff --git a/indra/llxml/llxmlnode.h b/indra/llxml/llxmlnode.h
index 51837ebf14..7c221574ac 100644
--- a/indra/llxml/llxmlnode.h
+++ b/indra/llxml/llxmlnode.h
@@ -132,8 +132,8 @@ public:
LLXMLNodePtr& node,
LLXMLNodePtr& update_node);
static void writeHeaderToFile(FILE *fOut);
- void writeToFile(FILE *fOut, LLString indent = "");
- void writeToOstream(std::ostream& output_stream, const LLString& indent = "");
+ void writeToFile(FILE *fOut, LLString indent = LLString());
+ void writeToOstream(std::ostream& output_stream, const LLString& indent = LLString());
// Utility
void findName(const LLString& name, LLXMLNodeList &results);
diff --git a/indra/newview/llagent.cpp b/indra/newview/llagent.cpp
index 1a20d8da20..d825704bfc 100644
--- a/indra/newview/llagent.cpp
+++ b/indra/newview/llagent.cpp
@@ -2038,7 +2038,8 @@ void LLAgent::setAFK()
gAwayTimer.start();
if (gAFKMenu)
{
- gAFKMenu->setLabel("Set Not Away");
+ //*TODO:Translate
+ gAFKMenu->setLabel(LLString("Set Not Away"));
}
}
}
@@ -2061,7 +2062,8 @@ void LLAgent::clearAFK()
clearControlFlags(AGENT_CONTROL_AWAY);
if (gAFKMenu)
{
- gAFKMenu->setLabel("Set Away");
+ //*TODO:Translate
+ gAFKMenu->setLabel(LLString("Set Away"));
}
}
}
@@ -2083,7 +2085,8 @@ void LLAgent::setBusy()
mIsBusy = TRUE;
if (gBusyMenu)
{
- gBusyMenu->setLabel("Set Not Busy");
+ //*TODO:Translate
+ gBusyMenu->setLabel(LLString("Set Not Busy"));
}
if (gFloaterMute)
{
@@ -2100,7 +2103,8 @@ void LLAgent::clearBusy()
sendAnimationRequest(ANIM_AGENT_BUSY, ANIM_REQUEST_STOP);
if (gBusyMenu)
{
- gBusyMenu->setLabel("Set Busy");
+ //*TODO:Translate
+ gBusyMenu->setLabel(LLString("Set Busy"));
}
if (gFloaterMute)
{
@@ -4888,7 +4892,7 @@ void LLAgent::buildLocationString(std::string& str)
// create a defult name and description for the landmark
std::string buffer;
- if( !strcmp("", gParcelMgr->getAgentParcelName()) )
+ if( gParcelMgr->getAgentParcelName().empty() )
{
// the parcel doesn't have a name
buffer = llformat("%.32s (%d, %d, %d)",
@@ -4899,7 +4903,7 @@ void LLAgent::buildLocationString(std::string& str)
{
// the parcel has a name, so include it in the landmark name
buffer = llformat("%.32s, %.32s (%d, %d, %d)",
- gParcelMgr->getAgentParcelName(),
+ gParcelMgr->getAgentParcelName().c_str(),
getRegion()->getName().c_str(),
pos_x, pos_y, pos_z);
}
diff --git a/indra/newview/llagent.h b/indra/newview/llagent.h
index 991a55b796..5b6c3c0a1d 100644
--- a/indra/newview/llagent.h
+++ b/indra/newview/llagent.h
@@ -422,7 +422,7 @@ public:
void propagate(const F32 dt); // BUG: should roll into updateAgentPosition
- void startAutoPilotGlobal(const LLVector3d &pos_global, const std::string& behavior_name = "", const LLQuaternion *target_rotation = NULL,
+ void startAutoPilotGlobal(const LLVector3d &pos_global, const std::string& behavior_name = std::string(), const LLQuaternion *target_rotation = NULL,
void (*finish_callback)(BOOL, void *) = NULL, void *callback_data = NULL, F32 stop_distance = 0.f, F32 rotation_threshold = 0.03f);
void startFollowPilot(const LLUUID &leader_id);
diff --git a/indra/newview/llcallingcard.cpp b/indra/newview/llcallingcard.cpp
index c876a24aa8..b80c2bb5e3 100644
--- a/indra/newview/llcallingcard.cpp
+++ b/indra/newview/llcallingcard.cpp
@@ -681,7 +681,6 @@ void LLAvatarTracker::processNotify(LLMessageSystem* msg, bool online)
}
}
-// XUI:translate
void LLAvatarTracker::formFriendship(const LLUUID& id)
{
if(id.notNull())
@@ -849,3 +848,4 @@ bool LLCollectAllBuddies::operator()(const LLUUID& buddy_id, LLRelationship* bud
return true;
}
+
diff --git a/indra/newview/llcompilequeue.cpp b/indra/newview/llcompilequeue.cpp
index 33109ad5ce..cebd51d4da 100644
--- a/indra/newview/llcompilequeue.cpp
+++ b/indra/newview/llcompilequeue.cpp
@@ -59,13 +59,11 @@
#include "llviewerstats.h"
#include "llvieweruictrlfactory.h"
-// XUI:translate
-
///----------------------------------------------------------------------------
/// Local function declarations, constants, enums, and typedefs
///----------------------------------------------------------------------------
-// XUI:translate
+// *TODO:Translate
const char* COMPILE_QUEUE_TITLE = "Recompilation Progress";
const char* COMPILE_START_STRING = "recompile";
const char* RESET_QUEUE_TITLE = "Reset Progress";
diff --git a/indra/newview/llcurrencyuimanager.cpp b/indra/newview/llcurrencyuimanager.cpp
index 6f649acb29..1e97df0b8b 100644
--- a/indra/newview/llcurrencyuimanager.cpp
+++ b/indra/newview/llcurrencyuimanager.cpp
@@ -380,7 +380,7 @@ void LLCurrencyUIManager::Impl::updateUI()
{
if (!mZeroMessage.empty() && mUserCurrencyBuy == 0)
{
- lindenAmount->setText("");
+ lindenAmount->setText(LLString::null);
}
else
{
@@ -459,20 +459,20 @@ bool LLCurrencyUIManager::process()
return changed;
}
-void LLCurrencyUIManager::buy()
+void LLCurrencyUIManager::buy(const LLString& buy_msg)
{
if (!canBuy())
{
return;
}
- // XUI:translate
+ LLUIString msg = buy_msg;
+ msg.setArg("[LINDENS]", llformat("%d", impl.mUserCurrencyBuy));
+ msg.setArg("[USD]", llformat("%#.2f", impl.mSiteCurrencyEstimatedCost / 100.0));
LLConfirmationManager::confirm(impl.mSiteConfirm,
- llformat("Buy L$ %d for approx. US$ %#.2f\n",
- impl.mUserCurrencyBuy,
- impl.mSiteCurrencyEstimatedCost / 100.0),
- impl,
- &LLCurrencyUIManager::Impl::startCurrencyBuy);
+ msg,
+ impl,
+ &LLCurrencyUIManager::Impl::startCurrencyBuy);
}
@@ -518,3 +518,4 @@ std::string LLCurrencyUIManager::errorURI()
return impl.mErrorURI;
}
+
diff --git a/indra/newview/llcurrencyuimanager.h b/indra/newview/llcurrencyuimanager.h
index 7a3a8b7060..bb135d0189 100644
--- a/indra/newview/llcurrencyuimanager.h
+++ b/indra/newview/llcurrencyuimanager.h
@@ -71,7 +71,7 @@ public:
// call periodically, for example, from draw()
// returns true if the UI needs to be updated
- void buy();
+ void buy(const LLString& buy_msg);
// call to initiate the purchase
bool inProcess(); // is a transaction in process
@@ -93,3 +93,4 @@ private:
#endif
+
diff --git a/indra/newview/lldebugmessagebox.cpp b/indra/newview/lldebugmessagebox.cpp
index a66aef86fd..de185e280d 100644
--- a/indra/newview/lldebugmessagebox.cpp
+++ b/indra/newview/lldebugmessagebox.cpp
@@ -218,22 +218,22 @@ void LLDebugVarMessageBox::onClose(bool app_quitting)
void LLDebugVarMessageBox::draw()
{
- char text[128]; /*Flawfinder: ignore*/
+ LLString text;
switch(mVarType)
{
- case VAR_TYPE_F32:
- snprintf(text, sizeof(text), "%.3f", *((F32*)mVarData)); /* Flawfinder: ignore */
+ case VAR_TYPE_F32:
+ text = llformat("%.3f", *((F32*)mVarData));
break;
- case VAR_TYPE_S32:
- snprintf(text, sizeof(text), "%d", *((S32*)mVarData)); /* Flawfinder: ignore */
+ case VAR_TYPE_S32:
+ text = llformat("%d", *((S32*)mVarData));
break;
- case VAR_TYPE_VEC3:
- {
- LLVector3* vec_p = (LLVector3*)mVarData;
- snprintf(text, sizeof(text), "%.3f %.3f %.3f", vec_p->mV[VX], vec_p->mV[VY], vec_p->mV[VZ]); /* Flawfinder: ignore */
- break;
- }
- default:
+ case VAR_TYPE_VEC3:
+ {
+ LLVector3* vec_p = (LLVector3*)mVarData;
+ text= llformat("%.3f %.3f %.3f", vec_p->mV[VX], vec_p->mV[VY], vec_p->mV[VZ]);
+ break;
+ }
+ default:
llwarns << "Unhandled var type " << mVarType << llendl;
break;
}
diff --git a/indra/newview/lldrawpoolbump.h b/indra/newview/lldrawpoolbump.h
index 45b554905f..15d84639fe 100644
--- a/indra/newview/lldrawpoolbump.h
+++ b/indra/newview/lldrawpoolbump.h
@@ -90,7 +90,7 @@ enum EBumpEffect
class LLStandardBumpmap
{
public:
- LLStandardBumpmap() : mLabel("") {}
+ LLStandardBumpmap() : mLabel() {}
LLStandardBumpmap( const char* label ) : mLabel(label) {}
LLString mLabel;
diff --git a/indra/newview/llfloaterabout.cpp b/indra/newview/llfloaterabout.cpp
index d6f00f8110..460b719094 100644
--- a/indra/newview/llfloaterabout.cpp
+++ b/indra/newview/llfloaterabout.cpp
@@ -96,10 +96,10 @@ LLFloaterAbout::LLFloaterAbout()
LLViewerRegion* region = gAgent.getRegion();
if (region)
{
- //XUI:translate
const LLVector3d &pos = gAgent.getPositionGlobal();
- LLString pos_text = llformat("You are at %.1f, %.1f, %.1f ",
- pos.mdV[VX], pos.mdV[VY], pos.mdV[VZ]);
+ LLUIString pos_text = childGetText("you_are_at");
+ pos_text.setArg("[POSITION]",
+ llformat("%.1f, %.1f, %.1f ", pos.mdV[VX], pos.mdV[VY], pos.mdV[VZ]));
support.append(pos_text);
LLString region_text = llformat("in %s located at ",
@@ -117,6 +117,10 @@ LLFloaterAbout::LLFloaterAbout()
support.append("\n\n");
}
+ //*NOTE: Do not translate text like GPU, Graphics Card, etc -
+ // Most PC users that know what these mean will be used to the english versions,
+ // and this info sometimes gets sent to support
+
// CPU
support.append("CPU: ");
support.append( gSysCPU.getCPUString() );
diff --git a/indra/newview/llfloateranimpreview.cpp b/indra/newview/llfloateranimpreview.cpp
index 1d89a07c43..71c221775e 100644
--- a/indra/newview/llfloateranimpreview.cpp
+++ b/indra/newview/llfloateranimpreview.cpp
@@ -294,8 +294,7 @@ BOOL LLFloaterAnimPreview::postBuild()
delete mAnimPreview;
mAnimPreview = NULL;
mMotionID.setNull();
- // XUI:translate
- childSetValue("bad_animation_text", LLSD("Failed to initialize motion."));
+ childSetValue("bad_animation_text", childGetText("failed_to_initialize"));
mEnabled = FALSE;
}
}
@@ -305,18 +304,16 @@ BOOL LLFloaterAnimPreview::postBuild()
{
if (loaderp->getDuration() > MAX_ANIM_DURATION)
{
- char output_str[256]; /*Flawfinder: ignore*/
-
- snprintf(output_str, sizeof(output_str), "Animation file is %.1f seconds in length.\n\nMaximum animation length is %.1f seconds.\n", /* Flawfinder: ignore */
- loaderp->getDuration(), MAX_ANIM_DURATION);
- childSetValue("bad_animation_text", LLSD(output_str));
+ LLUIString out_str = childGetText("anim_too_long");
+ out_str.setArg("[LENGTH]", llformat("%.1f", loaderp->getDuration()));
+ out_str.setArg("[MAX_LENGTH]", llformat("%.1f", MAX_ANIM_DURATION));
+ childSetValue("bad_animation_text", out_str.getString());
}
else
{
- char* status = loaderp->getStatus();
- LLString error_string("Unable to read animation file.\n\n");
- error_string += LLString(status);
- childSetValue("bad_animation_text", LLSD(error_string));
+ LLUIString out_str = childGetText("failed_file_read");
+ out_str.setArg("[STATUS]", loaderp->getStatus()); // *TODO:Translate
+ childSetValue("bad_animation_text", out_str.getString());
}
}
@@ -1158,3 +1155,4 @@ void LLPreviewAnimation::pan(F32 right, F32 up)
mCameraOffset.mV[VZ] = llclamp(mCameraOffset.mV[VZ] + up * mCameraDistance / mCameraZoom, -1.f, 1.f);
}
+
diff --git a/indra/newview/llfloaterauction.cpp b/indra/newview/llfloaterauction.cpp
index 44ebe0c98b..bc00565a28 100644
--- a/indra/newview/llfloaterauction.cpp
+++ b/indra/newview/llfloaterauction.cpp
@@ -126,7 +126,7 @@ void LLFloaterAuction::initialize()
}
else
{
- childSetText("parcel_text", "");
+ childSetText("parcel_text", LLString::null);
}
mParcelID = -1;
childSetEnabled("snapshot_btn", false);
diff --git a/indra/newview/llfloaterbuy.cpp b/indra/newview/llfloaterbuy.cpp
index 7767a37ccb..707ec0e852 100644
--- a/indra/newview/llfloaterbuy.cpp
+++ b/indra/newview/llfloaterbuy.cpp
@@ -113,21 +113,23 @@ void LLFloaterBuy::show(const LLSaleInfo& sale_info)
sInstance->center();
LLSelectNode* node = selection->getFirstRootNode();
- if (!node) return;
+ if (!node)
+ return;
// Set title based on sale type
- std::ostringstream title;
+ LLUIString title;
switch (sale_info.getSaleType())
{
- case LLSaleInfo::FS_ORIGINAL:
- title << "Buy " << node->mName; // XUI:translate
+ case LLSaleInfo::FS_ORIGINAL:
+ title = sInstance->childGetText("title_buy_text");
break;
- case LLSaleInfo::FS_COPY:
- default:
- title << "Buy Copy of " << node->mName; // XUI:translate
+ case LLSaleInfo::FS_COPY:
+ default:
+ title = sInstance->childGetText("title_buy_copy_text");
break;
}
- sInstance->setTitle(title.str());
+ title.setArg("[NAME]", node->mName);
+ sInstance->setTitle(title);
LLUUID owner_id;
LLString owner_name;
@@ -163,15 +165,15 @@ void LLFloaterBuy::show(const LLSaleInfo& sale_info)
LLString text = node->mName;
if (!(next_owner_mask & PERM_COPY))
{
- text.append(" (no copy)"); // XUI:translate
+ text.append(sInstance->childGetText("no_copy_text"));
}
if (!(next_owner_mask & PERM_MODIFY))
{
- text.append(" (no modify)"); // XUI:translate
+ text.append(sInstance->childGetText("no_modify_text"));
}
if (!(next_owner_mask & PERM_TRANSFER))
{
- text.append(" (no transfer)"); // XUI:translate
+ text.append(sInstance->childGetText("no_transfer_text"));
}
row["columns"][1]["column"] = "text";
diff --git a/indra/newview/llfloaterbuycontents.cpp b/indra/newview/llfloaterbuycontents.cpp
index b99b2bac1e..38266797cf 100644
--- a/indra/newview/llfloaterbuycontents.cpp
+++ b/indra/newview/llfloaterbuycontents.cpp
@@ -238,20 +238,19 @@ void LLFloaterBuyContents::inventoryChanged(LLViewerObject* obj,
U32 next_owner_mask = inv_item->getPermissions().getMaskNextOwner();
LLString text = (*it)->getName();
- // *TODO: Move into shared library function.
if (!(next_owner_mask & PERM_COPY))
{
- text.append(" (no copy)"); // XUI:translate
+ text.append(childGetText("no_copy_text"));
}
if (!(next_owner_mask & PERM_MODIFY))
{
- text.append(" (no modify)"); // XUI:translate
+ text.append(childGetText("no_modify_text"));
}
if (!(next_owner_mask & PERM_TRANSFER))
{
- text.append(" (no transfer)"); // XUI:translate
+ text.append(childGetText("no_transfer_text"));
}
-
+
row["columns"][1]["column"] = "text";
row["columns"][1]["value"] = text;
row["columns"][1]["font"] = "SANSSERIF";
diff --git a/indra/newview/llfloaterbuycurrency.cpp b/indra/newview/llfloaterbuycurrency.cpp
index 2da9c95a19..a7233c310a 100644
--- a/indra/newview/llfloaterbuycurrency.cpp
+++ b/indra/newview/llfloaterbuycurrency.cpp
@@ -316,7 +316,7 @@ void LLFloaterBuyCurrencyUI::onClickBuy(void* data)
LLFloaterBuyCurrencyUI* self = LLFloaterBuyCurrencyUI::soleInstance(false);
if (self)
{
- self->mManager.buy();
+ self->mManager.buy(self->childGetText("buy_currency"));
self->updateUI();
// JC: updateUI() doesn't get called again until progress is made
// with transaction processing, so the "Purchase" button would be
@@ -377,3 +377,4 @@ void LLFloaterBuyCurrency::buyCurrency(const std::string& name, S32 price)
ui->open();
}
+
diff --git a/indra/newview/llfloaterbuyland.cpp b/indra/newview/llfloaterbuyland.cpp
index c6bb53aed7..9ae634c76f 100644
--- a/indra/newview/llfloaterbuyland.cpp
+++ b/indra/newview/llfloaterbuyland.cpp
@@ -1022,9 +1022,9 @@ void LLFloaterBuyLandUI::refreshUI()
}
else
{
- childSetText("info_parcel", "(no parcel selected)");
- childSetText("info_size", "");
- childSetText("info_price", "");
+ childSetText("info_parcel", childGetText("no_parcel_selected"));
+ childSetText("info_size", LLString::null);
+ childSetText("info_price", LLString::null);
}
childSetText("info_action",
@@ -1127,7 +1127,7 @@ void LLFloaterBuyLandUI::refreshUI()
if (mIsForGroup)
{
- childSetTextArg("insufficient_land_credits", "[GROUP]", gAgent.mGroupName);
+ childSetTextArg("insufficient_land_credits", "[GROUP]", LLString(gAgent.mGroupName));
message += childGetText("insufficient_land_credits");
@@ -1306,7 +1306,7 @@ void LLFloaterBuyLandUI::startBuyPreConfirm()
}
childSetTextArg("pay_to_for_land", "[AMOUNT]", llformat("%d", mParcelPrice));
- childSetTextArg("pay_to_for_land", "[SELLER]", mParcelSellerName.c_str());
+ childSetTextArg("pay_to_for_land", "[SELLER]", mParcelSellerName);
action += childGetText("pay_to_for_land");
@@ -1349,3 +1349,4 @@ void LLFloaterBuyLandUI::onClickErrorWeb(void* data)
self->close();
}
+
diff --git a/indra/newview/llfloatercolorpicker.cpp b/indra/newview/llfloatercolorpicker.cpp
index bdb927cac7..03e3a2e967 100644
--- a/indra/newview/llfloatercolorpicker.cpp
+++ b/indra/newview/llfloatercolorpicker.cpp
@@ -83,6 +83,7 @@ LLFloaterColorPicker (LLColorSwatchCtrl* swatch, BOOL show_apply_immediate )
mMouseDownInLumRegion ( FALSE ),
mMouseDownInHueRegion ( FALSE ),
mMouseDownInSwatch ( FALSE ),
+ // *TODO: Specify this in XML
mRGBViewerImageLeft ( 140 ),
mRGBViewerImageTop ( 356 ),
mRGBViewerImageWidth ( 256 ),
@@ -92,17 +93,19 @@ LLFloaterColorPicker (LLColorSwatchCtrl* swatch, BOOL show_apply_immediate )
mLumRegionWidth ( 16 ),
mLumRegionHeight ( mRGBViewerImageHeight ),
mLumMarkerSize ( 6 ),
+ // *TODO: Specify this in XML
mSwatchRegionLeft ( 12 ),
- mSwatchRegionTop ( 160 + 16 - 4 ), // get help text baseline to line up with bottom of RGB viewer
- mSwatchRegionWidth ( 110 ),
+ mSwatchRegionTop ( 190 ),
+ mSwatchRegionWidth ( 116 ),
mSwatchRegionHeight ( 60 ),
mSwatchView ( NULL ),
+ // *TODO: Specify this in XML
numPaletteColumns ( 16 ),
numPaletteRows ( 2 ),
highlightEntry ( -1 ),
- mPaletteRegionLeft ( mSwatchRegionLeft - 1 ),
+ mPaletteRegionLeft ( 11 ),
mPaletteRegionTop ( 100 - 8 ),
- mPaletteRegionWidth ( mLumRegionLeft + mLumRegionWidth - mSwatchRegionLeft + 2 ),
+ mPaletteRegionWidth ( mLumRegionLeft + mLumRegionWidth - 10 ),
mPaletteRegionHeight ( 40 ),
mSwatch ( swatch ),
mActive ( TRUE ),
diff --git a/indra/newview/llfloaterfriends.cpp b/indra/newview/llfloaterfriends.cpp
index 4a614ca8e1..6f792e062f 100644
--- a/indra/newview/llfloaterfriends.cpp
+++ b/indra/newview/llfloaterfriends.cpp
@@ -422,7 +422,7 @@ void LLPanelFriends::refreshUI()
single_selected = TRUE;
if(num_selected > 1)
{
- childSetText("friend_name_label", "Multiple friends...");
+ childSetText("friend_name_label", childGetText("Multiple"));
multiple_selected = TRUE;
}
else
@@ -432,7 +432,7 @@ void LLPanelFriends::refreshUI()
}
else
{
- childSetText("friend_name_label", "");
+ childSetText("friend_name_label", LLString::null);
}
diff --git a/indra/newview/llfloatergodtools.cpp b/indra/newview/llfloatergodtools.cpp
index 6a56052e12..27d427115b 100644
--- a/indra/newview/llfloatergodtools.cpp
+++ b/indra/newview/llfloatergodtools.cpp
@@ -1260,8 +1260,8 @@ void LLPanelObjectTools::onClickSetBySelection(void* data)
LLPanelObjectTools* panelp = (LLPanelObjectTools*) data;
if (!panelp) return;
- LLSelectNode* node = gSelectMgr->getSelection()->getFirstRootNode();
- if (!node) node = gSelectMgr->getSelection()->getFirstNode();
+ const BOOL non_root_ok = TRUE;
+ LLSelectNode* node = gSelectMgr->getSelection()->getFirstRootNode(NULL, non_root_ok);
if (!node) return;
LLString owner_name;
diff --git a/indra/newview/llfloatergodtools.h b/indra/newview/llfloatergodtools.h
index f817a7bda1..53e250f67e 100644
--- a/indra/newview/llfloatergodtools.h
+++ b/indra/newview/llfloatergodtools.h
@@ -109,8 +109,6 @@ protected:
LLFloaterGodTools();
~LLFloaterGodTools();
- void setStatusText(const std::string& text);
-
// When the floater is going away, reset any options that need to be
// cleared.
void resetToolState();
diff --git a/indra/newview/llfloaterinspect.cpp b/indra/newview/llfloaterinspect.cpp
index 0f9f60a49a..0ce91ef740 100644
--- a/indra/newview/llfloaterinspect.cpp
+++ b/indra/newview/llfloaterinspect.cpp
@@ -97,27 +97,28 @@ void LLFloaterInspect::show(void* ignored)
void LLFloaterInspect::onClickCreatorProfile(void* ctrl)
{
- if(sInstance->mObjectList->getAllSelected().size() == 0) return;
+ if(sInstance->mObjectList->getAllSelected().size() == 0)
+ {
+ return;
+ }
LLScrollListItem* first_selected =
sInstance->mObjectList->getFirstSelected();
if (first_selected)
{
- LLSelectNode* obj= sInstance->mObjectSelection->getFirstNode();
- LLUUID obj_id, creator_id;
- obj_id = first_selected->getUUID();
- while(obj)
+ struct f : public LLSelectedNodeFunctor
{
- if(obj_id == obj->getObject()->getID())
+ LLUUID obj_id;
+ f(const LLUUID& id) : obj_id(id) {}
+ virtual bool apply(LLSelectNode* node)
{
- creator_id = obj->mPermissions->getCreator();
- break;
+ return (obj_id == node->getObject()->getID());
}
- obj = sInstance->mObjectSelection->getNextNode();
- }
- if(obj)
+ } func(first_selected->getUUID());
+ LLSelectNode* node = sInstance->mObjectSelection->getFirstNode(&func);
+ if(node)
{
- LLFloaterAvatarInfo::showFromDirectory(creator_id);
+ LLFloaterAvatarInfo::showFromDirectory(node->mPermissions->getCreator());
}
}
}
@@ -130,20 +131,20 @@ void LLFloaterInspect::onClickOwnerProfile(void* ctrl)
if (first_selected)
{
- LLSelectNode* obj= sInstance->mObjectSelection->getFirstNode();
- LLUUID obj_id, owner_id;
- obj_id = first_selected->getUUID();
- while(obj)
+ LLUUID selected_id = first_selected->getUUID();
+ struct f : public LLSelectedNodeFunctor
{
- if(obj_id == obj->getObject()->getID())
+ LLUUID obj_id;
+ f(const LLUUID& id) : obj_id(id) {}
+ virtual bool apply(LLSelectNode* node)
{
- owner_id = obj->mPermissions->getOwner();
- break;
+ return (obj_id == node->getObject()->getID());
}
- obj = sInstance->mObjectSelection->getNextNode();
- }
- if(obj)
+ } func(selected_id);
+ LLSelectNode* node = sInstance->mObjectSelection->getFirstNode(&func);
+ if(node)
{
+ const LLUUID& owner_id = node->mPermissions->getOwner();
LLFloaterAvatarInfo::showFromDirectory(owner_id);
}
}
@@ -204,10 +205,12 @@ void LLFloaterInspect::refresh()
}
mObjectList->operateOnAll(LLScrollListCtrl::OP_DELETE);
//List all transient objects, then all linked objects
- LLSelectNode* obj = mObjectSelection->getFirstNode();
- LLSD row;
- while(obj)
+
+ for (LLObjectSelection::iterator iter = mObjectSelection->begin();
+ iter != mObjectSelection->end(); iter++)
{
+ LLSelectNode* obj = *iter;
+ LLSD row;
char owner_first_name[MAX_STRING], owner_last_name[MAX_STRING];
char creator_first_name[MAX_STRING], creator_last_name[MAX_STRING];
char time[MAX_STRING];
@@ -243,7 +246,6 @@ void LLFloaterInspect::refresh()
row["columns"][3]["type"] = "text";
row["columns"][3]["value"] = time;
mObjectList->addElement(row, ADD_TOP);
- obj = mObjectSelection->getNextNode();
}
if(selected_index > -1 && mObjectList->getItemIndex(selected_uuid) == selected_index)
{
diff --git a/indra/newview/llfloaterland.cpp b/indra/newview/llfloaterland.cpp
index 65b93e704a..43c39aa3ea 100644
--- a/indra/newview/llfloaterland.cpp
+++ b/indra/newview/llfloaterland.cpp
@@ -72,43 +72,10 @@
#include "llviewercontrol.h"
#include "roles_constants.h"
-static const S32 EDIT_HEIGHT = 16;
-static const S32 LEFT = HPAD;
-static const S32 BOTTOM = VPAD;
-static const S32 RULER0 = LEFT;
-static const S32 RULER05 = RULER0 + 24;
-static const S32 RULER1 = RULER05 + 16;
-static const S32 RULER15 = RULER1 + 20;
-static const S32 RULER2 = RULER1 + 32;
-static const S32 RULER205= RULER2 + 32;
-static const S32 RULER20 = RULER2 + 64;
-static const S32 RULER21 = RULER20 + 16;
-static const S32 RULER22 = RULER21 + 32;
-static const S32 RULER225 = RULER20 + 64;
-static const S32 RULER23 = RULER22 + 64;
-static const S32 RULER24 = RULER23 + 26;
-static const S32 RULER3 = RULER2 + 102;
-static const S32 RULER4 = RULER3 + 8;
-static const S32 RULER5 = RULER4 + 50;
-static const S32 RULER6 = RULER5 + 52;
-static const S32 RULER7 = RULER6 + 24;
-static const S32 RIGHT = LEFT + 278;
-static const S32 FAR_RIGHT = LEFT + 324 + 40;
-
-static const char PRICE[] = "Price:";
-static const char NO_PRICE[] = "";
-static const char AREA[] = "Area:";
-
static const char OWNER_ONLINE[] = "0";
static const char OWNER_OFFLINE[] = "1";
static const char OWNER_GROUP[] = "2";
-static const char NEED_TIER_TO_MODIFY_STRING[] = "You must approve your purchase to modify this land.";
-
-static const char WEB_PAGE[] = "Web page";
-static const char QUICKTIME_MOVIE[] = "QuickTime movie";
-static const char RAW_HTML[] = "Raw HTML";
-
// constants used in callbacks below - syntactic sugar.
static const BOOL BUY_GROUP_LAND = TRUE;
static const BOOL BUY_PERSONAL_LAND = FALSE;
@@ -508,12 +475,12 @@ void LLPanelLandGeneral::refresh()
{
// nothing selected, disable panel
mEditName->setEnabled(FALSE);
- mEditName->setText("");
+ mEditName->setText(LLString::null);
mEditDesc->setEnabled(FALSE);
- mEditDesc->setText("");
+ mEditDesc->setText(LLString::null);
- mTextSalePending->setText("");
+ mTextSalePending->setText(LLString::null);
mTextSalePending->setEnabled(FALSE);
mBtnDeedToGroup->setEnabled(FALSE);
@@ -525,14 +492,13 @@ void LLPanelLandGeneral::refresh()
mCheckContributeWithDeed->set(FALSE);
mCheckContributeWithDeed->setEnabled(FALSE);
- mTextOwner->setText("");
- mBtnProfile->setLabelSelected("Profile...");
- mBtnProfile->setLabelUnselected("Profile...");
+ mTextOwner->setText(LLString::null);
+ mBtnProfile->setLabel(childGetText("profile_text"));
mBtnProfile->setEnabled(FALSE);
- mTextClaimDate->setText("");
- mTextGroup->setText("");
- mTextPrice->setText("");
+ mTextClaimDate->setText(LLString::null);
+ mTextGroup->setText(LLString::null);
+ mTextPrice->setText(LLString::null);
mSaleInfoForSale1->setVisible(FALSE);
mSaleInfoForSale2->setVisible(FALSE);
@@ -542,8 +508,8 @@ void LLPanelLandGeneral::refresh()
mBtnSellLand->setVisible(FALSE);
mBtnStopSellLand->setVisible(FALSE);
- mTextPriceLabel->setText(NO_PRICE);
- mTextDwell->setText("");
+ mTextPriceLabel->setText(LLString::null);
+ mTextDwell->setText(LLString::null);
mBtnBuyLand->setEnabled(FALSE);
mBtnBuyGroupLand->setEnabled(FALSE);
@@ -579,14 +545,14 @@ void LLPanelLandGeneral::refresh()
// Is it owned?
if (is_public)
{
- mTextSalePending->setText("");
+ mTextSalePending->setText(LLString::null);
mTextSalePending->setEnabled(FALSE);
- mTextOwner->setText("(public)");
+ mTextOwner->setText(childGetText("public_text"));
mTextOwner->setEnabled(FALSE);
mBtnProfile->setEnabled(FALSE);
- mTextClaimDate->setText("");
+ mTextClaimDate->setText(LLString::null);
mTextClaimDate->setEnabled(FALSE);
- mTextGroup->setText("(none)");
+ mTextGroup->setText(childGetText("none_text"));
mTextGroup->setEnabled(FALSE);
mBtnStartAuction->setEnabled(FALSE);
}
@@ -594,20 +560,19 @@ void LLPanelLandGeneral::refresh()
{
if(!is_leased && (owner_id == gAgent.getID()))
{
- mTextSalePending->setText(NEED_TIER_TO_MODIFY_STRING);
+ mTextSalePending->setText(childGetText("need_tier_to_modify"));
mTextSalePending->setEnabled(TRUE);
}
else if(parcel->getAuctionID())
{
- char auction_str[MAX_STRING]; /*Flawfinder: ignore*/
- snprintf(auction_str, sizeof(auction_str), "Auction ID: %u", parcel->getAuctionID()); /* Flawfinder: ignore */
- mTextSalePending->setText(auction_str);
+ mTextSalePending->setText(childGetText("auction_id_text"));
+ mTextSalePending->setTextArg("[ID]", llformat("%u", parcel->getAuctionID()));
mTextSalePending->setEnabled(TRUE);
}
else
{
// not the owner, or it is leased
- mTextSalePending->setText("");
+ mTextSalePending->setText(LLString::null);
mTextSalePending->setEnabled(FALSE);
}
//refreshNames();
@@ -619,26 +584,25 @@ void LLPanelLandGeneral::refresh()
if (parcel->getGroupID().isNull())
{
// Not group owned, so "Profile"
- mBtnProfile->setLabelSelected("Profile...");
- mBtnProfile->setLabelUnselected("Profile...");
+ mBtnProfile->setLabel(childGetText("profile_text"));
- mTextGroup->setText("(none)");
+ mTextGroup->setText(childGetText("none_text"));
mTextGroup->setEnabled(FALSE);
}
else
{
// Group owned, so "Info"
- mBtnProfile->setLabelSelected("Info...");
- mBtnProfile->setLabelUnselected("Info...");
+ mBtnProfile->setLabel(childGetText("info_text"));
//mTextGroup->setText("HIPPOS!");//parcel->getGroupName());
mTextGroup->setEnabled(TRUE);
}
// Display claim date
+ // *TODO:Localize (Time format may need Translating)
time_t claim_date = parcel->getClaimDate();
char time_buf[TIME_STR_LENGTH]; /*Flawfinder: ignore*/
- mTextClaimDate->setText(formatted_time(claim_date, time_buf));
+ mTextClaimDate->setText(LLString(formatted_time(claim_date, time_buf)));
mTextClaimDate->setEnabled(is_leased);
BOOL enable_auction = (gAgent.getGodLevel() >= GOD_LIAISON)
@@ -727,8 +691,6 @@ void LLPanelLandGeneral::refresh()
gParcelMgr->canAgentBuyParcel(parcel, true));
// show pricing information
- char price[64]; /*Flawfinder: ignore*/
- const char* label = NULL;
S32 area;
S32 claim_price;
S32 rent_price;
@@ -740,14 +702,12 @@ void LLPanelLandGeneral::refresh()
&dwell);
// Area
- snprintf(price, sizeof(price), "%d sq. m.", area); /* Flawfinder: ignore */
- label = AREA;
-
- mTextPriceLabel->setText(label);
- mTextPrice->setText(price);
+ LLUIString price = childGetText("area_size_text");
+ price.setArg("[AREA]", llformat("%d",area));
+ mTextPriceLabel->setText(childGetText("area_text"));
+ mTextPrice->setText(price.getString());
- snprintf(price, sizeof(price), "%.0f", dwell); /* Flawfinder: ignore */
- mTextDwell->setText(price);
+ mTextDwell->setText(llformat("%.0f", dwell));
if(region_owner)
{
@@ -775,15 +735,14 @@ void LLPanelLandGeneral::refreshNames()
LLParcel *parcel = mParcel->getParcel();
if (!parcel)
{
- mTextOwner->setText("");
+ mTextOwner->setText(LLString::null);
return;
}
- char buffer[MAX_STRING]; /*Flawfinder: ignore*/
+ LLString owner;
if (parcel->getIsGroupOwned())
{
- buffer[0] = '\0';
- strcat(buffer, "(Group Owned)"); /*Flawfinder: ignore*/
+ owner = childGetText("group_owned_text");
}
else
{
@@ -791,24 +750,23 @@ void LLPanelLandGeneral::refreshNames()
char owner_first[MAX_STRING]; /*Flawfinder: ignore*/
char owner_last[MAX_STRING]; /*Flawfinder: ignore*/
gCacheName->getName(parcel->getOwnerID(), owner_first, owner_last);
- snprintf(buffer, sizeof(buffer), "%s %s", owner_first, owner_last); /* Flawfinder: ignore */
+ owner = llformat("%s %s", owner_first, owner_last);
}
if(LLParcel::OS_LEASE_PENDING == parcel->getOwnershipStatus())
{
- strcat(buffer, " (Sale Pending)"); /*Flawfinder: ignore*/
+ owner += childGetText("sale_pending_text");
}
- mTextOwner->setText(buffer);
+ mTextOwner->setText(owner);
+ LLString group;
if(!parcel->getGroupID().isNull())
{
+ char buffer[MAX_STRING]; /*Flawfinder: ignore*/
gCacheName->getGroupName(parcel->getGroupID(), buffer);
+ group = buffer;
}
- else
- {
- buffer[0] = '\0';
- }
- mTextGroup->setText(buffer);
+ mTextGroup->setText(group);
const LLUUID& auth_buyer_id = parcel->getAuthorizedBuyerID();
if(auth_buyer_id.notNull())
@@ -955,7 +913,7 @@ void LLPanelLandGeneral::onClickBuyPass(void* data)
if (!parcel) return;
S32 pass_price = parcel->getPassPrice();
- const char* parcel_name = parcel->getName();
+ LLString parcel_name = parcel->getName();
F32 pass_hours = parcel->getPassHours();
char cost[256], time[256]; /*Flawfinder: ignore*/
@@ -1071,8 +1029,8 @@ BOOL LLPanelLandObjects::postBuild()
{
mFirstReply = TRUE;
- mParcelObjectBonus = LLUICtrlFactory::getTextBoxByName(this, "Simulator Primitive Bonus Factor: 1.00");
- mSWTotalObjects = LLUICtrlFactory::getTextBoxByName(this, "0 out of 0 available");
+ mParcelObjectBonus = LLUICtrlFactory::getTextBoxByName(this, "parcel_object_bonus");
+ mSWTotalObjects = LLUICtrlFactory::getTextBoxByName(this, "objects_available");
mObjectContribution = LLUICtrlFactory::getTextBoxByName(this, "object_contrib_text");
mTotalObjects = LLUICtrlFactory::getTextBoxByName(this, "total_objects_text");
mOwnerObjects = LLUICtrlFactory::getTextBoxByName(this, "owner_objects_text");
@@ -1221,17 +1179,18 @@ void LLPanelLandObjects::refresh()
if (!parcel)
{
- mSWTotalObjects->setText("0 out of 0 available");
- mObjectContribution->setText("0");
- mTotalObjects->setText("0");
- mOwnerObjects->setText("0");
- mGroupObjects->setText("0");
- mOtherObjects->setText("0");
- mSelectedObjects->setText("0");
+ mSWTotalObjects->setTextArg("[COUNT]", llformat("%d", 0));
+ mSWTotalObjects->setTextArg("[TOTAL]", llformat("%d", 0));
+ mSWTotalObjects->setTextArg("[AVAILABLE]", llformat("%d", 0));
+ mObjectContribution->setTextArg("[COUNT]", llformat("%d", 0));
+ mTotalObjects->setTextArg("[COUNT]", llformat("%d", 0));
+ mOwnerObjects->setTextArg("[COUNT]", llformat("%d", 0));
+ mGroupObjects->setTextArg("[COUNT]", llformat("%d", 0));
+ mOtherObjects->setTextArg("[COUNT]", llformat("%d", 0));
+ mSelectedObjects->setTextArg("[COUNT]", llformat("%d", 0));
}
else
{
- char count[MAX_STRING]; /*Flawfinder: ignore*/
S32 sw_max = 0;
S32 sw_total = 0;
S32 max = 0;
@@ -1258,47 +1217,34 @@ void LLPanelLandObjects::refresh()
if (parcel_object_bonus != 1.0f)
{
- snprintf(count, sizeof(count), "Region Object Bonus Factor: %.2f", /* Flawfinder: ignore */
- parcel_object_bonus);
- mParcelObjectBonus->setText(count);
+ mParcelObjectBonus->setVisible(TRUE);
+ mParcelObjectBonus->setTextArg("[BONUS]", llformat("%.2f", parcel_object_bonus));
}
else
{
- mParcelObjectBonus->setText("");
+ mParcelObjectBonus->setVisible(FALSE);
}
if (sw_total > sw_max)
{
- snprintf(count, sizeof(count), "%d out of %d (%d will be deleted)", /* Flawfinder: ignore */
- sw_total, sw_max, sw_total - sw_max);
+ mSWTotalObjects->setText(childGetText("objects_deleted_text"));
+ mSWTotalObjects->setTextArg("[DELETED]", llformat("%d", sw_total - sw_max));
}
else
{
- snprintf(count, sizeof(count), "%d out of %d (%d available)", /* Flawfinder: ignore */
- sw_total, sw_max, sw_max - sw_total);
+ mSWTotalObjects->setText(childGetText("objects_available_text"));
+ mSWTotalObjects->setTextArg("[AVAILABLE]", llformat("%d", sw_max - sw_total));
}
- mSWTotalObjects->setText(count);
-
- snprintf(count, sizeof(count), "%d", max); /* Flawfinder: ignore */
- mObjectContribution->setText(count);
+ mSWTotalObjects->setTextArg("[COUNT]", llformat("%d", sw_total));
+ mSWTotalObjects->setTextArg("[MAX]", llformat("%d", sw_max));
- snprintf(count, sizeof(count), "%d", total); /* Flawfinder: ignore */
- mTotalObjects->setText(count);
-
- snprintf(count, sizeof(count), "%d", owned); /* Flawfinder: ignore */
- mOwnerObjects->setText(count);
-
- snprintf(count, sizeof(count), "%d", group); /* Flawfinder: ignore */
- mGroupObjects->setText(count);
-
- snprintf(count, sizeof(count), "%d", other); /* Flawfinder: ignore */
- mOtherObjects->setText(count);
-
- snprintf(count, sizeof(count), "%d", selected); /* Flawfinder: ignore */
- mSelectedObjects->setText(count);
-
- snprintf(count, sizeof(count), "%d", mOtherTime); /* Flawfinder: ignore */
- mCleanOtherObjectsTime->setText(count);
+ mObjectContribution->setTextArg("[COUNT]", llformat("%d", max));
+ mTotalObjects->setTextArg("[COUNT]", llformat("%d", total));
+ mOwnerObjects->setTextArg("[COUNT]", llformat("%d", owned));
+ mGroupObjects->setTextArg("[COUNT]", llformat("%d", group));
+ mOtherObjects->setTextArg("[COUNT]", llformat("%d", other));
+ mSelectedObjects->setTextArg("[COUNT]", llformat("%d", selected));
+ mCleanOtherObjectsTime->setText(llformat("%d", mOtherTime));
BOOL can_return_owned = LLViewerParcelMgr::isParcelModifiableByAgent(parcel, GP_LAND_RETURN_GROUP_OWNED);
BOOL can_return_group_set = LLViewerParcelMgr::isParcelModifiableByAgent(parcel, GP_LAND_RETURN_GROUP_SET);
@@ -1488,7 +1434,6 @@ void LLPanelLandObjects::callbackReturnOwnerList(S32 option, void* userdata)
}
else
{
- // XUI:translate NAME -> FIRST LAST
args["[NAME]"] = self->mSelectedName;
LLNotifyBox::showXml("OtherObjectsReturned2", args);
}
@@ -1633,7 +1578,7 @@ void LLPanelLandObjects::processParcelObjectOwnersReply(LLMessageSystem *msg, vo
row->addColumn(OWNER_OFFLINE, FONT, self->mColWidth[1]);
}
// Placeholder for name.
- row->addColumn("", FONT, self->mColWidth[2]);
+ row->addColumn(LLString::null, FONT, self->mColWidth[2]);
snprintf(object_count_str, sizeof(object_count_str), "%d", object_count); /* Flawfinder: ignore */
row->addColumn(object_count_str, FONT, self->mColWidth[3]);
@@ -2032,7 +1977,7 @@ BOOL LLPanelLandOptions::postBuild()
}
- mLocationText = LLUICtrlFactory::getTextBoxByName(this, "Landing Point: (none)");
+ mLocationText = LLUICtrlFactory::getTextBoxByName(this, "landing_point");
mSetBtn = LLUICtrlFactory::getButtonByName(this, "Set");
mSetBtn->setClickedCallback(onClickSet, this);
@@ -2097,8 +2042,9 @@ void LLPanelLandOptions::refresh()
mPushRestrictionCtrl->set(FALSE);
mPushRestrictionCtrl->setEnabled(FALSE);
+ // *TODO:Translate
const char* none_string = LLParcel::getCategoryUIString(LLParcel::C_NONE);
- mCategoryCombo->setSimple(none_string);
+ mCategoryCombo->setSimple(LLString(none_string));
mCategoryCombo->setEnabled(FALSE);
mLandingTypeCombo->setCurrentByIndex(0);
@@ -2107,7 +2053,7 @@ void LLPanelLandOptions::refresh()
mSnapshotCtrl->setImageAssetID(LLUUID::null);
mSnapshotCtrl->setEnabled(FALSE);
- mLocationText->setText("Landing Point: (none)");
+ mLocationText->setTextArg("[LANDING]", childGetText("landing_point_none"));
mSetBtn->setEnabled(FALSE);
mClearBtn->setEnabled(FALSE);
@@ -2154,24 +2100,23 @@ void LLPanelLandOptions::refresh()
mPushRestrictionCtrl->set( parcel->getRestrictPushObject() );
if(parcel->getRegionPushOverride())
{
- mPushRestrictionCtrl->setLabel("Restrict Pushing (Region Override)");
+ mPushRestrictionCtrl->setLabel(childGetText("push_restrict_region_text"));
mPushRestrictionCtrl->setEnabled(false);
mPushRestrictionCtrl->set(TRUE);
}
else
{
- mPushRestrictionCtrl->setLabel("Restrict Pushing");
+ mPushRestrictionCtrl->setLabel(childGetText("push_restrict_text"));
mPushRestrictionCtrl->setEnabled(can_change_options);
}
BOOL can_change_identity =
LLViewerParcelMgr::isParcelModifiableByAgent(parcel, GP_LAND_CHANGE_IDENTITY);
-
- // Set by string in case the order in UI doesn't match the order
- // by index.
+ // Set by string in case the order in UI doesn't match the order by index.
+ // *TODO:Translate
LLParcel::ECategory cat = parcel->getCategory();
const char* category_string = LLParcel::getCategoryUIString(cat);
- mCategoryCombo->setSimple(category_string);
+ mCategoryCombo->setSimple(LLString(category_string));
mCategoryCombo->setEnabled( can_change_identity );
BOOL can_change_landing_point = LLViewerParcelMgr::isParcelModifiableByAgent(parcel,
@@ -2185,16 +2130,14 @@ void LLPanelLandOptions::refresh()
LLVector3 pos = parcel->getUserLocation();
if (pos.isExactlyZero())
{
- mLocationText->setText("Landing Point: (none)");
+ mLocationText->setTextArg("[LANDING]", childGetText("landing_point_none"));
}
else
{
- char buffer[256]; /*Flawfinder: ignore*/
- snprintf(buffer, sizeof(buffer), "Landing Point: %d, %d, %d", /* Flawfinder: ignore */
- llround(pos.mV[VX]),
- llround(pos.mV[VY]),
- llround(pos.mV[VZ]));
- mLocationText->setText(buffer);
+ mLocationText->setTextArg("[LANDING]",llformat("%d, %d, %d",
+ llround(pos.mV[VX]),
+ llround(pos.mV[VY]),
+ llround(pos.mV[VZ])));
}
mSetBtn->setEnabled( can_change_landing_point );
@@ -2445,10 +2388,10 @@ void LLPanelLandMedia::refresh()
mRadioVoiceChat->setSelectedIndex(kRadioVoiceChatEstate);
mRadioVoiceChat->setEnabled(FALSE);
- mMusicURLEdit->setText("");
+ mMusicURLEdit->setText(LLString::null);
mMusicURLEdit->setEnabled(FALSE);
- mMediaURLEdit->setText("");
+ mMediaURLEdit->setText(LLString::null);
mMediaURLEdit->setEnabled(FALSE);
mMediaAutoScaleCheck->set ( FALSE );
@@ -2664,24 +2607,20 @@ void LLPanelLandAccess::refresh()
if (parcel)
{
- char label[256]; /*Flawfinder: ignore*/
-
// Display options
BOOL use_group = parcel->getParcelFlag(PF_USE_ACCESS_GROUP);
mCheckGroup->set( use_group );
char group_name[MAX_STRING]; /*Flawfinder: ignore*/
gCacheName->getGroupName(parcel->getGroupID(), group_name);
- snprintf(label, sizeof(label), "Group: %s", group_name); /* Flawfinder: ignore */
- mCheckGroup->setLabel( label );
+ mCheckGroup->setLabelArg( "[GROUP]", LLString(group_name) );
S32 count = parcel->mAccessList.size();
BOOL use_list = parcel->getParcelFlag(PF_USE_ACCESS_LIST);
mCheckAccess->set( use_list );
- snprintf(label, sizeof(label), "Avatars: (%d listed, %d max)", /* Flawfinder: ignore */
- count, PARCEL_MAX_ACCESS_LIST);
- mCheckAccess->setLabel( label );
+ mCheckAccess->setLabelArg( "[LISTED]", llformat("%d",count));
+ mCheckAccess->setLabelArg( "[MAX]", llformat("%d",PARCEL_MAX_ACCESS_LIST));
access_map_const_iterator cit = parcel->mAccessList.begin();
access_map_const_iterator end = parcel->mAccessList.end();
@@ -2749,9 +2688,9 @@ void LLPanelLandAccess::refresh()
else
{
mCheckGroup->set(FALSE);
- mCheckGroup->setLabel("Group:");
+ mCheckGroup->setLabelArg( "[GROUP]", LLString::null );
mCheckAccess->set(FALSE);
- mCheckAccess->setLabel("Avatars:");
+ mCheckAccess->setLabelArg( "[LISTED]", llformat("%d",0));
mBtnAddAccess->setEnabled(FALSE);
mBtnRemoveAccess->setEnabled(FALSE);
mSpinPrice->set((F32)PARCEL_PASS_PRICE_DEFAULT);
@@ -2773,9 +2712,7 @@ void LLPanelLandAccess::refreshNames()
{
gCacheName->getGroupName(parcel->getGroupID(), group_name);
}
- char label[MAX_STRING]; /*Flawfinder: ignore*/
- snprintf(label, sizeof(label), "Group: %s", group_name); /* Flawfinder: ignore */
- mCheckGroup->setLabel(label);
+ mCheckGroup->setLabelArg("[GROUP]", LLString(group_name));
}
@@ -2941,18 +2878,14 @@ void LLPanelLandBan::refresh()
if (parcel)
{
- char label[256]; /*Flawfinder: ignore*/
-
// Display options
S32 count = parcel->mBanList.size();
BOOL use_ban = parcel->getParcelFlag(PF_USE_BAN_LIST);
mCheck->set( use_ban );
-
- snprintf(label, sizeof(label), "Ban these avatars: (%d listed, %d max)", /* Flawfinder: ignore */
- count, PARCEL_MAX_ACCESS_LIST);
- mCheck->setLabel( label );
+ mCheck->setLabelArg( "[LISTED]", llformat("%d",count));
+ mCheck->setLabelArg( "[MAX]", llformat("%d",PARCEL_MAX_ACCESS_LIST));
access_map_const_iterator cit = parcel->mBanList.begin();
access_map_const_iterator end = parcel->mBanList.end();
@@ -3031,7 +2964,7 @@ void LLPanelLandBan::refresh()
else
{
mCheck->set(FALSE);
- mCheck->setLabel("Ban these avatars:");
+ mCheck->setLabelArg( "[LISTED]", llformat("%d",0));
mCheck->setEnabled(FALSE);
mBtnAdd->setEnabled(FALSE);
mBtnRemove->setEnabled(FALSE);
@@ -3125,82 +3058,6 @@ void LLPanelLandBan::onClickRemove(void* data)
}
//---------------------------------------------------------------------------
-// LLPanelLandRenters
-//---------------------------------------------------------------------------
-LLPanelLandRenters::LLPanelLandRenters(LLParcelSelectionHandle& parcel)
-: LLPanel("landrenters", LLRect(0,500,500,0)), mParcel(parcel)
-{
- const S32 BTN_WIDTH = 64;
-
- S32 x = LEFT;
- S32 y = mRect.getHeight() - VPAD;
-
- LLCheckBoxCtrl* check = NULL;
- LLButton* btn = NULL;
- LLNameListCtrl* list = NULL;
-
- check = new LLCheckBoxCtrl("RentersCheck",
- LLRect(RULER0, y, RIGHT, y-LINE),
- "Rent space to these avatars:");
- addChild(check);
- mCheckRenters = check;
-
- y -= VPAD + LINE;
-
- const S32 ITEMS = 5;
- const BOOL NO_MULTIPLE_SELECT = FALSE;
-
- list = new LLNameListCtrl("RentersList",
- LLRect(RULER05, y, RIGHT, y-LINE*ITEMS),
- NULL, NULL,
- NO_MULTIPLE_SELECT);
- list->addSimpleItem("foo tester");
- list->addSimpleItem("bar tester");
- list->setFollows(FOLLOWS_TOP | FOLLOWS_LEFT);
- addChild(list);
- mListRenters = list;
-
- y -= VPAD + LINE*ITEMS;
-
- x = RULER05;
- btn = new LLButton("Add...",
- LLRect(x, y, x+BTN_WIDTH, y-LINE),
- "",
- onClickAdd, this);
- btn->setFont( LLFontGL::sSansSerifSmall );
- btn->setFollows(FOLLOWS_TOP | FOLLOWS_LEFT);
- addChild(btn);
- mBtnAddRenter = btn;
-
- x += HPAD + BTN_WIDTH;
-
- btn = new LLButton("Remove",
- LLRect(x, y, x+BTN_WIDTH, y-LINE),
- "",
- onClickRemove, this);
- btn->setFont( LLFontGL::sSansSerifSmall );
- btn->setFollows(FOLLOWS_TOP | FOLLOWS_LEFT);
- addChild(btn);
- mBtnRemoveRenter = btn;
-}
-
-LLPanelLandRenters::~LLPanelLandRenters()
-{ }
-
-void LLPanelLandRenters::refresh()
-{ }
-
-// static
-void LLPanelLandRenters::onClickAdd(void*)
-{
-}
-
-// static
-void LLPanelLandRenters::onClickRemove(void*)
-{
-}
-
-//---------------------------------------------------------------------------
// LLPanelLandCovenant
//---------------------------------------------------------------------------
LLPanelLandCovenant::LLPanelLandCovenant(LLParcelSelectionHandle& parcel)
diff --git a/indra/newview/llfloaterland.h b/indra/newview/llfloaterland.h
index f3ad542be9..9eb9172b60 100644
--- a/indra/newview/llfloaterland.h
+++ b/indra/newview/llfloaterland.h
@@ -113,7 +113,6 @@ protected:
LLPanelLandAccess* mPanelAccess;
LLPanelLandBan* mPanelBan;
LLPanelLandCovenant* mPanelCovenant;
- LLPanelLandRenters* mPanelRenters;
LLHandle<LLParcelSelection> mParcel;
diff --git a/indra/newview/llfloateropenobject.cpp b/indra/newview/llfloateropenobject.cpp
index 8aaf1089a5..0b79c85963 100644
--- a/indra/newview/llfloateropenobject.cpp
+++ b/indra/newview/llfloateropenobject.cpp
@@ -67,7 +67,7 @@ LLFloaterOpenObject::LLFloaterOpenObject()
childSetAction("copy_to_inventory_button", onClickMoveToInventory, this);
childSetAction("copy_and_wear_button", onClickMoveAndWear, this);
- childSetTextArg("object_name", "[DESC]", "Object");
+ childSetTextArg("object_name", "[DESC]", LLString("Object") ); // *Note: probably do not want to translate this
}
LLFloaterOpenObject::~LLFloaterOpenObject()
diff --git a/indra/newview/llfloaterpostcard.cpp b/indra/newview/llfloaterpostcard.cpp
index 821e5190ce..8dcdb99a69 100644
--- a/indra/newview/llfloaterpostcard.cpp
+++ b/indra/newview/llfloaterpostcard.cpp
@@ -357,7 +357,7 @@ void LLFloaterPostcard::onMsgFormFocusRecieved(LLUICtrl* receiver, void* data)
if(msgForm && msgForm == receiver && msgForm->hasFocus() && !(self->mHasFirstMsgFocus))
{
self->mHasFirstMsgFocus = true;
- msgForm->setText(LLString(""));
+ msgForm->setText(LLString::null);
}
}
}
@@ -380,7 +380,6 @@ void LLFloaterPostcard::missingSubjMsgAlertCallback(S32 option, void* data)
{
// The user never switched focus to the messagee window.
// Using the default string.
- // XUI: translate
self->childSetValue("msg_form", self->childGetText("default_message"));
}
diff --git a/indra/newview/llfloaterproperties.cpp b/indra/newview/llfloaterproperties.cpp
index 4df3ab04c7..af2a717ff7 100644
--- a/indra/newview/llfloaterproperties.cpp
+++ b/indra/newview/llfloaterproperties.cpp
@@ -59,14 +59,6 @@
#include "llvieweruictrlfactory.h"
-///----------------------------------------------------------------------------
-/// Local function declarations, constants, enums, and typedefs
-///----------------------------------------------------------------------------
-
-const char* YOU_CAN = "You can:";
-const char* OWNER_CAN = "Owner can: ";
-
-
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Class LLPropertiesObserver
//
@@ -302,22 +294,11 @@ void LLFloaterProperties::refreshFromItem(LLInventoryItem* item)
childSetEnabled("LabelItemNameTitle",TRUE);
childSetEnabled("LabelItemName",is_modifiable);
- const char EMPTY_STRING[1] = ""; /* Flawfinder: ignore */
- const char* txt = EMPTY_STRING;
- if(!item->getName().empty())
- {
- txt = item->getName().c_str();
- }
- childSetText("LabelItemName",txt);
+ childSetText("LabelItemName",item->getName());
childSetEnabled("LabelItemDescTitle",TRUE);
childSetEnabled("LabelItemDesc",is_modifiable);
childSetVisible("IconLocked",!is_modifiable);
- txt = EMPTY_STRING;
- if(!item->getDescription().empty())
- {
- txt = item->getDescription().c_str();
- }
- childSetText("LabelItemDesc",txt);
+ childSetText("LabelItemDesc",item->getDescription());
//////////////////
// CREATOR NAME //
@@ -344,7 +325,7 @@ void LLFloaterProperties::refreshFromItem(LLInventoryItem* item)
childSetEnabled("BtnCreator",FALSE);
childSetEnabled("LabelCreatorTitle",FALSE);
childSetEnabled("LabelCreatorName",FALSE);
- childSetText("LabelCreatorName","(unknown)"); // XUI:translate
+ childSetText("LabelCreatorName",childGetText("unknown"));
}
////////////////
@@ -376,20 +357,22 @@ void LLFloaterProperties::refreshFromItem(LLInventoryItem* item)
childSetEnabled("BtnOwner",FALSE);
childSetEnabled("LabelOwnerTitle",FALSE);
childSetEnabled("LabelOwnerName",FALSE);
- childSetText("LabelOwnerName","(public)"); // XUI:translate
+ childSetText("LabelOwnerName",childGetText("public"));
}
//////////////////
// ACQUIRE DATE //
//////////////////
+
+ // *TODO: Localize / translate this
time_t time_utc = (time_t)item->getCreationDate();
if (0 == time_utc)
{
- childSetText("LabelAcquiredDate","(unknown)");
+ childSetText("LabelAcquiredDate",childGetText("unknown"));
}
else
{
- childSetText("LabelAcquiredDate", ctime(&time_utc) );
+ childSetText("LabelAcquiredDate", LLString(ctime(&time_utc)) );
}
///////////////////////
@@ -397,11 +380,11 @@ void LLFloaterProperties::refreshFromItem(LLInventoryItem* item)
///////////////////////
if(can_agent_manipulate)
{
- childSetText("OwnerLabel",YOU_CAN);
+ childSetText("OwnerLabel",childGetText("you_can"));
}
else
{
- childSetText("OwnerLabel",OWNER_CAN);
+ childSetText("OwnerLabel",childGetText("owner_can"));
}
U32 base_mask = perm.getMaskBase();
@@ -436,30 +419,33 @@ void LLFloaterProperties::refreshFromItem(LLInventoryItem* item)
overwrite_group = flags & LLInventoryItem::II_FLAGS_OBJECT_PERM_OVERWRITE_GROUP;
}
- char perm_string[11]; /* Flawfinder: ignore */
+ std::string perm_string;
- snprintf(perm_string, sizeof(perm_string), "B: "); /* Flawfinder: ignore */
- mask_to_string(base_mask, perm_string+3);
+ perm_string = "B: ";
+ perm_string += mask_to_string(base_mask);
childSetText("BaseMaskDebug",perm_string);
childSetVisible("BaseMaskDebug",TRUE);
- snprintf(perm_string, sizeof(perm_string), "O: "); /* Flawfinder: ignore */
- mask_to_string(owner_mask, perm_string+3);
+ perm_string = "O: ";
+ perm_string += mask_to_string(owner_mask);
childSetText("OwnerMaskDebug",perm_string);
childSetVisible("OwnerMaskDebug",TRUE);
- snprintf(perm_string, sizeof(perm_string), "G%s: ", overwrite_group ? "*" : ""); /* Flawfinder: ignore */
- mask_to_string(group_mask, perm_string + (overwrite_group ? 4 : 3));
+ perm_string = "G";
+ perm_string += overwrite_group ? "*: " : ": ";
+ perm_string += perm_string += mask_to_string(group_mask);
childSetText("GroupMaskDebug",perm_string);
childSetVisible("GroupMaskDebug",TRUE);
- snprintf(perm_string, sizeof(perm_string), "E%s: ", overwrite_everyone ? "*" : ""); /* Flawfinder: ignore */
- mask_to_string(everyone_mask, perm_string + (overwrite_everyone ? 4 : 3));
+ perm_string = "E";
+ perm_string += overwrite_everyone ? "*: " : ": ";
+ perm_string += mask_to_string(everyone_mask);
childSetText("EveryoneMaskDebug",perm_string);
childSetVisible("EveryoneMaskDebug",TRUE);
- snprintf(perm_string, sizeof(perm_string), "N%s: ", slam_perm ? "*" : ""); /* Flawfinder: ignore */
- mask_to_string(next_owner_mask, perm_string + (slam_perm ? 4 : 3));
+ perm_string = "N";
+ perm_string += slam_perm ? "*: " : ": ";
+ perm_string += mask_to_string(next_owner_mask);
childSetText("NextMaskDebug",perm_string);
childSetVisible("NextMaskDebug",TRUE);
}
@@ -571,14 +557,14 @@ void LLFloaterProperties::refreshFromItem(LLInventoryItem* item)
if (is_for_sale)
{
radioSaleType->setSelectedIndex((S32)sale_info.getSaleType() - 1);
- char numerical_price[MAX_STRING]; /* Flawfinder: ignore */
- snprintf(numerical_price, MAX_STRING, "%d", sale_info.getSalePrice()); /* Flawfinder: ignore */
+ std::string numerical_price;
+ numerical_price = sale_info.getSalePrice();
childSetText("EditPrice",numerical_price);
}
else
{
radioSaleType->setSelectedIndex(-1);
- childSetText("EditPrice","");
+ childSetText("EditPrice",LLString::null);
}
}
diff --git a/indra/newview/llfloaterreporter.cpp b/indra/newview/llfloaterreporter.cpp
index 0d62b93ed5..a7cd2114e0 100644
--- a/indra/newview/llfloaterreporter.cpp
+++ b/indra/newview/llfloaterreporter.cpp
@@ -177,8 +177,8 @@ LLFloaterReporter::LLFloaterReporter(
setVisible(TRUE);
// Default text to be blank
- childSetText("object_name", "");
- childSetText("owner_name", "");
+ childSetText("object_name", LLString::null);
+ childSetText("owner_name", LLString::null);
childSetFocus("summary_edit");
@@ -461,8 +461,8 @@ void LLFloaterReporter::onClickObjPicker(void *userdata)
gToolObjPicker->setExitCallback(LLFloaterReporter::closePickTool, self);
gToolMgr->setTransientTool(gToolObjPicker);
self->mPicking = TRUE;
- self->childSetText("object_name", "");
- self->childSetText("owner_name", "");
+ self->childSetText("object_name", LLString::null);
+ self->childSetText("owner_name", LLString::null);
LLButton* pick_btn = LLUICtrlFactory::getButtonByName(self, "pick_btn");
if (pick_btn) pick_btn->setToggleState(TRUE);
}
@@ -581,7 +581,7 @@ LLFloaterReporter* LLFloaterReporter::createNewBugReporter()
-void LLFloaterReporter::setPickedObjectProperties(const char *object_name, const char *owner_name, const LLUUID owner_id)
+void LLFloaterReporter::setPickedObjectProperties(const LLString& object_name, const LLString& owner_name, const LLUUID owner_id)
{
childSetText("object_name", object_name);
childSetText("owner_name", owner_name);
diff --git a/indra/newview/llfloaterreporter.h b/indra/newview/llfloaterreporter.h
index a824135efe..771a6a385d 100644
--- a/indra/newview/llfloaterreporter.h
+++ b/indra/newview/llfloaterreporter.h
@@ -109,7 +109,7 @@ public:
// static
static void processRegionInfo(LLMessageSystem* msg);
- void setPickedObjectProperties(const char *object_name, const char *owner_name, const LLUUID owner_id);
+ void setPickedObjectProperties(const LLString& object_name, const LLString& owner_name, const LLUUID owner_id);
private:
void takeScreenshot();
diff --git a/indra/newview/llfloatersnapshot.cpp b/indra/newview/llfloatersnapshot.cpp
index 96d53ffd1f..d0a21d2da6 100644
--- a/indra/newview/llfloatersnapshot.cpp
+++ b/indra/newview/llfloatersnapshot.cpp
@@ -1348,16 +1348,15 @@ void LLFloaterSnapshot::draw()
childSetEnabled("send_btn", previewp->getSnapshotUpToDate());
}
- //XUI:translate
if (previewp->getSnapshotUpToDate())
{
LLString bytes_string;
gResMgr->getIntegerString(bytes_string, previewp->getDataSize());
- childSetTextArg("file_size_label", "[SIZE]", llformat("%s bytes", bytes_string.c_str()));
+ childSetTextArg("file_size_label", "[SIZE]", bytes_string);
}
else
{
- childSetTextArg("file_size_label", "[SIZE]", "unknown");
+ childSetTextArg("file_size_label", "[SIZE]", childGetText("unknwon"));
childSetColor("file_size_label", gColors.getColor( "LabelTextColor" ));
}
childSetEnabled("upload_btn", previewp->getSnapshotUpToDate());
@@ -1366,7 +1365,7 @@ void LLFloaterSnapshot::draw()
}
else
{
- childSetTextArg("file_size_label", "[SIZE]", "unknown");
+ childSetTextArg("file_size_label", "[SIZE]", LLString("???"));
childSetEnabled("upload_btn", FALSE);
childSetEnabled("send_btn", FALSE);
childSetEnabled("save_btn", FALSE);
diff --git a/indra/newview/llfloatertelehub.cpp b/indra/newview/llfloatertelehub.cpp
index b0158aaaff..95a47bb2ac 100644
--- a/indra/newview/llfloatertelehub.cpp
+++ b/indra/newview/llfloatertelehub.cpp
@@ -129,11 +129,8 @@ void LLFloaterTelehub::draw()
// Per-frame updates, because we don't have a selection manager observer.
void LLFloaterTelehub::refresh()
{
- LLViewerObject* object = mObjectSelection->getFirstRootObject();
- if(!object)
- {
- object = mObjectSelection->getFirstObject();
- }
+ const BOOL children_ok = TRUE;
+ LLViewerObject* object = mObjectSelection->getFirstRootObject(children_ok);
BOOL have_selection = (object != NULL);
BOOL all_volume = gSelectMgr->selectionAllPCode( LL_PCODE_VOLUME );
diff --git a/indra/newview/llfloatertools.cpp b/indra/newview/llfloatertools.cpp
index 2c0cb4164d..4f8ed08a69 100644
--- a/indra/newview/llfloatertools.cpp
+++ b/indra/newview/llfloatertools.cpp
@@ -317,6 +317,16 @@ BOOL LLFloaterTools::postBuild()
mTab->setBorderVisible(FALSE);
mTab->selectFirstTab();
}
+
+ mStatusText["rotate"] = childGetText("status_rotate");
+ mStatusText["scale"] = childGetText("status_scale");
+ mStatusText["move"] = childGetText("status_move");
+ mStatusText["modifyland"] = childGetText("status_modifyland");
+ mStatusText["camera"] = childGetText("status_camera");
+ mStatusText["grab"] = childGetText("status_grab");
+ mStatusText["place"] = childGetText("status_place");
+ mStatusText["selectland"] = childGetText("status_selectland");
+
return TRUE;
}
@@ -418,9 +428,17 @@ LLFloaterTools::~LLFloaterTools()
// children automatically deleted
}
-void LLFloaterTools::setStatusText(const LLString& text)
+void LLFloaterTools::setStatusText(const std::string& text)
{
- mTextStatus->setText(text);
+ std::map<std::string, std::string>::iterator iter = mStatusText.find(text);
+ if (iter != mStatusText.end())
+ {
+ mTextStatus->setText(iter->second);
+ }
+ else
+ {
+ mTextStatus->setText(text);
+ }
}
void LLFloaterTools::refresh()
@@ -587,27 +605,27 @@ void LLFloaterTools::updatePopup(LLCoordGL center, MASK mask)
if (mComboGridMode)
{
- mComboGridMode ->setVisible( edit_visible );
+ mComboGridMode->setVisible( edit_visible );
S32 index = mComboGridMode->getCurrentIndex();
mComboGridMode->removeall();
switch (mObjectSelection->getSelectType())
{
case SELECT_TYPE_HUD:
- mComboGridMode->add("Screen");
- mComboGridMode->add("Local");
- //mComboGridMode->add("Reference");
- break;
+ mComboGridMode->add(childGetText("grid_screen_text"));
+ mComboGridMode->add(childGetText("grid_local_text"));
+ //mComboGridMode->add(childGetText("grid_reference_text"));
+ break;
case SELECT_TYPE_WORLD:
- mComboGridMode->add("World");
- mComboGridMode->add("Local");
- mComboGridMode->add("Reference");
- break;
+ mComboGridMode->add(childGetText("grid_world_text"));
+ mComboGridMode->add(childGetText("grid_local_text"));
+ mComboGridMode->add(childGetText("grid_reference_text"));
+ break;
case SELECT_TYPE_ATTACHMENT:
- mComboGridMode->add("Attachment");
- mComboGridMode->add("Local");
- mComboGridMode->add("Reference");
- break;
+ mComboGridMode->add(childGetText("grid_attachment_text"));
+ mComboGridMode->add(childGetText("grid_local_text"));
+ mComboGridMode->add(childGetText("grid_reference_text"));
+ break;
}
mComboGridMode->setCurrentByIndex(index);
diff --git a/indra/newview/llfloatertools.h b/indra/newview/llfloatertools.h
index e710947992..f56cdbecb5 100644
--- a/indra/newview/llfloatertools.h
+++ b/indra/newview/llfloatertools.h
@@ -97,7 +97,7 @@ public:
void showMore(BOOL show_more);
void showPanel(EInfoPanel panel);
- void setStatusText(const LLString& text);
+ void setStatusText(const std::string& text);
virtual void onFocusReceived();
static void setEditTool(void* data);
void saveLastTool();
@@ -191,6 +191,8 @@ private:
BOOL mDirty;
S32 mSmallHeight;
S32 mLargeHeight;
+
+ std::map<std::string, std::string> mStatusText;
};
extern LLFloaterTools *gFloaterTools;
diff --git a/indra/newview/llfloaterworldmap.cpp b/indra/newview/llfloaterworldmap.cpp
index ac63fddff1..23d01a963b 100644
--- a/indra/newview/llfloaterworldmap.cpp
+++ b/indra/newview/llfloaterworldmap.cpp
@@ -262,7 +262,7 @@ BOOL LLFloaterWorldMap::postBuild()
mCurZoomVal = log(gMapScale)/log(2.f);
childSetValue("zoom slider", gMapScale);
- setDefaultBtn("");
+ setDefaultBtn(NULL);
if ( gAgent.mAccess <= SIM_ACCESS_PG )
{
@@ -1226,7 +1226,7 @@ void LLFloaterWorldMap::updateSearchEnabled( LLUICtrl* ctrl, void* userdata )
}
else
{
- self->setDefaultBtn("");
+ self->setDefaultBtn(NULL);
}
}
diff --git a/indra/newview/llfolderview.cpp b/indra/newview/llfolderview.cpp
index cc8e80bee6..38f2249329 100644
--- a/indra/newview/llfolderview.cpp
+++ b/indra/newview/llfolderview.cpp
@@ -3193,18 +3193,18 @@ void LLFolderView::draw()
if (hasVisibleChildren() || getShowFolderState() == LLInventoryFilter::SHOW_ALL_FOLDERS)
{
- setStatusText("");
+ mStatusText.clear();
}
else
{
if (gInventory.backgroundFetchActive() || mCompletedFilterGeneration < mFilter.getMinRequiredGeneration())
{
- setStatusText("Searching...");
+ mStatusText = "Searching..."; // *TODO:translate
sFont->renderUTF8(mStatusText, 0, 2, 1, LLColor4::white, LLFontGL::LEFT, LLFontGL::TOP, LLFontGL::NORMAL, S32_MAX, S32_MAX, NULL, FALSE );
}
else
{
- setStatusText("No matching items found in inventory.");
+ mStatusText = "No matching items found in inventory."; // *TODO:translate
sFont->renderUTF8(mStatusText, 0, 2, 1, LLColor4::white, LLFontGL::LEFT, LLFontGL::TOP, LLFontGL::NORMAL, S32_MAX, S32_MAX, NULL, FALSE );
}
}
diff --git a/indra/newview/llfolderview.h b/indra/newview/llfolderview.h
index 602b19328f..dd0dd21705 100644
--- a/indra/newview/llfolderview.h
+++ b/indra/newview/llfolderview.h
@@ -484,8 +484,6 @@ public:
BOOL isDescendantOf( const LLFolderViewFolder* potential_ancestor );
S32 getIndentation() { return mIndentation; }
- virtual void setStatusText(const LLString& text) { mStatusText = text; }
-
virtual BOOL potentiallyVisible(); // do we know for a fact that this item has been filtered out?
virtual BOOL getFiltered();
diff --git a/indra/newview/llglsandbox.cpp b/indra/newview/llglsandbox.cpp
index ca387ac3c8..da3f7aad46 100644
--- a/indra/newview/llglsandbox.cpp
+++ b/indra/newview/llglsandbox.cpp
@@ -251,35 +251,35 @@ void LLToolSelectRect::handleRectangleSelection(S32 x, S32 y, MASK mask)
if (shrink_selection)
{
- LLObjectSelectionHandle highlighted_objects = gSelectMgr->getHighlightedObjects();
-
- for (LLViewerObject* vobjp = highlighted_objects->getFirstObject();
- vobjp;
- vobjp = highlighted_objects->getNextObject())
+ struct f : public LLSelectedObjectFunctor
+ {
+ virtual bool apply(LLViewerObject* vobjp)
{
LLDrawable* drawable = vobjp->mDrawable;
if (!drawable || vobjp->getPCode() != LL_PCODE_VOLUME || vobjp->isAttachment())
{
- continue;
+ return true;
}
-
S32 result = gCamera->sphereInFrustum(drawable->getPositionAgent(), drawable->getRadius());
switch (result)
{
- case 0:
+ case 0:
gSelectMgr->unhighlightObjectOnly(vobjp);
break;
- case 1:
+ case 1:
// check vertices
if (!gCamera->areVertsVisible(vobjp, LLSelectMgr::sRectSelectInclusive))
{
gSelectMgr->unhighlightObjectOnly(vobjp);
}
break;
- default:
+ default:
break;
}
+ return true;
}
+ } func;
+ gSelectMgr->getHighlightedObjects()->applyToObjects(&func);
}
if (grow_selection)
diff --git a/indra/newview/llgroupmgr.cpp b/indra/newview/llgroupmgr.cpp
index 016c4920cc..7d7a5b9a3a 100644
--- a/indra/newview/llgroupmgr.cpp
+++ b/indra/newview/llgroupmgr.cpp
@@ -1277,7 +1277,7 @@ void LLGroupMgr::processCreateGroupReply(LLMessageSystem* msg, void ** data)
}
else
{
- // XUI:translate
+ // *TODO:translate
LLString::format_map_t args;
args["[MESSAGE]"] = message;
gViewerWindow->alertXml("UnableToCreateGroup", args);
@@ -1853,3 +1853,4 @@ void LLGroupMgr::debugClearAllGroups(void*)
LLGroupMgr::parseRoleActions("role_actions.xml");
}
+
diff --git a/indra/newview/llimpanel.cpp b/indra/newview/llimpanel.cpp
index a18bf793d8..3a947bcbff 100644
--- a/indra/newview/llimpanel.cpp
+++ b/indra/newview/llimpanel.cpp
@@ -1637,7 +1637,7 @@ void LLFloaterIMPanel::sendMsg()
gViewerStats->incStat(LLViewerStats::ST_IM_COUNT);
}
- mInputEditor->setText("");
+ mInputEditor->setText(LLString::null);
// Don't need to actually send the typing stop message, the other
// client will infer it from receiving the message.
diff --git a/indra/newview/llimview.cpp b/indra/newview/llimview.cpp
index 47ab36959d..dee1ed2bfd 100644
--- a/indra/newview/llimview.cpp
+++ b/indra/newview/llimview.cpp
@@ -167,7 +167,8 @@ BOOL LLFloaterIM::postBuild()
sErrorStringsMap["no_user_911"] =
getFormattedUIString("user_no_help");
- sEventStringsMap["add"] = childGetText("add_session_event");
+ sEventStringsMap["add"] =
+ getFormattedUIString("add_session_event");
sEventStringsMap["message"] =
getFormattedUIString("message_session_event");
@@ -388,7 +389,7 @@ void LLIMMgr::addMessage(
// when answering questions.
if(gAgent.isGodlike())
{
- // XUI:translate
+ // *TODO:translate (low priority, god ability)
std::ostringstream bonus_info;
bonus_info << "*** parent estate: "
<< parent_estate_id
diff --git a/indra/newview/llinventorybridge.cpp b/indra/newview/llinventorybridge.cpp
index 204ec57f46..4e9c399f3e 100644
--- a/indra/newview/llinventorybridge.cpp
+++ b/indra/newview/llinventorybridge.cpp
@@ -112,13 +112,6 @@ void remove_inventory_category_from_avatar_step2( BOOL proceed, void* userdata);
void move_task_inventory_callback(S32 option, void* user_data);
void confirm_replace_attachment_rez(S32 option, void* user_data);
-// TomY XUI: translate
-const char* FIND_HINT = "Start typing to select an item by name";
-const char* NAME_SEARCH_DESC = "Find items whose name contains (leave blank for all):";
-const char* NEW_LSL_NAME = "New Script";
-const char* NEW_NOTECARD_NAME = "New Note";
-const char* NEW_GESTURE_NAME = "New Gesture";
-
const char* ICON_NAME[ICON_NAME_COUNT] =
{
"inv_item_texture.tga",
diff --git a/indra/newview/llmanip.cpp b/indra/newview/llmanip.cpp
index 14f86d12e3..953befcd30 100644
--- a/indra/newview/llmanip.cpp
+++ b/indra/newview/llmanip.cpp
@@ -94,9 +94,10 @@ void LLManip::rebuild(LLViewerObject* vobj)
LLManip::LLManip( const LLString& name, LLToolComposite* composite )
:
LLTool( name, composite ),
- mInSnapRegime(FALSE)
-{}
-
+ mInSnapRegime(FALSE),
+ mHighlightedPart(LL_NO_PART)
+{
+}
void LLManip::getManipNormal(LLViewerObject* object, EManipPart manip, LLVector3 &normal)
{
@@ -360,14 +361,11 @@ void LLManip::renderGuidelines(BOOL draw_x, BOOL draw_y, BOOL draw_z)
LLVector3 grid_scale;
gSelectMgr->getGrid(grid_origin, grid_rot, grid_scale);
- LLViewerObject* object = mObjectSelection->getFirstRootObject();
+ const BOOL children_ok = TRUE;
+ LLViewerObject* object = mObjectSelection->getFirstRootObject(children_ok);
if (!object)
{
- object = mObjectSelection->getFirstObject();
- if (!object)
- {
- return;
- }
+ return;
}
//LLVector3 center_agent = gSelectMgr->getBBoxOfSelection().getCenterAgent();
diff --git a/indra/newview/llmanip.h b/indra/newview/llmanip.h
index aaae5e8f25..8c51746d1c 100644
--- a/indra/newview/llmanip.h
+++ b/indra/newview/llmanip.h
@@ -128,11 +128,13 @@ public:
/*virtual*/ BOOL handleMouseUp(S32 x, S32 y, MASK mask);
/*virtual*/ BOOL handleHover(S32 x, S32 y, MASK mask);
- virtual EManipPart getHighlightedPart() { return LL_NO_PART; }
- virtual void highlightManipulators(S32 x, S32 y) {};
+ virtual void highlightManipulators(S32 x, S32 y) = 0;
virtual void handleSelect();
virtual void handleDeselect();
+ virtual BOOL canAffectSelection() = 0;
+ EManipPart getHighlightedPart() { return mHighlightedPart; }
+
LLHandle<LLObjectSelection> getSelection();
protected:
@@ -152,6 +154,7 @@ protected:
LLFrameTimer mHelpTextTimer;
BOOL mInSnapRegime;
LLHandle<LLObjectSelection> mObjectSelection;
+ EManipPart mHighlightedPart;
static F32 sHelpTextVisibleTime;
static F32 sHelpTextFadeTime;
diff --git a/indra/newview/llmaniprotate.cpp b/indra/newview/llmaniprotate.cpp
index 093b3a24ee..15559bc1db 100644
--- a/indra/newview/llmaniprotate.cpp
+++ b/indra/newview/llmaniprotate.cpp
@@ -110,7 +110,7 @@ void LLManipRotate::handleSelect()
{
// *FIX: put this in mouseDown?
gSelectMgr->saveSelectedObjectTransform(SELECT_ACTION_TYPE_PICK);
- gFloaterTools->setStatusText("Drag colored bands to rotate object");
+ gFloaterTools->setStatusText("rotate");
LLManip::handleSelect();
}
@@ -118,8 +118,6 @@ void LLManipRotate::handleDeselect()
{
mHighlightedPart = LL_NO_PART;
mManipPart = LL_NO_PART;
-
- gFloaterTools->setStatusText("");
LLManip::handleDeselect();
}
@@ -379,14 +377,7 @@ BOOL LLManipRotate::handleMouseDown(S32 x, S32 y, MASK mask)
// Assumes that one of the parts of the manipulator was hit.
BOOL LLManipRotate::handleMouseDownOnPart( S32 x, S32 y, MASK mask )
{
- BOOL can_rotate = mObjectSelection->getObjectCount() != 0;
- for (LLViewerObject* objectp = mObjectSelection->getFirstObject();
- objectp;
- objectp = mObjectSelection->getNextObject())
- {
- can_rotate = can_rotate && objectp->permMove() && (objectp->permModify() || !gSavedSettings.getBOOL("EditLinkedParts"));
- }
-
+ BOOL can_rotate = canAffectSelection();
if (!can_rotate)
{
return FALSE;
@@ -541,12 +532,11 @@ void LLManipRotate::drag( S32 x, S32 y )
BOOL damped = mSmoothRotate;
mSmoothRotate = FALSE;
- LLViewerObject* object;
- LLSelectNode* selectNode;
-
- for( selectNode = mObjectSelection->getFirstNode(); selectNode != NULL; selectNode = mObjectSelection->getNextNode() )
+ for (LLObjectSelection::iterator iter = mObjectSelection->begin();
+ iter != mObjectSelection->end(); iter++)
{
- object = selectNode->getObject();
+ LLSelectNode* selectNode = *iter;
+ LLViewerObject* object = selectNode->getObject();
// have permission to move and object is root of selection or individually selected
if (object->permMove() && (object->isRootEdit() || selectNode->mIndividualSelection))
@@ -610,10 +600,12 @@ void LLManipRotate::drag( S32 x, S32 y )
}
// update positions
- for( selectNode = mObjectSelection->getFirstNode(); selectNode != NULL; selectNode = mObjectSelection->getNextNode() )
+ for (LLObjectSelection::iterator iter = mObjectSelection->begin();
+ iter != mObjectSelection->end(); iter++)
{
- object = selectNode->getObject();
-
+ LLSelectNode* selectNode = *iter;
+ LLViewerObject* object = selectNode->getObject();
+
// to avoid cumulative position changes we calculate the objects new position using its saved position
if (object && object->permMove())
{
@@ -711,10 +703,10 @@ void LLManipRotate::drag( S32 x, S32 y )
}
// store changes to override updates
- for (LLSelectNode* selectNode = gSelectMgr->getSelection()->getFirstNode();
- selectNode != NULL;
- selectNode = gSelectMgr->getSelection()->getNextNode())
+ for (LLObjectSelection::iterator iter = gSelectMgr->getSelection()->begin();
+ iter != gSelectMgr->getSelection()->end(); iter++)
{
+ LLSelectNode* selectNode = *iter;
LLViewerObject*cur = selectNode->getObject();
if( cur->permModify() && cur->permMove() && !cur->isAvatar())
{
@@ -1869,3 +1861,22 @@ S32 LLManipRotate::getObjectAxisClosestToMouse(LLVector3& object_axis)
return axis_index;
}
+
+//virtual
+BOOL LLManipRotate::canAffectSelection()
+{
+ BOOL can_rotate = mObjectSelection->getObjectCount() != 0;
+ if (can_rotate)
+ {
+ struct f : public LLSelectedObjectFunctor
+ {
+ virtual bool apply(LLViewerObject* objectp)
+ {
+ return objectp->permMove() && (objectp->permModify() || !gSavedSettings.getBOOL("EditLinkedParts"));
+ }
+ } func;
+ can_rotate = mObjectSelection->applyToObjects(&func);
+ }
+ return can_rotate;
+}
+
diff --git a/indra/newview/llmaniprotate.h b/indra/newview/llmaniprotate.h
index 62eddb3120..460bd3fcba 100644
--- a/indra/newview/llmaniprotate.h
+++ b/indra/newview/llmaniprotate.h
@@ -66,9 +66,10 @@ public:
virtual void handleSelect();
virtual void handleDeselect();
- BOOL handleMouseDownOnPart(S32 x, S32 y, MASK mask);
+ virtual BOOL handleMouseDownOnPart(S32 x, S32 y, MASK mask);
virtual void highlightManipulators(S32 x, S32 y);
- EManipPart getHighlightedPart() { return mHighlightedPart; }
+ virtual BOOL canAffectSelection();
+
private:
void updateHoverView();
@@ -111,7 +112,6 @@ private:
EManipPart mManipPart;
BOOL mSendUpdateOnMouseUp;
- EManipPart mHighlightedPart;
BOOL mSmoothRotate;
BOOL mCamEdgeOn;
diff --git a/indra/newview/llmanipscale.cpp b/indra/newview/llmanipscale.cpp
index 9ff802770b..7df5311aa4 100644
--- a/indra/newview/llmanipscale.cpp
+++ b/indra/newview/llmanipscale.cpp
@@ -162,7 +162,7 @@ void LLManipScale::handleSelect()
LLBBox bbox = gSelectMgr->getBBoxOfSelection();
updateSnapGuides(bbox);
gSelectMgr->saveSelectedObjectTransform(SELECT_ACTION_TYPE_PICK);
- gFloaterTools->setStatusText("Click and drag to stretch selected side");
+ gFloaterTools->setStatusText("scale");
LLManip::handleSelect();
}
@@ -170,7 +170,6 @@ void LLManipScale::handleDeselect()
{
mHighlightedPart = LL_NO_PART;
mManipPart = LL_NO_PART;
- gFloaterTools->setStatusText("");
LLManip::handleDeselect();
}
@@ -185,7 +184,6 @@ LLManipScale::LLManipScale( LLToolComposite* composite )
mBoxHandleSize( 1.f ),
mScaledBoxHandleSize( 1.f ),
mManipPart( LL_NO_PART ),
- mHighlightedPart( LL_NO_PART ),
mLastMouseX( -1 ),
mLastMouseY( -1 ),
mSendUpdateOnMouseUp( FALSE ),
@@ -217,7 +215,7 @@ void LLManipScale::render()
LLGLEnable gl_blend(GL_BLEND);
LLGLEnable gls_alpha_test(GL_ALPHA_TEST);
- if( isSelectionScalable() )
+ if( canAffectSelection() )
{
glMatrixMode(GL_MODELVIEW);
glPushMatrix();
@@ -336,14 +334,7 @@ BOOL LLManipScale::handleMouseDown(S32 x, S32 y, MASK mask)
// Assumes that one of the arrows on an object was hit.
BOOL LLManipScale::handleMouseDownOnPart( S32 x, S32 y, MASK mask )
{
- BOOL can_scale = mObjectSelection->getObjectCount() != 0;
- for (LLViewerObject* objectp = mObjectSelection->getFirstObject();
- objectp;
- objectp = mObjectSelection->getNextObject())
- {
- can_scale = can_scale && objectp->permModify() && objectp->permMove() && !objectp->isSeat();
- }
-
+ BOOL can_scale = canAffectSelection();
if (!can_scale)
{
return FALSE;
@@ -447,7 +438,7 @@ void LLManipScale::highlightManipulators(S32 x, S32 y)
// Don't do this with nothing selected, as it kills the framerate.
LLBBox bbox = gSelectMgr->getBBoxOfSelection();
- if( isSelectionScalable() )
+ if( canAffectSelection() )
{
LLMatrix4 transform;
if (mObjectSelection->getSelectType() == SELECT_TYPE_HUD)
@@ -827,10 +818,10 @@ void LLManipScale::drag( S32 x, S32 y )
}
// store changes to override updates
- for (LLSelectNode* selectNode = gSelectMgr->getSelection()->getFirstNode();
- selectNode != NULL;
- selectNode = gSelectMgr->getSelection()->getNextNode())
+ for (LLObjectSelection::iterator iter = gSelectMgr->getSelection()->begin();
+ iter != gSelectMgr->getSelection()->end(); iter++)
{
+ LLSelectNode* selectNode = *iter;
LLViewerObject*cur = selectNode->getObject();
if( cur->permModify() && cur->permMove() && !cur->isAvatar())
{
@@ -974,9 +965,10 @@ void LLManipScale::dragCorner( S32 x, S32 y )
F32 min_scale_factor = MIN_OBJECT_SCALE / MAX_OBJECT_SCALE;
// find max and min scale factors that will make biggest object hit max absolute scale and smallest object hit min absolute scale
- LLSelectNode* selectNode;
- for( selectNode = mObjectSelection->getFirstNode(); selectNode; selectNode = mObjectSelection->getNextNode() )
+ for (LLObjectSelection::iterator iter = mObjectSelection->begin();
+ iter != mObjectSelection->end(); iter++)
{
+ LLSelectNode* selectNode = *iter;
LLViewerObject* cur = selectNode->getObject();
if( cur->permModify() && cur->permMove() && !cur->isAvatar() )
{
@@ -995,8 +987,10 @@ void LLManipScale::dragCorner( S32 x, S32 y )
LLVector3d drag_global = uniform ? mDragStartCenterGlobal : mDragFarHitGlobal;
// do the root objects i.e. (TRUE == cur->isRootEdit())
- for( selectNode = mObjectSelection->getFirstNode(); selectNode; selectNode = mObjectSelection->getNextNode() )
+ for (LLObjectSelection::iterator iter = mObjectSelection->begin();
+ iter != mObjectSelection->end(); iter++)
{
+ LLSelectNode* selectNode = *iter;
LLViewerObject* cur = selectNode->getObject();
if( cur->permModify() && cur->permMove() && !cur->isAvatar() && cur->isRootEdit() )
{
@@ -1039,8 +1033,10 @@ void LLManipScale::dragCorner( S32 x, S32 y )
}
}
// do the child objects i.e. (FALSE == cur->isRootEdit())
- for( selectNode = mObjectSelection->getFirstNode(); selectNode; selectNode = mObjectSelection->getNextNode() )
+ for (LLObjectSelection::iterator iter = mObjectSelection->begin();
+ iter != mObjectSelection->end(); iter++)
{
+ LLSelectNode* selectNode = *iter;
LLViewerObject*cur = selectNode->getObject();
if( cur->permModify() && cur->permMove() && !cur->isAvatar() && !cur->isRootEdit() )
{
@@ -1245,9 +1241,10 @@ void LLManipScale::stretchFace( const LLVector3& drag_start_agent, const LLVecto
{
LLVector3 drag_start_center_agent = gAgent.getPosAgentFromGlobal(mDragStartCenterGlobal);
- LLSelectNode *selectNode;
- for( selectNode = mObjectSelection->getFirstNode(); selectNode; selectNode = mObjectSelection->getNextNode() )
+ for (LLObjectSelection::iterator iter = mObjectSelection->begin();
+ iter != mObjectSelection->end(); iter++)
{
+ LLSelectNode* selectNode = *iter;
LLViewerObject*cur = selectNode->getObject();
if( cur->permModify() && cur->permMove() && !cur->isAvatar() )
{
@@ -2040,23 +2037,22 @@ LLVector3 LLManipScale::nearestAxis( const LLVector3& v ) const
return LLVector3( coords[greatest_index] );
}
-//FIXME: make this const once we switch to iterator interface
-//(making object traversal a const-able operation)
-BOOL LLManipScale::isSelectionScalable()
+// virtual
+BOOL LLManipScale::canAffectSelection()
{
// An selection is scalable if you are allowed to both edit and move
// everything in it, and it does not have any sitting agents
- BOOL scalable = mObjectSelection->getFirstObject() ? TRUE : FALSE;
- for(LLViewerObject* cur = mObjectSelection->getFirstObject();
- cur;
- cur = mObjectSelection->getNextObject() )
+ BOOL can_scale = mObjectSelection->getObjectCount() != 0;
+ if (can_scale)
{
- if( !(cur->permModify() && cur->permMove())
- || cur->isSeat())
+ struct f : public LLSelectedObjectFunctor
{
- scalable = FALSE;
- break;
- }
- }
- return scalable;
+ virtual bool apply(LLViewerObject* objectp)
+ {
+ return objectp->permModify() && objectp->permMove() && !objectp->isSeat();
+ }
+ } func;
+ can_scale = mObjectSelection->applyToObjects(&func);
+ }
+ return can_scale;
}
diff --git a/indra/newview/llmanipscale.h b/indra/newview/llmanipscale.h
index 13686fa38d..3ea5ee7d7a 100644
--- a/indra/newview/llmanipscale.h
+++ b/indra/newview/llmanipscale.h
@@ -78,9 +78,9 @@ public:
virtual void handleSelect();
virtual void handleDeselect();
- BOOL handleMouseDownOnPart(S32 x, S32 y, MASK mask);
- EManipPart getHighlightedPart() { return mHighlightedPart; }
+ virtual BOOL handleMouseDownOnPart(S32 x, S32 y, MASK mask);
virtual void highlightManipulators(S32 x, S32 y); // decided which manipulator, if any, should be highlighted by mouse hover
+ virtual BOOL canAffectSelection();
static void setUniform( BOOL b );
static BOOL getUniform();
@@ -117,8 +117,6 @@ private:
F32 partToMinScale( S32 part, const LLBBox& bbox ) const;
LLVector3 nearestAxis( const LLVector3& v ) const;
- BOOL isSelectionScalable();
-
void stretchFace( const LLVector3& drag_start_agent, const LLVector3& drag_delta_agent);
void adjustTextureRepeats(); // Adjusts texture coords based on mSavedScale and current scale, only works for boxes
@@ -133,7 +131,6 @@ private:
LLVector3d mDragStartCenterGlobal; // The center of the bounding box of all selected objects at time of drag start
LLVector3d mDragPointGlobal;
LLVector3d mDragFarHitGlobal;
- EManipPart mHighlightedPart;
S32 mLastMouseX;
S32 mLastMouseY;
BOOL mSendUpdateOnMouseUp;
diff --git a/indra/newview/llmaniptranslate.cpp b/indra/newview/llmaniptranslate.cpp
index c43ef73090..1f52f30c88 100644
--- a/indra/newview/llmaniptranslate.cpp
+++ b/indra/newview/llmaniptranslate.cpp
@@ -261,7 +261,7 @@ LLManipTranslate::~LLManipTranslate()
void LLManipTranslate::handleSelect()
{
gSelectMgr->saveSelectedObjectTransform(SELECT_ACTION_TYPE_PICK);
- gFloaterTools->setStatusText("Drag to move, shift-drag to copy");
+ gFloaterTools->setStatusText("move");
LLManip::handleSelect();
}
@@ -269,7 +269,6 @@ void LLManipTranslate::handleDeselect()
{
mHighlightedPart = LL_NO_PART;
mManipPart = LL_NO_PART;
- gFloaterTools->setStatusText("");
LLManip::handleDeselect();
}
@@ -296,14 +295,7 @@ BOOL LLManipTranslate::handleMouseDown(S32 x, S32 y, MASK mask)
// Assumes that one of the arrows on an object was hit.
BOOL LLManipTranslate::handleMouseDownOnPart( S32 x, S32 y, MASK mask )
{
- BOOL can_move = mObjectSelection->getObjectCount() != 0;
- for (LLViewerObject* objectp = mObjectSelection->getFirstObject();
- objectp;
- objectp = mObjectSelection->getNextObject())
- {
- can_move = can_move && objectp->permMove() && (objectp->permModify() || !gSavedSettings.getBOOL("EditLinkedParts"));
- }
-
+ BOOL can_move = canAffectSelection();
if (!can_move)
{
return FALSE;
@@ -431,8 +423,6 @@ BOOL LLManipTranslate::handleHover(S32 x, S32 y, MASK mask)
}
}
- LLViewerObject *object;
-
// Suppress processing if mouse hasn't actually moved.
// This may cause problems if the camera moves outside of the
// rotation above.
@@ -491,7 +481,7 @@ BOOL LLManipTranslate::handleHover(S32 x, S32 y, MASK mask)
return TRUE;
}
- object = selectNode->getObject();
+ LLViewerObject* object = selectNode->getObject();
if (!object)
{
// somehow we lost the object!
@@ -654,11 +644,11 @@ BOOL LLManipTranslate::handleHover(S32 x, S32 y, MASK mask)
LLVector3d clamped_relative_move = axis_magnitude * axis_d; // scalar multiply
LLVector3 clamped_relative_move_f = (F32)axis_magnitude * axis_f; // scalar multiply
- for(selectNode = mObjectSelection->getFirstNode();
- selectNode;
- selectNode = mObjectSelection->getNextNode() )
+ for (LLObjectSelection::iterator iter = mObjectSelection->begin();
+ iter != mObjectSelection->end(); iter++)
{
- object = selectNode->getObject();
+ LLSelectNode* selectNode = *iter;
+ LLViewerObject* object = selectNode->getObject();
// Only apply motion to root objects and objects selected
// as "individual".
@@ -1739,12 +1729,8 @@ void LLManipTranslate::renderText()
}
else
{
- LLViewerObject* objectp = mObjectSelection->getFirstRootObject();
- if(!objectp)
- {
- objectp = mObjectSelection->getFirstObject();
- }
-
+ const BOOL children_ok = TRUE;
+ LLViewerObject* objectp = mObjectSelection->getFirstRootObject(children_ok);
if (objectp)
{
renderXYZ(objectp->getPositionEdit());
@@ -2264,3 +2250,21 @@ void LLManipTranslate::renderGridVert(F32 x_trans, F32 y_trans, F32 r, F32 g, F3
}
}
+
+// virtual
+BOOL LLManipTranslate::canAffectSelection()
+{
+ BOOL can_move = mObjectSelection->getObjectCount() != 0;
+ if (can_move)
+ {
+ struct f : public LLSelectedObjectFunctor
+ {
+ virtual bool apply(LLViewerObject* objectp)
+ {
+ return objectp->permMove() && (objectp->permModify() || !gSavedSettings.getBOOL("EditLinkedParts"));
+ }
+ } func;
+ can_move = mObjectSelection->applyToObjects(&func);
+ }
+ return can_move;
+}
diff --git a/indra/newview/llmaniptranslate.h b/indra/newview/llmaniptranslate.h
index b1f211d355..8821b64c90 100644
--- a/indra/newview/llmaniptranslate.h
+++ b/indra/newview/llmaniptranslate.h
@@ -64,9 +64,9 @@ public:
virtual void handleSelect();
virtual void handleDeselect();
- EManipPart getHighlightedPart() { return mHighlightedPart; }
virtual void highlightManipulators(S32 x, S32 y);
- /*virtual*/ BOOL handleMouseDownOnPart(S32 x, S32 y, MASK mask);
+ virtual BOOL handleMouseDownOnPart(S32 x, S32 y, MASK mask);
+ virtual BOOL canAffectSelection();
protected:
enum EHandleType {
@@ -107,7 +107,6 @@ private:
LLTimer mUpdateTimer;
LLLinkedList<ManipulatorHandle> mProjectedManipulators;
LLVector4 mManipulatorVertices[18];
- EManipPart mHighlightedPart;
F32 mSnapOffsetMeters;
LLVector3 mSnapOffsetAxis;
LLQuaternion mGridRotation;
diff --git a/indra/newview/llmutelist.h b/indra/newview/llmutelist.h
index ed675ec1b4..23e0620ade 100644
--- a/indra/newview/llmutelist.h
+++ b/indra/newview/llmutelist.h
@@ -60,7 +60,7 @@ public:
flagAll = 0x0000000F // Mask of all currently defined flags
};
- LLMute(const LLUUID& id, const LLString& name = "", EType type = BY_NAME, U32 flags = 0)
+ LLMute(const LLUUID& id, const LLString& name = LLString(), EType type = BY_NAME, U32 flags = 0)
: mID(id), mName(name), mType(type),mFlags(flags) { }
// Returns name + suffix based on type
diff --git a/indra/newview/llnamebox.cpp b/indra/newview/llnamebox.cpp
index f5a9045f2b..b5021eff9c 100644
--- a/indra/newview/llnamebox.cpp
+++ b/indra/newview/llnamebox.cpp
@@ -57,7 +57,7 @@ LLNameBox::LLNameBox(const std::string& name, const LLRect& rect, const LLUUID&
}
else
{
- setText("");
+ setText(LLString::null);
}
}
diff --git a/indra/newview/llnamelistctrl.cpp b/indra/newview/llnamelistctrl.cpp
index 8f66035f2e..adcc141bb1 100644
--- a/indra/newview/llnamelistctrl.cpp
+++ b/indra/newview/llnamelistctrl.cpp
@@ -157,7 +157,7 @@ void LLNameListCtrl::addGroupNameItem(LLScrollListItem* item, EAddPosition pos)
gCacheName->getGroupName(item->getUUID(), group_name);
LLScrollListCell* cell = (LLScrollListCell*)item->getColumn(mNameColumnIndex);
- ((LLScrollListText*)cell)->setText( group_name );
+ ((LLScrollListText*)cell)->setText( LLString(group_name) );
addItem(item, pos);
}
@@ -461,3 +461,4 @@ LLView* LLNameListCtrl::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFacto
}
+
diff --git a/indra/newview/lloverlaybar.cpp b/indra/newview/lloverlaybar.cpp
index c941ce3bb5..d8131c27d7 100644
--- a/indra/newview/lloverlaybar.cpp
+++ b/indra/newview/lloverlaybar.cpp
@@ -360,8 +360,7 @@ void LLOverlayBar::refresh()
{
LLParcel* parcel = gParcelMgr->getAgentParcel();
if (!parcel
- || !parcel->getMusicURL()
- || !parcel->getMusicURL()[0]
+ || parcel->getMusicURL().empty()
|| !gSavedSettings.getBOOL("AudioStreamingMusic"))
{
mMusicRemote->setVisible(FALSE);
@@ -509,7 +508,7 @@ void LLOverlayBar::musicPlay(void*)
// stream is stopped, it doesn't return the right thing - commenting out for now.
// if ( gAudiop->isInternetStreamPlaying() == 0 )
{
- gAudiop->startInternetStream(parcel->getMusicURL());
+ gAudiop->startInternetStream(parcel->getMusicURL().c_str());
}
}
}
diff --git a/indra/newview/llpanelavatar.cpp b/indra/newview/llpanelavatar.cpp
index 4fbdeb46f6..dc2f14fcef 100644
--- a/indra/newview/llpanelavatar.cpp
+++ b/indra/newview/llpanelavatar.cpp
@@ -87,36 +87,6 @@
std::list<LLPanelAvatar*> LLPanelAvatar::sAllPanels;
BOOL LLPanelAvatar::sAllowFirstLife = FALSE;
-//-----------------------------------------------------------------------------
-// Constants
-//-----------------------------------------------------------------------------
-
-// RN: move these to lldbstrings.h
-static const S32 DB_USER_FAVORITES_STR_LEN = 254;
-
-const char LOADING_MSG[] = "Loading...";
-static const char IM_DISABLED_TOOLTIP[] = "Instant Message (IM).\nDisabled because you do not have their card.";
-static const char IM_ENABLED_TOOLTIP[] = "Instant Message (IM)";
-static const S32 LEFT = HPAD;
-
-static const S32 RULER0 = 65;
-static const S32 RULER1 = RULER0 + 5;
-static const S32 RULER2 = RULER1 + 90;
-static const S32 RULER3 = RULER2 + 90;
-static const S32 RULER4 = RULER3 + 10;
-
-static const S32 PICT_WIDTH = 180;
-static const S32 PICT_HEIGHT = 135;
-
-static const S32 RULER5 = RULER4 + 140;
-static const S32 WIDTH = RULER5 + 16;
-
-static const S32 MAX_CHARS = 254;
-
-static const LLColor4 WHITE(1,1,1,1);
-static const LLColor4 BLACK(0,0,0,1);
-static const LLColor4 CLEAR(0,0,0,0);
-
extern void handle_lure(const LLUUID& invitee);
extern void handle_pay_by_id(const LLUUID& payee);
@@ -317,8 +287,8 @@ void LLPanelAvatarSecondLife::updatePartnerName()
BOOL found = gCacheName->getName(mPartnerID, first, last);
if (found)
{
- childSetTextArg("partner_edit", "[FIRST]", first);
- childSetTextArg("partner_edit", "[LAST]", last);
+ childSetTextArg("partner_edit", "[FIRST]", LLString(first));
+ childSetTextArg("partner_edit", "[LAST]", LLString(last));
}
}
}
@@ -339,8 +309,8 @@ void LLPanelAvatarSecondLife::clearControls()
childSetValue("born", "");
childSetValue("acct", "");
- childSetTextArg("partner_edit", "[FIRST]", "");
- childSetTextArg("partner_edit", "[LAST]", "");
+ childSetTextArg("partner_edit", "[FIRST]", LLString::null);
+ childSetTextArg("partner_edit", "[LAST]", LLString::null);
mPartnerID = LLUUID::null;
@@ -376,7 +346,7 @@ void LLPanelAvatarSecondLife::enableControls(BOOL self)
// appears to reset the read only background color when
// setEnable is called, for some reason
LLTextEditor* about = LLUICtrlFactory::getTextEditorByName(this,"about");
- if (about) about->setReadOnlyBgColor(CLEAR);
+ if (about) about->setReadOnlyBgColor(LLColor4::transparent);
}
}
@@ -756,10 +726,10 @@ void LLPanelAvatarAdvanced::enableControls(BOOL self)
// This is because the LLTextEditor
// appears to reset the read only background color when
// setEnable is called, for some reason
- if (mWantToEdit) mWantToEdit->setReadOnlyBgColor(CLEAR);
- if (mSkillsEdit) mSkillsEdit->setReadOnlyBgColor(CLEAR);
+ if (mWantToEdit) mWantToEdit->setReadOnlyBgColor(LLColor4::transparent);
+ if (mSkillsEdit) mSkillsEdit->setReadOnlyBgColor(LLColor4::transparent);
LLLineEditor* languages_edit = (LLLineEditor*)getChildByName("languages_edit");
- languages_edit->setReadOnlyBgColor(CLEAR);
+ languages_edit->setReadOnlyBgColor(LLColor4::transparent);
}
}
@@ -834,7 +804,7 @@ void LLPanelAvatarNotes::refresh()
void LLPanelAvatarNotes::clearControls()
{
- childSetText("notes edit", LOADING_MSG);
+ childSetText("notes edit", childGetText("Loading"));
childSetEnabled("notes edit", false);
}
@@ -1515,7 +1485,6 @@ void LLPanelAvatar::setAvatarID(const LLUUID &avatar_id, const LLString &name,
childSetVisible("Instant Message...",TRUE);
childSetEnabled("Instant Message...",FALSE);
- childSetToolTip("Instant Message...",IM_ENABLED_TOOLTIP);
childSetVisible("Mute",TRUE);
childSetEnabled("Mute",FALSE);
@@ -1778,7 +1747,7 @@ void LLPanelAvatar::sendAvatarNotesUpdate()
std::string notes = mPanelNotes->childGetValue("notes edit").asString();
if (!mHaveNotes
- && (notes.empty() || notes == LOADING_MSG))
+ && (notes.empty() || notes == childGetText("Loading")))
{
// no notes from server and no user updates
return;
diff --git a/indra/newview/llpanelclassified.cpp b/indra/newview/llpanelclassified.cpp
index 95d2541fc5..0c3edf1242 100644
--- a/indra/newview/llpanelclassified.cpp
+++ b/indra/newview/llpanelclassified.cpp
@@ -355,8 +355,7 @@ void LLPanelClassified::initNewClassified()
// delay commit until user hits save
// sendClassifiedInfoUpdate();
- mUpdateBtn->setLabelSelected("Publish...");
- mUpdateBtn->setLabelUnselected("Publish...");
+ mUpdateBtn->setLabel(childGetText("publish_txt"));
}
@@ -575,8 +574,8 @@ void LLPanelClassified::processClassifiedInfoReply(LLMessageSystem *msg, void **
self->mPosGlobal = pos_global;
// Update UI controls
- self->mNameEditor->setText(name);
- self->mDescEditor->setText(desc);
+ self->mNameEditor->setText(LLString(name));
+ self->mDescEditor->setText(LLString(desc));
self->mSnapshotCtrl->setImageAssetID(snapshot_id);
self->mLocationEditor->setText(location_text);
self->mLocationChanged = false;
@@ -596,8 +595,7 @@ void LLPanelClassified::processClassifiedInfoReply(LLMessageSystem *msg, void **
// If we got data from the database, we know the listing is paid for.
self->mPaidFor = TRUE;
- self->mUpdateBtn->setLabelSelected("Update");
- self->mUpdateBtn->setLabelUnselected("Update");
+ self->mUpdateBtn->setLabel(self->childGetText("update_txt"));
}
}
diff --git a/indra/newview/llpanelcontents.cpp b/indra/newview/llpanelcontents.cpp
index ec966d2fc5..50ff7bd9eb 100644
--- a/indra/newview/llpanelcontents.cpp
+++ b/indra/newview/llpanelcontents.cpp
@@ -138,11 +138,8 @@ void LLPanelContents::getState(LLViewerObject *objectp )
void LLPanelContents::refresh()
{
- LLViewerObject* object = gSelectMgr->getSelection()->getFirstRootObject();
- if(!object)
- {
- object = gSelectMgr->getSelection()->getFirstObject();
- }
+ const BOOL children_ok = TRUE;
+ LLViewerObject* object = gSelectMgr->getSelection()->getFirstRootObject(children_ok);
getState(object);
if (mPanelInventory)
@@ -160,11 +157,8 @@ void LLPanelContents::refresh()
// static
void LLPanelContents::onClickNewScript(void *userdata)
{
- LLViewerObject* object = gSelectMgr->getSelection()->getFirstRootObject();
- if(!object)
- {
- object = gSelectMgr->getSelection()->getFirstObject();
- }
+ const BOOL children_ok = TRUE;
+ LLViewerObject* object = gSelectMgr->getSelection()->getFirstRootObject(children_ok);
if(object)
{
LLPermissions perm;
diff --git a/indra/newview/llpanelface.cpp b/indra/newview/llpanelface.cpp
index 57d1a57a70..63e25d9f2d 100644
--- a/indra/newview/llpanelface.cpp
+++ b/indra/newview/llpanelface.cpp
@@ -255,35 +255,32 @@ void LLPanelFace::sendAlpha()
}
-
-void LLPanelFace::sendTextureInfo()
+struct LLPanelFaceSetTEFunctor : public LLSelectedTEFunctor
{
- S32 te;
- LLViewerObject* object;
- LLObjectSelectionHandle selection = gSelectMgr->getSelection();
- for ( selection->getFirstTE(&object, &te); object; selection->getNextTE(&object, &te) )
+ LLPanelFaceSetTEFunctor(LLPanelFace* panel) : mPanel(panel) {}
+ virtual bool apply(LLViewerObject* object, S32 te)
{
BOOL valid;
F32 value;
- LLSpinCtrl* mCtrlTexScaleS = LLViewerUICtrlFactory::getSpinnerByName(this,"TexScaleU");
- LLSpinCtrl* mCtrlTexScaleT = LLViewerUICtrlFactory::getSpinnerByName(this,"TexScaleV");
- LLSpinCtrl* mCtrlTexOffsetS = LLViewerUICtrlFactory::getSpinnerByName(this,"TexOffsetU");
- LLSpinCtrl* mCtrlTexOffsetT = LLViewerUICtrlFactory::getSpinnerByName(this,"TexOffsetV");
- LLSpinCtrl* mCtrlTexRotation = LLViewerUICtrlFactory::getSpinnerByName(this,"TexRot");
- LLCheckBoxCtrl* mCheckFlipScaleS = LLViewerUICtrlFactory::getCheckBoxByName(this,"checkbox flip s");
- LLCheckBoxCtrl* mCheckFlipScaleT = LLViewerUICtrlFactory::getCheckBoxByName(this,"checkbox flip t");
- LLComboBox* mComboTexGen = LLViewerUICtrlFactory::getComboBoxByName(this,"combobox texgen");
- if (mCtrlTexScaleS)
+ LLSpinCtrl* ctrlTexScaleS = LLViewerUICtrlFactory::getSpinnerByName(mPanel,"TexScaleU");
+ LLSpinCtrl* ctrlTexScaleT = LLViewerUICtrlFactory::getSpinnerByName(mPanel,"TexScaleV");
+ LLSpinCtrl* ctrlTexOffsetS = LLViewerUICtrlFactory::getSpinnerByName(mPanel,"TexOffsetU");
+ LLSpinCtrl* ctrlTexOffsetT = LLViewerUICtrlFactory::getSpinnerByName(mPanel,"TexOffsetV");
+ LLSpinCtrl* ctrlTexRotation = LLViewerUICtrlFactory::getSpinnerByName(mPanel,"TexRot");
+ LLCheckBoxCtrl* checkFlipScaleS = LLViewerUICtrlFactory::getCheckBoxByName(mPanel,"checkbox flip s");
+ LLCheckBoxCtrl* checkFlipScaleT = LLViewerUICtrlFactory::getCheckBoxByName(mPanel,"checkbox flip t");
+ LLComboBox* comboTexGen = LLViewerUICtrlFactory::getComboBoxByName(mPanel,"combobox texgen");
+ if (ctrlTexScaleS)
{
- valid = !mCtrlTexScaleS->getTentative() || !mCheckFlipScaleS->getTentative();
+ valid = !ctrlTexScaleS->getTentative() || !checkFlipScaleS->getTentative();
if (valid)
{
- value = mCtrlTexScaleS->get();
- if( mCheckFlipScaleS->get() )
+ value = ctrlTexScaleS->get();
+ if( checkFlipScaleS->get() )
{
value = -value;
}
- if (mComboTexGen->getCurrentIndex() == 1)
+ if (comboTexGen->getCurrentIndex() == 1)
{
value *= 0.5f;
}
@@ -291,17 +288,17 @@ void LLPanelFace::sendTextureInfo()
}
}
- if (mCtrlTexScaleT)
+ if (ctrlTexScaleT)
{
- valid = !mCtrlTexScaleT->getTentative() || !mCheckFlipScaleT->getTentative();
+ valid = !ctrlTexScaleT->getTentative() || !checkFlipScaleT->getTentative();
if (valid)
{
- value = mCtrlTexScaleT->get();
- if( mCheckFlipScaleT->get() )
+ value = ctrlTexScaleT->get();
+ if( checkFlipScaleT->get() )
{
value = -value;
}
- if (mComboTexGen->getCurrentIndex() == 1)
+ if (comboTexGen->getCurrentIndex() == 1)
{
value *= 0.5f;
}
@@ -309,41 +306,57 @@ void LLPanelFace::sendTextureInfo()
}
}
- if (mCtrlTexOffsetS)
+ if (ctrlTexOffsetS)
{
- valid = !mCtrlTexOffsetS->getTentative();
+ valid = !ctrlTexOffsetS->getTentative();
if (valid)
{
- value = mCtrlTexOffsetS->get();
+ value = ctrlTexOffsetS->get();
object->setTEOffsetS( te, value );
}
}
- if (mCtrlTexOffsetT)
+ if (ctrlTexOffsetT)
{
- valid = !mCtrlTexOffsetT->getTentative();
+ valid = !ctrlTexOffsetT->getTentative();
if (valid)
{
- value = mCtrlTexOffsetT->get();
+ value = ctrlTexOffsetT->get();
object->setTEOffsetT( te, value );
}
}
- if (mCtrlTexRotation)
+ if (ctrlTexRotation)
{
- valid = !mCtrlTexRotation->getTentative();
+ valid = !ctrlTexRotation->getTentative();
if (valid)
{
- value = mCtrlTexRotation->get() * DEG_TO_RAD;
+ value = ctrlTexRotation->get() * DEG_TO_RAD;
object->setTERotation( te, value );
}
}
+ return true;
}
+private:
+ LLPanelFace* mPanel;
+};
- for ( object = gSelectMgr->getSelection()->getFirstObject(); object; object = gSelectMgr->getSelection()->getNextObject() )
+struct LLPanelFaceSendFunctor : public LLSelectedObjectFunctor
+{
+ virtual bool apply(LLViewerObject* object)
{
object->sendTEUpdate();
+ return true;
}
+};
+
+void LLPanelFace::sendTextureInfo()
+{
+ LLPanelFaceSetTEFunctor setfunc(this);
+ gSelectMgr->getSelection()->applyToTEs(&setfunc);
+
+ LLPanelFaceSendFunctor sendfunc;
+ gSelectMgr->getSelection()->applyToObjects(&sendfunc);
}
void LLPanelFace::getState()
@@ -371,43 +384,58 @@ void LLPanelFace::getState()
}
childSetEnabled("button apply",editable);
+ bool identical;
+ LLTextureCtrl* texture_ctrl = LLViewerUICtrlFactory::getTexturePickerByName(this,"texture control");
+
// Texture
- LLUUID id;
- BOOL identical = gSelectMgr->selectionGetTexUUID(id);
- LLTextureCtrl* mTextureCtrl = LLViewerUICtrlFactory::getTexturePickerByName(this,"texture control");
- if (identical)
{
- // All selected have the same texture
- if(mTextureCtrl){
- mTextureCtrl->setTentative( FALSE );
- mTextureCtrl->setEnabled( editable );
- mTextureCtrl->setImageAssetID( id );
- }
- }
- else
- {
- if(mTextureCtrl){
- if( id.isNull() )
+ LLUUID id;
+ struct f1 : public LLSelectedTEGetFunctor<LLUUID>
+ {
+ LLUUID get(LLViewerObject* object, S32 te)
+ {
+ LLViewerImage* image = object->getTEImage(te);
+ return image ? image->getID() : LLUUID::null;
+ }
+ } func;
+ identical = gSelectMgr->getSelection()->getSelectedTEValue( &func, id );
+
+ if (identical)
+ {
+ // All selected have the same texture
+ if(texture_ctrl)
{
- // None selected
- mTextureCtrl->setTentative( FALSE );
- mTextureCtrl->setEnabled( FALSE );
- mTextureCtrl->setImageAssetID( LLUUID::null );
+ texture_ctrl->setTentative( FALSE );
+ texture_ctrl->setEnabled( editable );
+ texture_ctrl->setImageAssetID( id );
}
- else
+ }
+ else
+ {
+ if(texture_ctrl)
{
- // Tentative: multiple selected with different textures
- mTextureCtrl->setTentative( TRUE );
- mTextureCtrl->setEnabled( editable );
- mTextureCtrl->setImageAssetID( id );
+ if( id.isNull() )
+ {
+ // None selected
+ texture_ctrl->setTentative( FALSE );
+ texture_ctrl->setEnabled( FALSE );
+ texture_ctrl->setImageAssetID( LLUUID::null );
+ }
+ else
+ {
+ // Tentative: multiple selected with different textures
+ texture_ctrl->setTentative( TRUE );
+ texture_ctrl->setEnabled( editable );
+ texture_ctrl->setImageAssetID( id );
+ }
}
}
}
-
+
LLAggregatePermissions texture_perms;
- if(mTextureCtrl)
+ if(texture_ctrl)
{
-// mTextureCtrl->setValid( editable );
+// texture_ctrl->setValid( editable );
if (gSelectMgr->selectGetAggregateTexturePermissions(texture_perms))
{
@@ -417,11 +445,11 @@ void LLPanelFace::getState()
BOOL can_transfer =
texture_perms.getValue(PERM_TRANSFER) == LLAggregatePermissions::AP_EMPTY ||
texture_perms.getValue(PERM_TRANSFER) == LLAggregatePermissions::AP_ALL;
- mTextureCtrl->setCanApplyImmediately(can_copy && can_transfer);
+ texture_ctrl->setCanApplyImmediately(can_copy && can_transfer);
}
else
{
- mTextureCtrl->setCanApplyImmediately(FALSE);
+ texture_ctrl->setCanApplyImmediately(FALSE);
}
}
@@ -430,7 +458,14 @@ void LLPanelFace::getState()
childSetEnabled("tex scale",editable);
//mLabelTexScale->setEnabled( editable );
F32 scale_s = 1.f;
- identical = allFacesSameValue( &LLPanelFace::valueScaleS, &scale_s );
+ struct f2 : public LLSelectedTEGetFunctor<F32>
+ {
+ F32 get(LLViewerObject* object, S32 face)
+ {
+ return object->getTE(face)->mScaleS;
+ }
+ } func;
+ identical = gSelectMgr->getSelection()->getSelectedTEValue( &func, scale_s );
childSetValue("TexScaleU",editable ? llabs(scale_s) : 0);
childSetTentative("TexScaleU",LLSD((BOOL)(!identical)));
childSetEnabled("TexScaleU",editable);
@@ -441,7 +476,14 @@ void LLPanelFace::getState()
{
F32 scale_t = 1.f;
- identical = allFacesSameValue( &LLPanelFace::valueScaleT, &scale_t );
+ struct f3 : public LLSelectedTEGetFunctor<F32>
+ {
+ F32 get(LLViewerObject* object, S32 face)
+ {
+ return object->getTE(face)->mScaleS;
+ }
+ } func;
+ identical = gSelectMgr->getSelection()->getSelectedTEValue( &func, scale_t );
childSetValue("TexScaleV",llabs(editable ? llabs(scale_t) : 0));
childSetTentative("TexScaleV",LLSD((BOOL)(!identical)));
@@ -455,7 +497,14 @@ void LLPanelFace::getState()
{
childSetEnabled("tex offset",editable);
F32 offset_s = 0.f;
- identical = allFacesSameValue( &LLPanelFace::valueOffsetS, &offset_s );
+ struct f4 : public LLSelectedTEGetFunctor<F32>
+ {
+ F32 get(LLViewerObject* object, S32 face)
+ {
+ return object->getTE(face)->mOffsetS;
+ }
+ } func;
+ identical = gSelectMgr->getSelection()->getSelectedTEValue( &func, offset_s );
childSetValue("TexOffsetU", editable ? offset_s : 0);
childSetTentative("TexOffsetU",!identical);
childSetEnabled("TexOffsetU",editable);
@@ -463,7 +512,14 @@ void LLPanelFace::getState()
{
F32 offset_t = 0.f;
- identical = allFacesSameValue( &LLPanelFace::valueOffsetT, &offset_t );
+ struct f5 : public LLSelectedTEGetFunctor<F32>
+ {
+ F32 get(LLViewerObject* object, S32 face)
+ {
+ return object->getTE(face)->mOffsetT;
+ }
+ } func;
+ identical = gSelectMgr->getSelection()->getSelectedTEValue( &func, offset_t );
childSetValue("TexOffsetV", editable ? offset_t : 0);
childSetTentative("TexOffsetV",!identical);
childSetEnabled("TexOffsetV",editable);
@@ -473,7 +529,14 @@ void LLPanelFace::getState()
{
childSetEnabled("tex rotate",editable);
F32 rotation = 0.f;
- identical = allFacesSameValue( &LLPanelFace::valueTexRotation, &rotation );
+ struct f6 : public LLSelectedTEGetFunctor<F32>
+ {
+ F32 get(LLViewerObject* object, S32 face)
+ {
+ return object->getTE(face)->mRotation;
+ }
+ } func;
+ identical = gSelectMgr->getSelection()->getSelectedTEValue( &func, rotation );
childSetValue("TexRot", editable ? rotation * RAD_TO_DEG : 0);
childSetTentative("TexRot",!identical);
childSetEnabled("TexRot",editable);
@@ -484,7 +547,15 @@ void LLPanelFace::getState()
LLColor4 color = LLColor4::white;
if(mColorSwatch)
{
- identical = gSelectMgr->selectionGetColor(color);
+ struct f7 : public LLSelectedTEGetFunctor<LLColor4>
+ {
+ LLColor4 get(LLViewerObject* object, S32 face)
+ {
+ return object->getTE(face)->getColor();
+ }
+ } func;
+ identical = gSelectMgr->getSelection()->getSelectedTEValue( &func, color );
+
mColorSwatch->setOriginal(color);
mColorSwatch->set(color, TRUE);
@@ -506,7 +577,14 @@ void LLPanelFace::getState()
// Bump
{
F32 shinyf = 0.f;
- identical = allFacesSameValue( &LLPanelFace::valueShiny, &shinyf );
+ struct f8 : public LLSelectedTEGetFunctor<F32>
+ {
+ F32 get(LLViewerObject* object, S32 face)
+ {
+ return (F32)(object->getTE(face)->getShiny());
+ }
+ } func;
+ identical = gSelectMgr->getSelection()->getSelectedTEValue( &func, shinyf );
LLCtrlSelectionInterface* combobox_shininess =
childGetSelectionInterface("combobox shininess");
if (combobox_shininess)
@@ -524,7 +602,14 @@ void LLPanelFace::getState()
{
F32 bumpf = 0.f;
- identical = allFacesSameValue( &LLPanelFace::valueBump, &bumpf );
+ struct f9 : public LLSelectedTEGetFunctor<F32>
+ {
+ F32 get(LLViewerObject* object, S32 face)
+ {
+ return (F32)(object->getTE(face)->getBumpmap());
+ }
+ } func;
+ identical = gSelectMgr->getSelection()->getSelectedTEValue( &func, bumpf );
LLCtrlSelectionInterface* combobox_bumpiness =
childGetSelectionInterface("combobox bumpiness");
if (combobox_bumpiness)
@@ -542,7 +627,14 @@ void LLPanelFace::getState()
{
F32 genf = 0.f;
- identical = allFacesSameValue( &LLPanelFace::valueTexGen, &genf);
+ struct f10 : public LLSelectedTEGetFunctor<F32>
+ {
+ F32 get(LLViewerObject* object, S32 face)
+ {
+ return (F32)(object->getTE(face)->getTexGen());
+ }
+ } func;
+ identical = gSelectMgr->getSelection()->getSelectedTEValue( &func, genf );
S32 selected_texgen = ((S32) genf) >> TEM_TEX_GEN_SHIFT;
LLCtrlSelectionInterface* combobox_texgen =
childGetSelectionInterface("combobox texgen");
@@ -573,7 +665,14 @@ void LLPanelFace::getState()
{
F32 fullbrightf = 0.f;
- identical = allFacesSameValue( &LLPanelFace::valueFullbright, &fullbrightf );
+ struct f11 : public LLSelectedTEGetFunctor<F32>
+ {
+ F32 get(LLViewerObject* object, S32 face)
+ {
+ return (F32)(object->getTE(face)->getFullbright());
+ }
+ } func;
+ identical = gSelectMgr->getSelection()->getSelectedTEValue( &func, fullbrightf );
childSetValue("checkbox fullbright",(S32)fullbrightf);
childSetEnabled("checkbox fullbright",editable);
@@ -586,9 +685,22 @@ void LLPanelFace::getState()
}
// Repeats per meter
- F32 repeats = 1.f;
- identical = allFacesSameValue( &LLPanelFace::valueRepeatsPerMeter, &repeats );
{
+ F32 repeats = 1.f;
+ struct f12 : public LLSelectedTEGetFunctor<F32>
+ {
+ F32 get(LLViewerObject* object, S32 face)
+ {
+ U32 s_axis = VX;
+ U32 t_axis = VY;
+ // BUG: Only repeats along S axis
+ // BUG: Only works for boxes.
+ LLPrimitive::getTESTAxes(face, &s_axis, &t_axis);
+ return object->getTE(face)->mScaleS / object->getScale().mV[s_axis];
+ }
+ } func;
+ identical = gSelectMgr->getSelection()->getSelectedTEValue( &func, repeats );
+
childSetValue("rptctrl", editable ? repeats : 0);
childSetTentative("rptctrl",!identical);
LLComboBox* mComboTexGen = LLViewerUICtrlFactory::getComboBoxByName(this,"combobox texgen");
@@ -606,12 +718,12 @@ void LLPanelFace::getState()
clearCtrls();
// Disable non-UICtrls
- LLTextureCtrl* mTextureCtrl = LLUICtrlFactory::getTexturePickerByName(this,"texture control");
- if(mTextureCtrl)
+ LLTextureCtrl* texture_ctrl = LLUICtrlFactory::getTexturePickerByName(this,"texture control");
+ if(texture_ctrl)
{
- mTextureCtrl->setImageAssetID( LLUUID::null );
- mTextureCtrl->setEnabled( FALSE ); // this is a LLUICtrl, but we don't want it to have keyboard focus so we add it as a child, not a ctrl.
-// mTextureCtrl->setValid(FALSE);
+ texture_ctrl->setImageAssetID( LLUUID::null );
+ texture_ctrl->setEnabled( FALSE ); // this is a LLUICtrl, but we don't want it to have keyboard focus so we add it as a child, not a ctrl.
+// texture_ctrl->setValid(FALSE);
}
LLColorSwatchCtrl* mColorSwatch = LLUICtrlFactory::getColorSwatchByName(this,"colorswatch");
if(mColorSwatch)
@@ -641,115 +753,10 @@ void LLPanelFace::refresh()
getState();
}
-
-BOOL LLPanelFace::allFacesSameValue( F32 (get_face_value(LLViewerObject*, S32)), F32 *value)
-{
- LLViewerObject* object;
- S32 te;
-
- // Get the value from the primary selected TE
- F32 first_value = *value;
- BOOL got_first = FALSE;
- gSelectMgr->getSelection()->getPrimaryTE(&object, &te);
- if (object)
- {
- first_value = get_face_value(object, te);
- got_first = true;
- }
-
- // Now iterate through all TEs to test for sameness
- BOOL identical = TRUE;
- LLObjectSelectionHandle selection = gSelectMgr->getSelection();
- for ( selection->getFirstTE(&object, &te); object; selection->getNextTE(&object, &te) )
- {
- if (!got_first)
- {
- first_value = get_face_value(object, te);
- got_first = true;
- }
- if ( get_face_value(object, te) != first_value )
- {
- identical = FALSE;
- break;
- }
- }
-
- *value = first_value;
- return identical;
-}
-
-
//
// Static functions
//
-// static
-F32 LLPanelFace::valueRepeatsPerMeter(LLViewerObject* object, S32 face)
-{
- U32 s_axis = VX;
- U32 t_axis = VY;
-
- // BUG: Only repeats along S axis
- // BUG: Only works for boxes.
- gSelectMgr->getTESTAxes(object, face, &s_axis, &t_axis);
- return object->getTE(face)->mScaleS / object->getScale().mV[s_axis];
-}
-
-// static
-F32 LLPanelFace::valueScaleS(LLViewerObject* object, S32 face)
-{
- return object->getTE(face)->mScaleS;
-}
-
-
-// static
-F32 LLPanelFace::valueScaleT(LLViewerObject* object, S32 face)
-{
- return object->getTE(face)->mScaleT;
-}
-
-// static
-F32 LLPanelFace::valueOffsetS(LLViewerObject* object, S32 face)
-{
- return object->getTE(face)->mOffsetS;
-}
-
-// static
-F32 LLPanelFace::valueOffsetT(LLViewerObject* object, S32 face)
-{
- return object->getTE(face)->mOffsetT;
-}
-
-// static
-F32 LLPanelFace::valueTexRotation(LLViewerObject* object, S32 face)
-{
- return object->getTE(face)->mRotation;
-}
-
-// static
-F32 LLPanelFace::valueBump(LLViewerObject* object, S32 face)
-{
- return (F32)(object->getTE(face)->getBumpmap());
-}
-
-// static
-F32 LLPanelFace::valueTexGen(LLViewerObject* object, S32 face)
-{
- return (F32)(object->getTE(face)->getTexGen());
-}
-
-// static
-F32 LLPanelFace::valueShiny(LLViewerObject* object, S32 face)
-{
- return (F32)(object->getTE(face)->getShiny());
-}
-
-// static
-F32 LLPanelFace::valueFullbright(LLViewerObject* object, S32 face)
-{
- return (F32)(object->getTE(face)->getFullbright());
-}
-
// static
void LLPanelFace::onCommitColor(LLUICtrl* ctrl, void* userdata)
@@ -811,13 +818,16 @@ void LLPanelFace::onCommitFullbright(LLUICtrl* ctrl, void* userdata)
BOOL LLPanelFace::onDragTexture(LLUICtrl*, LLInventoryItem* item, void*)
{
BOOL accept = TRUE;
- LLViewerObject* obj = gSelectMgr->getSelection()->getFirstRootObject();
- while(accept && obj)
+ for (LLObjectSelection::root_iterator iter = gSelectMgr->getSelection()->root_begin();
+ iter != gSelectMgr->getSelection()->root_end(); iter++)
{
+ LLSelectNode* node = *iter;
+ LLViewerObject* obj = node->getObject();
if(!LLToolDragAndDrop::isInventoryDropAcceptable(obj, item))
+ {
accept = FALSE;
- else
- obj = gSelectMgr->getSelection()->getNextRootObject();
+ break;
+ }
}
return accept;
}
@@ -868,14 +878,10 @@ void LLPanelFace::onClickApply(void* userdata)
}
// commit the fit media texture to prim button
-void LLPanelFace::onClickAutoFix(void* userdata)
-{
- S32 te;
- LLViewerObject* object;
- // for all selected objects
- LLObjectSelectionHandle selection = gSelectMgr->getSelection();
- for ( selection->getFirstTE(&object, &te); object; selection->getNextTE(&object, &te) )
+struct LLPanelFaceSetMediaFunctor : public LLSelectedTEFunctor
+{
+ virtual bool apply(LLViewerObject* object, S32 te)
{
// only do this if it's a media texture
if ( object->getTE ( te )->getID() == LLMediaEngine::getInstance()->getImageUUID () )
@@ -895,13 +901,17 @@ void LLPanelFace::onClickAutoFix(void* userdata)
object->setTEScaleT( te, scaleT ); // don't need to flip Y anymore since QT does this for us now.
object->setTEOffsetS( te, -( 1.0f - scaleS ) / 2.0f );
object->setTEOffsetT( te, -( 1.0f - scaleT ) / 2.0f );
- };
- };
- };
+ }
+ }
+ return true;
+ }
+};
- // not clear why this is in a separate loop but i followed the patter from further up this file just in case.
- for ( object = gSelectMgr->getSelection()->getFirstObject(); object; object = gSelectMgr->getSelection()->getNextObject() )
- {
- object->sendTEUpdate();
- };
+void LLPanelFace::onClickAutoFix(void* userdata)
+{
+ LLPanelFaceSetMediaFunctor setfunc;
+ gSelectMgr->getSelection()->applyToTEs(&setfunc);
+
+ LLPanelFaceSendFunctor sendfunc;
+ gSelectMgr->getSelection()->applyToObjects(&sendfunc);
}
diff --git a/indra/newview/llpanelface.h b/indra/newview/llpanelface.h
index ff6ca24599..d680129989 100644
--- a/indra/newview/llpanelface.h
+++ b/indra/newview/llpanelface.h
@@ -57,11 +57,6 @@ public:
void refresh();
protected:
- // Given a callback function that returns an F32, figures out
- // if that F32 is the same for all selected faces. "value"
- // contains the identical value, or the first object's value.
- BOOL allFacesSameValue( F32 (get_face_value(LLViewerObject*, S32)), F32 *value);
-
void getState();
void sendTexture(); // applies and sends texture
@@ -91,17 +86,6 @@ protected:
static void onClickApply(void*);
static void onClickAutoFix(void*);
-
- static F32 valueScaleS(LLViewerObject* object, S32 face);
- static F32 valueScaleT(LLViewerObject* object, S32 face);
- static F32 valueOffsetS(LLViewerObject* object, S32 face);
- static F32 valueOffsetT(LLViewerObject* object, S32 face);
- static F32 valueTexRotation(LLViewerObject* object, S32 face);
- static F32 valueRepeatsPerMeter(LLViewerObject* object, S32 face);
- static F32 valueBump(LLViewerObject* object, S32 face);
- static F32 valueTexGen(LLViewerObject* object, S32 face);
- static F32 valueShiny(LLViewerObject* object, S32 face);
- static F32 valueFullbright(LLViewerObject* object, S32 face);
};
#endif
diff --git a/indra/newview/llpanelgroup.h b/indra/newview/llpanelgroup.h
index 982b8cc3b7..19f43ecb88 100644
--- a/indra/newview/llpanelgroup.h
+++ b/indra/newview/llpanelgroup.h
@@ -60,7 +60,7 @@ public:
LLPanelGroup(const std::string& filename,
const std::string& name,
const LLUUID& group_id,
- const std::string& initial_tab_selected = "");
+ const std::string& initial_tab_selected = std::string());
virtual ~LLPanelGroup();
virtual BOOL postBuild();
diff --git a/indra/newview/llpanelgroupinvite.cpp b/indra/newview/llpanelgroupinvite.cpp
index 14ca3c2bff..9bab774a46 100644
--- a/indra/newview/llpanelgroupinvite.cpp
+++ b/indra/newview/llpanelgroupinvite.cpp
@@ -69,6 +69,7 @@ public:
public:
LLUUID mGroupID;
+ LLString mLoadingText;
LLNameListCtrl *mInvitees;
LLComboBox *mRoleNames;
LLButton *mOKButton;
@@ -395,14 +396,14 @@ void LLPanelGroupInvite::update()
mPendingUpdate = FALSE;
if (mImplementation->mGroupName)
{
- mImplementation->mGroupName->setText("(loading...)");
+ mImplementation->mGroupName->setText(mImplementation->mLoadingText);
}
if ( mImplementation->mRoleNames )
{
mStoreSelected = mImplementation->mRoleNames->getCurrentID();
mImplementation->mRoleNames->clear();
mImplementation->mRoleNames->removeall();
- mImplementation->mRoleNames->add("(loading...)", LLUUID::null, ADD_BOTTOM);
+ mImplementation->mRoleNames->add(mImplementation->mLoadingText, LLUUID::null, ADD_BOTTOM);
mImplementation->mRoleNames->setCurrentByID(LLUUID::null);
}
@@ -473,6 +474,7 @@ BOOL LLPanelGroupInvite::postBuild()
{
BOOL recurse = TRUE;
+ mImplementation->mLoadingText = childGetText("loading");
mImplementation->mRoleNames = (LLComboBox*) getChildByName("role_name",
recurse);
mImplementation->mGroupName = (LLTextBox*) getChildByName("group_name_text", recurse);
diff --git a/indra/newview/llpanelgrouplandmoney.cpp b/indra/newview/llpanelgrouplandmoney.cpp
index dd5966f823..a6ffe4f922 100644
--- a/indra/newview/llpanelgrouplandmoney.cpp
+++ b/indra/newview/llpanelgrouplandmoney.cpp
@@ -52,12 +52,93 @@
#include "llfloaterworldmap.h"
#include "llviewermessage.h"
-const char LOADING_STRING[] = "Computing...";
+////////////////////////////////////////////////////////////////////////////
+
+class LLGroupMoneyTabEventHandler
+{
+public:
+ LLGroupMoneyTabEventHandler(LLButton* earlier_button,
+ LLButton* later_button,
+ LLTextEditor* text_editor,
+ LLTabContainerCommon* tab_containerp,
+ LLPanel* panelp,
+ const LLString& loading_text,
+ const LLUUID& group_id,
+ S32 interval_length_days,
+ S32 max_interval_days);
+ virtual ~LLGroupMoneyTabEventHandler();
+
+ virtual void requestData(LLMessageSystem* msg);
+ virtual void processReply(LLMessageSystem* msg, void** data);
+
+ virtual void onClickEarlier();
+ virtual void onClickLater();
+ virtual void onClickTab();
+
+ static void clickEarlierCallback(void* data);
+ static void clickLaterCallback(void* data);
+ static void clickTabCallback(void* user_data, bool from_click);
+
+ static LLMap<LLUUID, LLGroupMoneyTabEventHandler*> sInstanceIDs;
+ static std::map<LLPanel*, LLGroupMoneyTabEventHandler*> sTabsToHandlers;
+protected:
+ class impl;
+ impl* mImplementationp;
+};
+
+class LLGroupMoneyDetailsTabEventHandler : public LLGroupMoneyTabEventHandler
+{
+public:
+ LLGroupMoneyDetailsTabEventHandler(LLButton* earlier_buttonp,
+ LLButton* later_buttonp,
+ LLTextEditor* text_editorp,
+ LLTabContainerCommon* tab_containerp,
+ LLPanel* panelp,
+ const LLString& loading_text,
+ const LLUUID& group_id);
+ virtual ~LLGroupMoneyDetailsTabEventHandler();
+
+ virtual void requestData(LLMessageSystem* msg);
+ virtual void processReply(LLMessageSystem* msg, void** data);
+};
+
+
+class LLGroupMoneySalesTabEventHandler : public LLGroupMoneyTabEventHandler
+{
+public:
+ LLGroupMoneySalesTabEventHandler(LLButton* earlier_buttonp,
+ LLButton* later_buttonp,
+ LLTextEditor* text_editorp,
+ LLTabContainerCommon* tab_containerp,
+ LLPanel* panelp,
+ const LLString& loading_text,
+ const LLUUID& group_id);
+ virtual ~LLGroupMoneySalesTabEventHandler();
+
+ virtual void requestData(LLMessageSystem* msg);
+ virtual void processReply(LLMessageSystem* msg, void** data);
+};
+
+class LLGroupMoneyPlanningTabEventHandler : public LLGroupMoneyTabEventHandler
+{
+public:
+ LLGroupMoneyPlanningTabEventHandler(LLTextEditor* text_editor,
+ LLTabContainerCommon* tab_containerp,
+ LLPanel* panelp,
+ const LLString& loading_text,
+ const LLUUID& group_id);
+ virtual ~LLGroupMoneyPlanningTabEventHandler();
+
+ virtual void requestData(LLMessageSystem* msg);
+ virtual void processReply(LLMessageSystem* msg, void** data);
+};
+
+////////////////////////////////////////////////////////////////////////////
class LLPanelGroupLandMoney::impl
{
public:
- impl(const LLUUID& group_id); //constructor
+ impl(LLPanelGroupLandMoney& panel, const LLUUID& group_id); //constructor
virtual ~impl();
void requestGroupLandInfo();
@@ -76,12 +157,10 @@ public:
//member variables
public:
- LLTextBox *mTotalContributedLandp;
- LLTextBox *mTotalLandInUsep;
- LLTextBox *mLandAvailablep;
+ LLPanelGroupLandMoney& mPanel;
+
LLTextBox* mGroupOverLimitTextp;
LLIconCtrl* mGroupOverLimitIconp;
- LLTextBox* mYourContributionMaxTextp;
LLLineEditor* mYourContributionEditorp;
@@ -107,22 +186,19 @@ public:
//*******************************************
//** LLPanelGroupLandMoney::impl Functions **
//*******************************************
-LLPanelGroupLandMoney::impl::impl(const LLUUID& group_id)
+LLPanelGroupLandMoney::impl::impl(LLPanelGroupLandMoney& panel, const LLUUID& group_id)
+ : mPanel(panel),
+ mGroupID(group_id)
{
- mGroupID = group_id;
mTransID = LLUUID::null;
mBeenActivated = false;
mNeedsSendGroupLandRequest = true;
mNeedsApply = false;
- mTotalLandInUsep = NULL;
- mTotalContributedLandp = NULL;
- mLandAvailablep = NULL;
mYourContributionEditorp = NULL;
mMapButtonp = NULL;
mGroupParcelsp = NULL;
- mYourContributionMaxTextp = NULL;
mGroupOverLimitTextp = NULL;
mGroupOverLimitIconp = NULL;
@@ -230,9 +306,7 @@ int LLPanelGroupLandMoney::impl::getStoredContribution()
// Fills in the text field with the contribution, contrib
void LLPanelGroupLandMoney::impl::setYourContributionTextField(int contrib)
{
- char buffer[MAX_STRING]; /* Flawfinder: ignore*/
- buffer[0] = '\0';
- snprintf(buffer, sizeof(buffer), "%d", contrib); /* Flawfinder: ignore*/
+ LLString buffer = llformat("%d", contrib);
if ( mYourContributionEditorp )
{
@@ -243,14 +317,7 @@ void LLPanelGroupLandMoney::impl::setYourContributionTextField(int contrib)
void LLPanelGroupLandMoney::impl::setYourMaxContributionTextBox(int max)
{
- char buffer[MAX_STRING]; /*Flawfinder: ignore*/
- buffer[0] = '\0';
-
- snprintf(buffer, sizeof(buffer), "(%d max)", max); /* Flawfinder: ignore */
- if ( mYourContributionMaxTextp )
- {
- mYourContributionMaxTextp->setText(buffer);
- }
+ mPanel.childSetTextArg("your_contribution_max_value", "[AMOUNT]", llformat("%d", max));
}
//static
@@ -309,19 +376,18 @@ void LLPanelGroupLandMoney::impl::processGroupLand(LLMessageSystem* msg)
{
// special block which has total contribution
++first_block;
+
S32 total_contribution;
msg->getS32("QueryData", "ActualArea", total_contribution, 0);
- char buffer[MAX_STRING]; /*Flawfinder: ignore*/
- snprintf(buffer, sizeof(buffer), "%d sq. meters", total_contribution); /* Flawfinder: ignore */
- mTotalContributedLandp->setText(buffer);
+ mPanel.childSetTextArg("total_contributed_land_value", "[AREA]", llformat("%d", total_contribution));
+
S32 committed;
msg->getS32("QueryData", "BillableArea", committed, 0);
- snprintf(buffer, sizeof(buffer), "%d sq. meters", committed); /* Flawfinder: ignore */
- mTotalLandInUsep->setText(buffer);
+ mPanel.childSetTextArg("total_land_in_use_value", "[AREA]", llformat("%d", committed));
+
S32 available = total_contribution - committed;
- snprintf(buffer, sizeof(buffer), "%d sq. meters", available); /* Flawfinder: ignore */
- mLandAvailablep->setText(buffer);
- buffer[0] = '\0';
+ mPanel.childSetTextArg("land_available_value", "[AREA]", llformat("%d", available));
+
if ( mGroupOverLimitTextp && mGroupOverLimitIconp )
{
mGroupOverLimitIconp->setVisible(available < 0);
@@ -416,7 +482,7 @@ LLPanelGroupLandMoney::LLPanelGroupLandMoney(const std::string& name,
const LLUUID& group_id) :
LLPanelGroupTab(name, group_id)
{
- mImplementationp = new impl(group_id);
+ mImplementationp = new impl(*this, group_id);
//problem what if someone has both the group floater open and the finder
//open to the same group? Some maps that map group ids to panels
@@ -538,18 +604,10 @@ BOOL LLPanelGroupLandMoney::postBuild()
bool can_view = gAgent.isInGroup(mGroupID);
- mImplementationp->mTotalLandInUsep =
- (LLTextBox*) getChildByName("total_land_in_use_value");
- mImplementationp->mTotalContributedLandp =
- (LLTextBox*) getChildByName("total_contributed_land_value");
- mImplementationp->mLandAvailablep =
- (LLTextBox*) getChildByName("land_available_value");
mImplementationp->mGroupOverLimitIconp =
(LLIconCtrl*) getChildByName("group_over_limit_icon");
mImplementationp->mGroupOverLimitTextp =
(LLTextBox*) getChildByName("group_over_limit_text");
- mImplementationp->mYourContributionMaxTextp =
- (LLTextBox*) getChildByName("your_contribution_max_value");
mImplementationp->mYourContributionEditorp
= (LLLineEditor*) getChildByName("your_contribution_line_editor");
@@ -636,7 +694,8 @@ BOOL LLPanelGroupLandMoney::postBuild()
}
}
-
+ LLString loading_text = childGetText("loading_txt");
+
//pull out the widgets for the L$ details tab
earlierp = (LLButton*) getChildByName("earlier_details_button", true);
laterp = (LLButton*) getChildByName("later_details_button", true);
@@ -655,6 +714,7 @@ BOOL LLPanelGroupLandMoney::postBuild()
textp,
tabcp,
panelp,
+ loading_text,
mGroupID);
}
@@ -671,6 +731,7 @@ BOOL LLPanelGroupLandMoney::postBuild()
new LLGroupMoneyPlanningTabEventHandler(textp,
tabcp,
panelp,
+ loading_text,
mGroupID);
}
@@ -692,6 +753,7 @@ BOOL LLPanelGroupLandMoney::postBuild()
textp,
tabcp,
panelp,
+ loading_text,
mGroupID);
}
@@ -729,7 +791,8 @@ public:
impl(LLButton* earlier_buttonp,
LLButton* later_buttonp,
LLTextEditor* text_editorp,
- LLPanel* panelp,
+ LLPanel* tabpanelp,
+ const LLString& loading_text,
const LLUUID& group_id,
S32 interval_length_days,
S32 max_interval_days);
@@ -745,7 +808,7 @@ public:
LLUUID mGroupID;
LLUUID mPanelID;
- LLPanel* mPanelp;
+ LLPanel* mTabPanelp;
int mIntervalLength;
int mMaxInterval;
@@ -754,12 +817,15 @@ public:
LLTextEditor* mTextEditorp;
LLButton* mEarlierButtonp;
LLButton* mLaterButtonp;
+
+ LLString mLoadingText;
};
LLGroupMoneyTabEventHandler::impl::impl(LLButton* earlier_buttonp,
LLButton* later_buttonp,
LLTextEditor* text_editorp,
- LLPanel* panelp,
+ LLPanel* tabpanelp,
+ const LLString& loading_text,
const LLUUID& group_id,
S32 interval_length_days,
S32 max_interval_days)
@@ -774,7 +840,9 @@ LLGroupMoneyTabEventHandler::impl::impl(LLButton* earlier_buttonp,
mTextEditorp = text_editorp;
mEarlierButtonp = earlier_buttonp;
mLaterButtonp = later_buttonp;
- mPanelp = panelp;
+ mTabPanelp = tabpanelp;
+
+ mLoadingText = loading_text;
}
LLGroupMoneyTabEventHandler::impl::~impl()
@@ -806,6 +874,7 @@ void LLGroupMoneyTabEventHandler::impl::updateButtons()
//*******************************************
//** LLGroupMoneyTabEventHandler Functions **
//*******************************************
+
LLMap<LLUUID, LLGroupMoneyTabEventHandler*> LLGroupMoneyTabEventHandler::sInstanceIDs;
std::map<LLPanel*, LLGroupMoneyTabEventHandler*> LLGroupMoneyTabEventHandler::sTabsToHandlers;
@@ -814,6 +883,7 @@ LLGroupMoneyTabEventHandler::LLGroupMoneyTabEventHandler(LLButton* earlier_butto
LLTextEditor* text_editorp,
LLTabContainerCommon* tab_containerp,
LLPanel* panelp,
+ const LLString& loading_text,
const LLUUID& group_id,
S32 interval_length_days,
S32 max_interval_days)
@@ -822,28 +892,26 @@ LLGroupMoneyTabEventHandler::LLGroupMoneyTabEventHandler(LLButton* earlier_butto
later_buttonp,
text_editorp,
panelp,
+ loading_text,
group_id,
interval_length_days,
max_interval_days);
if ( earlier_buttonp )
{
- earlier_buttonp->setClickedCallback(LLGroupMoneyTabEventHandler::clickEarlierCallback,
- this);
+ earlier_buttonp->setClickedCallback(clickEarlierCallback, this);
}
if ( later_buttonp )
{
- later_buttonp->setClickedCallback(LLGroupMoneyTabEventHandler::clickLaterCallback,
- this);
+ later_buttonp->setClickedCallback(clickLaterCallback, this);
}
mImplementationp->updateButtons();
if ( tab_containerp && panelp )
{
- tab_containerp->setTabChangeCallback(panelp,
- LLGroupMoneyTabEventHandler::clickTabCallback);
+ tab_containerp->setTabChangeCallback(panelp, clickTabCallback);
tab_containerp->setTabUserData(panelp, this);
}
@@ -854,7 +922,7 @@ LLGroupMoneyTabEventHandler::LLGroupMoneyTabEventHandler(LLButton* earlier_butto
LLGroupMoneyTabEventHandler::~LLGroupMoneyTabEventHandler()
{
sInstanceIDs.removeData(mImplementationp->mPanelID);
- sTabsToHandlers.erase(mImplementationp->mPanelp);
+ sTabsToHandlers.erase(mImplementationp->mTabPanelp);
delete mImplementationp;
}
@@ -879,7 +947,7 @@ void LLGroupMoneyTabEventHandler::onClickEarlier()
{
if ( mImplementationp->mTextEditorp)
{
- mImplementationp->mTextEditorp->setText(LOADING_STRING);
+ mImplementationp->mTextEditorp->setText(mImplementationp->mLoadingText);
}
mImplementationp->mCurrentInterval++;
@@ -892,7 +960,7 @@ void LLGroupMoneyTabEventHandler::onClickLater()
{
if ( mImplementationp->mTextEditorp )
{
- mImplementationp->mTextEditorp->setText(LOADING_STRING);
+ mImplementationp->mTextEditorp->setText(mImplementationp->mLoadingText);
}
mImplementationp->mCurrentInterval--;
@@ -932,12 +1000,14 @@ LLGroupMoneyDetailsTabEventHandler::LLGroupMoneyDetailsTabEventHandler(LLButton*
LLTextEditor* text_editorp,
LLTabContainerCommon* tab_containerp,
LLPanel* panelp,
+ const LLString& loading_text,
const LLUUID& group_id)
: LLGroupMoneyTabEventHandler(earlier_buttonp,
later_buttonp,
text_editorp,
tab_containerp,
panelp,
+ loading_text,
group_id,
SUMMARY_INTERVAL,
SUMMARY_MAX)
@@ -964,7 +1034,7 @@ void LLGroupMoneyDetailsTabEventHandler::requestData(LLMessageSystem* msg)
if ( mImplementationp->mTextEditorp )
{
- mImplementationp->mTextEditorp->setText(LOADING_STRING);
+ mImplementationp->mTextEditorp->setText(mImplementationp->mLoadingText);
}
LLGroupMoneyTabEventHandler::requestData(msg);
@@ -1038,8 +1108,8 @@ void LLGroupMoneyDetailsTabEventHandler::processReply(LLMessageSystem* msg,
}
//static
-void LLGroupMoneyDetailsTabEventHandler::processGroupAccountDetailsReply(LLMessageSystem* msg,
- void** data)
+void LLPanelGroupLandMoney::processGroupAccountDetailsReply(LLMessageSystem* msg,
+ void** data)
{
LLUUID agent_id;
msg->getUUIDFast(_PREHASH_AgentData, _PREHASH_AgentID, agent_id );
@@ -1071,12 +1141,14 @@ LLGroupMoneySalesTabEventHandler::LLGroupMoneySalesTabEventHandler(LLButton* ear
LLTextEditor* text_editorp,
LLTabContainerCommon* tab_containerp,
LLPanel* panelp,
+ const LLString& loading_text,
const LLUUID& group_id)
: LLGroupMoneyTabEventHandler(earlier_buttonp,
later_buttonp,
text_editorp,
tab_containerp,
panelp,
+ loading_text,
group_id,
SUMMARY_INTERVAL,
SUMMARY_MAX)
@@ -1103,7 +1175,7 @@ void LLGroupMoneySalesTabEventHandler::requestData(LLMessageSystem* msg)
if ( mImplementationp->mTextEditorp )
{
- mImplementationp->mTextEditorp->setText(LOADING_STRING);
+ mImplementationp->mTextEditorp->setText(mImplementationp->mLoadingText);
}
LLGroupMoneyTabEventHandler::requestData(msg);
@@ -1141,7 +1213,7 @@ void LLGroupMoneySalesTabEventHandler::processReply(LLMessageSystem* msg,
// If this is the first packet, clear the text, don't append.
// Start with the date.
- if (text == LOADING_STRING)
+ if (text == mImplementationp->mLoadingText)
{
text.clear();
@@ -1213,8 +1285,8 @@ void LLGroupMoneySalesTabEventHandler::processReply(LLMessageSystem* msg,
}
//static
-void LLGroupMoneySalesTabEventHandler::processGroupAccountTransactionsReply(LLMessageSystem* msg,
- void** data)
+void LLPanelGroupLandMoney::processGroupAccountTransactionsReply(LLMessageSystem* msg,
+ void** data)
{
LLUUID agent_id;
msg->getUUIDFast(_PREHASH_AgentData, _PREHASH_AgentID, agent_id );
@@ -1247,12 +1319,14 @@ void LLGroupMoneySalesTabEventHandler::processGroupAccountTransactionsReply(LLMe
LLGroupMoneyPlanningTabEventHandler::LLGroupMoneyPlanningTabEventHandler(LLTextEditor* text_editorp,
LLTabContainerCommon* tab_containerp,
LLPanel* panelp,
+ const LLString& loading_text,
const LLUUID& group_id)
: LLGroupMoneyTabEventHandler(NULL,
NULL,
text_editorp,
tab_containerp,
panelp,
+ loading_text,
group_id,
SUMMARY_INTERVAL,
SUMMARY_MAX)
@@ -1279,7 +1353,7 @@ void LLGroupMoneyPlanningTabEventHandler::requestData(LLMessageSystem* msg)
if ( mImplementationp->mTextEditorp )
{
- mImplementationp->mTextEditorp->setText(LOADING_STRING);
+ mImplementationp->mTextEditorp->setText(mImplementationp->mLoadingText);
}
LLGroupMoneyTabEventHandler::requestData(msg);
@@ -1382,8 +1456,8 @@ void LLGroupMoneyPlanningTabEventHandler::processReply(LLMessageSystem* msg,
}
//static
-void LLGroupMoneyPlanningTabEventHandler::processGroupAccountSummaryReply(LLMessageSystem* msg,
- void** data)
+void LLPanelGroupLandMoney::processGroupAccountSummaryReply(LLMessageSystem* msg,
+ void** data)
{
LLUUID agent_id;
msg->getUUIDFast(_PREHASH_AgentData, _PREHASH_AgentID, agent_id );
diff --git a/indra/newview/llpanelgrouplandmoney.h b/indra/newview/llpanelgrouplandmoney.h
index 319d13a54f..83126f9906 100644
--- a/indra/newview/llpanelgrouplandmoney.h
+++ b/indra/newview/llpanelgrouplandmoney.h
@@ -59,92 +59,14 @@ public:
static void processPlacesReply(LLMessageSystem* msg, void**);
static LLMap<LLUUID, LLPanelGroupLandMoney*> sGroupIDs;
-protected:
- class impl;
- impl* mImplementationp;
-};
-
-class LLGroupMoneyTabEventHandler
-{
-public:
- LLGroupMoneyTabEventHandler(LLButton* earlier_button,
- LLButton* later_button,
- LLTextEditor* text_editor,
- LLTabContainerCommon* tab_containerp,
- LLPanel* panelp,
- const LLUUID& group_id,
- S32 interval_length_days,
- S32 max_interval_days);
- virtual ~LLGroupMoneyTabEventHandler();
- virtual void requestData(LLMessageSystem* msg);
- virtual void processReply(LLMessageSystem* msg, void** data);
-
- virtual void onClickEarlier();
- virtual void onClickLater();
- virtual void onClickTab();
-
- static void clickEarlierCallback(void* data);
- static void clickLaterCallback(void* data);
- static void clickTabCallback(void* user_data, bool from_click);
-
- static LLMap<LLUUID, LLGroupMoneyTabEventHandler*> sInstanceIDs;
- static std::map<LLPanel*, LLGroupMoneyTabEventHandler*> sTabsToHandlers;
+ static void processGroupAccountDetailsReply(LLMessageSystem* msg, void** data);
+ static void processGroupAccountTransactionsReply(LLMessageSystem* msg, void** data);
+ static void processGroupAccountSummaryReply(LLMessageSystem* msg, void** data);
+
protected:
class impl;
impl* mImplementationp;
};
-class LLGroupMoneyDetailsTabEventHandler : public LLGroupMoneyTabEventHandler
-{
-public:
- LLGroupMoneyDetailsTabEventHandler(LLButton* earlier_buttonp,
- LLButton* later_buttonp,
- LLTextEditor* text_editorp,
- LLTabContainerCommon* tab_containerp,
- LLPanel* panelp,
- const LLUUID& group_id);
- virtual ~LLGroupMoneyDetailsTabEventHandler();
-
- virtual void requestData(LLMessageSystem* msg);
- virtual void processReply(LLMessageSystem* msg, void** data);
-
- static void processGroupAccountDetailsReply(LLMessageSystem* msg,
- void** data);
-};
-
-class LLGroupMoneySalesTabEventHandler : public LLGroupMoneyTabEventHandler
-{
-public:
- LLGroupMoneySalesTabEventHandler(LLButton* earlier_buttonp,
- LLButton* later_buttonp,
- LLTextEditor* text_editorp,
- LLTabContainerCommon* tab_containerp,
- LLPanel* panelp,
- const LLUUID& group_id);
- virtual ~LLGroupMoneySalesTabEventHandler();
-
- virtual void requestData(LLMessageSystem* msg);
- virtual void processReply(LLMessageSystem* msg, void** data);
-
- static void processGroupAccountTransactionsReply(LLMessageSystem* msg,
- void** data);
-};
-
-class LLGroupMoneyPlanningTabEventHandler : public LLGroupMoneyTabEventHandler
-{
-public:
- LLGroupMoneyPlanningTabEventHandler(LLTextEditor* text_editor,
- LLTabContainerCommon* tab_containerp,
- LLPanel* panelp,
- const LLUUID& group_id);
- virtual ~LLGroupMoneyPlanningTabEventHandler();
-
- virtual void requestData(LLMessageSystem* msg);
- virtual void processReply(LLMessageSystem* msg, void** data);
-
- static void processGroupAccountSummaryReply(LLMessageSystem* msg,
- void** data);
-};
-
#endif // LL_PANEL_GROUP_LAND_MONEY_H
diff --git a/indra/newview/llpanelgroupnotices.cpp b/indra/newview/llpanelgroupnotices.cpp
index 15aa1ede5c..c7c7912bf2 100644
--- a/indra/newview/llpanelgroupnotices.cpp
+++ b/indra/newview/llpanelgroupnotices.cpp
@@ -545,8 +545,8 @@ void LLPanelGroupNotices::showNotice(const char* subject,
{
arrangeNoticeView(VIEW_PAST_NOTICE);
- if(mViewSubject) mViewSubject->setText(subject);
- if(mViewMessage) mViewMessage->setText(message);
+ if(mViewSubject) mViewSubject->setText(LLString(subject));
+ if(mViewMessage) mViewMessage->setText(LLString(message));
if (mInventoryOffer)
{
diff --git a/indra/newview/llpanelland.cpp b/indra/newview/llpanelland.cpp
index a5fc9665ec..d86f81d21d 100644
--- a/indra/newview/llpanelland.cpp
+++ b/indra/newview/llpanelland.cpp
@@ -120,8 +120,8 @@ void LLPanelLandInfo::refresh()
childSetVisible("label_area_price",false);
childSetVisible("label_area",false);
- //mTextPrice->setText("");
- childSetText("textbox price","");
+ //mTextPrice->setText(LLString::null);
+ childSetText("textbox price",LLString::null);
childSetEnabled("button buy land",FALSE);
childSetEnabled("button abandon land",FALSE);
diff --git a/indra/newview/llpanellogin.cpp b/indra/newview/llpanellogin.cpp
index dda8efd126..292f5c36f8 100644
--- a/indra/newview/llpanellogin.cpp
+++ b/indra/newview/llpanellogin.cpp
@@ -132,8 +132,6 @@ LLPanelLogin::LLPanelLogin(const LLRect &rect,
mHtmlAvailable( TRUE )
{
mIsFocusRoot = TRUE;
- mMungedPassword[0] = '\0';
- mIncomingPassword[0] = '\0';
setBackgroundVisible(FALSE);
setBackgroundOpaque(TRUE);
@@ -346,7 +344,9 @@ void LLPanelLogin::mungePassword(LLUICtrl* caller, void* user_data)
if (password != self->mIncomingPassword)
{
LLMD5 pass((unsigned char *)password.c_str());
- pass.hex_digest(self->mMungedPassword);
+ char munged_password[MD5HEX_STR_SIZE];
+ pass.hex_digest(munged_password);
+ self->mMungedPassword = munged_password;
}
}
@@ -559,19 +559,20 @@ void LLPanelLogin::setFields(const std::string& firstname, const std::string& la
// We don't actually use the password input field,
// fill it with MAX_PASSWORD characters so we get a
// nice row of asterixes.
- const char* filler = "123456789!123456";
+ const std::string filler("123456789!123456");
sInstance->childSetText("password_edit", filler);
- strcpy(sInstance->mIncomingPassword, filler); /*Flawfinder: ignore*/
- strcpy(sInstance->mMungedPassword, password.c_str()); /*Flawfinder: ignore*/
+ sInstance->mIncomingPassword = filler;
+ sInstance->mMungedPassword = password;
}
else
{
// this is a normal text password
sInstance->childSetText("password_edit", password);
- strncpy(sInstance->mIncomingPassword, password.c_str(), sizeof(sInstance->mIncomingPassword) -1); /*Flawfinder: ignore*/
- sInstance->mIncomingPassword[sizeof(sInstance->mIncomingPassword) -1] = '\0';
+ sInstance->mIncomingPassword = password;
LLMD5 pass((unsigned char *)password.c_str());
- pass.hex_digest(sInstance->mMungedPassword);
+ char munged_password[MD5HEX_STR_SIZE];
+ pass.hex_digest(munged_password);
+ sInstance->mMungedPassword = munged_password;
}
sInstance->childSetValue("remember_check", remember);
@@ -611,7 +612,7 @@ void LLPanelLogin::getFields(LLString &firstname, LLString &lastname, LLString &
lastname = sInstance->childGetText("last_name_edit");
LLString::trim(lastname);
- password.assign( sInstance->mMungedPassword );
+ password = sInstance->mMungedPassword;
remember = sInstance->childGetValue("remember_check");
}
diff --git a/indra/newview/llpanellogin.h b/indra/newview/llpanellogin.h
index 4d1908df4c..94e746eb69 100644
--- a/indra/newview/llpanellogin.h
+++ b/indra/newview/llpanellogin.h
@@ -96,8 +96,8 @@ private:
void (*mCallback)(S32 option, void *userdata);
void* mCallbackData;
- char mIncomingPassword[DB_USER_PASSWORD_BUF_SIZE]; /*Flawfinder: ignore*/
- char mMungedPassword[MD5HEX_STR_SIZE]; /*Flawfinder: ignore*/
+ std::string mIncomingPassword;
+ std::string mMungedPassword;
static LLPanelLogin* sInstance;
static BOOL sCapslockDidNotification;
diff --git a/indra/newview/llpanelobject.cpp b/indra/newview/llpanelobject.cpp
index 412ca3b53d..cf507098f7 100644
--- a/indra/newview/llpanelobject.cpp
+++ b/indra/newview/llpanelobject.cpp
@@ -98,7 +98,7 @@ enum {
MI_HOLE_COUNT
};
-//XUI:translate (depricated, so very low priority)
+//*TODO:translate (depricated, so very low priority)
static const LLString LEGACY_FULLBRIGHT_DESC("Fullbright (Legacy)");
BOOL LLPanelObject::postBuild()
@@ -163,7 +163,7 @@ BOOL LLPanelObject::postBuild()
mComboMaterial = gUICtrlFactory->getComboBoxByName(this,"material");
childSetCommitCallback("material",onCommitMaterial,this);
mComboMaterial->removeall();
- // XUI:translate
+ // *TODO:translate
LLMaterialInfo *minfop;
for (minfop = LLMaterialTable::basic.mMaterialInfoList.getFirstData();
minfop != NULL;
@@ -509,8 +509,17 @@ void LLPanelObject::getState( )
#endif
// Update material part
- U8 material_code;
- BOOL material_same = gSelectMgr->selectionGetMaterial(&material_code);
+ // slightly inefficient - materials are unique per object, not per TE
+ U8 material_code = 0;
+ struct f : public LLSelectedTEGetFunctor<U8>
+ {
+ U8 get(LLViewerObject* object, S32 te)
+ {
+ return object->getMaterial();
+ }
+ } func;
+ bool material_same = gSelectMgr->getSelection()->getSelectedTEValue( &func, material_code );
+
if (editable && single_volume && material_same)
{
mComboMaterial->setEnabled( TRUE );
@@ -529,7 +538,8 @@ void LLPanelObject::getState( )
{
mComboMaterial->remove(LEGACY_FULLBRIGHT_DESC);
}
- mComboMaterial->setSimple(LLMaterialTable::basic.getName(material_code));
+ // *TODO:Translate
+ mComboMaterial->setSimple(LLString(LLMaterialTable::basic.getName(material_code)));
}
}
else
diff --git a/indra/newview/llpanelpermissions.cpp b/indra/newview/llpanelpermissions.cpp
index 5fd80ce80a..3d5723ed7d 100644
--- a/indra/newview/llpanelpermissions.cpp
+++ b/indra/newview/llpanelpermissions.cpp
@@ -165,33 +165,33 @@ void LLPanelPermissions::refresh()
{
// ...nothing selected
childSetEnabled("perm_modify",false);
- childSetText("perm_modify","");
+ childSetText("perm_modify",LLString::null);
childSetEnabled("Creator:",false);
- childSetText("Creator Name","");
+ childSetText("Creator Name",LLString::null);
childSetEnabled("Creator Name",false);
childSetEnabled("button creator profile",false);
childSetEnabled("Owner:",false);
- childSetText("Owner Name","");
+ childSetText("Owner Name",LLString::null);
childSetEnabled("Owner Name",false);
childSetEnabled("button owner profile",false);
childSetEnabled("Group:",false);
- childSetText("Group Name","");
+ childSetText("Group Name",LLString::null);
childSetEnabled("Group Name",false);
childSetEnabled("button set group",false);
- childSetText("Object Name","");
+ childSetText("Object Name",LLString::null);
childSetEnabled("Object Name",false);
childSetEnabled("Name:",false);
- childSetText("Group Name","");
+ childSetText("Group Name",LLString::null);
childSetEnabled("Group Name",false);
childSetEnabled("Description:",false);
- childSetText("Object Description","");
+ childSetText("Object Description",LLString::null);
childSetEnabled("Object Description",false);
- childSetText("prim info","");
+ childSetText("prim info",LLString::null);
childSetEnabled("prim info",false);
childSetEnabled("Permissions:",false);
@@ -230,7 +230,7 @@ void LLPanelPermissions::refresh()
}
childSetEnabled("Price: L$",false);
- childSetText("EdCost",false);
+ childSetText("EdCost",LLString::null);
childSetEnabled("EdCost",false);
childSetEnabled("label click action",false);
@@ -421,7 +421,7 @@ void LLPanelPermissions::refresh()
if(!owners_identical)
{
childSetEnabled("Price: L$",false);
- childSetText("EdCost","");
+ childSetText("EdCost",LLString::null);
childSetEnabled("EdCost",false);
}
else if(self_owned || (group_owned && gAgent.hasPowerInGroup(group_id,GP_OBJECT_SET_SALE)))
@@ -453,7 +453,7 @@ void LLPanelPermissions::refresh()
{
// ...public object
childSetEnabled("Price: L$",false);
- childSetText("EdCost","");
+ childSetText("EdCost",LLString::null);
childSetEnabled("EdCost",false);
}
@@ -501,36 +501,35 @@ void LLPanelPermissions::refresh()
if( gSavedSettings.getBOOL("DebugPermissions") )
{
- char perm_string[10]; /*Flawfinder: ignore*/
+ std::string perm_string;
if (valid_base_perms)
{
-
- strcpy(perm_string, "B: "); /*Flawfinder: ignore*/
- mask_to_string(base_mask_on, perm_string+3);
+ perm_string = "B: ";
+ perm_string += mask_to_string(base_mask_on);
childSetText("B:",perm_string);
childSetVisible("B:",true);
- strcpy(perm_string, "O: "); /*Flawfinder: ignore*/
- mask_to_string(owner_mask_on, perm_string+3);
+ perm_string = "O: ";
+ perm_string += mask_to_string(owner_mask_on);
childSetText("O:",perm_string);
childSetVisible("O:",true);
- strcpy(perm_string, "G: "); /*Flawfinder: ignore*/
- mask_to_string(group_mask_on, perm_string+3);
+ perm_string = "G: ";
+ perm_string += mask_to_string(group_mask_on);
childSetText("G:",perm_string);
childSetVisible("G:",true);
- strcpy(perm_string, "E: "); /*Flawfinder: ignore*/
- mask_to_string(everyone_mask_on, perm_string+3);
+ perm_string = "E: ";
+ perm_string += mask_to_string(everyone_mask_on);
childSetText("E:",perm_string);
childSetVisible("E:",true);
- strcpy(perm_string, "N: "); /*Flawfinder: ignore*/
- mask_to_string(next_owner_mask_on, perm_string+3);
+ perm_string = "N: ";
+ perm_string += mask_to_string(next_owner_mask_on);
childSetText("N:",perm_string);
childSetVisible("N:",true);
}
- strcpy(perm_string, "F: "); /*Flawfinder: ignore*/
+ perm_string = "F: ";
U32 flag_mask = 0x0;
if (objectp->permMove())
flag_mask |= PERM_MOVE;
@@ -540,7 +539,7 @@ void LLPanelPermissions::refresh()
flag_mask |= PERM_COPY;
if (objectp->permTransfer())
flag_mask |= PERM_TRANSFER;
- mask_to_string(flag_mask, perm_string+3);
+ perm_string += mask_to_string(flag_mask);
childSetText("F:",perm_string);
childSetVisible("F:",true);
}
@@ -572,9 +571,8 @@ void LLPanelPermissions::refresh()
if (!has_change_perm_ability && !has_change_sale_ability && !root_selected)
{
- // XUI:translate
// ...must select root to choose permissions
- childSetValue("perm_modify", "Must select entire object to set permissions.");
+ childSetValue("perm_modify", childGetText("text modify warning"));
}
if (has_change_perm_ability)
@@ -1027,9 +1025,8 @@ void LLPanelPermissions::setAllSaleInfo()
}
}
-class LLSelectionPayable : public LLSelectedObjectFunctor
+struct LLSelectionPayable : public LLSelectedObjectFunctor
{
-public:
virtual bool apply(LLViewerObject* obj)
{
// can pay if you or your parent has money() event in script
diff --git a/indra/newview/llpanelpick.cpp b/indra/newview/llpanelpick.cpp
index 982056c381..cd251314d3 100644
--- a/indra/newview/llpanelpick.cpp
+++ b/indra/newview/llpanelpick.cpp
@@ -327,8 +327,7 @@ void LLPanelPick::processPickInfoReply(LLMessageSystem *msg, void **)
S32 region_y = llround((F32)pos_global.mdV[VY]) % REGION_WIDTH_UNITS;
S32 region_z = llround((F32)pos_global.mdV[VZ]);
- snprintf(buffer, sizeof(buffer), "%s (%d, %d, %d)", sim_name, region_x, region_y, region_z); /* Flawfinder: ignore */
- location_text.append(buffer);
+ location_text.append(llformat("%s (%d, %d, %d)", sim_name, region_x, region_y, region_z));
S32 sort_order;
msg->getS32("Data", "SortOrder", sort_order);
@@ -356,14 +355,13 @@ void LLPanelPick::processPickInfoReply(LLMessageSystem *msg, void **)
self->mPosGlobal = pos_global;
// Update UI controls
- self->mNameEditor->setText(name);
- self->mDescEditor->setText(desc);
+ self->mNameEditor->setText(LLString(name));
+ self->mDescEditor->setText(LLString(desc));
self->mSnapshotCtrl->setImageAssetID(snapshot_id);
self->mLocationEditor->setText(location_text);
self->mEnabledCheck->set(enabled);
- snprintf(buffer, sizeof(buffer), "%d", sort_order); /* Flawfinder: ignore */
- self->mSortOrderEditor->setText(buffer);
+ self->mSortOrderEditor->setText(llformat("%d", sort_order));
}
}
diff --git a/indra/newview/llpanelplace.cpp b/indra/newview/llpanelplace.cpp
index 696fbe9a4c..2176fdc7c9 100644
--- a/indra/newview/llpanelplace.cpp
+++ b/indra/newview/llpanelplace.cpp
@@ -156,7 +156,6 @@ void LLPanelPlace::processParcelInfoReply(LLMessageSystem *msg, void **)
F32 dwell;
S32 sale_price;
S32 auction_id;
- char buffer[256]; /*Flawfinder: ignore*/
msg->getUUID("AgentData", "AgentID", agent_id );
msg->getUUID("Data", "ParcelID", parcel_id);
@@ -191,29 +190,35 @@ void LLPanelPlace::processParcelInfoReply(LLMessageSystem *msg, void **)
self->mSnapshotCtrl->setImageAssetID(snapshot_id);
- self->mNameEditor->setText(name);
+ self->mNameEditor->setText(LLString(name));
- self->mDescEditor->setText(desc);
+ self->mDescEditor->setText(LLString(desc));
- LLString info;
- snprintf(buffer, sizeof(buffer), "Traffic: %.0f, Area: %d sq. m.", dwell, actual_area); /* Flawfinder: ignore */
- info.append(buffer);
+ LLString info_text;
+ LLUIString traffic = self->childGetText("traffic_text");
+ traffic.setArg("[TRAFFIC]", llformat("%.0f", dwell));
+ info_text = traffic;
+ LLUIString area = self->childGetText("area_text");
+ traffic.setArg("[AREA]", llformat("%d", actual_area));
+ info_text += area;
if (flags & DFQ_FOR_SALE)
{
- snprintf(buffer, sizeof(buffer), ", For Sale for L$%d", sale_price); /* Flawfinder: ignore */
- info.append(buffer);
+ LLUIString forsale = self->childGetText("forsale_text");
+ traffic.setArg("[PRICE]", llformat("%d", sale_price));
+ info_text += forsale;
}
if (auction_id != 0)
{
- snprintf(buffer, sizeof(buffer), ", Auction ID %010d", auction_id); /* Flawfinder: ignore */
- info.append(buffer);
+ LLUIString auction = self->childGetText("auction_text");
+ auction.setArg("[ID]", llformat("%010d", auction_id));
+ info_text += auction;
}
- self->mInfoEditor->setText(info);
+ self->mInfoEditor->setText(info_text);
S32 region_x = llround(global_x) % REGION_WIDTH_UNITS;
S32 region_y = llround(global_y) % REGION_WIDTH_UNITS;
S32 region_z = llround(global_z);
-
+
// HACK: Flag 0x1 == mature region, otherwise assume PG
const char* rating = LLViewerRegion::accessToString(SIM_ACCESS_PG);
if (flags & 0x1)
@@ -221,9 +226,9 @@ void LLPanelPlace::processParcelInfoReply(LLMessageSystem *msg, void **)
rating = LLViewerRegion::accessToString(SIM_ACCESS_MATURE);
}
- snprintf(buffer, sizeof(buffer), "%s %d, %d, %d (%s)", /* Flawfinder: ignore */
- sim_name, region_x, region_y, region_z, rating);
- self->mLocationEditor->setText(buffer);
+ LLString location = llformat("%s %d, %d, %d (%s)",
+ sim_name, region_x, region_y, region_z, rating);
+ self->mLocationEditor->setText(location);
BOOL show_auction = (auction_id > 0);
self->mAuctionBtn->setVisible(show_auction);
diff --git a/indra/newview/llpreviewgesture.cpp b/indra/newview/llpreviewgesture.cpp
index 1f6d62c85c..a9205998e6 100644
--- a/indra/newview/llpreviewgesture.cpp
+++ b/indra/newview/llpreviewgesture.cpp
@@ -69,6 +69,7 @@
#include "llresmgr.h"
+// *TODO: Translate?
const char NONE_LABEL[] = "---";
const char SHIFT_LABEL[] = "Shift";
const char CTRL_LABEL[] = "Ctrl";
@@ -761,17 +762,20 @@ void LLPreviewGesture::refresh()
mWaitTimeCheck->setVisible(FALSE);
mWaitTimeEditor->setVisible(FALSE);
+ LLString optionstext;
+
if (have_step)
{
// figure out the type, show proper options, update text
LLGestureStep* step = (LLGestureStep*)step_item->getUserdata();
EStepType type = step->getType();
+
switch(type)
{
case STEP_ANIMATION:
{
LLGestureStepAnimation* anim_step = (LLGestureStepAnimation*)step;
- mOptionsText->setText("Animation to play:");
+ optionstext = childGetText("step_anim");
mAnimationCombo->setVisible(TRUE);
mAnimationRadio->setVisible(TRUE);
mAnimationRadio->setSelectedIndex((anim_step->mFlags & ANIM_FLAG_STOP) ? 1 : 0);
@@ -781,7 +785,7 @@ void LLPreviewGesture::refresh()
case STEP_SOUND:
{
LLGestureStepSound* sound_step = (LLGestureStepSound*)step;
- mOptionsText->setText("Sound to play:");
+ optionstext = childGetText("step_sound");
mSoundCombo->setVisible(TRUE);
mSoundCombo->setCurrentByID(sound_step->mSoundAssetID);
break;
@@ -789,7 +793,7 @@ void LLPreviewGesture::refresh()
case STEP_CHAT:
{
LLGestureStepChat* chat_step = (LLGestureStepChat*)step;
- mOptionsText->setText("Chat to say:");
+ optionstext = childGetText("step_chat");
mChatEditor->setVisible(TRUE);
mChatEditor->setText(chat_step->mChatText);
break;
@@ -797,14 +801,13 @@ void LLPreviewGesture::refresh()
case STEP_WAIT:
{
LLGestureStepWait* wait_step = (LLGestureStepWait*)step;
- mOptionsText->setText("Wait:");
+ optionstext = childGetText("step_wait");
mWaitAnimCheck->setVisible(TRUE);
mWaitAnimCheck->set(wait_step->mFlags & WAIT_FLAG_ALL_ANIM);
mWaitTimeCheck->setVisible(TRUE);
mWaitTimeCheck->set(wait_step->mFlags & WAIT_FLAG_TIME);
mWaitTimeEditor->setVisible(TRUE);
- char buffer[16]; /*Flawfinder: ignore*/
- snprintf(buffer, sizeof(buffer), "%.1f", (double)wait_step->mWaitSeconds); /* Flawfinder: ignore */
+ std::string buffer = llformat("%.1f", (double)wait_step->mWaitSeconds);
mWaitTimeEditor->setText(buffer);
break;
}
@@ -812,11 +815,8 @@ void LLPreviewGesture::refresh()
break;
}
}
- else
- {
- // no gesture
- mOptionsText->setText("");
- }
+
+ mOptionsText->setText(optionstext);
BOOL active = gGestureManager.isGestureActive(mItemUUID);
mActiveCheck->set(active);
@@ -984,14 +984,14 @@ void LLPreviewGesture::loadUIFromGesture(LLMultiGesture* gesture)
switch (gesture->mMask)
{
default:
- case MASK_NONE:
- mModifierCombo->setSimple( NONE_LABEL );
+ case MASK_NONE:
+ mModifierCombo->setSimple( LLString(NONE_LABEL) );
break;
- case MASK_SHIFT:
- mModifierCombo->setSimple( SHIFT_LABEL );
+ case MASK_SHIFT:
+ mModifierCombo->setSimple( LLString(SHIFT_LABEL) );
break;
- case MASK_CONTROL:
- mModifierCombo->setSimple( CTRL_LABEL );
+ case MASK_CONTROL:
+ mModifierCombo->setSimple( LLString(CTRL_LABEL) );
break;
}
@@ -1734,8 +1734,7 @@ void LLPreviewGesture::onClickPreview(void* data)
self->mPreviewGesture->mCallbackData = self;
// set the button title
- self->mPreviewBtn->setLabelSelected("Stop");
- self->mPreviewBtn->setLabelUnselected("Stop");
+ self->mPreviewBtn->setLabel(self->childGetText("stop_txt"));
// play it, and delete when done
gGestureManager.playGesture(self->mPreviewGesture);
@@ -1757,8 +1756,7 @@ void LLPreviewGesture::onDonePreview(LLMultiGesture* gesture, void* data)
{
LLPreviewGesture* self = (LLPreviewGesture*)data;
- self->mPreviewBtn->setLabelSelected("Preview");
- self->mPreviewBtn->setLabelUnselected("Preview");
+ self->mPreviewBtn->setLabel(self->childGetText("preview_txt"));
delete self->mPreviewGesture;
self->mPreviewGesture = NULL;
diff --git a/indra/newview/llpreviewnotecard.cpp b/indra/newview/llpreviewnotecard.cpp
index ccd975addc..620be8f8c6 100644
--- a/indra/newview/llpreviewnotecard.cpp
+++ b/indra/newview/llpreviewnotecard.cpp
@@ -281,7 +281,7 @@ void LLPreviewNotecard::loadAsset()
mAssetID = item->getAssetUUID();
if(mAssetID.isNull())
{
- editor->setText("");
+ editor->setText(LLString::null);
editor->makePristine();
editor->setEnabled(TRUE);
mAssetStatus = PREVIEW_ASSET_LOADED;
@@ -302,7 +302,7 @@ void LLPreviewNotecard::loadAsset()
// The object that we're trying to look at disappeared, bail.
llwarns << "Can't find object " << mObjectUUID << " associated with notecard." << llendl;
mAssetID.setNull();
- editor->setText("Unable to find object containing this note.");
+ editor->setText(childGetText("no_object"));
editor->makePristine();
editor->setEnabled(FALSE);
mAssetStatus = PREVIEW_ASSET_LOADED;
@@ -327,7 +327,7 @@ void LLPreviewNotecard::loadAsset()
else
{
mAssetID.setNull();
- editor->setText("You are not allowed to view this note.");
+ editor->setText(childGetText("not_allowed"));
editor->makePristine();
editor->setEnabled(FALSE);
mAssetStatus = PREVIEW_ASSET_LOADED;
@@ -341,7 +341,7 @@ void LLPreviewNotecard::loadAsset()
}
else
{
- editor->setText("");
+ editor->setText(LLString::null);
editor->makePristine();
editor->setEnabled(TRUE);
mAssetStatus = PREVIEW_ASSET_LOADED;
@@ -384,7 +384,7 @@ void LLPreviewNotecard::onLoadComplete(LLVFS *vfs,
else
{
// Version 0 (just text, doesn't include version number)
- previewEditor->setText(buffer);
+ previewEditor->setText(LLStringExplicit(buffer));
}
previewEditor->makePristine();
diff --git a/indra/newview/llpreviewscript.cpp b/indra/newview/llpreviewscript.cpp
index acaa666efa..7eac589640 100644
--- a/indra/newview/llpreviewscript.cpp
+++ b/indra/newview/llpreviewscript.cpp
@@ -103,11 +103,8 @@ const char HELLO_LSL[] =
"}\n";
const char HELP_LSL[] = "lsl_guide.html";
-const char DEFAULT_SCRIPT_NAME[] = "New Script";
-const char DEFAULT_SCRIPT_DESC[] = "(No Description)";
-
-const char ENABLED_RUNNING_CHECKBOX_LABEL[] = "Running";
-const char DISABLED_RUNNING_CHECKBOX_LABEL[] = "Public Objects cannot run scripts";
+const char DEFAULT_SCRIPT_NAME[] = "New Script"; // *TODO:Translate?
+const char DEFAULT_SCRIPT_DESC[] = "(No Description)"; // *TODO:Translate?
// Description and header information
@@ -321,7 +318,6 @@ LLScriptEdCore::LLScriptEdCore(
mFunctions = LLUICtrlFactory::getComboBoxByName(this, "Insert...");
childSetCommitCallback("Insert...", &LLScriptEdCore::onBtnInsertFunction, this);
- mFunctions->setLabel("Insert...");
mEditor = LLViewerUICtrlFactory::getViewerTextEditorByName(this, "Script Editor");
mEditor->setReadOnlyBgColor(gColors.getColor( "ScriptBgReadOnlyColor" ) );
@@ -456,13 +452,13 @@ void LLScriptEdCore::draw()
S32 line = 0;
S32 column = 0;
mEditor->getCurrentLineAndColumn( &line, &column, FALSE ); // don't include wordwrap
- char cursor_pos[STD_STRING_BUF_SIZE]; /*Flawfinder: ignore*/
- snprintf( cursor_pos, STD_STRING_BUF_SIZE, "Line %d, Column %d", line, column ); /* Flawfinder: ignore */
+ std::string cursor_pos;
+ cursor_pos = llformat("Line %d, Column %d", line, column );
childSetText("line_col", cursor_pos);
}
else
{
- childSetText("line_col", "");
+ childSetText("line_col", LLString::null);
}
updateDynamicHelp();
@@ -985,7 +981,7 @@ void LLScriptEdCore::handleReloadFromServerDialog( S32 option, void* userdata )
case 0: // "Yes"
if( self->mLoadCallback )
{
- self->mEditor->setText( "Loading..." );
+ self->mEditor->setText( self->childGetText("loading") );
self->mLoadCallback( self->mUserdata );
}
break;
@@ -1199,7 +1195,7 @@ void LLPreviewLSL::loadAsset()
}
else
{
- mScriptEd->mEditor->setText("You are not allowed to view this script.");
+ mScriptEd->mEditor->setText(mScriptEd->childGetText("can_not_view"));
mScriptEd->mEditor->makePristine();
mScriptEd->mEditor->setEnabled(FALSE);
mScriptEd->mFunctions->setEnabled(FALSE);
@@ -1210,7 +1206,7 @@ void LLPreviewLSL::loadAsset()
}
else
{
- mScriptEd->mEditor->setText(HELLO_LSL);
+ mScriptEd->mEditor->setText(LLString(HELLO_LSL));
mAssetStatus = PREVIEW_ASSET_LOADED;
}
}
@@ -1517,7 +1513,7 @@ void LLPreviewLSL::onLoadComplete( LLVFS *vfs, const LLUUID& asset_uuid, LLAsset
// put a EOS at the end
buffer[file_length] = 0;
- preview->mScriptEd->mEditor->setText(buffer);
+ preview->mScriptEd->mEditor->setText(LLStringExplicit(buffer));
preview->mScriptEd->mEditor->makePristine();
delete [] buffer;
LLInventoryItem* item = gInventory.getItem(*item_uuid);
@@ -1731,7 +1727,7 @@ void LLLiveLSLEditor::loadAsset(BOOL is_new)
|| !gAgent.allowOperation(PERM_MODIFY, item->getPermissions(), GP_OBJECT_MANIPULATE))))
{
mItem = new LLViewerInventoryItem(item);
- mScriptEd->mEditor->setText("You are not allowed to view this script.");
+ mScriptEd->mEditor->setText(childGetText("not_allowed"));
mScriptEd->mEditor->makePristine();
mScriptEd->mEditor->setEnabled(FALSE);
mAssetStatus = PREVIEW_ASSET_LOADED;
@@ -1762,7 +1758,7 @@ void LLLiveLSLEditor::loadAsset(BOOL is_new)
}
else
{
- mScriptEd->mEditor->setText("");
+ mScriptEd->mEditor->setText(LLString::null);
mScriptEd->mEditor->makePristine();
mAssetStatus = PREVIEW_ASSET_LOADED;
}
@@ -1797,7 +1793,7 @@ void LLLiveLSLEditor::loadAsset(BOOL is_new)
// This may be better than having a accessible null pointer around,
// though this newly allocated object will most likely be replaced.
mItem = new LLViewerInventoryItem();
- mScriptEd->mEditor->setText("");
+ mScriptEd->mEditor->setText(LLString::null);
mScriptEd->mEditor->makePristine();
mScriptEd->mEditor->setEnabled(FALSE);
mAssetStatus = PREVIEW_ASSET_LOADED;
@@ -1805,8 +1801,8 @@ void LLLiveLSLEditor::loadAsset(BOOL is_new)
}
else
{
- mScriptEd->mEditor->setText(HELLO_LSL);
- //mScriptEd->mEditor->setText("");
+ mScriptEd->mEditor->setText(LLString(HELLO_LSL));
+ //mScriptEd->mEditor->setText(LLString::null);
//mScriptEd->mEditor->makePristine();
LLPermissions perm;
perm.init(gAgent.getID(), gAgent.getID(), LLUUID::null, gAgent.getGroupID());
@@ -1893,7 +1889,7 @@ void LLLiveLSLEditor::loadScriptText(const char* filename)
}
buffer[nread] = '\0';
fclose(file);
- mScriptEd->mEditor->setText(buffer);
+ mScriptEd->mEditor->setText(LLStringExplicit(buffer));
mScriptEd->mEditor->makePristine();
delete[] buffer;
}
@@ -1918,7 +1914,7 @@ void LLLiveLSLEditor::loadScriptText(LLVFS *vfs, const LLUUID &uuid, LLAssetType
buffer[file_length] = '\0';
- mScriptEd->mEditor->setText(buffer);
+ mScriptEd->mEditor->setText(LLStringExplicit(buffer));
mScriptEd->mEditor->makePristine();
delete[] buffer;
@@ -1985,12 +1981,12 @@ void LLLiveLSLEditor::draw()
{
if(object->permAnyOwner())
{
- runningCheckbox->setLabel(ENABLED_RUNNING_CHECKBOX_LABEL);
+ runningCheckbox->setLabel(childGetText("script_running"));
runningCheckbox->setEnabled(TRUE);
}
else
{
- runningCheckbox->setLabel(DISABLED_RUNNING_CHECKBOX_LABEL);
+ runningCheckbox->setLabel(childGetText("public_objects_can_not_run"));
runningCheckbox->setEnabled(FALSE);
// *FIX: Set it to false so that the ui is correct for
// a box that is released to public. It could be
@@ -2238,7 +2234,7 @@ void LLLiveLSLEditor::uploadAssetLegacy(const std::string& filename,
// If we successfully saved it, then we should be able to check/uncheck the running box!
LLCheckBoxCtrl* runningCheckbox = LLUICtrlFactory::getCheckBoxByName(this, "running");
- runningCheckbox->setLabel(ENABLED_RUNNING_CHECKBOX_LABEL);
+ runningCheckbox->setLabel(childGetText("script_running"));
runningCheckbox->setEnabled(TRUE);
}
diff --git a/indra/newview/llselectmgr.cpp b/indra/newview/llselectmgr.cpp
index b7bde1cc8a..af16a4d3fa 100644
--- a/indra/newview/llselectmgr.cpp
+++ b/indra/newview/llselectmgr.cpp
@@ -213,6 +213,11 @@ LLSelectMgr::LLSelectMgr()
//-----------------------------------------------------------------------------
LLSelectMgr::~LLSelectMgr()
{
+ clearSelections();
+}
+
+void LLSelectMgr::clearSelections()
+{
mHoverObjects->deleteAllNodes();
mSelectedObjects->deleteAllNodes();
mHighlightedObjects->deleteAllNodes();
@@ -220,21 +225,27 @@ LLSelectMgr::~LLSelectMgr()
mGridObjects.deleteAllNodes();
}
-void LLSelectMgr::updateEffects()
+void LLSelectMgr::update()
{
+ mSelectedObjects->cleanupNodes();
+}
+void LLSelectMgr::updateEffects()
+{
//keep reference grid objects active
- for (LLSelectNode* grid_nodep = mGridObjects.getFirstNode();
- grid_nodep;
- grid_nodep = mGridObjects.getNextNode())
+ struct f : public LLSelectedObjectFunctor
{
- LLViewerObject* grid_object = grid_nodep->getObject();
- LLDrawable* drawable = grid_object->mDrawable;
- if (drawable)
+ virtual bool apply(LLViewerObject* object)
{
- gPipeline.markMoved(drawable);
+ LLDrawable* drawable = object->mDrawable;
+ if (drawable)
+ {
+ gPipeline.markMoved(drawable);
+ }
+ return true;
}
- }
+ } func;
+ mGridObjects.applyToObjects(&func);
if (mEffectsTimer.getElapsedTimeF32() > 1.f)
{
@@ -246,29 +257,30 @@ void LLSelectMgr::updateEffects()
void LLSelectMgr::overrideObjectUpdates()
{
//override any position updates from simulator on objects being edited
- LLSelectNode* selectNode;
- for (selectNode = gSelectMgr->getSelection()->getFirstNode();
- selectNode != NULL;
- selectNode = gSelectMgr->getSelection()->getNextNode())
+ struct f : public LLSelectedNodeFunctor
{
- LLViewerObject* object = selectNode->getObject();
-
- if (object->permMove())
+ virtual bool apply(LLSelectNode* selectNode)
{
- if (!selectNode->mLastPositionLocal.isExactlyZero())
+ LLViewerObject* object = selectNode->getObject();
+ if (object->permMove())
{
- object->setPosition(selectNode->mLastPositionLocal);
- }
- if (selectNode->mLastRotation != LLQuaternion())
- {
- object->setRotation(selectNode->mLastRotation);
- }
- if (!selectNode->mLastScale.isExactlyZero())
- {
- object->setScale(selectNode->mLastScale);
+ if (!selectNode->mLastPositionLocal.isExactlyZero())
+ {
+ object->setPosition(selectNode->mLastPositionLocal);
+ }
+ if (selectNode->mLastRotation != LLQuaternion())
+ {
+ object->setRotation(selectNode->mLastRotation);
+ }
+ if (!selectNode->mLastScale.isExactlyZero())
+ {
+ object->setScale(selectNode->mLastScale);
+ }
}
+ return true;
}
- }
+ } func;
+ getSelection()->applyToNodes(&func);
}
//-----------------------------------------------------------------------------
@@ -417,24 +429,26 @@ LLObjectSelectionHandle LLSelectMgr::selectObjectAndFamily(LLViewerObject* obj,
//-----------------------------------------------------------------------------
// Select the object, parents and children.
//-----------------------------------------------------------------------------
-LLObjectSelectionHandle LLSelectMgr::selectObjectAndFamily(const LLDynamicArray<LLViewerObject*>& object_list,
- BOOL send_to_sim)
+LLObjectSelectionHandle LLSelectMgr::selectObjectAndFamily(const std::vector<LLViewerObject*>& object_list,
+ BOOL send_to_sim)
{
// Collect all of the objects, children included
LLDynamicArray<LLViewerObject*> objects;
- LLViewerObject *object;
- S32 i;
//clear primary object (no primary object)
mSelectedObjects->mPrimaryObject = NULL;
- if (object_list.count() < 1) return NULL;
-
+ if (object_list.size() < 1)
+ {
+ return NULL;
+ }
+
// NOTE -- we add the objects in REVERSE ORDER
// to preserve the order in the mSelectedObjects list
- for (i = object_list.count() - 1; i >= 0; i--)
+ for (std::vector<LLViewerObject*>::const_reverse_iterator riter = object_list.rbegin();
+ riter != object_list.rend(); ++riter)
{
- object = object_list.get(i);
+ LLViewerObject *object = *riter;
llassert( object );
@@ -506,44 +520,30 @@ BOOL LLSelectMgr::removeObjectFromSelections(const LLUUID &id)
// Iterate through selected objects list and kill the object
if( !object_found )
{
- LLViewerObject* prevobjp = NULL;
- for( LLViewerObject* tobjp = mSelectedObjects->getFirstObject(); tobjp != NULL; tobjp = mSelectedObjects->getNextObject() )
+ for (LLObjectSelection::iterator iter = getSelection()->begin();
+ iter != getSelection()->end(); )
{
- if (tobjp == prevobjp)
+ LLObjectSelection::iterator curiter = iter++;
+ LLViewerObject* object = (*curiter)->getObject();
+ if (object->mID == id)
{
- // Somehow we got stuck in an infinite loop... (DaveP)
- // this logic is kind of twisted, not sure how this is happening, so...
- llwarns << "Detected infinite loop #1 in LLSelectMgr::removeObjectFromSelections:|" << llendl;
- //MikeS. adding warning and comment...
- //These infinite loops happen because the LLSelectMgr iteration routines are non-reentrant.
- //deselectObjectAndFamily uses getFirstObject and getNextObject to mess with the array,
- //resetting the arrays internal iterator state. This needs fixing BAD.
- continue;
- }
- // It's possible the item being removed has an avatar sitting on it
- // So remove the avatar that is sitting on the object.
- if (tobjp->mID == id || tobjp->isAvatar())
- {
- if (!gNoRender)
+ if (tool)
{
tool->stopEditing();
}
// lose the selection, don't tell simulator, it knows
- deselectObjectAndFamily(tobjp, FALSE);
-
- if (tobjp->mID == id)
- {
- if(object_found == TRUE){
- //MikeS. adding warning... This happens when removing a linked attachment while sitting on an object..
- //I think the selection manager needs to be rewritten. BAD.
- llwarns << "Detected infinite loop #2 in LLSelectMgr::removeObjectFromSelections:|" << llendl;
- break;
- }
- object_found = TRUE;
- }
+ deselectObjectAndFamily(object, FALSE);
+ object_found = TRUE;
+ break; // must break here, may have removed multiple objects from list
+ }
+ else if (object->isAvatar())
+ {
+ // It's possible the item being removed has an avatar sitting on it
+ // So remove the avatar that is sitting on the object.
+ deselectObjectAndFamily(object, FALSE);
+ break; // must break here, may have removed multiple objects from list
}
- prevobjp = tobjp;
}
}
@@ -596,7 +596,7 @@ void LLSelectMgr::deselectObjectAndFamily(LLViewerObject* object, BOOL send_to_s
S32 select_count = 0;
LLMessageSystem* msg = gMessageSystem;
- for (S32 i = 0; i < objects.count(); i++)
+ for (U32 i = 0; i < objects.size(); i++)
{
if (start_new_message)
{
@@ -659,15 +659,12 @@ void LLSelectMgr::deselectObjectOnly(LLViewerObject* object, BOOL send_to_sim)
// addAsFamily
//-----------------------------------------------------------------------------
-void LLSelectMgr::addAsFamily(LLDynamicArray<LLViewerObject*>& objects, BOOL add_to_end)
+void LLSelectMgr::addAsFamily(std::vector<LLViewerObject*>& objects, BOOL add_to_end)
{
- S32 count = objects.count();
- LLViewerObject *objectp = NULL;
-
- LLSelectNode *nodep = NULL;
- for (S32 i = 0; i < count; i++)
+ for (std::vector<LLViewerObject*>::iterator iter = objects.begin();
+ iter != objects.end(); ++iter)
{
- objectp = objects.get(i);
+ LLViewerObject* objectp = *iter;
// Can't select yourself
if (objectp->mID == gAgentID
@@ -678,7 +675,7 @@ void LLSelectMgr::addAsFamily(LLDynamicArray<LLViewerObject*>& objects, BOOL add
if (!objectp->isSelected())
{
- nodep = new LLSelectNode(objectp, TRUE);
+ LLSelectNode *nodep = new LLSelectNode(objectp, TRUE);
if (add_to_end)
{
mSelectedObjects->addNodeAtEnd(nodep);
@@ -725,14 +722,14 @@ void LLSelectMgr::addAsIndividual(LLViewerObject *objectp, S32 face, BOOL undoab
{
nodep = new LLSelectNode(objectp, TRUE);
mSelectedObjects->addNode(nodep);
+ llassert_always(nodep->getObject());
}
else
{
// make this a full-fledged selection
nodep->setTransient(FALSE);
// Move it to the front of the list
- mSelectedObjects->removeNode(nodep);
- mSelectedObjects->addNode(nodep);
+ mSelectedObjects->moveNodeToFront(nodep);
}
// Make sure the object is tagged as selected
@@ -793,14 +790,11 @@ LLObjectSelectionHandle LLSelectMgr::setHoverObject(LLViewerObject *objectp)
objectp = objectp->getRootEdit();
objectp->addThisAndNonJointChildren(objects);
-
- S32 count = objects.count();
- LLViewerObject* cur_objectp = NULL;
- LLSelectNode* nodep = NULL;
- for(S32 i = 0; i < count; i++)
+ for (std::vector<LLViewerObject*>::iterator iter = objects.begin();
+ iter != objects.end(); ++iter)
{
- cur_objectp = objects[i];
- nodep = new LLSelectNode(cur_objectp, FALSE);
+ LLViewerObject* cur_objectp = *iter;
+ LLSelectNode* nodep = new LLSelectNode(cur_objectp, FALSE);
mHoverObjects->addNodeAtEnd(nodep);
}
@@ -853,28 +847,30 @@ void LLSelectMgr::highlightObjectAndFamily(LLViewerObject* objectp)
}
// Note that this ignores the "select owned only" flag
-// It's also more efficient than calling the single-object version over and
-// over.
-void LLSelectMgr::highlightObjectAndFamily(const LLDynamicArray<LLViewerObject*>& list)
+// It's also more efficient than calling the single-object version over and over.
+void LLSelectMgr::highlightObjectAndFamily(const std::vector<LLViewerObject*>& objects)
{
- S32 i;
- S32 count = list.count();
-
- for (i = 0; i < count; i++)
+ for (std::vector<LLViewerObject*>::const_iterator iter1 = objects.begin();
+ iter1 != objects.end(); ++iter1)
{
- LLViewerObject* object = list.get(i);
+ LLViewerObject* object = *iter1;
- if (!object) continue;
- if (object->getPCode() != LL_PCODE_VOLUME) continue;
+ if (!object)
+ {
+ continue;
+ }
+ if (object->getPCode() != LL_PCODE_VOLUME)
+ {
+ continue;
+ }
LLViewerObject* root = (LLViewerObject*)object->getRoot();
mRectSelectedObjects.insert(root);
- S32 j;
- S32 child_count = root->mChildList.size();
- for (j = 0; j < child_count; j++)
+ for (LLViewerObject::child_list_t::const_iterator iter2 = root->mChildList.begin();
+ iter2 != root->mChildList.end(); ++iter2)
{
- LLViewerObject* child = root->mChildList[j];
+ LLViewerObject* child = *iter2;
mRectSelectedObjects.insert(child);
}
}
@@ -901,9 +897,11 @@ void LLSelectMgr::unhighlightObjectAndFamily(LLViewerObject* objectp)
unhighlightObjectOnly(root_obj);
- for(U32 i = 0; i < root_obj->mChildList.size(); i++)
+ for (LLViewerObject::child_list_t::iterator iter2 = root_obj->mChildList.begin();
+ iter2 != root_obj->mChildList.end(); ++iter2)
{
- unhighlightObjectOnly(root_obj->mChildList[i]);
+ LLViewerObject* child = *iter2;
+ unhighlightObjectOnly(child);
}
}
@@ -924,11 +922,12 @@ LLObjectSelectionHandle LLSelectMgr::selectHighlightedObjects()
//clear primary object
mSelectedObjects->mPrimaryObject = NULL;
- LLSelectNode *nodep;
- for (nodep = mHighlightedObjects->getFirstNode();
- nodep;
- nodep = mHighlightedObjects->getNextNode())
+ for (LLObjectSelection::iterator iter = getHighlightedObjects()->begin();
+ iter != getHighlightedObjects()->end(); )
{
+ LLObjectSelection::iterator curiter = iter++;
+
+ LLSelectNode *nodep = *curiter;
LLViewerObject* objectp = nodep->getObject();
if (!canSelectObject(objectp))
@@ -1000,9 +999,12 @@ void LLSelectMgr::addGridObject(LLViewerObject* objectp)
{
LLSelectNode* nodep = new LLSelectNode(objectp, FALSE);
mGridObjects.addNodeAtEnd(nodep);
- for (U32 i = 0; i < objectp->mChildList.size(); i++)
+
+ for (LLViewerObject::child_list_t::iterator iter2 = objectp->mChildList.begin();
+ iter2 != objectp->mChildList.end(); ++iter2)
{
- nodep = new LLSelectNode(objectp->mChildList[i], FALSE);
+ LLViewerObject* child = *iter2;
+ nodep = new LLSelectNode(child, FALSE);
mGridObjects.addNodeAtEnd(nodep);
}
}
@@ -1022,14 +1024,9 @@ void LLSelectMgr::setGridMode(EGridMode mode)
void LLSelectMgr::getGrid(LLVector3& origin, LLQuaternion &rotation, LLVector3 &scale)
{
- LLSelectNode* grid_node = mGridObjects.getFirstNode();
- LLViewerObject* grid_object = mGridObjects.getFirstObject();
- // *TODO: get to work with multiple grid objects
- if (grid_node && grid_node->getObject()->isDead())
- {
- mGridObjects.removeNode(grid_node);
- grid_object = NULL;
- }
+ mGridObjects.cleanupNodes();
+
+ LLViewerObject* first_grid_object = mGridObjects.getFirstObject();
if (mGridMode == GRID_MODE_LOCAL && mSelectedObjects->getObjectCount())
{
@@ -1038,47 +1035,42 @@ void LLSelectMgr::getGrid(LLVector3& origin, LLQuaternion &rotation, LLVector3 &
mGridRotation = mSavedSelectionBBox.getRotation();
mGridScale = mSavedSelectionBBox.getExtentLocal() * 0.5f;
}
- else if (mGridMode == GRID_MODE_REF_OBJECT && grid_object && grid_object->mDrawable.notNull())
+ else if (mGridMode == GRID_MODE_REF_OBJECT && first_grid_object && first_grid_object->mDrawable.notNull())
{
- mGridRotation = grid_object->getRenderRotation();
- LLVector3 first_grid_obj_pos = grid_object->getRenderPosition();
+ mGridRotation = first_grid_object->getRenderRotation();
+ LLVector3 first_grid_obj_pos = first_grid_object->getRenderPosition();
LLVector3 min_extents(F32_MAX, F32_MAX, F32_MAX);
- LLVector3 max_extents(-min_extents);
+ LLVector3 max_extents(-F32_MAX, -F32_MAX, -F32_MAX);
BOOL grid_changed = FALSE;
- LLSelectNode* grid_nodep;
- for (grid_nodep = mGridObjects.getFirstNode();
- grid_nodep;
- grid_nodep = mGridObjects.getNextNode())
+ for (LLObjectSelection::iterator iter = mGridObjects.begin();
+ iter != mGridObjects.end(); ++iter)
+ {
+ LLViewerObject* object = (*iter)->getObject();
+ LLDrawable* drawable = object->mDrawable;
+ if (drawable)
{
- grid_object = grid_nodep->getObject();
- LLDrawable* drawable = grid_object->mDrawable;
- if (drawable)
- {
- const LLVector3* ext = drawable->getSpatialExtents();
- update_min_max(min_extents, max_extents, ext[0]);
- update_min_max(min_extents, max_extents, ext[1]);
- grid_changed = TRUE;
- }
+ const LLVector3* ext = drawable->getSpatialExtents();
+ update_min_max(min_extents, max_extents, ext[0]);
+ update_min_max(min_extents, max_extents, ext[1]);
+ grid_changed = TRUE;
}
+ }
if (grid_changed)
{
mGridOrigin = lerp(min_extents, max_extents, 0.5f);
- LLDrawable* drawable = grid_object->mDrawable;
+ LLDrawable* drawable = first_grid_object->mDrawable;
if (drawable && drawable->isActive())
{
- mGridOrigin = mGridOrigin * grid_object->getRenderMatrix();
+ mGridOrigin = mGridOrigin * first_grid_object->getRenderMatrix();
}
mGridScale = (max_extents - min_extents) * 0.5f;
}
}
else // GRID_MODE_WORLD or just plain default
{
- LLViewerObject* first_object = mSelectedObjects->getFirstRootObject();
- if (!first_object)
- {
- first_object = mSelectedObjects->getFirstObject();
- }
+ const BOOL non_root_ok = TRUE;
+ LLViewerObject* first_object = mSelectedObjects->getFirstRootObject(non_root_ok);
mGridOrigin.clearVec();
mGridRotation.loadIdentity();
@@ -1118,26 +1110,20 @@ void LLSelectMgr::getGrid(LLVector3& origin, LLQuaternion &rotation, LLVector3 &
// remove() - an array of objects
//-----------------------------------------------------------------------------
-void LLSelectMgr::remove(LLDynamicArray<LLViewerObject*>& objects)
+void LLSelectMgr::remove(std::vector<LLViewerObject*>& objects)
{
- S32 count = objects.count();
- LLViewerObject *objectp = NULL;
- LLSelectNode *nodep = NULL;
- for(S32 i = 0; i < count; i++)
+ for (std::vector<LLViewerObject*>::iterator iter = objects.begin();
+ iter != objects.end(); ++iter)
{
- objectp = objects.get(i);
- for(nodep = mSelectedObjects->getFirstNode();
- nodep != NULL;
- nodep = mSelectedObjects->getNextNode())
+ LLViewerObject* objectp = *iter;
+ LLSelectNode* nodep = mSelectedObjects->findNode(objectp);
+ if (nodep)
{
- if(nodep->getObject() == objectp)
- {
- objectp->setSelected(FALSE);
- mSelectedObjects->removeNode(nodep);
- break;
- }
+ objectp->setSelected(FALSE);
+ mSelectedObjects->removeNode(nodep);
+ nodep = NULL;
}
- }
+ }
updateSelectionCenter();
dialog_refresh_all();
}
@@ -1148,26 +1134,19 @@ void LLSelectMgr::remove(LLDynamicArray<LLViewerObject*>& objects)
//-----------------------------------------------------------------------------
void LLSelectMgr::remove(LLViewerObject *objectp, S32 te, BOOL undoable)
{
- // check if object already in list
- // *FIX: can we just check isSelected()?
+ // get object node (and verify it is in the selected list)
LLSelectNode *nodep = mSelectedObjects->findNode(objectp);
-
if (!nodep)
{
return;
}
-
// if face = all, remove object from list
- if (objectp->getNumTEs() <= 0)
- {
- // object doesn't have faces, so blow it away
- mSelectedObjects->removeNode(nodep);
- objectp->setSelected( FALSE );
- }
- else if (te == SELECT_ALL_TES)
+ if ((objectp->getNumTEs() <= 0) || (te == SELECT_ALL_TES))
{
+ // Remove all faces (or the object doesn't have faces) so remove the node
mSelectedObjects->removeNode(nodep);
+ nodep = NULL;
objectp->setSelected( FALSE );
}
else if (0 <= te && te < SELECT_MAX_TES)
@@ -1194,9 +1173,9 @@ void LLSelectMgr::remove(LLViewerObject *objectp, S32 te, BOOL undoable)
if (!found)
{
mSelectedObjects->removeNode(nodep);
+ nodep = NULL;
objectp->setSelected( FALSE );
-
- // BUG: Doesn't update simulator that object is gone.
+ // *FIXME: Doesn't update simulator that object is no longer selected
}
}
else
@@ -1215,14 +1194,15 @@ void LLSelectMgr::remove(LLViewerObject *objectp, S32 te, BOOL undoable)
//-----------------------------------------------------------------------------
void LLSelectMgr::removeAll()
{
- LLViewerObject *objectp;
- for (objectp = mSelectedObjects->getFirstObject(); objectp; objectp = mSelectedObjects->getNextObject() )
+ for (LLObjectSelection::iterator iter = mSelectedObjects->begin();
+ iter != mSelectedObjects->end(); iter++ )
{
+ LLViewerObject *objectp = (*iter)->getObject();
objectp->setSelected( FALSE );
}
mSelectedObjects->deleteAllNodes();
-
+
updateSelectionCenter();
dialog_refresh_all();
}
@@ -1236,19 +1216,19 @@ void LLSelectMgr::promoteSelectionToRoot()
BOOL selection_changed = FALSE;
- LLSelectNode* nodep;
- LLViewerObject *objectp;
- for (nodep = mSelectedObjects->getFirstNode();
- nodep;
- nodep = mSelectedObjects->getNextNode() )
+ for (LLObjectSelection::iterator iter = getSelection()->begin();
+ iter != getSelection()->end(); )
{
+ LLObjectSelection::iterator curiter = iter++;
+ LLSelectNode* nodep = *curiter;
+ LLViewerObject* object = nodep->getObject();
+
if (nodep->mIndividualSelection)
{
selection_changed = TRUE;
}
- objectp = nodep->getObject();
- LLViewerObject* parentp = objectp;
+ LLViewerObject* parentp = object;
while(parentp->getParent() && !(parentp->isRootEdit() || parentp->isJointChild()))
{
parentp = (LLViewerObject*)parentp->getParent();
@@ -1276,19 +1256,21 @@ void LLSelectMgr::demoteSelectionToIndividuals()
{
LLDynamicArray<LLViewerObject*> objects;
- for (LLViewerObject* root_objectp = mSelectedObjects->getFirstRootObject();
- root_objectp;
- root_objectp = mSelectedObjects->getNextRootObject())
+ for (LLObjectSelection::root_iterator iter = getSelection()->root_begin();
+ iter != getSelection()->root_end(); iter++)
{
- root_objectp->addThisAndNonJointChildren(objects);
+ LLViewerObject* object = (*iter)->getObject();
+ object->addThisAndNonJointChildren(objects);
}
if (objects.getLength())
{
deselectAll();
- for(S32 i = 0; i < objects.count(); i++)
+ for (std::vector<LLViewerObject*>::iterator iter = objects.begin();
+ iter != objects.end(); ++iter)
{
- selectObjectOnly(objects[i]);
+ LLViewerObject* objectp = *iter;
+ selectObjectOnly(objectp);
}
}
}
@@ -1302,14 +1284,12 @@ void LLSelectMgr::dump()
llinfos << "TE mode " << mTEMode << llendl;
- S32 i = 0;
-
- LLViewerObject *objectp;
- for (objectp = mSelectedObjects->getFirstObject();
- objectp;
- objectp = mSelectedObjects->getNextObject())
+ S32 count = 0;
+ for (LLObjectSelection::iterator iter = getSelection()->begin();
+ iter != getSelection()->end(); iter++ )
{
- llinfos << "Object " << i << " type " << LLPrimitive::pCodeToString(objectp->getPCode()) << llendl;
+ LLViewerObject* objectp = (*iter)->getObject();
+ llinfos << "Object " << count << " type " << LLPrimitive::pCodeToString(objectp->getPCode()) << llendl;
llinfos << " hasLSL " << objectp->flagScripted() << llendl;
llinfos << " hasTouch " << objectp->flagHandleTouch() << llendl;
llinfos << " hasMoney " << objectp->flagTakesMoney() << llendl;
@@ -1320,16 +1300,22 @@ void LLSelectMgr::dump()
LLDrawable* drawablep = objectp->mDrawable;
llinfos << " " << (drawablep&& drawablep->isVisible() ? "visible" : "invisible") << llendl;
llinfos << " " << (drawablep&& drawablep->isState(LLDrawable::FORCE_INVISIBLE) ? "force_invisible" : "") << llendl;
- i++;
+ count++;
}
// Face iterator
- S32 te;
- for (mSelectedObjects->getFirstTE(&objectp, &te);
- objectp;
- mSelectedObjects->getNextTE(&objectp, &te))
+ for (LLObjectSelection::iterator iter = getSelection()->begin();
+ iter != getSelection()->end(); iter++ )
{
- llinfos << "Object " << objectp << " te " << te << llendl;
+ LLSelectNode* node = *iter;
+ LLViewerObject* objectp = node->getObject();
+ for (S32 te = 0; te < objectp->getNumTEs(); ++te )
+ {
+ if (node->isTESelected(te))
+ {
+ llinfos << "Object " << objectp << " te " << te << llendl;
+ }
+ }
}
llinfos << mHighlightedObjects->getNumNodes() << " objects currently highlighted." << llendl;
@@ -1350,6 +1336,18 @@ void LLSelectMgr::cleanup()
// Manipulate properties of selected objects
//---------------------------------------------------------------------------
+struct LLSelectMgrSendFunctor : public LLSelectedObjectFunctor
+{
+ virtual bool apply(LLViewerObject* object)
+ {
+ if (object->permModify())
+ {
+ object->sendTEUpdate();
+ }
+ return true;
+ }
+};
+
//-----------------------------------------------------------------------------
// selectionSetImage()
//-----------------------------------------------------------------------------
@@ -1358,7 +1356,6 @@ void LLSelectMgr::selectionSetImage(const LLUUID& imageid)
{
// First for (no copy) textures and multiple object selection
LLViewerInventoryItem* item = gInventory.getItem(imageid);
-
if(item
&& !item->getPermissions().allowOperationBy(PERM_COPY, gAgent.getID())
&& (mSelectedObjects->getNumNodes() > 1) )
@@ -1368,54 +1365,63 @@ void LLSelectMgr::selectionSetImage(const LLUUID& imageid)
return;
}
- LLViewerObject* objectp;
- S32 te;
-
- for (mSelectedObjects->getFirstTE(&objectp, &te); objectp; mSelectedObjects->getNextTE(&objectp, &te))
+ struct f : public LLSelectedTEFunctor
{
- if (item)
+ LLViewerInventoryItem* mItem;
+ LLUUID mImageID;
+ f(LLViewerInventoryItem* item, const LLUUID& id) : mItem(item), mImageID(id) {}
+ bool apply(LLViewerObject* objectp, S32 te)
{
- if (te == -1) // all faces
+ if (mItem)
{
- LLToolDragAndDrop::dropTextureAllFaces(objectp,
- item,
- LLToolDragAndDrop::SOURCE_AGENT,
- LLUUID::null);
+ if (te == -1) // all faces
+ {
+ LLToolDragAndDrop::dropTextureAllFaces(objectp,
+ mItem,
+ LLToolDragAndDrop::SOURCE_AGENT,
+ LLUUID::null);
+ }
+ else // one face
+ {
+ LLToolDragAndDrop::dropTextureOneFace(objectp,
+ te,
+ mItem,
+ LLToolDragAndDrop::SOURCE_AGENT,
+ LLUUID::null);
+ }
}
- else // one face
+ else // not an inventory item
{
- LLToolDragAndDrop::dropTextureOneFace(objectp,
- te,
- item,
- LLToolDragAndDrop::SOURCE_AGENT,
- LLUUID::null);
+ // Texture picker defaults aren't inventory items
+ // * Don't need to worry about permissions for them
+ // * Can just apply the texture and be done with it.
+ objectp->setTEImage(te, gImageList.getImage(mImageID, TRUE, FALSE));
}
+ return true;
}
-
- else // not an inventory item
- {
- // Texture picker defaults aren't inventory items
- // * Don't need to worry about permissions for them
- // * Can just apply the texture and be done with it.
- objectp->setTEImage(te, gImageList.getImage(imageid));
+ } setfunc(item, imageid);
+ getSelection()->applyToTEs(&setfunc);
- objectp->sendTEUpdate();
- }
- }
-
-
- // 1 particle effect per object
- if (mSelectedObjects->mSelectType != SELECT_TYPE_HUD)
+ struct g : public LLSelectedObjectFunctor
{
- for (objectp = mSelectedObjects->getFirstObject(); objectp; objectp = mSelectedObjects->getNextObject())
+ LLViewerInventoryItem* mItem;
+ g(LLViewerInventoryItem* item) : mItem(item) {}
+ virtual bool apply(LLViewerObject* object)
{
- LLHUDEffectSpiral *effectp = (LLHUDEffectSpiral *)gHUDManager->createViewerEffect(LLHUDObject::LL_HUD_EFFECT_BEAM, TRUE);
- effectp->setSourceObject(gAgent.getAvatarObject());
- effectp->setTargetObject(objectp);
- effectp->setDuration(LL_HUD_DUR_SHORT);
- effectp->setColor(LLColor4U(gAgent.getEffectColor()));
+ if (!mItem)
+ {
+ object->sendTEUpdate();
+ // 1 particle effect per object
+ LLHUDEffectSpiral *effectp = (LLHUDEffectSpiral *)gHUDManager->createViewerEffect(LLHUDObject::LL_HUD_EFFECT_BEAM, TRUE);
+ effectp->setSourceObject(gAgent.getAvatarObject());
+ effectp->setTargetObject(object);
+ effectp->setDuration(LL_HUD_DUR_SHORT);
+ effectp->setColor(LLColor4U(gAgent.getEffectColor()));
+ }
+ return true;
}
- }
+ } sendfunc(item);
+ getSelection()->applyToObjects(&sendfunc);
}
//-----------------------------------------------------------------------------
@@ -1423,24 +1429,23 @@ void LLSelectMgr::selectionSetImage(const LLUUID& imageid)
//-----------------------------------------------------------------------------
void LLSelectMgr::selectionSetColor(const LLColor4 &color)
{
- LLViewerObject* object;
- S32 te;
- for (mSelectedObjects->getFirstTE(&object, &te); object; mSelectedObjects->getNextTE(&object, &te) )
- {
- if (object->permModify())
- {
- // update viewer side color in anticipation of update from simulator
- object->setTEColor(te, color);
- }
- }
-
- for ( object = mSelectedObjects->getFirstObject(); object; object = mSelectedObjects->getNextObject() )
+ struct f : public LLSelectedTEFunctor
{
- if (object->permModify())
+ LLColor4 mColor;
+ f(const LLColor4& c) : mColor(c) {}
+ bool apply(LLViewerObject* object, S32 te)
{
- object->sendTEUpdate();
+ if (object->permModify())
+ {
+ object->setTEColor(te, mColor);
+ }
+ return true;
}
- }
+ } setfunc(color);
+ getSelection()->applyToTEs(&setfunc);
+
+ LLSelectMgrSendFunctor sendfunc;
+ getSelection()->applyToObjects(&sendfunc);
}
//-----------------------------------------------------------------------------
@@ -1448,27 +1453,26 @@ void LLSelectMgr::selectionSetColor(const LLColor4 &color)
//-----------------------------------------------------------------------------
void LLSelectMgr::selectionSetColorOnly(const LLColor4 &color)
{
- LLViewerObject* object;
- LLColor4 new_color = color;
- S32 te;
- for (mSelectedObjects->getFirstTE(&object, &te); object; mSelectedObjects->getNextTE(&object, &te) )
+ struct f : public LLSelectedTEFunctor
{
- if (object->permModify())
+ LLColor4 mColor;
+ f(const LLColor4& c) : mColor(c) {}
+ bool apply(LLViewerObject* object, S32 te)
{
- LLColor4 prev_color = object->getTE(te)->getColor();
- new_color.mV[VALPHA] = prev_color.mV[VALPHA];
- // update viewer side color in anticipation of update from simulator
- object->setTEColor(te, new_color);
- }
- }
-
- for ( object = mSelectedObjects->getFirstObject(); object; object = mSelectedObjects->getNextObject() )
- {
- if (object->permModify())
- {
- object->sendTEUpdate();
+ if (object->permModify())
+ {
+ LLColor4 prev_color = object->getTE(te)->getColor();
+ mColor.mV[VALPHA] = prev_color.mV[VALPHA];
+ // update viewer side color in anticipation of update from simulator
+ object->setTEColor(te, mColor);
+ }
+ return true;
}
- }
+ } setfunc(color);
+ getSelection()->applyToTEs(&setfunc);
+
+ LLSelectMgrSendFunctor sendfunc;
+ getSelection()->applyToObjects(&sendfunc);
}
//-----------------------------------------------------------------------------
@@ -1476,227 +1480,246 @@ void LLSelectMgr::selectionSetColorOnly(const LLColor4 &color)
//-----------------------------------------------------------------------------
void LLSelectMgr::selectionSetAlphaOnly(const F32 alpha)
{
- LLViewerObject* object;
- S32 te;
- for (mSelectedObjects->getFirstTE(&object, &te); object; mSelectedObjects->getNextTE(&object, &te) )
+ struct f : public LLSelectedTEFunctor
{
- if (object->permModify())
- {
- LLColor4 prev_color = object->getTE(te)->getColor();
- prev_color.mV[VALPHA] = alpha;
- // update viewer side color in anticipation of update from simulator
- object->setTEColor(te, prev_color);
- }
- }
-
- for ( object = mSelectedObjects->getFirstObject(); object; object = mSelectedObjects->getNextObject() )
- {
- if (object->permModify())
+ F32 mAlpha;
+ f(const F32& a) : mAlpha(a) {}
+ bool apply(LLViewerObject* object, S32 te)
{
- object->sendTEUpdate();
+ if (object->permModify())
+ {
+ LLColor4 prev_color = object->getTE(te)->getColor();
+ prev_color.mV[VALPHA] = mAlpha;
+ // update viewer side color in anticipation of update from simulator
+ object->setTEColor(te, prev_color);
+ }
+ return true;
}
- }
+ } setfunc(alpha);
+ getSelection()->applyToTEs(&setfunc);
+
+ LLSelectMgrSendFunctor sendfunc;
+ getSelection()->applyToObjects(&sendfunc);
}
void LLSelectMgr::selectionRevertColors()
{
- LLViewerObject* object;
- S32 te;
-
- for (mSelectedObjects->getFirstTE(&object, &te); object; mSelectedObjects->getNextTE(&object, &te) )
+ struct f : public LLSelectedTEFunctor
{
- if (object->permModify())
+ LLObjectSelectionHandle mSelectedObjects;
+ f(LLObjectSelectionHandle sel) : mSelectedObjects(sel) {}
+ bool apply(LLViewerObject* object, S32 te)
{
- LLSelectNode* nodep = mSelectedObjects->findNode(object);
- if (nodep && te < (S32)nodep->mSavedColors.size())
+ if (object->permModify())
{
- LLColor4 color = nodep->mSavedColors[te];
- // update viewer side color in anticipation of update from simulator
- object->setTEColor(te, color);
+ LLSelectNode* nodep = mSelectedObjects->findNode(object);
+ if (nodep && te < (S32)nodep->mSavedColors.size())
+ {
+ LLColor4 color = nodep->mSavedColors[te];
+ // update viewer side color in anticipation of update from simulator
+ object->setTEColor(te, color);
+ }
}
+ return true;
}
- }
-
- for ( object = mSelectedObjects->getFirstObject(); object; object = mSelectedObjects->getNextObject() )
- {
- if (object->permModify())
- {
- object->sendTEUpdate();
- }
- }
+ } setfunc(mSelectedObjects);
+ getSelection()->applyToTEs(&setfunc);
+
+ LLSelectMgrSendFunctor sendfunc;
+ getSelection()->applyToObjects(&sendfunc);
}
BOOL LLSelectMgr::selectionRevertTextures()
{
- LLViewerObject* object;
- S32 te;
-
- BOOL revert_successful = TRUE;
- for (mSelectedObjects->getFirstTE(&object, &te); object; mSelectedObjects->getNextTE(&object, &te) )
+ struct f : public LLSelectedTEFunctor
{
- if (object->permModify())
+ LLObjectSelectionHandle mSelectedObjects;
+ f(LLObjectSelectionHandle sel) : mSelectedObjects(sel) {}
+ bool apply(LLViewerObject* object, S32 te)
{
- LLSelectNode* nodep = mSelectedObjects->findNode(object);
- if (nodep && te < (S32)nodep->mSavedTextures.size())
+ if (object->permModify())
{
- LLUUID id = nodep->mSavedTextures[te];
- // update textures on viewer side
- if (id.isNull())
+ LLSelectNode* nodep = mSelectedObjects->findNode(object);
+ if (nodep && te < (S32)nodep->mSavedTextures.size())
{
- // this was probably a no-copy texture, leave image as-is
- revert_successful = FALSE;
- }
- else
- {
- object->setTEImage(te, gImageList.getImage(id));
+ LLUUID id = nodep->mSavedTextures[te];
+ // update textures on viewer side
+ if (id.isNull())
+ {
+ // this was probably a no-copy texture, leave image as-is
+ return FALSE;
+ }
+ else
+ {
+ object->setTEImage(te, gImageList.getImage(id));
+ }
}
}
+ return true;
}
- }
-
- // propagate texture changes to server
- for ( object = mSelectedObjects->getFirstObject(); object; object = mSelectedObjects->getNextObject() )
- {
- if (object->permModify())
- {
- object->sendTEUpdate();
- }
- }
+ } setfunc(mSelectedObjects);
+ BOOL revert_successful = getSelection()->applyToTEs(&setfunc);
+
+ LLSelectMgrSendFunctor sendfunc;
+ getSelection()->applyToObjects(&sendfunc);
return revert_successful;
}
void LLSelectMgr::selectionSetBumpmap(U8 bumpmap)
{
- LLViewerObject* object;
- S32 te;
- for (mSelectedObjects->getFirstTE(&object, &te); object; mSelectedObjects->getNextTE(&object, &te) )
+ struct f : public LLSelectedTEFunctor
{
- if (object->permModify())
+ U8 mBump;
+ f(const U8& b) : mBump(b) {}
+ bool apply(LLViewerObject* object, S32 te)
{
- // update viewer side color in anticipation of update from simulator
- object->setTEBumpmap(te, bumpmap);
- }
- }
-
- for ( object = mSelectedObjects->getFirstObject(); object; object = mSelectedObjects->getNextObject() )
- {
- if (object->permModify())
- {
- object->sendTEUpdate();
+ if (object->permModify())
+ {
+ // update viewer side color in anticipation of update from simulator
+ object->setTEBumpmap(te, mBump);
+ }
+ return true;
}
- }
+ } setfunc(bumpmap);
+ getSelection()->applyToTEs(&setfunc);
+
+ LLSelectMgrSendFunctor sendfunc;
+ getSelection()->applyToObjects(&sendfunc);
}
void LLSelectMgr::selectionSetTexGen(U8 texgen)
{
- LLViewerObject* object;
- S32 te;
- for (mSelectedObjects->getFirstTE(&object, &te); object; mSelectedObjects->getNextTE(&object, &te) )
+ struct f : public LLSelectedTEFunctor
{
- if (object->permModify())
+ U8 mTexgen;
+ f(const U8& t) : mTexgen(t) {}
+ bool apply(LLViewerObject* object, S32 te)
{
- // update viewer side color in anticipation of update from simulator
- object->setTETexGen(te, texgen);
+ if (object->permModify())
+ {
+ // update viewer side color in anticipation of update from simulator
+ object->setTETexGen(te, mTexgen);
+ }
+ return true;
}
- }
+ } setfunc(texgen);
+ getSelection()->applyToTEs(&setfunc);
- for ( object = mSelectedObjects->getFirstObject(); object; object = mSelectedObjects->getNextObject() )
- {
- if (object->permModify())
- {
- object->sendTEUpdate();
- }
- }
+ LLSelectMgrSendFunctor sendfunc;
+ getSelection()->applyToObjects(&sendfunc);
}
void LLSelectMgr::selectionSetShiny(U8 shiny)
{
- LLViewerObject* object;
- S32 te;
- for (mSelectedObjects->getFirstTE(&object, &te); object; mSelectedObjects->getNextTE(&object, &te) )
+ struct f : public LLSelectedTEFunctor
{
- if (object->permModify())
+ U8 mShiny;
+ f(const U8& t) : mShiny(t) {}
+ bool apply(LLViewerObject* object, S32 te)
{
- // update viewer side color in anticipation of update from simulator
- object->setTEShiny(te, shiny);
+ if (object->permModify())
+ {
+ // update viewer side color in anticipation of update from simulator
+ object->setTEShiny(te, mShiny);
+ }
+ return true;
}
- }
+ } setfunc(shiny);
+ getSelection()->applyToTEs(&setfunc);
- for ( object = mSelectedObjects->getFirstObject(); object; object = mSelectedObjects->getNextObject() )
- {
- if (object->permModify())
- {
- object->sendTEUpdate();
- }
- }
+ LLSelectMgrSendFunctor sendfunc;
+ getSelection()->applyToObjects(&sendfunc);
}
void LLSelectMgr::selectionSetFullbright(U8 fullbright)
{
- LLViewerObject* object;
- S32 te;
- for (mSelectedObjects->getFirstTE(&object, &te); object; mSelectedObjects->getNextTE(&object, &te) )
+ struct f : public LLSelectedTEFunctor
{
- if (object->permModify())
+ U8 mFullbright;
+ f(const U8& t) : mFullbright(t) {}
+ bool apply(LLViewerObject* object, S32 te)
{
- // update viewer side color in anticipation of update from simulator
- object->setTEFullbright(te, fullbright);
+ if (object->permModify())
+ {
+ // update viewer side color in anticipation of update from simulator
+ object->setTEFullbright(te, mFullbright);
+ }
+ return true;
}
- }
+ } setfunc(fullbright);
+ getSelection()->applyToTEs(&setfunc);
- for ( object = mSelectedObjects->getFirstObject(); object; object = mSelectedObjects->getNextObject() )
+ struct g : public LLSelectedObjectFunctor
{
- if (object->permModify())
+ U8 mFullbright;
+ g(const U8& t) : mFullbright(t) {}
+ virtual bool apply(LLViewerObject* object)
{
- object->sendTEUpdate();
- if (fullbright)
+ if (object->permModify())
{
- U8 material = object->getMaterial();
- U8 mcode = material & LL_MCODE_MASK;
- if (mcode == LL_MCODE_LIGHT)
+ object->sendTEUpdate();
+ if (mFullbright)
{
- mcode = LL_MCODE_GLASS;
- material = (material & ~LL_MCODE_MASK) | mcode;
- object->setMaterial(material);
- object->sendMaterialUpdate();
+ U8 material = object->getMaterial();
+ U8 mcode = material & LL_MCODE_MASK;
+ if (mcode == LL_MCODE_LIGHT)
+ {
+ mcode = LL_MCODE_GLASS;
+ material = (material & ~LL_MCODE_MASK) | mcode;
+ object->setMaterial(material);
+ object->sendMaterialUpdate();
+ }
}
}
+ return true;
}
- }
+ } sendfunc(fullbright);
+ getSelection()->applyToObjects(&sendfunc);
}
void LLSelectMgr::selectionSetMediaTypeAndURL(U8 media_type, const std::string& media_url)
{
- LLViewerObject* object;
- S32 te;
U8 media_flags = LLTextureEntry::MF_NONE;
if (media_type == LLViewerObject::MEDIA_TYPE_WEB_PAGE)
{
media_flags = LLTextureEntry::MF_WEB_PAGE;
}
-
- for (mSelectedObjects->getFirstTE(&object, &te); object; mSelectedObjects->getNextTE(&object, &te) )
+
+ struct f : public LLSelectedTEFunctor
{
- if (object->permModify())
+ U8 mMediaFlags;
+ f(const U8& t) : mMediaFlags(t) {}
+ bool apply(LLViewerObject* object, S32 te)
{
- // update viewer side color in anticipation of update from simulator
- object->setTEMediaFlags(te, media_flags);
+ if (object->permModify())
+ {
+ // update viewer side color in anticipation of update from simulator
+ object->setTEMediaFlags(te, mMediaFlags);
+ }
+ return true;
}
- }
+ } setfunc(media_flags);
+ getSelection()->applyToTEs(&setfunc);
- for ( object = mSelectedObjects->getFirstObject(); object; object = mSelectedObjects->getNextObject() )
+ struct g : public LLSelectedObjectFunctor
{
- if (object->permModify())
+ U8 media_type;
+ const std::string& media_url ;
+ g(U8 a, const std::string& b) : media_type(a), media_url(b) {}
+ virtual bool apply(LLViewerObject* object)
{
- // JAMESDEBUG TODO set object media type
- object->setMediaType(media_type);
- object->setMediaURL(media_url);
-
- object->sendTEUpdate();
+ if (object->permModify())
+ {
+ object->sendTEUpdate();
+ object->setMediaType(media_type);
+ object->setMediaURL(media_url);
+ }
+ return true;
}
- }
+ } sendfunc(media_type, media_url);
+ getSelection()->applyToObjects(&sendfunc);
}
@@ -1706,11 +1729,11 @@ void LLSelectMgr::selectionSetMediaTypeAndURL(U8 media_type, const std::string&
//-----------------------------------------------------------------------------
LLPermissions* LLSelectMgr::findObjectPermissions(const LLViewerObject* object)
{
- LLSelectNode* nodep;
-
- for (nodep = mSelectedObjects->getFirstNode(); nodep; nodep = mSelectedObjects->getNextNode() )
+ for (LLObjectSelection::valid_iterator iter = getSelection()->valid_begin();
+ iter != getSelection()->valid_end(); iter++ )
{
- if((nodep->getObject() == object) && nodep->mValid)
+ LLSelectNode* nodep = *iter;
+ if (nodep->getObject() == object)
{
return nodep->mPermissions;
}
@@ -1721,306 +1744,49 @@ LLPermissions* LLSelectMgr::findObjectPermissions(const LLViewerObject* object)
//-----------------------------------------------------------------------------
-// selectionGetTexUUID()
-//-----------------------------------------------------------------------------
-BOOL LLSelectMgr::selectionGetTexUUID(LLUUID& id)
-{
- LLViewerObject* first_objectp;
- S32 first_te;
- mSelectedObjects->getPrimaryTE(&first_objectp, &first_te);
-
- // nothing selected
- if (!first_objectp)
- {
- return FALSE;
- }
-
- LLViewerImage* first_imagep = first_objectp->getTEImage(first_te);
-
- if (!first_imagep)
- {
- return FALSE;
- }
-
- BOOL identical = TRUE;
- LLViewerObject *objectp;
- S32 te;
- for (mSelectedObjects->getFirstTE(&objectp, &te); objectp; mSelectedObjects->getNextTE(&objectp, &te) )
- {
- if (objectp->getTEImage(te) != first_imagep)
- {
- identical = FALSE;
- break;
- }
- }
-
- id = first_imagep->getID();
- return identical;
-}
-
-//-----------------------------------------------------------------------------
-// selectionGetColor()
-//-----------------------------------------------------------------------------
-BOOL LLSelectMgr::selectionGetColor(LLColor4 &color)
-{
- LLViewerObject* first_object;
- S32 first_te;
- mSelectedObjects->getPrimaryTE(&first_object, &first_te);
-
- // nothing selected
- if (!first_object)
- {
- return FALSE;
- }
-
- LLColor4 first_color;
- if (!first_object->getTE(first_te))
- {
- return FALSE;
- }
- else
- {
- first_color = first_object->getTE(first_te)->getColor();
- }
-
- BOOL identical = TRUE;
- LLViewerObject* object;
- S32 te;
- for (mSelectedObjects->getFirstTE(&object, &te); object; mSelectedObjects->getNextTE(&object, &te))
- {
- if (!object->getTE(te) || (object->getTE(te)->getColor() != first_color))
- {
- identical = FALSE;
- break;
- }
- }
-
- color = first_color;
- return identical;
-}
-
-
-//-----------------------------------------------------------------------------
-// selectionGetBumpmap()
-//-----------------------------------------------------------------------------
-BOOL LLSelectMgr::selectionGetBumpmap(U8 *bumpmap)
-{
- LLViewerObject* first_object;
- S32 first_te;
- mSelectedObjects->getPrimaryTE(&first_object, &first_te);
-
- // nothing selected
- if (!first_object)
- {
- return FALSE;
- }
-
- U8 first_value;
- if (!first_object->getTE(first_te))
- {
- return FALSE;
- }
- else
- {
- first_value = first_object->getTE(first_te)->getBumpmap();
- }
-
- BOOL identical = TRUE;
- LLViewerObject* object;
- S32 te;
- for (mSelectedObjects->getFirstTE(&object, &te); object; mSelectedObjects->getNextTE(&object, &te))
- {
- if (!object->getTE(te) || (object->getTE(te)->getBumpmap() != first_value))
- {
- identical = FALSE;
- break;
- }
- }
-
- *bumpmap = first_value;
- return identical;
-}
-
-//-----------------------------------------------------------------------------
-// selectionGetShiny()
-//-----------------------------------------------------------------------------
-BOOL LLSelectMgr::selectionGetShiny(U8 *shiny)
-{
- LLViewerObject* first_object;
- S32 first_te;
- mSelectedObjects->getPrimaryTE(&first_object, &first_te);
-
- // nothing selected
- if (!first_object)
- {
- return FALSE;
- }
-
- U8 first_value;
- if (!first_object->getTE(first_te))
- {
- return FALSE;
- }
- else
- {
- first_value = first_object->getTE(first_te)->getShiny();
- }
-
- BOOL identical = TRUE;
- LLViewerObject* object;
- S32 te;
- for (mSelectedObjects->getFirstTE(&object, &te); object; mSelectedObjects->getNextTE(&object, &te))
- {
- if (!object->getTE(te) || (object->getTE(te)->getShiny() != first_value))
- {
- identical = FALSE;
- break;
- }
- }
-
- *shiny = first_value;
- return identical;
-}
-
-//-----------------------------------------------------------------------------
-// selectionGetFullbright()
-//-----------------------------------------------------------------------------
-BOOL LLSelectMgr::selectionGetFullbright(U8 *fullbright)
-{
- LLViewerObject* first_object;
- S32 first_te;
- mSelectedObjects->getPrimaryTE(&first_object, &first_te);
-
- // nothing selected
- if (!first_object)
- {
- return FALSE;
- }
-
- U8 first_value;
- if (!first_object->getTE(first_te))
- {
- return FALSE;
- }
- else
- {
- first_value = first_object->getTE(first_te)->getFullbright();
- }
-
- BOOL identical = TRUE;
- LLViewerObject* object;
- S32 te;
- for (mSelectedObjects->getFirstTE(&object, &te); object; mSelectedObjects->getNextTE(&object, &te))
- {
- if (!object->getTE(te) || (object->getTE(te)->getFullbright() != first_value))
- {
- identical = FALSE;
- break;
- }
- }
-
- *fullbright = first_value;
- return identical;
-}
-
-// JAMESDEBUG TODO make this return mediatype off viewer object
-bool LLSelectMgr::selectionGetMediaType(U8 *media_type)
-{
- LLViewerObject* first_object;
- S32 first_te;
- mSelectedObjects->getPrimaryTE(&first_object, &first_te);
-
- // nothing selected
- if (!first_object)
- {
- return false;
- }
-
- U8 first_value;
- if (!first_object->getTE(first_te))
- {
- return false;
- }
- else
- {
- first_value = first_object->getTE(first_te)->getMediaFlags();
- }
-
- bool identical = true;
- LLViewerObject* object;
- S32 te;
- for (mSelectedObjects->getFirstTE(&object, &te); object; mSelectedObjects->getNextTE(&object, &te))
- {
- if (!object->getTE(te) || (object->getTE(te)->getMediaFlags() != first_value))
- {
- identical = false;
- break;
- }
- }
-
- *media_type = first_value;
- return identical;
-}
-
-
-
-//-----------------------------------------------------------------------------
// selectionSetMaterial()
//-----------------------------------------------------------------------------
void LLSelectMgr::selectionSetMaterial(U8 material)
{
- LLViewerObject* object;
- for (object = mSelectedObjects->getFirstObject(); object != NULL; object = mSelectedObjects->getNextObject() )
+ struct f : public LLSelectedObjectFunctor
{
- if (object->permModify())
+ U8 mMaterial;
+ f(const U8& t) : mMaterial(t) {}
+ virtual bool apply(LLViewerObject* object)
{
- U8 cur_material = object->getMaterial();
- material |= (cur_material & ~LL_MCODE_MASK);
- object->setMaterial(material);
- object->sendMaterialUpdate();
+ if (object->permModify())
+ {
+ U8 cur_material = object->getMaterial();
+ U8 material = mMaterial | (cur_material & ~LL_MCODE_MASK);
+ object->setMaterial(material);
+ object->sendMaterialUpdate();
+ }
+ return true;
}
- }
+ } sendfunc(material);
+ getSelection()->applyToObjects(&sendfunc);
}
-// True if all selected objects have this PCode
+// TRUE if all selected objects have this PCode
BOOL LLSelectMgr::selectionAllPCode(LLPCode code)
{
- LLViewerObject *object;
- for ( object = mSelectedObjects->getFirstObject(); object; object = mSelectedObjects->getNextObject() )
- {
- if (object->getPCode() != code)
- {
- return FALSE;
- }
- }
- return TRUE;
-}
-
-//-----------------------------------------------------------------------------
-// selectionGetMaterial()
-//-----------------------------------------------------------------------------
-BOOL LLSelectMgr::selectionGetMaterial(U8 *out_material)
-{
- LLViewerObject *object = mSelectedObjects->getFirstObject();
- if (!object) return FALSE;
-
- U8 material = object->getMaterial();
-
- BOOL identical = TRUE;
- for ( object = mSelectedObjects->getFirstObject(); object; object = mSelectedObjects->getNextObject() )
+ struct f : public LLSelectedObjectFunctor
{
- if ( material != object->getMaterial())
+ LLPCode mCode;
+ f(const LLPCode& t) : mCode(t) {}
+ virtual bool apply(LLViewerObject* object)
{
- identical = FALSE;
- break;
+ if (object->getPCode() != mCode)
+ {
+ return FALSE;
+ }
+ return true;
}
- }
-
- *out_material = material;
- return identical;
+ } func(code);
+ BOOL res = getSelection()->applyToObjects(&func);
+ return res;
}
-
bool LLSelectMgr::selectionGetIncludeInSearch(bool* include_in_search_out)
{
LLViewerObject *object = mSelectedObjects->getFirstRootObject();
@@ -2029,8 +1795,12 @@ bool LLSelectMgr::selectionGetIncludeInSearch(bool* include_in_search_out)
bool include_in_search = object->getIncludeInSearch();
bool identical = true;
- for ( object = mSelectedObjects->getFirstRootObject(); object; object = mSelectedObjects->getNextRootObject() )
+
+ for (LLObjectSelection::root_iterator iter = getSelection()->root_begin();
+ iter != getSelection()->root_end(); iter++)
{
+ LLViewerObject* object = (*iter)->getObject();
+
if ( include_in_search != object->getIncludeInSearch())
{
identical = false;
@@ -2045,8 +1815,10 @@ bool LLSelectMgr::selectionGetIncludeInSearch(bool* include_in_search_out)
void LLSelectMgr::selectionSetIncludeInSearch(bool include_in_search)
{
LLViewerObject* object = NULL;
- for ( object = mSelectedObjects->getFirstRootObject(); object; object = mSelectedObjects->getNextRootObject() )
+ for (LLObjectSelection::root_iterator iter = getSelection()->root_begin();
+ iter != getSelection()->root_end(); iter++)
{
+ object = (*iter)->getObject();
object->setIncludeInSearch(include_in_search);
}
sendListToRegions(
@@ -2060,37 +1832,50 @@ void LLSelectMgr::selectionSetIncludeInSearch(bool include_in_search)
BOOL LLSelectMgr::selectionGetClickAction(U8 *out_action)
{
LLViewerObject *object = mSelectedObjects->getFirstObject();
- if (!object) return FALSE;
-
+ if (!object)
+ {
+ return FALSE;
+ }
+
U8 action = object->getClickAction();
+ *out_action = action;
- BOOL identical = TRUE;
- for ( object = mSelectedObjects->getFirstObject(); object; object = mSelectedObjects->getNextObject() )
+ struct f : public LLSelectedObjectFunctor
{
- if ( action != object->getClickAction())
+ U8 mAction;
+ f(const U8& t) : mAction(t) {}
+ virtual bool apply(LLViewerObject* object)
{
- identical = FALSE;
- break;
+ if ( mAction != object->getClickAction())
+ {
+ return false;
+ }
+ return true;
}
- }
-
- *out_action = action;
- return identical;
+ } func(action);
+ BOOL res = getSelection()->applyToObjects(&func);
+ return res;
}
void LLSelectMgr::selectionSetClickAction(U8 action)
{
- LLViewerObject* object = NULL;
- for ( object = mSelectedObjects->getFirstObject(); object; object = mSelectedObjects->getNextObject() )
+ struct f : public LLSelectedObjectFunctor
{
- object->setClickAction(action);
- }
- sendListToRegions(
- "ObjectClickAction",
- packAgentAndSessionID,
- packObjectClickAction,
- &action,
- SEND_INDIVIDUALS);
+ U8 mAction;
+ f(const U8& t) : mAction(t) {}
+ virtual bool apply(LLViewerObject* object)
+ {
+ object->setClickAction(mAction);
+ return true;
+ }
+ } func(action);
+ getSelection()->applyToObjects(&func);
+
+ sendListToRegions("ObjectClickAction",
+ packAgentAndSessionID,
+ packObjectClickAction,
+ &action,
+ SEND_INDIVIDUALS);
}
@@ -2165,34 +1950,42 @@ void LLSelectMgr::packObjectIDAsParam(LLSelectNode* node, void *)
//-----------------------------------------------------------------------------
void LLSelectMgr::selectionResetRotation()
{
- LLQuaternion identity(0.f, 0.f, 0.f, 1.f);
-
- LLViewerObject* object;
- for (object = mSelectedObjects->getFirstRootObject(); object; object = mSelectedObjects->getNextRootObject() )
+ struct f : public LLSelectedObjectFunctor
{
- object->setRotation(identity);
- if (object->mDrawable.notNull())
+ virtual bool apply(LLViewerObject* object)
{
- gPipeline.markMoved(object->mDrawable, TRUE);
+ LLQuaternion identity(0.f, 0.f, 0.f, 1.f);
+ object->setRotation(identity);
+ if (object->mDrawable.notNull())
+ {
+ gPipeline.markMoved(object->mDrawable, TRUE);
+ }
+ object->sendRotationUpdate();
+ return true;
}
- object->sendRotationUpdate();
- }
+ } func;
+ getSelection()->applyToRootObjects(&func);
}
void LLSelectMgr::selectionRotateAroundZ(F32 degrees)
{
LLQuaternion rot( degrees * DEG_TO_RAD, LLVector3(0,0,1) );
-
- LLViewerObject* object;
- for (object = mSelectedObjects->getFirstRootObject(); object; object = mSelectedObjects->getNextRootObject() )
+ struct f : public LLSelectedObjectFunctor
{
- object->setRotation( object->getRotationEdit() * rot );
- if (object->mDrawable.notNull())
+ LLQuaternion mRot;
+ f(const LLQuaternion& rot) : mRot(rot) {}
+ virtual bool apply(LLViewerObject* object)
{
- gPipeline.markMoved(object->mDrawable, TRUE);
+ object->setRotation( object->getRotationEdit() * mRot );
+ if (object->mDrawable.notNull())
+ {
+ gPipeline.markMoved(object->mDrawable, TRUE);
+ }
+ object->sendRotationUpdate();
+ return true;
}
- object->sendRotationUpdate();
- }
+ } func(rot);
+ getSelection()->applyToRootObjects(&func);
}
@@ -2201,86 +1994,37 @@ void LLSelectMgr::selectionRotateAroundZ(F32 degrees)
//-----------------------------------------------------------------------------
void LLSelectMgr::selectionTexScaleAutofit(F32 repeats_per_meter)
{
- LLViewerObject* object;
- S32 te;
- for (mSelectedObjects->getFirstTE(&object, &te); object; mSelectedObjects->getNextTE(&object, &te))
+ struct f : public LLSelectedTEFunctor
{
- if (!object->permModify())
+ F32 mRepeatsPerMeter;
+ f(const F32& t) : mRepeatsPerMeter(t) {}
+ bool apply(LLViewerObject* object, S32 te)
{
- continue;
- }
+
+ if (object->permModify())
+ {
+ // Compute S,T to axis mapping
+ U32 s_axis, t_axis;
+ if (!LLPrimitive::getTESTAxes(te, &s_axis, &t_axis))
+ {
+ return TRUE;
+ }
- if (object->getNumTEs() == 0)
- {
- continue;
- }
+ F32 new_s = object->getScale().mV[s_axis] * mRepeatsPerMeter;
+ F32 new_t = object->getScale().mV[t_axis] * mRepeatsPerMeter;
- // Compute S,T to axis mapping
- U32 s_axis, t_axis;
- if (!getTESTAxes(object, te, &s_axis, &t_axis))
- {
- continue;
+ object->setTEScale(te, new_s, new_t);
+ }
+ return true;
}
+ } setfunc(repeats_per_meter);
+ getSelection()->applyToTEs(&setfunc);
- F32 new_s = object->getScale().mV[s_axis] * repeats_per_meter;
- F32 new_t = object->getScale().mV[t_axis] * repeats_per_meter;
-
- object->setTEScale(te, new_s, new_t);
- }
-
- for (object = mSelectedObjects->getFirstObject(); object; object = mSelectedObjects->getNextObject())
- {
- if (object->permModify())
- {
- object->sendTEUpdate();
- }
- }
+ LLSelectMgrSendFunctor sendfunc;
+ getSelection()->applyToObjects(&sendfunc);
}
-// BUG: Only works for boxes.
-// Face numbering for flex boxes as of 1.14.2002
-//-----------------------------------------------------------------------------
-// getFaceSTAxes()
-//-----------------------------------------------------------------------------
-BOOL LLSelectMgr::getTESTAxes(const LLViewerObject* object, const U8 face, U32* s_axis, U32* t_axis)
-{
- if (face == 0)
- {
- *s_axis = VX; *t_axis = VY;
- return TRUE;
- }
- else if (face == 1)
- {
- *s_axis = VX; *t_axis = VZ;
- return TRUE;
- }
- else if (face == 2)
- {
- *s_axis = VY; *t_axis = VZ;
- return TRUE;
- }
- else if (face == 3)
- {
- *s_axis = VX; *t_axis = VZ;
- return TRUE;
- }
- else if (face == 4)
- {
- *s_axis = VY; *t_axis = VZ;
- return TRUE;
- }
- else if (face == 5)
- {
- *s_axis = VX; *t_axis = VY;
- return TRUE;
- }
- else
- {
- // unknown face
- return FALSE;
- }
-}
// Called at the end of a scale operation, this adjusts the textures to attempt to
// maintain a constant repeats per meter.
@@ -2290,14 +2034,12 @@ BOOL LLSelectMgr::getTESTAxes(const LLViewerObject* object, const U8 face, U32*
//-----------------------------------------------------------------------------
void LLSelectMgr::adjustTexturesByScale(BOOL send_to_sim, BOOL stretch)
{
- LLViewerObject* object;
- LLSelectNode* selectNode;
-
- BOOL send = FALSE;
-
- for (selectNode = mSelectedObjects->getFirstNode(); selectNode; selectNode = mSelectedObjects->getNextNode())
+ for (LLObjectSelection::iterator iter = getSelection()->begin();
+ iter != getSelection()->end(); iter++)
{
- object = selectNode->getObject();
+ LLSelectNode* selectNode = *iter;
+ LLViewerObject* object = selectNode->getObject();
+
if (!object->permModify())
{
continue;
@@ -2308,6 +2050,8 @@ void LLSelectMgr::adjustTexturesByScale(BOOL send_to_sim, BOOL stretch)
continue;
}
+ BOOL send = FALSE;
+
for (U8 te_num = 0; te_num < object->getNumTEs(); te_num++)
{
const LLTextureEntry* tep = object->getTE(te_num);
@@ -2317,8 +2061,11 @@ void LLSelectMgr::adjustTexturesByScale(BOOL send_to_sim, BOOL stretch)
{
// Figure out how S,T changed with scale operation
U32 s_axis, t_axis;
- if (!getTESTAxes(object, te_num, &s_axis, &t_axis)) continue;
-
+ if (!LLPrimitive::getTESTAxes(te_num, &s_axis, &t_axis))
+ {
+ continue;
+ }
+
LLVector3 scale_ratio = selectNode->mTextureScaleRatios[te_num];
LLVector3 object_scale = object->getScale();
@@ -2341,70 +2088,23 @@ void LLSelectMgr::adjustTexturesByScale(BOOL send_to_sim, BOOL stretch)
{
object->sendTEUpdate();
}
- }
-}
-
-
-//-----------------------------------------------------------------------------
-// selectionResetTexInfo()
-//-----------------------------------------------------------------------------
-void LLSelectMgr::selectionResetTexInfo(S32 selected_face)
-{
- S32 start_face, end_face;
-
- LLViewerObject* object;
- for (object = mSelectedObjects->getFirstObject(); object; object = mSelectedObjects->getNextObject())
- {
- if (!object->permModify())
- {
- continue;
- }
- if (object->getNumTEs() == 0)
- {
- continue;
- }
-
- if (selected_face == -1)
- {
- start_face = 0;
- end_face = object->getNumTEs() - 1;
- }
- else
- {
- start_face = selected_face;
- end_face = selected_face;
- }
-
- for (S32 face = start_face; face <= end_face; face++)
- {
- // Actually, each object should reset to its appropriate value.
- object->setTEScale(face, 1.f, 1.f);
- object->setTEOffset(face, 0.f, 0.f);
- object->setTERotation(face, 0.f);
- }
-
- object->sendTEUpdate();
- }
+ }
}
//-----------------------------------------------------------------------------
// selectGetAllRootsValid()
-// Returns true if the viewer has information on all selected objects
+// Returns TRUE if the viewer has information on all selected objects
//-----------------------------------------------------------------------------
BOOL LLSelectMgr::selectGetAllRootsValid()
{
- for( LLSelectNode* node = mSelectedObjects->getFirstRootNode(); node; node = mSelectedObjects->getNextRootNode() )
+ for (LLObjectSelection::root_iterator iter = getSelection()->root_begin();
+ iter != getSelection()->root_end(); ++iter )
{
-
+ LLSelectNode* node = *iter;
if( !node->mValid )
{
return FALSE;
}
-
- if( !node->getObject() )
- {
- return FALSE;
- }
}
return TRUE;
}
@@ -2412,63 +2112,62 @@ BOOL LLSelectMgr::selectGetAllRootsValid()
//-----------------------------------------------------------------------------
// selectGetAllValid()
-// Returns true if the viewer has information on all selected objects
+// Returns TRUE if the viewer has information on all selected objects
//-----------------------------------------------------------------------------
BOOL LLSelectMgr::selectGetAllValid()
{
- for( LLSelectNode* node = mSelectedObjects->getFirstNode(); node; node = mSelectedObjects->getNextNode() )
+ for (LLObjectSelection::iterator iter = getSelection()->begin();
+ iter != getSelection()->end(); ++iter )
{
-
+ LLSelectNode* node = *iter;
if( !node->mValid )
{
return FALSE;
}
-
- if( !node->getObject() )
- {
- return FALSE;
- }
}
return TRUE;
}
//-----------------------------------------------------------------------------
-// selectGetModify() - return true if current agent can modify all
+// selectGetModify() - return TRUE if current agent can modify all
// selected objects.
//-----------------------------------------------------------------------------
BOOL LLSelectMgr::selectGetModify()
{
- for( LLSelectNode* node = mSelectedObjects->getFirstNode(); node; node = mSelectedObjects->getNextNode() )
+ for (LLObjectSelection::iterator iter = getSelection()->begin();
+ iter != getSelection()->end(); iter++ )
{
+ LLSelectNode* node = *iter;
+ LLViewerObject* object = node->getObject();
if( !node->mValid )
{
return FALSE;
}
- LLViewerObject* object = node->getObject();
- if( !object || !object->permModify() )
+ if( !object->permModify() )
{
return FALSE;
}
}
-
return TRUE;
}
//-----------------------------------------------------------------------------
-// selectGetRootsModify() - return true if current agent can modify all
+// selectGetRootsModify() - return TRUE if current agent can modify all
// selected root objects.
//-----------------------------------------------------------------------------
BOOL LLSelectMgr::selectGetRootsModify()
{
- for( LLSelectNode* node = mSelectedObjects->getFirstRootNode(); node; node = mSelectedObjects->getNextRootNode() )
+ for (LLObjectSelection::root_iterator iter = getSelection()->root_begin();
+ iter != getSelection()->root_end(); iter++ )
{
+ LLSelectNode* node = *iter;
+ LLViewerObject* object = node->getObject();
if( !node->mValid )
{
return FALSE;
}
- LLViewerObject* object = node->getObject();
- if( !object || !object->permModify() )
+ if( !object->permModify() )
{
return FALSE;
}
@@ -2479,19 +2178,21 @@ BOOL LLSelectMgr::selectGetRootsModify()
//-----------------------------------------------------------------------------
-// selectGetRootsTransfer() - return true if current agent can transfer all
+// selectGetRootsTransfer() - return TRUE if current agent can transfer all
// selected root objects.
//-----------------------------------------------------------------------------
BOOL LLSelectMgr::selectGetRootsTransfer()
{
- for(LLSelectNode* node = mSelectedObjects->getFirstRootNode(); node; node = mSelectedObjects->getNextRootNode())
+ for (LLObjectSelection::root_iterator iter = getSelection()->root_begin();
+ iter != getSelection()->root_end(); iter++ )
{
- if(!node->mValid)
+ LLSelectNode* node = *iter;
+ LLViewerObject* object = node->getObject();
+ if( !node->mValid )
{
return FALSE;
}
- LLViewerObject* object = node->getObject();
- if(!object || !object->permTransfer())
+ if(!object->permTransfer())
{
return FALSE;
}
@@ -2500,19 +2201,21 @@ BOOL LLSelectMgr::selectGetRootsTransfer()
}
//-----------------------------------------------------------------------------
-// selectGetRootsCopy() - return true if current agent can copy all
+// selectGetRootsCopy() - return TRUE if current agent can copy all
// selected root objects.
//-----------------------------------------------------------------------------
BOOL LLSelectMgr::selectGetRootsCopy()
{
- for(LLSelectNode* node = mSelectedObjects->getFirstRootNode(); node; node = mSelectedObjects->getNextRootNode())
+ for (LLObjectSelection::root_iterator iter = getSelection()->root_begin();
+ iter != getSelection()->root_end(); iter++ )
{
- if(!node->mValid)
+ LLSelectNode* node = *iter;
+ LLViewerObject* object = node->getObject();
+ if( !node->mValid )
{
return FALSE;
}
- LLViewerObject* object = node->getObject();
- if(!object || !object->permCopy())
+ if(!object->permCopy())
{
return FALSE;
}
@@ -2524,39 +2227,42 @@ BOOL LLSelectMgr::selectGetRootsCopy()
// selectGetCreator()
// Creator information only applies to root objects.
//-----------------------------------------------------------------------------
-BOOL LLSelectMgr::selectGetCreator(LLUUID& id, LLString& name)
+BOOL LLSelectMgr::selectGetCreator(LLUUID& result_id, LLString& name)
{
- LLSelectNode* node = mSelectedObjects->getFirstRootNode();
- if(!node) node = mSelectedObjects->getFirstNode();
- if(!node) return FALSE;
- if(!node->mValid) return FALSE;
- LLViewerObject* obj = node->getObject();
- if(!obj) return FALSE;
- if(!(obj->isRoot() || obj->isJointChild())) return FALSE;
-
- id = node->mPermissions->getCreator();
-
BOOL identical = TRUE;
- for ( node = mSelectedObjects->getNextRootNode(); node; node = mSelectedObjects->getNextRootNode() )
+ BOOL first = TRUE;
+ LLUUID first_id;
+ for (LLObjectSelection::root_iterator iter = getSelection()->root_begin();
+ iter != getSelection()->root_end(); iter++ )
{
+ LLSelectNode* node = *iter;
if (!node->mValid)
{
- identical = FALSE;
- break;
+ return FALSE;
}
- if ( !(id == node->mPermissions->getCreator() ) )
+ if (first)
{
- identical = FALSE;
- break;
+ first_id = node->mPermissions->getCreator();
+ first = FALSE;
+ }
+ else
+ {
+ if ( !(first_id == node->mPermissions->getCreator() ) )
+ {
+ identical = FALSE;
+ break;
+ }
}
}
+ result_id = first_id;
+
if (identical)
{
char firstname[DB_FIRST_NAME_BUF_SIZE]; /* Flawfinder: ignore */
char lastname[DB_LAST_NAME_BUF_SIZE]; /* Flawfinder: ignore */
- gCacheName->getName(id, firstname, lastname);
+ gCacheName->getName(first_id, firstname, lastname);
name.assign( firstname );
name.append( " " );
name.append( lastname );
@@ -2574,44 +2280,45 @@ BOOL LLSelectMgr::selectGetCreator(LLUUID& id, LLString& name)
// selectGetOwner()
// Owner information only applies to roots.
//-----------------------------------------------------------------------------
-BOOL LLSelectMgr::selectGetOwner(LLUUID& id, LLString& name)
+BOOL LLSelectMgr::selectGetOwner(LLUUID& result_id, LLString& name)
{
- LLSelectNode* node = mSelectedObjects->getFirstRootNode();
- if(!node) node = mSelectedObjects->getFirstNode();
- if(!node) return FALSE;
- if(!node->mValid) return FALSE;
- LLViewerObject* obj = node->getObject();
- if(!obj) return FALSE;
- if(!(obj->isRootEdit() || obj->isRoot() || obj->isJointChild())) return FALSE;
-
- BOOL group_owner = FALSE;
- id.setNull();
- node->mPermissions->getOwnership(id, group_owner);
-
BOOL identical = TRUE;
- for ( node = mSelectedObjects->getNextRootNode(); node; node = mSelectedObjects->getNextRootNode() )
+ BOOL first = TRUE;
+ BOOL first_group_owned = FALSE;
+ LLUUID first_id;
+ for (LLObjectSelection::root_iterator iter = getSelection()->root_begin();
+ iter != getSelection()->root_end(); iter++ )
{
+ LLSelectNode* node = *iter;
if (!node->mValid)
{
- identical = FALSE;
- break;
+ return FALSE;
}
-
- LLUUID owner_id;
- BOOL is_group_owned = FALSE;
- if (!(node->mPermissions->getOwnership(owner_id, is_group_owned))
- || owner_id != id )
+
+ if (first)
{
- identical = FALSE;
- break;
+ node->mPermissions->getOwnership(first_id, first_group_owned);
+ first = FALSE;
+ }
+ else
+ {
+ LLUUID owner_id;
+ BOOL is_group_owned = FALSE;
+ if (!(node->mPermissions->getOwnership(owner_id, is_group_owned))
+ || owner_id != first_id || is_group_owned != first_group_owned)
+ {
+ identical = FALSE;
+ break;
+ }
}
}
- BOOL public_owner = (id.isNull() && !group_owner);
-
+ result_id = first_id;
+
if (identical)
{
- if (group_owner)
+ BOOL public_owner = (first_id.isNull() && !first_group_owned);
+ if (first_group_owned)
{
name.assign( "(Group Owned)");
}
@@ -2619,7 +2326,7 @@ BOOL LLSelectMgr::selectGetOwner(LLUUID& id, LLString& name)
{
char firstname[DB_FIRST_NAME_BUF_SIZE]; /* Flawfinder: ignore */
char lastname[DB_LAST_NAME_BUF_SIZE]; /* Flawfinder: ignore */
- gCacheName->getName(id, firstname, lastname);
+ gCacheName->getName(first_id, firstname, lastname);
name.assign( firstname );
name.append( " " );
name.append( lastname );
@@ -2642,43 +2349,45 @@ BOOL LLSelectMgr::selectGetOwner(LLUUID& id, LLString& name)
// selectGetLastOwner()
// Owner information only applies to roots.
//-----------------------------------------------------------------------------
-BOOL LLSelectMgr::selectGetLastOwner(LLUUID& id, LLString& name)
+BOOL LLSelectMgr::selectGetLastOwner(LLUUID& result_id, LLString& name)
{
- LLSelectNode* node = mSelectedObjects->getFirstRootNode();
- if(!node) node = mSelectedObjects->getFirstNode();
- if(!node) return FALSE;
- if(!node->mValid) return FALSE;
- LLViewerObject* obj = node->getObject();
- if(!obj) return FALSE;
- if(!(obj->isRoot() || obj->isJointChild())) return FALSE;
-
- id = node->mPermissions->getLastOwner();
-
BOOL identical = TRUE;
- for ( node = mSelectedObjects->getNextRootNode(); node; node = mSelectedObjects->getNextRootNode() )
+ BOOL first = TRUE;
+ LLUUID first_id;
+ for (LLObjectSelection::root_iterator iter = getSelection()->root_begin();
+ iter != getSelection()->root_end(); iter++ )
{
+ LLSelectNode* node = *iter;
if (!node->mValid)
{
- identical = FALSE;
- break;
+ return FALSE;
}
- if ( !(id == node->mPermissions->getLastOwner() ) )
+ if (first)
{
- identical = FALSE;
- break;
+ first_id = node->mPermissions->getLastOwner();
+ first = FALSE;
+ }
+ else
+ {
+ if ( !(first_id == node->mPermissions->getLastOwner() ) )
+ {
+ identical = FALSE;
+ break;
+ }
}
}
- BOOL public_owner = (id.isNull());
-
+ result_id = first_id;
+
if (identical)
{
+ BOOL public_owner = (first_id.isNull());
if(!public_owner)
{
char firstname[DB_FIRST_NAME_BUF_SIZE]; /* Flawfinder: ignore */
char lastname[DB_LAST_NAME_BUF_SIZE]; /* Flawfinder: ignore */
- gCacheName->getName(id, firstname, lastname);
+ gCacheName->getName(first_id, firstname, lastname);
name.assign( firstname );
name.append( " " );
name.append( lastname );
@@ -2701,33 +2410,36 @@ BOOL LLSelectMgr::selectGetLastOwner(LLUUID& id, LLString& name)
// selectGetGroup()
// Group information only applies to roots.
//-----------------------------------------------------------------------------
-BOOL LLSelectMgr::selectGetGroup(LLUUID& id)
+BOOL LLSelectMgr::selectGetGroup(LLUUID& result_id)
{
- LLSelectNode* node = mSelectedObjects->getFirstRootNode();
- if(!node) node = mSelectedObjects->getFirstNode();
- if(!node) return FALSE;
- if(!node->mValid) return FALSE;
- LLViewerObject* obj = node->getObject();
- if(!obj) return FALSE;
- if(!(obj->isRoot() || obj->isJointChild())) return FALSE;
-
- id = node->mPermissions->getGroup();
-
BOOL identical = TRUE;
- for ( node = mSelectedObjects->getNextRootNode(); node; node = mSelectedObjects->getNextRootNode() )
+ BOOL first = TRUE;
+ LLUUID first_id;
+ for (LLObjectSelection::root_iterator iter = getSelection()->root_begin();
+ iter != getSelection()->root_end(); iter++ )
{
+ LLSelectNode* node = *iter;
if (!node->mValid)
{
- identical = FALSE;
- break;
+ return FALSE;
}
- if ( !(id == node->mPermissions->getGroup() ) )
+ if (first)
{
- identical = FALSE;
- break;
+ first_id = node->mPermissions->getGroup();
+ first = FALSE;
+ }
+ else
+ {
+ if ( !(first_id == node->mPermissions->getGroup() ) )
+ {
+ identical = FALSE;
+ break;
+ }
}
}
+
+ result_id = first_id;
return identical;
}
@@ -2739,64 +2451,53 @@ BOOL LLSelectMgr::selectGetGroup(LLUUID& id)
//-----------------------------------------------------------------------------
BOOL LLSelectMgr::selectIsGroupOwned()
{
- LLSelectNode* node = mSelectedObjects->getFirstRootNode();
- if(!node) node = mSelectedObjects->getFirstNode();
- if(!node) return FALSE;
- if(!node->mValid) return FALSE;
- LLViewerObject* obj = node->getObject();
- if(!obj) return FALSE;
- if(!(obj->isRoot() || obj->isJointChild())) return FALSE;
-
- BOOL is_group_owned = node->mPermissions->isGroupOwned();
-
- if(is_group_owned)
+ BOOL found_one = FALSE;
+ for (LLObjectSelection::root_iterator iter = getSelection()->root_begin();
+ iter != getSelection()->root_end(); iter++ )
{
- for ( node = mSelectedObjects->getNextRootNode(); node; node = mSelectedObjects->getNextRootNode() )
+ LLSelectNode* node = *iter;
+ if (!node->mValid)
{
- if (!node->mValid)
- {
- is_group_owned = FALSE;
- break;
- }
-
- if ( !( node->mPermissions->isGroupOwned() ) )
- {
- is_group_owned = FALSE;
- break;
- }
+ return FALSE;
}
- }
- return is_group_owned;
+ found_one = TRUE;
+ if (!node->mPermissions->isGroupOwned())
+ {
+ return FALSE;
+ }
+ }
+ return found_one ? TRUE : FALSE;
}
//-----------------------------------------------------------------------------
// selectGetPerm()
// Only operates on root nodes.
// Returns TRUE if all have valid data.
-// mask_on has bits set to true where all permissions are true
-// mask_off has bits set to true where all permissions are false
+// mask_on has bits set to TRUE where all permissions are TRUE
+// mask_off has bits set to TRUE where all permissions are FALSE
// if a bit is off both in mask_on and mask_off, the values differ within
// the selection.
//-----------------------------------------------------------------------------
BOOL LLSelectMgr::selectGetPerm(U8 which_perm, U32* mask_on, U32* mask_off)
{
- LLSelectNode* node = mSelectedObjects->getFirstRootNode();
- if (!node) return FALSE;
- if (!node->mValid) return FALSE;
-
U32 mask;
U32 mask_and = 0xffffffff;
U32 mask_or = 0x00000000;
- BOOL all_valid = TRUE;
+ BOOL all_valid = FALSE;
- for ( node = mSelectedObjects->getFirstRootNode(); node; node = mSelectedObjects->getNextRootNode() )
+ for (LLObjectSelection::root_iterator iter = getSelection()->root_begin();
+ iter != getSelection()->root_end(); iter++)
{
+ LLSelectNode* node = *iter;
+
if (!node->mValid)
{
all_valid = FALSE;
break;
}
+ all_valid = TRUE;
+
switch( which_perm )
{
case PERM_BASE:
@@ -2824,10 +2525,10 @@ BOOL LLSelectMgr::selectGetPerm(U8 which_perm, U32* mask_on, U32* mask_off)
if (all_valid)
{
- // ...true through all ANDs means all true
+ // ...TRUE through all ANDs means all TRUE
*mask_on = mask_and;
- // ...false through all ORs means all false
+ // ...FALSE through all ORs means all FALSE
*mask_off = ~mask_or;
return TRUE;
}
@@ -2846,23 +2547,33 @@ BOOL LLSelectMgr::selectGetOwnershipCost(S32* out_cost)
return mSelectedObjects->getOwnershipCost(*out_cost);
}
-BOOL LLSelectMgr::selectGetPermissions(LLPermissions& perm)
+BOOL LLSelectMgr::selectGetPermissions(LLPermissions& result_perm)
{
- LLSelectNode* node = mSelectedObjects->getFirstRootNode();
- if (!node) return FALSE;
- if (!node->mValid) return FALSE;
- BOOL valid = TRUE;
- perm = *(node->mPermissions);
- for(node = mSelectedObjects->getNextRootNode(); node != NULL; node = mSelectedObjects->getNextRootNode())
+ BOOL first = TRUE;
+ LLPermissions perm;
+ for (LLObjectSelection::root_iterator iter = getSelection()->root_begin();
+ iter != getSelection()->root_end(); iter++ )
{
- if(!node->mValid)
+ LLSelectNode* node = *iter;
+ if (!node->mValid)
{
- valid = FALSE;
- break;
+ return FALSE;
+ }
+
+ if (first)
+ {
+ perm = *(node->mPermissions);
+ first = FALSE;
+ }
+ else
+ {
+ perm.accumulate(*(node->mPermissions));
}
- perm.accumulate(*(node->mPermissions));
}
- return valid;
+
+ result_perm = perm;
+
+ return TRUE;
}
@@ -2873,10 +2584,12 @@ void LLSelectMgr::selectDelete()
BOOL locked_but_deleteable_object = FALSE;
BOOL no_copy_but_deleteable_object = FALSE;
BOOL all_owned_by_you = TRUE;
- for(LLViewerObject* obj = mSelectedObjects->getFirstObject();
- obj != NULL;
- obj = mSelectedObjects->getNextObject())
+
+ for (LLObjectSelection::iterator iter = getSelection()->begin();
+ iter != getSelection()->end(); iter++)
{
+ LLViewerObject* obj = (*iter)->getObject();
+
if( obj->isAttachment() )
{
continue;
@@ -2998,10 +2711,10 @@ void LLSelectMgr::confirmDelete(S32 option, void* data)
// attempt to derez into the trash.
LLDeRezInfo* info = new LLDeRezInfo(DRD_TRASH, trash_id);
gSelectMgr->sendListToRegions("DeRezObject",
- packDeRezHeader,
- packObjectLocalID,
- (void*)info,
- SEND_ONLY_ROOTS);
+ packDeRezHeader,
+ packObjectLocalID,
+ (void*)info,
+ SEND_ONLY_ROOTS);
// VEFFECT: Delete Object - one effect for all deletes
if (gSelectMgr->mSelectedObjects->mSelectType != SELECT_TYPE_HUD)
{
@@ -3046,9 +2759,10 @@ BOOL LLSelectMgr::selectIsForSale(S32& price)
BOOL any_for_sale = FALSE;
price = 0;
- LLSelectNode *node;
- for (node = mSelectedObjects->getFirstRootNode(); node; node = mSelectedObjects->getNextRootNode() )
+ for (LLObjectSelection::root_iterator iter = getSelection()->root_begin();
+ iter != getSelection()->root_end(); iter++)
{
+ LLSelectNode* node = *iter;
if (node->mSaleInfo.isForSale())
{
price += node->mSaleInfo.getSalePrice();
@@ -3062,61 +2776,92 @@ BOOL LLSelectMgr::selectIsForSale(S32& price)
// returns TRUE if all nodes are valid. method also stores an
// accumulated sale info.
-BOOL LLSelectMgr::selectGetSaleInfo(LLSaleInfo& sale_info)
+BOOL LLSelectMgr::selectGetSaleInfo(LLSaleInfo& result_sale_info)
{
- LLSelectNode* node = mSelectedObjects->getFirstRootNode();
- if (!node) return FALSE;
- if (!node->mValid) return FALSE;
- BOOL valid = TRUE;
- sale_info = node->mSaleInfo;
- for(node = mSelectedObjects->getNextRootNode(); node != NULL; node = mSelectedObjects->getNextRootNode())
+ BOOL first = TRUE;
+ LLSaleInfo sale_info;
+ for (LLObjectSelection::root_iterator iter = getSelection()->root_begin();
+ iter != getSelection()->root_end(); iter++ )
{
- if(!node->mValid)
+ LLSelectNode* node = *iter;
+ if (!node->mValid)
{
- valid = FALSE;
- break;
+ return FALSE;
+ }
+
+ if (first)
+ {
+ sale_info = node->mSaleInfo;
+ first = FALSE;
+ }
+ else
+ {
+ sale_info.accumulate(node->mSaleInfo);
}
- sale_info.accumulate(node->mSaleInfo);
}
- return valid;
+
+ result_sale_info = sale_info;
+
+ return TRUE;
}
-BOOL LLSelectMgr::selectGetAggregatePermissions(LLAggregatePermissions& ag_perm)
+BOOL LLSelectMgr::selectGetAggregatePermissions(LLAggregatePermissions& result_perm)
{
- LLSelectNode* node = mSelectedObjects->getFirstNode();
- if (!node) return FALSE;
- if (!node->mValid) return FALSE;
- BOOL valid = TRUE;
- ag_perm = node->mAggregatePerm;
- for(node = mSelectedObjects->getNextNode(); node != NULL; node = mSelectedObjects->getNextNode())
+ BOOL first = TRUE;
+ LLAggregatePermissions perm;
+ for (LLObjectSelection::root_iterator iter = getSelection()->root_begin();
+ iter != getSelection()->root_end(); iter++ )
{
- if(!node->mValid)
+ LLSelectNode* node = *iter;
+ if (!node->mValid)
{
- valid = FALSE;
- break;
+ return FALSE;
+ }
+
+ if (first)
+ {
+ perm = node->mAggregatePerm;
+ first = FALSE;
+ }
+ else
+ {
+ perm.aggregate(node->mAggregatePerm);
}
- ag_perm.aggregate(node->mAggregatePerm);
}
- return valid;
+
+ result_perm = perm;
+
+ return TRUE;
}
-BOOL LLSelectMgr::selectGetAggregateTexturePermissions(LLAggregatePermissions& ag_perm)
+BOOL LLSelectMgr::selectGetAggregateTexturePermissions(LLAggregatePermissions& result_perm)
{
- LLSelectNode* node = mSelectedObjects->getFirstNode();
- if (!node) return FALSE;
- if (!node->mValid) return FALSE;
- BOOL valid = TRUE;
- ag_perm = node->getObject()->permYouOwner() ? node->mAggregateTexturePermOwner : node->mAggregateTexturePerm;
- for(node = mSelectedObjects->getNextNode(); node != NULL; node = mSelectedObjects->getNextNode())
+ BOOL first = TRUE;
+ LLAggregatePermissions perm;
+ for (LLObjectSelection::root_iterator iter = getSelection()->root_begin();
+ iter != getSelection()->root_end(); iter++ )
{
- if(!node->mValid)
+ LLSelectNode* node = *iter;
+ if (!node->mValid)
{
- valid = FALSE;
- break;
+ return FALSE;
+ }
+
+ LLAggregatePermissions t_perm = node->getObject()->permYouOwner() ? node->mAggregateTexturePermOwner : node->mAggregateTexturePerm;
+ if (first)
+ {
+ perm = t_perm;
+ first = FALSE;
+ }
+ else
+ {
+ perm.aggregate(t_perm);
}
- ag_perm.aggregate(node->getObject()->permYouOwner() ? node->mAggregateTexturePermOwner : node->mAggregateTexturePerm);
}
- return valid;
+
+ result_perm = perm;
+
+ return TRUE;
}
@@ -3155,8 +2900,10 @@ void LLSelectMgr::selectDuplicate(const LLVector3& offset, BOOL select_copy)
}
else
{
- for (LLSelectNode* node = mSelectedObjects->getFirstRootNode(); node; node = mSelectedObjects->getNextRootNode())
+ for (LLObjectSelection::root_iterator iter = getSelection()->root_begin();
+ iter != getSelection()->root_end(); iter++ )
{
+ LLSelectNode* node = *iter;
node->mDuplicated = TRUE;
node->mDuplicatePos = node->getObject()->getPositionGlobal();
node->mDuplicateRot = node->getObject()->getRotation();
@@ -3173,21 +2920,24 @@ void LLSelectMgr::repeatDuplicate()
return;
}
- LLSelectNode* node;
- LLDynamicArray<LLViewerObject*> non_duplicated_objects;
+ std::vector<LLViewerObject*> non_duplicated_objects;
- for (node = mSelectedObjects->getFirstRootNode(); node; node = mSelectedObjects->getNextRootNode())
+ for (LLObjectSelection::root_iterator iter = getSelection()->root_begin();
+ iter != getSelection()->root_end(); iter++ )
{
+ LLSelectNode* node = *iter;
if (!node->mDuplicated)
{
- non_duplicated_objects.put(node->getObject());
+ non_duplicated_objects.push_back(node->getObject());
}
}
// make sure only previously duplicated objects are selected
- for (S32 i = 0; i < non_duplicated_objects.count(); i++)
+ for (std::vector<LLViewerObject*>::iterator iter = non_duplicated_objects.begin();
+ iter != non_duplicated_objects.end(); ++iter)
{
- deselectObjectAndFamily(non_duplicated_objects[i]);
+ LLViewerObject* objectp = *iter;
+ deselectObjectAndFamily(objectp);
}
// duplicate objects in place
@@ -3199,8 +2949,10 @@ void LLSelectMgr::repeatDuplicate()
sendListToRegions("ObjectDuplicate", packDuplicateHeader, packDuplicate, &data, SEND_ONLY_ROOTS);
// move current selection based on delta from duplication position and update duplication position
- for (node = mSelectedObjects->getFirstRootNode(); node; node = mSelectedObjects->getNextRootNode())
+ for (LLObjectSelection::root_iterator iter = getSelection()->root_begin();
+ iter != getSelection()->root_end(); iter++ )
{
+ LLSelectNode* node = *iter;
if (node->mDuplicated)
{
LLQuaternion cur_rot = node->getObject()->getRotation();
@@ -3420,7 +3172,7 @@ void LLSelectMgr::sendGroup(const LLUUID& group_id)
struct LLBuyData
{
- LLDynamicArray<LLViewerObject*> mObjectsSent;
+ std::vector<LLViewerObject*> mObjectsSent;
LLUUID mCategoryID;
LLSaleInfo mSaleInfo;
};
@@ -3443,9 +3195,9 @@ void LLSelectMgr::packBuyObjectIDs(LLSelectNode* node, void* data)
LLBuyData* buy = (LLBuyData*)data;
LLViewerObject* object = node->getObject();
- if(buy->mObjectsSent.find(object) == LLDynamicArray<LLViewerObject*>::FAIL)
+ if (std::find(buy->mObjectsSent.begin(), buy->mObjectsSent.end(), object) == buy->mObjectsSent.end())
{
- buy->mObjectsSent.put(object);
+ buy->mObjectsSent.push_back(object);
gMessageSystem->nextBlockFast(_PREHASH_ObjectData);
gMessageSystem->addU32Fast(_PREHASH_ObjectLocalID, node->getObject()->getLocalID() );
gMessageSystem->addU8Fast(_PREHASH_SaleType, buy->mSaleInfo.getSaleType());
@@ -3534,7 +3286,6 @@ void LLSelectMgr::deselectUnused()
void LLSelectMgr::convertTransient()
{
- // use STL-style iteration to avoid recursive iteration problems
LLObjectSelection::iterator node_it;
for (node_it = mSelectedObjects->begin(); node_it != mSelectedObjects->end(); ++node_it)
{
@@ -3812,32 +3563,42 @@ void LLSelectMgr::packHingeHead(void *user_data)
void LLSelectMgr::selectionDump()
{
- LLViewerObject *object;
-
- for (object = mSelectedObjects->getFirstObject(); object; object = mSelectedObjects->getNextObject() )
+ struct f : public LLSelectedObjectFunctor
{
- object->dump();
- }
+ virtual bool apply(LLViewerObject* object)
+ {
+ object->dump();
+ return true;
+ }
+ } func;
+ getSelection()->applyToObjects(&func);
}
void LLSelectMgr::saveSelectedObjectColors()
{
- LLSelectNode* selectNode;
- for (selectNode = mSelectedObjects->getFirstNode(); selectNode; selectNode = mSelectedObjects->getNextNode() )
+ struct f : public LLSelectedNodeFunctor
{
- selectNode->saveColors();
- }
+ virtual bool apply(LLSelectNode* node)
+ {
+ node->saveColors();
+ return true;
+ }
+ } func;
+ getSelection()->applyToNodes(&func);
}
void LLSelectMgr::saveSelectedObjectTextures()
{
- LLSelectNode* selectNode;
-
// invalidate current selection so we update saved textures
- for (selectNode = mSelectedObjects->getFirstNode(); selectNode; selectNode = mSelectedObjects->getNextNode() )
+ struct f : public LLSelectedNodeFunctor
{
- selectNode->mValid = FALSE;
- }
+ virtual bool apply(LLSelectNode* node)
+ {
+ node->mValid = FALSE;
+ return true;
+ }
+ } func;
+ getSelection()->applyToNodes(&func);
// request object properties message to get updated permissions data
sendSelect();
@@ -3848,113 +3609,95 @@ void LLSelectMgr::saveSelectedObjectTextures()
// also need to know to which simulator to send update message
void LLSelectMgr::saveSelectedObjectTransform(EActionType action_type)
{
- LLSelectNode* selectNode;
-
if (mSelectedObjects->isEmpty())
{
// nothing selected, so nothing to save
return;
}
- for (selectNode = mSelectedObjects->getFirstNode(); selectNode; selectNode = mSelectedObjects->getNextNode() )
+ struct f : public LLSelectedNodeFunctor
{
- LLViewerObject* object;
- object = selectNode->getObject();
- selectNode->mSavedPositionLocal = object->getPosition();
- if (object->isAttachment())
+ EActionType mActionType;
+ f(EActionType a) : mActionType(a) {}
+ virtual bool apply(LLSelectNode* selectNode)
{
- if (object->isRootEdit())
+ LLViewerObject* object = selectNode->getObject();
+ selectNode->mSavedPositionLocal = object->getPosition();
+ if (object->isAttachment())
{
- LLXform* parent_xform = object->mDrawable->getXform()->getParent();
- if (parent_xform)
+ if (object->isRootEdit())
+ {
+ LLXform* parent_xform = object->mDrawable->getXform()->getParent();
+ if (parent_xform)
+ {
+ selectNode->mSavedPositionGlobal = gAgent.getPosGlobalFromAgent((object->getPosition() * parent_xform->getWorldRotation()) + parent_xform->getWorldPosition());
+ }
+ }
+ else
{
- selectNode->mSavedPositionGlobal = gAgent.getPosGlobalFromAgent((object->getPosition() * parent_xform->getWorldRotation()) + parent_xform->getWorldPosition());
+ LLViewerObject* attachment_root = (LLViewerObject*)object->getParent();
+ LLXform* parent_xform = attachment_root->mDrawable->getXform()->getParent();
+ LLVector3 root_pos = (attachment_root->getPosition() * parent_xform->getWorldRotation()) + parent_xform->getWorldPosition();
+ LLQuaternion root_rot = (attachment_root->getRotation() * parent_xform->getWorldRotation());
+ selectNode->mSavedPositionGlobal = gAgent.getPosGlobalFromAgent((object->getPosition() * root_rot) + root_pos);
}
+ selectNode->mSavedRotation = object->getRenderRotation();
}
else
{
- LLViewerObject* attachment_root = (LLViewerObject*)object->getParent();
- LLXform* parent_xform = attachment_root->mDrawable->getXform()->getParent();
- LLVector3 root_pos = (attachment_root->getPosition() * parent_xform->getWorldRotation()) + parent_xform->getWorldPosition();
- LLQuaternion root_rot = (attachment_root->getRotation() * parent_xform->getWorldRotation());
- selectNode->mSavedPositionGlobal = gAgent.getPosGlobalFromAgent((object->getPosition() * root_rot) + root_pos);
+ selectNode->mSavedPositionGlobal = object->getPositionGlobal();
+ selectNode->mSavedRotation = object->getRotationRegion();
}
- selectNode->mSavedRotation = object->getRenderRotation();
- }
- else
- {
- selectNode->mSavedPositionGlobal = object->getPositionGlobal();
- selectNode->mSavedRotation = object->getRotationRegion();
- }
- selectNode->mSavedScale = object->getScale();
- selectNode->saveTextureScaleRatios();
-
- }
+ selectNode->mSavedScale = object->getScale();
+ selectNode->saveTextureScaleRatios();
+ return true;
+ }
+ } func(action_type);
+ getSelection()->applyToNodes(&func);
+
mSavedSelectionBBox = getBBoxOfSelection();
}
-void LLSelectMgr::selectionUpdatePhysics(BOOL physics)
+struct LLSelectMgrApplyFlags : public LLSelectedObjectFunctor
{
- LLViewerObject *object;
-
- for (object = mSelectedObjects->getFirstObject(); object; object = mSelectedObjects->getNextObject() )
+ LLSelectMgrApplyFlags(U32 flags, BOOL state) : mFlags(flags), mState(state) {}
+ U32 mFlags;
+ BOOL mState;
+ virtual bool apply(LLViewerObject* object)
{
- if ( !object->permModify() // preemptive permissions check
- || !(object->isRoot() // don't send for child objects
- || object->isJointChild()))
+ if ( object->permModify() && // preemptive permissions check
+ object->isRoot() && // don't send for child objects
+ !object->isJointChild())
{
- continue;
+ object->setFlags( mFlags, mState);
}
- object->setFlags( FLAGS_USE_PHYSICS, physics);
+ return true;
}
+};
+
+void LLSelectMgr::selectionUpdatePhysics(BOOL physics)
+{
+ LLSelectMgrApplyFlags func( FLAGS_USE_PHYSICS, physics);
+ getSelection()->applyToObjects(&func);
}
void LLSelectMgr::selectionUpdateTemporary(BOOL is_temporary)
{
- LLViewerObject *object;
-
- for (object = mSelectedObjects->getFirstObject(); object; object = mSelectedObjects->getNextObject() )
- {
- if ( !object->permModify() // preemptive permissions check
- || !(object->isRoot() // don't send for child objects
- || object->isJointChild()))
- {
- continue;
- }
- object->setFlags( FLAGS_TEMPORARY_ON_REZ, is_temporary);
- }
+ LLSelectMgrApplyFlags func( FLAGS_TEMPORARY_ON_REZ, is_temporary);
+ getSelection()->applyToObjects(&func);
}
void LLSelectMgr::selectionUpdatePhantom(BOOL is_phantom)
{
- LLViewerObject *object;
-
- for (object = mSelectedObjects->getFirstObject(); object; object = mSelectedObjects->getNextObject() )
- {
- if ( !object->permModify() // preemptive permissions check
- || !(object->isRoot() // don't send for child objects
- || object->isJointChild()))
- {
- continue;
- }
- object->setFlags( FLAGS_PHANTOM, is_phantom);
- }
+ LLSelectMgrApplyFlags func( FLAGS_PHANTOM, is_phantom);
+ getSelection()->applyToObjects(&func);
}
void LLSelectMgr::selectionUpdateCastShadows(BOOL cast_shadows)
{
- LLViewerObject *object;
-
- for (object = mSelectedObjects->getFirstObject(); object; object = mSelectedObjects->getNextObject() )
- {
- if ( !object->permModify() // preemptive permissions check
- || object->isJointChild())
- {
- continue;
- }
- object->setFlags( FLAGS_CAST_SHADOWS, cast_shadows);
- }
+ LLSelectMgrApplyFlags func( FLAGS_CAST_SHADOWS, cast_shadows);
+ getSelection()->applyToObjects(&func);
}
@@ -4177,85 +3920,87 @@ void LLSelectMgr::sendListToRegions(const LLString& message_name,
S32 packets_sent = 0;
S32 objects_in_this_packet = 0;
-
//clear update override data (allow next update through)
- for (node = mSelectedObjects->getFirstNode();
- node;
- node = mSelectedObjects->getNextNode())
+ struct f : public LLSelectedNodeFunctor
{
- node->mLastPositionLocal.setVec(0,0,0);
- node->mLastRotation = LLQuaternion();
- node->mLastScale.setVec(0,0,0);
- }
+ virtual bool apply(LLSelectNode* node)
+ {
+ node->mLastPositionLocal.setVec(0,0,0);
+ node->mLastRotation = LLQuaternion();
+ node->mLastScale.setVec(0,0,0);
+ return true;
+ }
+ } func;
+ getSelection()->applyToNodes(&func);
std::queue<LLSelectNode*> nodes_to_send;
-
- switch(send_type)
- {
- case SEND_ONLY_ROOTS:
- {
- node = mSelectedObjects->getFirstRootNode();
- while(node)
- {
- nodes_to_send.push(node);
- node = mSelectedObjects->getNextRootNode();
- }
- }
- break;
- case SEND_INDIVIDUALS:
- node = mSelectedObjects->getFirstNode();
- while(node)
+ struct push_all : public LLSelectedNodeFunctor
+ {
+ std::queue<LLSelectNode*>& nodes_to_send;
+ push_all(std::queue<LLSelectNode*>& n) : nodes_to_send(n) {}
+ virtual bool apply(LLSelectNode* node)
{
nodes_to_send.push(node);
- node = mSelectedObjects->getNextNode();
+ return true;
}
- break;
- case SEND_ROOTS_FIRST:
- // first roots...
- node = mSelectedObjects->getFirstNode();
- while(node)
+ };
+ struct push_some : public LLSelectedNodeFunctor
+ {
+ std::queue<LLSelectNode*>& nodes_to_send;
+ bool mRoots;
+ push_some(std::queue<LLSelectNode*>& n, bool roots) : nodes_to_send(n), mRoots(roots) {}
+ virtual bool apply(LLSelectNode* node)
{
- if (node->getObject()->isRootEdit())
+ BOOL is_root = node->getObject()->isRootEdit();
+ if ((mRoots && is_root) || (!mRoots && !is_root))
{
nodes_to_send.push(node);
}
- node = mSelectedObjects->getNextNode();
+ return true;
}
-
- // then children...
- node = mSelectedObjects->getFirstNode();
- while(node)
+ };
+ struct push_editable : public LLSelectedNodeFunctor
+ {
+ std::queue<LLSelectNode*>& nodes_to_send;
+ push_editable(std::queue<LLSelectNode*>& n) : nodes_to_send(n) {}
+ virtual bool apply(LLSelectNode* node)
{
- if (!node->getObject()->isRootEdit())
+ // look and see if this object is actually modifiable by the current agent, because if it's not, then there's little
+ // point in pushing it up to the server to be updated, since we couldn't change it anyway.
+ // That just results in errors on screen when this function gets called by other things, like pulling down a drop down menu
+ LLViewerObject* object = node->getObject();
+ if( object && (object->permModify() || gAgent.allowOperation(PERM_MODIFY, *node->mPermissions) || gAgent.allowOperation(PERM_MOVE, *node->mPermissions)))
{
nodes_to_send.push(node);
}
- node = mSelectedObjects->getNextNode();
+ return true;
}
+ };
+ struct push_all pushall(nodes_to_send);
+ struct push_some pushroots(nodes_to_send, TRUE);
+ struct push_some pushnonroots(nodes_to_send, FALSE);
+ struct push_editable pusheditable(nodes_to_send);
+
+ switch(send_type)
+ {
+ case SEND_ONLY_ROOTS:
+ getSelection()->applyToRootNodes(&pusheditable);
+ break;
+ case SEND_INDIVIDUALS:
+ getSelection()->applyToNodes(&pushall);
+ break;
+ case SEND_ROOTS_FIRST:
+ // first roots...
+ getSelection()->applyToNodes(&pushroots);
+ // then children...
+ getSelection()->applyToNodes(&pushnonroots);
break;
- case SEND_CHILDREN_FIRST:
+ case SEND_CHILDREN_FIRST:
// first children...
- node = mSelectedObjects->getFirstNode();
- while(node)
- {
- if (!node->getObject()->isRootEdit())
- {
- nodes_to_send.push(node);
- }
- node = mSelectedObjects->getNextNode();
- }
-
- // ...then roots
- node = mSelectedObjects->getFirstNode();
- while(node)
- {
- if (node->getObject()->isRootEdit())
- {
- nodes_to_send.push(node);
- }
- node = mSelectedObjects->getNextNode();
- }
+ getSelection()->applyToNodes(&pushnonroots);
+ // then roots...
+ getSelection()->applyToNodes(&pushroots);
break;
default:
@@ -4263,8 +4008,11 @@ void LLSelectMgr::sendListToRegions(const LLString& message_name,
}
// bail if nothing selected
- if (nodes_to_send.empty()) return;
-
+ if (nodes_to_send.empty())
+ {
+ return;
+ }
+
node = nodes_to_send.front();
nodes_to_send.pop();
@@ -4426,27 +4174,24 @@ void LLSelectMgr::processObjectProperties(LLMessageSystem* msg, void** user_data
for (S32 buf_offset = 0; buf_offset < size; buf_offset += UUID_BYTES)
{
- LLUUID id;
- memcpy(id.mData, packed_buffer + buf_offset, UUID_BYTES); /* Flawfinder: ignore */
- texture_ids.push_back(id);
+ LLUUID tid;
+ memcpy(tid.mData, packed_buffer + buf_offset, UUID_BYTES); /* Flawfinder: ignore */
+ texture_ids.push_back(tid);
}
}
// Iterate through nodes at end, since it can be on both the regular AND hover list
- BOOL found = FALSE;
- LLSelectNode* node;
- for (node = gSelectMgr->mSelectedObjects->getFirstNode();
- node;
- node = gSelectMgr->mSelectedObjects->getNextNode())
+ struct f : public LLSelectedNodeFunctor
{
- if (node->getObject()->mID == id)
+ LLUUID mID;
+ f(const LLUUID& id) : mID(id) {}
+ virtual bool apply(LLSelectNode* node)
{
- found = TRUE;
- break;
+ return (node->getObject()->mID == mID);
}
- }
-
+ } func(id);
+ LLSelectNode* node = gSelectMgr->getSelection()->getFirstNode(&func);
if (node)
{
@@ -4579,23 +4324,21 @@ void LLSelectMgr::processObjectPropertiesFamily(LLMessageSystem* msg, void** use
LLString fullname(first_name);
fullname.append(" ");
fullname.append(last_name);
- reporterp->setPickedObjectProperties(name, fullname.c_str(), owner_id);
+ reporterp->setPickedObjectProperties(name, fullname, owner_id);
}
}
// Now look through all of the hovered nodes
- BOOL found = FALSE;
- LLSelectNode* node;
- for (node = gSelectMgr->mHoverObjects->getFirstNode();
- node;
- node = gSelectMgr->mHoverObjects->getNextNode())
+ struct f : public LLSelectedNodeFunctor
{
- if (node->getObject()->mID == id)
+ LLUUID mID;
+ f(const LLUUID& id) : mID(id) {}
+ virtual bool apply(LLSelectNode* node)
{
- found = TRUE;
- break;
+ return (node->getObject()->mID == mID);
}
- }
+ } func(id);
+ LLSelectNode* node = gSelectMgr->getHoverObjects()->getFirstNode(&func);
if (node)
{
@@ -4627,7 +4370,7 @@ void LLSelectMgr::processForceObjectSelect(LLMessageSystem* msg, void**)
LLUUID full_id;
S32 local_id;
LLViewerObject* object;
- LLDynamicArray<LLViewerObject*> objects;
+ std::vector<LLViewerObject*> objects;
S32 i;
S32 block_count = msg->getNumberOfBlocks("Data");
@@ -4642,7 +4385,7 @@ void LLSelectMgr::processForceObjectSelect(LLMessageSystem* msg, void**)
object = gObjectList.findObject(full_id);
if (object)
{
- objects.put(object);
+ objects.push_back(object);
}
}
@@ -4655,7 +4398,6 @@ extern LLGLdouble gGLModelView[16];
void LLSelectMgr::updateSilhouettes()
{
- LLSelectNode *node;
S32 num_sils_genned = 0;
LLVector3d cameraPos = gAgent.getCameraPositionGlobal();
@@ -4668,21 +4410,24 @@ void LLSelectMgr::updateSilhouettes()
mSilhouetteImagep = gImageList.getImage(id, TRUE, TRUE);
}
+ mHighlightedObjects->cleanupNodes();
if((cameraPos - mLastCameraPos).magVecSquared() > SILHOUETTE_UPDATE_THRESHOLD_SQUARED * currentCameraZoom * currentCameraZoom)
{
- for (node = mSelectedObjects->getFirstNode(); node; node = mSelectedObjects->getNextNode() )
+ struct f : public LLSelectedObjectFunctor
{
- if (node->getObject())
+ virtual bool apply(LLViewerObject* object)
{
- node->getObject()->setChanged(LLXform::SILHOUETTE);
+ object->setChanged(LLXform::SILHOUETTE);
+ return true;
}
- }
+ } func;
+ getSelection()->applyToObjects(&func);
mLastCameraPos = gAgent.getCameraPositionGlobal();
}
- LLDynamicArray<LLViewerObject*> changed_objects;
+ std::vector<LLViewerObject*> changed_objects;
if (mSelectedObjects->getNumNodes())
{
@@ -4693,8 +4438,10 @@ void LLSelectMgr::updateSilhouettes()
for (S32 pass = 0; pass < 2; pass++)
{
- for (node = mSelectedObjects->getFirstNode(); node; node = mSelectedObjects->getNextNode() )
+ for (LLObjectSelection::iterator iter = mSelectedObjects->begin();
+ iter != mSelectedObjects->end(); iter++)
{
+ LLSelectNode* node = *iter;
LLViewerObject* objectp = node->getObject();
// do roots first, then children so that root flags are cleared ASAP
@@ -4712,7 +4459,7 @@ void LLSelectMgr::updateSilhouettes()
if (num_sils_genned++ < MAX_SILS_PER_FRAME)// && objectp->mDrawable->isVisible())
{
generateSilhouette(node, gCamera->getOrigin());
- changed_objects.put(objectp);
+ changed_objects.push_back(objectp);
}
else if (objectp->isAttachment())
{
@@ -4761,20 +4508,23 @@ void LLSelectMgr::updateSilhouettes()
}
// remove highlight nodes not in roots list
- LLDynamicArray<LLSelectNode*> remove_these_nodes;
- LLDynamicArray<LLViewerObject*> remove_these_roots;
- for (LLSelectNode* nodep = mHighlightedObjects->getFirstNode(); nodep; nodep = mHighlightedObjects->getNextNode())
+ std::vector<LLSelectNode*> remove_these_nodes;
+ std::vector<LLViewerObject*> remove_these_roots;
+
+ for (LLObjectSelection::iterator iter = mHighlightedObjects->begin();
+ iter != mHighlightedObjects->end(); iter++)
{
- LLViewerObject* objectp = nodep->getObject();
+ LLSelectNode* node = *iter;
+ LLViewerObject* objectp = node->getObject();
if (objectp->isRoot() || !select_linked_set)
{
if (roots.count(objectp) == 0)
{
- remove_these_nodes.put(nodep);
+ remove_these_nodes.push_back(node);
}
else
{
- remove_these_roots.put(objectp);
+ remove_these_roots.push_back(objectp);
}
}
else
@@ -4783,22 +4533,25 @@ void LLSelectMgr::updateSilhouettes()
if (roots.count(rootp) == 0)
{
- remove_these_nodes.put(nodep);
+ remove_these_nodes.push_back(node);
}
}
}
// remove all highlight nodes no longer in rectangle selection
- S32 i;
- for (i = 0; i < remove_these_nodes.count(); i++)
+ for (std::vector<LLSelectNode*>::iterator iter = remove_these_nodes.begin();
+ iter != remove_these_nodes.end(); ++iter)
{
- mHighlightedObjects->removeNode(remove_these_nodes[i]);
+ LLSelectNode* nodep = *iter;
+ mHighlightedObjects->removeNode(nodep);
}
// remove all root objects already being highlighted
- for (i = 0; i < remove_these_roots.count(); i++)
+ for (std::vector<LLViewerObject*>::iterator iter = remove_these_roots.begin();
+ iter != remove_these_roots.end(); ++iter)
{
- roots.erase(remove_these_roots[i]);
+ LLViewerObject* objectp = *iter;
+ roots.erase(objectp);
}
// add all new objects in rectangle selection
@@ -4820,16 +4573,17 @@ void LLSelectMgr::updateSilhouettes()
}
else
{
- for (U32 i = 0; i < objectp->mChildList.size(); i++)
+ for (LLViewerObject::child_list_t::iterator iter = objectp->mChildList.begin();
+ iter != objectp->mChildList.end(); ++iter)
{
- LLViewerObject* child_objectp = objectp->mChildList[i];
-
+ LLViewerObject* child_objectp = *iter;
+
if (!canSelectObject(child_objectp))
{
continue;
}
- LLSelectNode* rect_select_node = new LLSelectNode(objectp->mChildList[i], TRUE);
+ LLSelectNode* rect_select_node = new LLSelectNode(child_objectp, TRUE);
rect_select_node->selectAllTEs(TRUE);
mHighlightedObjects->addNodeAtEnd(rect_select_node);
}
@@ -4845,8 +4599,10 @@ void LLSelectMgr::updateSilhouettes()
//BOOL subtracting_from_selection = (gKeyboard->currentMask(TRUE) == MASK_CONTROL);
for (S32 pass = 0; pass < 2; pass++)
{
- for (node = mHighlightedObjects->getFirstNode(); node; node = mHighlightedObjects->getNextNode() )
+ for (LLObjectSelection::iterator iter = mHighlightedObjects->begin();
+ iter != mHighlightedObjects->end(); iter++)
{
+ LLSelectNode* node = *iter;
LLViewerObject* objectp = node->getObject();
// do roots first, then children so that root flags are cleared ASAP
@@ -4864,7 +4620,7 @@ void LLSelectMgr::updateSilhouettes()
if (num_sils_genned++ < MAX_SILS_PER_FRAME)
{
generateSilhouette(node, gCamera->getOrigin());
- changed_objects.put(objectp);
+ changed_objects.push_back(objectp);
}
else if (objectp->isAttachment() && objectp->getRootEdit()->mDrawable.notNull())
{
@@ -4897,10 +4653,12 @@ void LLSelectMgr::updateSilhouettes()
mHighlightedObjects->deleteAllNodes();
}
- for (S32 i = 0; i < changed_objects.count(); i++)
+ for (std::vector<LLViewerObject*>::iterator iter = changed_objects.begin();
+ iter != changed_objects.end(); ++iter)
{
// clear flags after traversing node list (as child objects need to refer to parent flags, etc)
- changed_objects[i]->clearChanged(LLXform::MOVED | LLXform::SILHOUETTE);
+ LLViewerObject* objectp = *iter;
+ objectp->clearChanged(LLXform::MOVED | LLXform::SILHOUETTE);
}
//glAlphaFunc(GL_GREATER, 0.01f);
@@ -4913,8 +4671,7 @@ void LLSelectMgr::renderSilhouettes(BOOL for_hud)
return;
}
- LLSelectNode *node;
- LLViewerImage::bindTexture(gSelectMgr->mSilhouetteImagep);
+ LLViewerImage::bindTexture(mSilhouetteImagep);
LLGLSPipelineSelection gls_select;
glAlphaFunc(GL_GREATER, 0.0f);
LLGLEnable blend(GL_BLEND);
@@ -4946,8 +4703,10 @@ void LLSelectMgr::renderSilhouettes(BOOL for_hud)
LLUUID inspect_item_id = LLFloaterInspect::getSelectedUUID();
for (S32 pass = 0; pass < 2; pass++)
{
- for (node = mSelectedObjects->getFirstNode(); node; node = mSelectedObjects->getNextNode() )
+ for (LLObjectSelection::iterator iter = mSelectedObjects->begin();
+ iter != mSelectedObjects->end(); iter++)
{
+ LLSelectNode* node = *iter;
LLViewerObject* objectp = node->getObject();
if (objectp->isHUDAttachment() != for_hud)
{
@@ -4982,8 +4741,10 @@ void LLSelectMgr::renderSilhouettes(BOOL for_hud)
BOOL subtracting_from_selection = (gKeyboard->currentMask(TRUE) == MASK_CONTROL);
for (S32 pass = 0; pass < 2; pass++)
{
- for (node = mHighlightedObjects->getFirstNode(); node; node = mHighlightedObjects->getNextNode() )
+ for (LLObjectSelection::iterator iter = mHighlightedObjects->begin();
+ iter != mHighlightedObjects->end(); iter++)
{
+ LLSelectNode* node = *iter;
LLViewerObject* objectp = node->getObject();
if (objectp->isHUDAttachment() != for_hud)
{
@@ -5013,7 +4774,7 @@ void LLSelectMgr::renderSilhouettes(BOOL for_hud)
stop_glerror();
}
- gSelectMgr->mSilhouetteImagep->unbindTexture(0, GL_TEXTURE_2D);
+ mSilhouetteImagep->unbindTexture(0, GL_TEXTURE_2D);
glAlphaFunc(GL_GREATER, 0.01f);
}
@@ -5142,7 +4903,7 @@ S32 LLSelectNode::getLastSelectedTE()
return mLastTESelected;
}
-LLViewerObject *LLSelectNode::getObject()
+LLViewerObject* LLSelectNode::getObject()
{
if (!mObject)
{
@@ -5155,6 +4916,11 @@ LLViewerObject *LLSelectNode::getObject()
return mObject;
}
+void LLSelectNode::setObject(LLViewerObject* object)
+{
+ mObject = object;
+}
+
void LLSelectNode::saveColors()
{
if (mObject.notNull())
@@ -5174,8 +4940,8 @@ void LLSelectNode::saveTextures(const std::vector<LLUUID>& textures)
{
mSavedTextures.clear();
- std::vector<LLUUID>::const_iterator texture_it;
- for (texture_it = textures.begin(); texture_it != textures.end(); ++texture_it)
+ for (std::vector<LLUUID>::const_iterator texture_it = textures.begin();
+ texture_it != textures.end(); ++texture_it)
{
mSavedTextures.push_back(*texture_it);
}
@@ -5195,7 +4961,7 @@ void LLSelectNode::saveTextureScaleRatios()
U32 s_axis = 0;
U32 t_axis = 0;
- gSelectMgr->getTESTAxes(mObject, i, &s_axis, &t_axis);
+ LLPrimitive::getTESTAxes(i, &s_axis, &t_axis);
LLVector3 v;
LLVector3 scale = mObject->getScale();
@@ -5491,9 +5257,10 @@ S32 get_family_count(LLViewerObject *parent)
llwarns << "Trying to get_family_count on null parent!" << llendl;
}
S32 count = 1; // for this object
- for (U32 i = 0; i < parent->mChildList.size(); i++)
+ for (LLViewerObject::child_list_t::iterator iter = parent->mChildList.begin();
+ iter != parent->mChildList.end(); ++iter)
{
- LLViewerObject* child = parent->mChildList[i];
+ LLViewerObject* child = *iter;
if (!child)
{
@@ -5524,7 +5291,7 @@ void LLSelectMgr::updateSelectionCenter()
//override any object updates received
//for selected objects
- gSelectMgr->overrideObjectUpdates();
+ overrideObjectUpdates();
LLViewerObject* object = mSelectedObjects->getFirstObject();
if (!object)
@@ -5568,10 +5335,13 @@ void LLSelectMgr::updateSelectionCenter()
LLVector3d select_center;
// keep a list of jointed objects for showing the joint HUDEffects
- LLDynamicArray < LLViewerObject *> jointed_objects;
+ std::vector < LLViewerObject *> jointed_objects;
- for (object = mSelectedObjects->getFirstObject(); object; object = mSelectedObjects->getNextObject() )
+ for (LLObjectSelection::iterator iter = mSelectedObjects->begin();
+ iter != mSelectedObjects->end(); iter++)
{
+ LLSelectNode* node = *iter;
+ LLViewerObject* object = node->getObject();
LLViewerObject *myAvatar = gAgent.getAvatarObject();
LLViewerObject *root = object->getRootEdit();
if (mSelectedObjects->mSelectType == SELECT_TYPE_WORLD && // not an attachment
@@ -5585,9 +5355,9 @@ void LLSelectMgr::updateSelectionCenter()
if (object->isJointChild())
{
- jointed_objects.put(object);
+ jointed_objects.push_back(object);
}
- } // end for
+ }
LLVector3 bbox_center_agent = bbox.getCenterAgent();
mSelectionCenterGlobal = gAgent.getPosGlobalFromAgent(bbox_center_agent);
@@ -5717,6 +5487,7 @@ void LLSelectMgr::redo()
//-----------------------------------------------------------------------------
BOOL LLSelectMgr::canDoDelete()
{
+ // Note: Can only delete root objects (see getFirstDeleteableObject() for more info)
return mSelectedObjects->getFirstDeleteableObject() != NULL;
}
@@ -5781,14 +5552,18 @@ ESelectType LLSelectMgr::getSelectTypeForObject(LLViewerObject* object)
void LLSelectMgr::validateSelection()
{
- LLViewerObject* objectp;
- for (objectp = mSelectedObjects->getFirstObject(); objectp; objectp = mSelectedObjects->getNextObject())
+ struct f : public LLSelectedObjectFunctor
{
- if (!canSelectObject(objectp))
+ virtual bool apply(LLViewerObject* object)
{
- deselectObjectOnly(objectp);
+ if (!gSelectMgr->canSelectObject(object))
+ {
+ gSelectMgr->deselectObjectOnly(object);
+ }
+ return true;
}
- }
+ } func;
+ getSelection()->applyToObjects(&func);
}
BOOL LLSelectMgr::canSelectObject(LLViewerObject* object)
@@ -5830,17 +5605,28 @@ BOOL LLSelectMgr::setForceSelection(BOOL force)
}
LLObjectSelection::LLObjectSelection() :
- std::list<LLSelectNode*>(),
LLRefCount(),
- mCurrentNode(end()),
- mCurrentTE(-1),
mSelectType(SELECT_TYPE_WORLD)
{
}
LLObjectSelection::~LLObjectSelection()
{
- std::for_each(begin(), end(), DeletePointer());
+ deleteAllNodes();
+}
+
+void LLObjectSelection::cleanupNodes()
+{
+ for (list_t::iterator iter = mList.begin(); iter != mList.end(); )
+ {
+ list_t::iterator curiter = iter++;
+ LLSelectNode* node = *curiter;
+ if (node->getObject() == NULL || node->getObject()->isDead())
+ {
+ mList.erase(curiter);
+ delete node;
+ }
+ }
}
void LLObjectSelection::updateEffects()
@@ -5849,43 +5635,46 @@ void LLObjectSelection::updateEffects()
S32 LLObjectSelection::getNumNodes()
{
- return size();
+ return mList.size();
}
void LLObjectSelection::addNode(LLSelectNode *nodep)
{
- push_front(nodep);
+ llassert_always(nodep->getObject() && !nodep->getObject()->isDead());
+ mList.push_front(nodep);
mSelectNodeMap[nodep->getObject()] = nodep;
}
void LLObjectSelection::addNodeAtEnd(LLSelectNode *nodep)
{
- push_back(nodep);
+ llassert_always(nodep->getObject() && !nodep->getObject()->isDead());
+ mList.push_back(nodep);
mSelectNodeMap[nodep->getObject()] = nodep;
}
+void LLObjectSelection::moveNodeToFront(LLSelectNode *nodep)
+{
+ mList.remove(nodep);
+ mList.push_front(nodep);
+}
+
void LLObjectSelection::removeNode(LLSelectNode *nodep)
{
- std::list<LLSelectNode*>::iterator iter = begin();
- while(iter != end())
+ mSelectNodeMap.erase(nodep->getObject());
+ if (nodep->getObject() == mPrimaryObject)
{
- if ((*iter) == nodep)
- {
- mSelectNodeMap.erase(nodep->getObject());
- iter = erase(iter);
- }
- else
- {
- ++iter;
- }
+ mPrimaryObject = NULL;
}
+ nodep->setObject(NULL); // Will get erased in cleanupNodes()
+ mList.remove(nodep);
}
void LLObjectSelection::deleteAllNodes()
{
- std::for_each(begin(), end(), DeletePointer());
- clear();
+ std::for_each(mList.begin(), mList.end(), DeletePointer());
+ mList.clear();
mSelectNodeMap.clear();
+ mPrimaryObject = NULL;
}
LLSelectNode* LLObjectSelection::findNode(LLViewerObject* objectp)
@@ -5899,357 +5688,11 @@ LLSelectNode* LLObjectSelection::findNode(LLViewerObject* objectp)
}
//-----------------------------------------------------------------------------
-// getFirstNode()
-//-----------------------------------------------------------------------------
-LLSelectNode *LLObjectSelection::getFirstNode()
-{
- mCurrentNode = begin();//getFirstData();
-
- while (mCurrentNode != end() && !(*mCurrentNode)->getObject())
- {
- // The object on this was killed at some point, delete it.
- erase(mCurrentNode++);
- }
-
- if (mCurrentNode != end())
- {
- return *mCurrentNode;
- }
-
- return NULL;
-}
-
-//-----------------------------------------------------------------------------
-// getCurrentNode()
-//-----------------------------------------------------------------------------
-LLSelectNode *LLObjectSelection::getCurrentNode()
-{
- while (mCurrentNode != end() && !(*mCurrentNode)->getObject())
- {
- // The object on this was killed at some point, delete it.
- erase(mCurrentNode++);
- }
-
- if (mCurrentNode != end())
- {
- return *mCurrentNode;
- }
- return NULL;
-}
-
-//-----------------------------------------------------------------------------
-// getNextNode()
-//-----------------------------------------------------------------------------
-LLSelectNode *LLObjectSelection::getNextNode()
-{
- ++mCurrentNode;
-
- while (mCurrentNode != end() && !(*mCurrentNode)->getObject())
- {
- // The object on this was killed at some point, delete it.
- erase(mCurrentNode++);
- }
-
- if (mCurrentNode != end())
- {
- return *mCurrentNode;
- }
- return NULL;
-}
-
-
-
-//-----------------------------------------------------------------------------
-// getFirstObject()
-//-----------------------------------------------------------------------------
-LLViewerObject* LLObjectSelection::getFirstObject()
-{
- mCurrentNode = begin();
-
- while (mCurrentNode != end() && !(*mCurrentNode)->getObject())
- {
- // The object on this was killed at some point, delete it.
- erase(mCurrentNode++);
- }
-
- if (mCurrentNode != end())
- {
- return (*mCurrentNode)->getObject();
- }
-
- return NULL;
-}
-
-
-//-----------------------------------------------------------------------------
-// getNextObject()
-//-----------------------------------------------------------------------------
-LLViewerObject* LLObjectSelection::getNextObject()
-{
- ++mCurrentNode;// = getNextData();
-
- while (mCurrentNode != end() && !(*mCurrentNode)->getObject())
- {
- // The object on this was killed at some point, delete it.
- erase(mCurrentNode++);
- }
-
- if (mCurrentNode != end())
- {
- return (*mCurrentNode)->getObject();
- }
-
- return NULL;
-}
-
-
-
-//-----------------------------------------------------------------------------
-// getPrimaryTE()
-//-----------------------------------------------------------------------------
-void LLObjectSelection::getPrimaryTE(LLViewerObject* *object, S32 *te)
-{
- // initialize object and te
- *te = 0;
- *object = NULL;
-
- BOOL searching_roots = TRUE;
-
- // try for root node first, then first child node
- LLSelectNode *primary_node = getFirstNode(); //getFirstRootNode();
- if (!primary_node)
- {
- primary_node = getFirstNode();
- searching_roots = FALSE;
- }
-
- while (primary_node)
- {
- S32 last_selected_te = primary_node->getLastSelectedTE();
- if (last_selected_te >= 0)
- {
- *object = primary_node->getObject();
- *te = last_selected_te;
- return;
- }
- for(S32 cur_te = 0; cur_te < primary_node->getObject()->getNumTEs(); cur_te++)
- {
- // if face selected
- if (primary_node->isTESelected(cur_te))
- {
- // return this object and face
- *object = primary_node->getObject();
- *te = cur_te;
- return;
- }
- }
- if (searching_roots)
- {
- primary_node = getNextRootNode();
- if (!primary_node)
- {
- primary_node = getFirstNode();
- searching_roots = FALSE;
- }
- }
- else
- {
- primary_node = getNextNode();
- }
- }
-}
-
-//-----------------------------------------------------------------------------
-// getFirstTE()
-//-----------------------------------------------------------------------------
-void LLObjectSelection::getFirstTE(LLViewerObject* *object, S32 *te)
-{
- // start with first face
- mCurrentTE = 0;
-
- LLSelectNode *cur_node = getFirstNode();
-
- // repeat over all selection nodes
- while (cur_node)
- {
- // skip objects with no faces
- if (cur_node->getObject()->getNumTEs() == 0)
- {
- mCurrentTE = 0;
- cur_node = getNextNode();
- continue;
- }
-
- // repeat over all faces for this object
- while (mCurrentTE < cur_node->getObject()->getNumTEs())
- {
- // if face selected
- if (cur_node->isTESelected(mCurrentTE))
- {
- // return this object and face
- *object = cur_node->getObject();
- *te = mCurrentTE;
- return;
- }
-
- mCurrentTE++;
- }
-
- // Couldn't find a selected face.
- // This can happen if an object's volume parameters are changed in such a way
- // that texture entries are eliminated.
- //
- // TODO: Consider selecting all faces in this case? Subscribe the selection
- // list to the volume changing code?
-
- mCurrentTE = 0;
- cur_node = getNextNode();
- }
-
- // The list doesn't contain any nodes. Return NULL.
- *object = NULL;
- *te = -1;
- return;
-}
-
-
-//-----------------------------------------------------------------------------
-// getNextFace()
-//-----------------------------------------------------------------------------
-void LLObjectSelection::getNextTE(LLViewerObject* *object, S32 *te)
-{
- // try next face
- mCurrentTE++;
-
- LLSelectNode *cur_node = getCurrentNode();
- // repeat over remaining selection nodes
- while ( cur_node )
- {
- // skip objects with no faces
- if (cur_node->getObject()->getNumTEs() == 0)
- {
- mCurrentTE = 0;
- cur_node = getNextNode();
- continue;
- }
-
- // repeat over all faces for this object
- // CRO: getNumTEs() no longer equals mFaces.count(), so use mFaces.count() instead
- while ( mCurrentTE < cur_node->getObject()->getNumTEs() )
- {
- // if face selected
- if (cur_node->isTESelected(mCurrentTE))
- {
- // return this object and face
- *object = cur_node->getObject();
- *te = mCurrentTE;
- return;
- }
-
- mCurrentTE++;
- }
-
- mCurrentTE = 0;
- cur_node = getNextNode();
- }
-
- // The list doesn't contain any nodes. Return NULL.
- *object = NULL;
- *te = -1;
- return;
-}
-
-void LLObjectSelection::getCurrentTE(LLViewerObject* *object, S32 *te)
-{
- if (mCurrentNode != end())
- {
- *object = (*mCurrentNode)->getObject();
- *te = mCurrentTE;
- }
- else
- {
- *object = NULL;
- *te = -1;
- }
-}
-//-----------------------------------------------------------------------------
-// getFirstRootNode()
-//-----------------------------------------------------------------------------
-LLSelectNode *LLObjectSelection::getFirstRootNode()
-{
- LLSelectNode *cur_node = getFirstNode();
-
- // scan through child objects and roots set to ignore
- while (cur_node &&
- (!(cur_node->getObject()->isRootEdit() || cur_node->getObject()->isJointChild()) ||
- cur_node->mIndividualSelection))
- {
- cur_node = getNextNode();
- }
-
- return cur_node;
-}
-
-
-//-----------------------------------------------------------------------------
-// getNextRootNode()
-//-----------------------------------------------------------------------------
-LLSelectNode *LLObjectSelection::getNextRootNode()
-{
- LLSelectNode *cur_node = getNextNode();
-
- while (cur_node &&
- (!(cur_node->getObject()->isRootEdit() || cur_node->getObject()->isJointChild()) ||
- cur_node->mIndividualSelection))
- {
- cur_node = getNextNode();
- }
-
- return cur_node;
-}
-
-
-//-----------------------------------------------------------------------------
-// getFirstRootObject()
-//-----------------------------------------------------------------------------
-LLViewerObject *LLObjectSelection::getFirstRootObject()
-{
- LLSelectNode *node = getFirstRootNode();
-
- if (node)
- {
- return node->getObject();
- }
- else
- {
- return NULL;
- }
-}
-
-
-//-----------------------------------------------------------------------------
-// getNextRootObject()
-//-----------------------------------------------------------------------------
-LLViewerObject *LLObjectSelection::getNextRootObject()
-{
- LLSelectNode *node = getNextRootNode();
-
- if (node)
- {
- return node->getObject();
- }
- else
- {
- return NULL;
- }
-}
-
-//-----------------------------------------------------------------------------
// isEmpty()
//-----------------------------------------------------------------------------
BOOL LLObjectSelection::isEmpty()
{
- return (size() == 0);
+ return (mList.size() == 0);
}
//-----------------------------------------------------------------------------
@@ -6257,24 +5700,20 @@ BOOL LLObjectSelection::isEmpty()
//-----------------------------------------------------------------------------
BOOL LLObjectSelection::getOwnershipCost(S32 &cost)
{
- S32 count = 0;
- for( LLSelectNode* nodep = getFirstNode(); nodep; nodep = getNextNode() )
- {
- count++;
- }
-
+ S32 count = getObjectCount();
cost = count * OWNERSHIP_COST_PER_OBJECT;
-
return (count > 0);
}
//-----------------------------------------------------------------------------
-// getObjectCount()
+// getObjectCount() - returns number of non null objects
//-----------------------------------------------------------------------------
S32 LLObjectSelection::getObjectCount()
{
- return getNumNodes();
+ cleanupNodes();
+ S32 count = mList.size();
+ return count;
}
@@ -6284,23 +5723,19 @@ S32 LLObjectSelection::getObjectCount()
S32 LLObjectSelection::getTECount()
{
S32 count = 0;
-
- LLSelectNode* nodep;
- for (nodep = getFirstNode(); nodep; nodep = getNextNode() )
+ for (LLObjectSelection::iterator iter = begin(); iter != end(); iter++)
{
- if (nodep->getObject())
+ LLSelectNode* node = *iter;
+ LLViewerObject* object = node->getObject();
+ S32 num_tes = object->getNumTEs();
+ for (S32 te = 0; te < num_tes; te++)
{
- S32 num_tes = nodep->getObject()->getNumTEs();
- for (S32 te = 0; te < num_tes; te++)
+ if (node->isTESelected(te))
{
- if (nodep->isTESelected(te))
- {
- count++;
- }
+ ++count;
}
}
}
-
return count;
}
@@ -6309,47 +5744,97 @@ S32 LLObjectSelection::getTECount()
//-----------------------------------------------------------------------------
S32 LLObjectSelection::getRootObjectCount()
{
- LLSelectNode *nodep;
-
S32 count = 0;
- for(nodep = getFirstRootNode(); nodep; nodep = getNextRootNode())
+ for (LLObjectSelection::root_iterator iter = root_begin(); iter != root_end(); iter++)
{
++count;
}
return count;
}
-bool LLObjectSelection::applyToObjects(LLSelectedObjectFunctor* func)
+bool LLObjectSelection::applyToObjects(LLSelectedObjectFunctor* func, bool firstonly)
{
- bool result = true;
- LLViewerObject* object;
- for (object = getFirstObject(); object != NULL; object = getNextObject())
+ bool result = firstonly ? false : true;
+ for (iterator iter = begin(); iter != end(); )
{
- result = result && func->apply(object);
+ iterator nextiter = iter++;
+ LLViewerObject* object = (*nextiter)->getObject();
+ bool r = func->apply(object);
+ if (firstonly && r)
+ return true;
+ else
+ result = result && r;
}
return result;
}
-bool LLObjectSelection::applyToRootObjects(LLSelectedObjectFunctor* func)
+bool LLObjectSelection::applyToRootObjects(LLSelectedObjectFunctor* func, bool firstonly)
{
- bool result = true;
- LLViewerObject* object;
- for (object = getFirstRootObject();
- object != NULL;
- object = getNextRootObject())
+ bool result = firstonly ? false : true;
+ for (root_iterator iter = root_begin(); iter != root_end(); )
{
- result = result && func->apply(object);
+ root_iterator nextiter = iter++;
+ LLViewerObject* object = (*nextiter)->getObject();
+ bool r = func->apply(object);
+ if (firstonly && r)
+ return true;
+ else
+ result = result && r;
}
return result;
}
-bool LLObjectSelection::applyToNodes(LLSelectedNodeFunctor *func)
+bool LLObjectSelection::applyToTEs(LLSelectedTEFunctor* func, bool firstonly)
{
- bool result = true;
- LLSelectNode* node;
- for (node = getFirstNode(); node != NULL; node = getNextNode())
+ bool result = firstonly ? false : true;
+ for (iterator iter = begin(); iter != end(); )
{
- result = result && func->apply(node);
+ iterator nextiter = iter++;
+ LLSelectNode* node = *nextiter;
+ LLViewerObject* object = (*nextiter)->getObject();
+ for (S32 te = 0; te < object->getNumTEs(); ++te)
+ {
+ if (node->isTESelected(te))
+ {
+ bool r = func->apply(object, te);
+ if (firstonly && r)
+ return true;
+ else
+ result = result && r;
+ }
+ }
+ }
+ return result;
+}
+
+bool LLObjectSelection::applyToNodes(LLSelectedNodeFunctor *func, bool firstonly)
+{
+ bool result = firstonly ? false : true;
+ for (iterator iter = begin(); iter != end(); )
+ {
+ iterator nextiter = iter++;
+ LLSelectNode* node = *nextiter;
+ bool r = func->apply(node);
+ if (firstonly && r)
+ return true;
+ else
+ result = result && r;
+ }
+ return result;
+}
+
+bool LLObjectSelection::applyToRootNodes(LLSelectedNodeFunctor *func, bool firstonly)
+{
+ bool result = firstonly ? false : true;
+ for (root_iterator iter = root_begin(); iter != root_end(); )
+ {
+ root_iterator nextiter = iter++;
+ LLSelectNode* node = *nextiter;
+ bool r = func->apply(node);
+ if (firstonly && r)
+ return true;
+ else
+ result = result && r;
}
return result;
}
@@ -6368,12 +5853,13 @@ BOOL LLObjectSelection::contains(LLViewerObject* object)
//-----------------------------------------------------------------------------
BOOL LLObjectSelection::contains(LLViewerObject* object, S32 te)
{
- LLSelectNode *nodep;
if (te == SELECT_ALL_TES)
{
// ...all faces
- for (nodep = getFirstNode(); nodep; nodep = getNextNode() )
+ for (LLObjectSelection::iterator iter = begin();
+ iter != end(); iter++)
{
+ LLSelectNode* nodep = *iter;
if (nodep->getObject() == object)
{
BOOL all_selected = TRUE;
@@ -6389,8 +5875,9 @@ BOOL LLObjectSelection::contains(LLViewerObject* object, S32 te)
else
{
// ...one face
- for (nodep = getFirstNode(); nodep; nodep = getNextNode() )
+ for (LLObjectSelection::iterator iter = begin(); iter != end(); iter++)
{
+ LLSelectNode* nodep = *iter;
if (nodep->getObject() == object && nodep->isTESelected(te))
{
return TRUE;
@@ -6407,203 +5894,193 @@ BOOL LLObjectSelection::isAttachment()
}
//-----------------------------------------------------------------------------
-// getFirstMoveableNode()
+// getSelectedParentObject()
//-----------------------------------------------------------------------------
-LLSelectNode* LLObjectSelection::getFirstMoveableNode(BOOL get_root)
+LLViewerObject* getSelectedParentObject(LLViewerObject *object)
{
- LLSelectNode* selectNode = NULL;
-
- if (get_root)
+ LLViewerObject *parent;
+ while (object && (parent = (LLViewerObject*)object->getParent()))
{
- for(selectNode = getFirstRootNode(); selectNode; selectNode = getNextRootNode())
+ if (parent->isSelected())
{
- if( selectNode->getObject()->permMove() )
- {
- return selectNode;
- break;
- }
+ object = parent;
}
- }
- for(selectNode = getFirstNode(); selectNode; selectNode = getNextNode())
- {
- if( selectNode->getObject()->permMove() )
+ else
{
- return selectNode;
break;
}
}
-
- return NULL;
+ return object;
}
//-----------------------------------------------------------------------------
-// getFirstCopyableObject()
+// getFirstNode
//-----------------------------------------------------------------------------
-LLViewerObject* LLObjectSelection::getFirstCopyableObject(BOOL get_root)
+LLSelectNode* LLObjectSelection::getFirstNode(LLSelectedNodeFunctor* func)
{
- LLViewerObject* object = NULL;
- for(LLViewerObject* cur = getFirstObject(); cur; cur = getNextObject())
+ for (iterator iter = begin(); iter != end(); ++iter)
{
- if( cur->permCopy() && !cur->isAttachment())
+ LLSelectNode* node = *iter;
+ if (func == NULL || func->apply(node))
{
- object = cur;
- break;
+ return node;
}
- }
+ }
+ return NULL;
+}
- if (get_root && object)
+LLSelectNode* LLObjectSelection::getFirstRootNode(LLSelectedNodeFunctor* func, BOOL non_root_ok)
+{
+ for (root_iterator iter = root_begin(); iter != root_end(); ++iter)
{
- LLViewerObject *parent;
- while ((parent = (LLViewerObject*)object->getParent()))
+ LLSelectNode* node = *iter;
+ if (func == NULL || func->apply(node))
{
- if (parent->isSelected())
- {
- object = parent;
- }
- else
- {
- break;
- }
+ return node;
}
}
+ if (non_root_ok)
+ {
+ // Get non root
+ return getFirstNode(func);
+ }
+ return NULL;
+}
- return object;
+
+//-----------------------------------------------------------------------------
+// getFirstSelectedObject
+//-----------------------------------------------------------------------------
+LLViewerObject* LLObjectSelection::getFirstSelectedObject(LLSelectedNodeFunctor* func, BOOL get_parent)
+{
+ LLSelectNode* res = getFirstNode(func);
+ if (res && get_parent)
+ {
+ return getSelectedParentObject(res->getObject());
+ }
+ else if (res)
+ {
+ return res->getObject();
+ }
+ return NULL;
}
+//-----------------------------------------------------------------------------
+// getFirstObject()
+//-----------------------------------------------------------------------------
+LLViewerObject* LLObjectSelection::getFirstObject()
+{
+ LLSelectNode* res = getFirstNode(NULL);
+ return res ? res->getObject() : NULL;
+}
//-----------------------------------------------------------------------------
-// getFirstDeleteableObject()
+// getFirstRootObject()
//-----------------------------------------------------------------------------
-LLViewerObject* LLObjectSelection::getFirstDeleteableObject(BOOL get_root)
+LLViewerObject* LLObjectSelection::getFirstRootObject(BOOL non_root_ok)
{
- //RN: don't currently support deletion of child objects, as that requires separating them first
- // then derezzing to trash
- get_root = TRUE;
+ LLSelectNode* res = getFirstRootNode(NULL, non_root_ok);
+ return res ? res->getObject() : NULL;
+}
- LLViewerObject* object = NULL;
- if (get_root)
+//-----------------------------------------------------------------------------
+// getFirstMoveableNode()
+//-----------------------------------------------------------------------------
+LLSelectNode* LLObjectSelection::getFirstMoveableNode(BOOL get_root_first)
+{
+ struct f : public LLSelectedNodeFunctor
{
- for(LLViewerObject* current = getFirstRootObject();
- current != NULL;
- current = getNextRootObject())
+ bool apply(LLSelectNode* node)
{
- // you can delete an object if permissions allow it, you are
- // the owner, you are an officer in the group that owns the
- // object, or you are not the owner but it is on land you own
- // or land owned by your group. (whew!)
- if( (current->permModify())
- || (current->permYouOwner())
- || (!current->permAnyOwner()) // public
- || (current->isOverAgentOwnedLand())
- || (current->isOverGroupOwnedLand())
- )
- {
+ LLViewerObject* obj = node->getObject();
+ return obj->permMove();
+ }
+ } func;
+ LLSelectNode* res = get_root_first ? getFirstRootNode(&func, TRUE) : getFirstNode(&func);
+ return res;
+}
- if( !current->isAttachment() )
- {
- object = current;
- break;
- }
- }
- }
- }
- else
+//-----------------------------------------------------------------------------
+// getFirstCopyableObject()
+//-----------------------------------------------------------------------------
+LLViewerObject* LLObjectSelection::getFirstCopyableObject(BOOL get_parent)
+{
+ struct f : public LLSelectedNodeFunctor
+ {
+ bool apply(LLSelectNode* node)
+ {
+ LLViewerObject* obj = node->getObject();
+ return obj->permCopy() && !obj->isAttachment();
+ }
+ } func;
+ return getFirstSelectedObject(&func, get_parent);
+}
+
+//-----------------------------------------------------------------------------
+// getFirstDeleteableObject()
+//-----------------------------------------------------------------------------
+LLViewerObject* LLObjectSelection::getFirstDeleteableObject()
+{
+ //RN: don't currently support deletion of child objects, as that requires separating them first
+ // then derezzing to trash
+
+ struct f : public LLSelectedNodeFunctor
{
- // We've avoided this path for a while. It may not work.
- llwarns << "!get_root code path may have bitrotted." << llendl;
- for(LLViewerObject* current = getFirstObject();
- current != NULL;
- current = getNextObject())
+ bool apply(LLSelectNode* node)
{
+ LLViewerObject* obj = node->getObject();
// you can delete an object if permissions allow it, you are
// the owner, you are an officer in the group that owns the
// object, or you are not the owner but it is on land you own
// or land owned by your group. (whew!)
- if( (current->permModify())
- || (current->permYouOwner())
- || (!current->permAnyOwner()) // public
- || (current->isOverAgentOwnedLand())
- || (current->isOverGroupOwnedLand())
- )
+ if( (obj->permModify())
+ || (obj->permYouOwner())
+ || (!obj->permAnyOwner()) // public
+ || (obj->isOverAgentOwnedLand())
+ || (obj->isOverGroupOwnedLand())
+ )
{
- if( !current->isAttachment() )
+ if( !obj->isAttachment() )
{
- object = current;
- break;
+ return TRUE;
}
}
- }
- }
-
- return object;
+ return true;
+ }
+ } func;
+ LLSelectNode* node = getFirstNode(&func);
+ return node ? node->getObject() : NULL;
}
-
//-----------------------------------------------------------------------------
// getFirstEditableObject()
//-----------------------------------------------------------------------------
-LLViewerObject* LLObjectSelection::getFirstEditableObject(BOOL get_root)
+LLViewerObject* LLObjectSelection::getFirstEditableObject(BOOL get_parent)
{
- LLViewerObject* object = NULL;
- for(LLViewerObject* cur = getFirstObject(); cur; cur = getNextObject())
+ struct f : public LLSelectedNodeFunctor
{
- if( cur->permModify() )
+ bool apply(LLSelectNode* node)
{
- object = cur;
- break;
+ LLViewerObject* obj = node->getObject();
+ return obj->permModify();
}
- }
-
- if (get_root && object)
- {
- LLViewerObject *parent;
- while ((parent = (LLViewerObject*)object->getParent()))
- {
- if (parent->isSelected())
- {
- object = parent;
- }
- else
- {
- break;
- }
- }
- }
-
- return object;
+ } func;
+ return getFirstSelectedObject(&func, get_parent);
}
//-----------------------------------------------------------------------------
// getFirstMoveableObject()
//-----------------------------------------------------------------------------
-LLViewerObject* LLObjectSelection::getFirstMoveableObject(BOOL get_root)
+LLViewerObject* LLObjectSelection::getFirstMoveableObject(BOOL get_parent)
{
- LLViewerObject* object = NULL;
- for(LLViewerObject* cur = getFirstObject(); cur; cur = getNextObject())
- {
- if( cur->permMove() )
- {
- object = cur;
- break;
- }
- }
-
- if (get_root && object && !object->isJointChild())
+ struct f : public LLSelectedNodeFunctor
{
- LLViewerObject *parent;
- while ((parent = (LLViewerObject*)object->getParent()))
+ bool apply(LLSelectNode* node)
{
- if (parent->isSelected())
- {
- object = parent;
- }
- else
- {
- break;
- }
+ LLViewerObject* obj = node->getObject();
+ return obj->permMove();
}
- }
-
- return object;
+ } func;
+ return getFirstSelectedObject(&func, get_parent);
}
diff --git a/indra/newview/llselectmgr.h b/indra/newview/llselectmgr.h
index ed59c19e45..69bf585005 100644
--- a/indra/newview/llselectmgr.h
+++ b/indra/newview/llselectmgr.h
@@ -33,7 +33,6 @@
#define LL_LLSELECTMGR_H
#include "llcharacter.h"
-#include "lldarray.h"
#include "lleditmenuhandler.h"
#include "llstring.h"
#include "llundo.h"
@@ -47,8 +46,10 @@
#include "llframetimer.h"
#include "llbbox.h"
#include "llpermissions.h"
+#include "llviewerobject.h"
#include <deque>
+#include "boost/iterator/filter_iterator.hpp"
class LLMessageSystem;
class LLViewerImage;
@@ -61,27 +62,37 @@ const S32 SELECT_ALL_TES = -1;
const S32 SELECT_MAX_TES = 32;
// Do something to all objects in the selection manager.
-// The bool return value can be used to indicate if all
+// The BOOL return value can be used to indicate if all
// objects are identical (gathering information) or if
// the operation was successful.
-class LLSelectedObjectFunctor
+struct LLSelectedObjectFunctor
{
-public:
virtual ~LLSelectedObjectFunctor() {};
virtual bool apply(LLViewerObject* object) = 0;
};
// Do something to all select nodes in the selection manager.
-// The bool return value can be used to indicate if all
+// The BOOL return value can be used to indicate if all
// objects are identical (gathering information) or if
// the operation was successful.
-class LLSelectedNodeFunctor
+struct LLSelectedNodeFunctor
{
-public:
virtual ~LLSelectedNodeFunctor() {};
virtual bool apply(LLSelectNode* node) = 0;
};
+struct LLSelectedTEFunctor
+{
+ virtual ~LLSelectedTEFunctor() {};
+ virtual bool apply(LLViewerObject* object, S32 face) = 0;
+};
+
+template <typename T> struct LLSelectedTEGetFunctor
+{
+ virtual ~LLSelectedTEGetFunctor() {};
+ virtual T get(LLViewerObject* object, S32 te) = 0;
+};
+
typedef enum e_send_type
{
SEND_ONLY_ROOTS,
@@ -114,53 +125,165 @@ typedef enum e_selection_type
SELECT_TYPE_HUD
}ESelectType;
-class LLObjectSelection : public std::list<LLSelectNode*>, public LLRefCount
+// Contains information about a selected object, particularly which TEs are selected.
+class LLSelectNode
+{
+public:
+ LLSelectNode(LLViewerObject* object, BOOL do_glow);
+ LLSelectNode(const LLSelectNode& nodep);
+ ~LLSelectNode();
+
+ void selectAllTEs(BOOL b);
+ void selectTE(S32 te_index, BOOL selected);
+ BOOL isTESelected(S32 te_index);
+ S32 getLastSelectedTE();
+ void renderOneSilhouette(const LLColor4 &color);
+ void setTransient(BOOL transient) { mTransient = transient; }
+ BOOL isTransient() { return mTransient; }
+ LLViewerObject* getObject();
+ void setObject(LLViewerObject* object);
+ // *NOTE: invalidate stored textures and colors when # faces change
+ void saveColors();
+ void saveTextures(const std::vector<LLUUID>& textures);
+ void saveTextureScaleRatios();
+
+ BOOL allowOperationOnNode(PermissionBit op, U64 group_proxy_power) const;
+
+public:
+ BOOL mIndividualSelection; // For root objects and objects individually selected
+
+ BOOL mTransient;
+ BOOL mValid; // is extra information valid?
+ LLPermissions* mPermissions;
+ LLSaleInfo mSaleInfo;
+ LLAggregatePermissions mAggregatePerm;
+ LLAggregatePermissions mAggregateTexturePerm;
+ LLAggregatePermissions mAggregateTexturePermOwner;
+ LLString mName;
+ LLString mDescription;
+ LLCategory mCategory;
+ S16 mInventorySerial;
+ LLVector3 mSavedPositionLocal; // for interactively modifying object position
+ LLVector3 mLastPositionLocal;
+ LLVector3d mSavedPositionGlobal; // for interactively modifying object position
+ LLVector3 mSavedScale; // for interactively modifying object scale
+ LLVector3 mLastScale;
+ LLQuaternion mSavedRotation; // for interactively modifying object rotation
+ LLQuaternion mLastRotation;
+ BOOL mDuplicated;
+ LLVector3d mDuplicatePos;
+ LLQuaternion mDuplicateRot;
+ LLUUID mItemID;
+ LLUUID mFolderID;
+ LLUUID mFromTaskID;
+ LLString mTouchName;
+ LLString mSitName;
+ U64 mCreationDate;
+ std::vector<LLColor4> mSavedColors;
+ std::vector<LLUUID> mSavedTextures;
+ std::vector<LLVector3> mTextureScaleRatios;
+ std::vector<LLVector3> mSilhouetteVertices; // array of vertices to render silhouette of object
+ std::vector<LLVector3> mSilhouetteNormals; // array of normals to render silhouette of object
+ std::vector<S32> mSilhouetteSegments; // array of normals to render silhouette of object
+ BOOL mSilhouetteExists; // need to generate silhouette?
+
+protected:
+ LLPointer<LLViewerObject> mObject;
+ BOOL mTESelected[SELECT_MAX_TES];
+ S32 mLastTESelected;
+};
+
+class LLObjectSelection : public LLRefCount
{
friend class LLSelectMgr;
protected:
~LLObjectSelection();
+ // List
+public:
+ typedef std::list<LLSelectNode*> list_t;
+private:
+ list_t mList;
+
+public:
+ // Iterators
+ struct is_non_null
+ {
+ bool operator()(LLSelectNode* node)
+ {
+ return (node->getObject() != NULL);
+ }
+ };
+ typedef boost::filter_iterator<is_non_null, list_t::iterator > iterator;
+ iterator begin() { return iterator(mList.begin(), mList.end()); }
+ iterator end() { return iterator(mList.end(), mList.end()); }
+
+ struct is_valid
+ {
+ bool operator()(LLSelectNode* node)
+ {
+ return (node->getObject() != NULL) && node->mValid;
+ }
+ };
+ typedef boost::filter_iterator<is_valid, list_t::iterator > valid_iterator;
+ valid_iterator valid_begin() { return valid_iterator(mList.begin(), mList.end()); }
+ valid_iterator valid_end() { return valid_iterator(mList.end(), mList.end()); }
+
+ struct is_root
+ {
+ bool operator()(LLSelectNode* node)
+ {
+ LLViewerObject* object = node->getObject();
+ return (object != NULL) && !node->mIndividualSelection && (object->isRootEdit() || object->isJointChild());
+ }
+ };
+ typedef boost::filter_iterator<is_root, list_t::iterator > root_iterator;
+ root_iterator root_begin() { return root_iterator(mList.begin(), mList.end()); }
+ root_iterator root_end() { return root_iterator(mList.end(), mList.end()); }
+
+ struct is_valid_root
+ {
+ bool operator()(LLSelectNode* node)
+ {
+ LLViewerObject* object = node->getObject();
+ return (object != NULL) && node->mValid && !node->mIndividualSelection && (object->isRootEdit() || object->isJointChild());
+ }
+ };
+ typedef boost::filter_iterator<is_root, list_t::iterator > valid_root_iterator;
+ valid_root_iterator valid_root_begin() { return valid_root_iterator(mList.begin(), mList.end()); }
+ valid_root_iterator valid_root_end() { return valid_root_iterator(mList.end(), mList.end()); }
+
public:
LLObjectSelection();
void updateEffects();
+ void cleanupNodes();
BOOL isEmpty();
S32 getOwnershipCost(S32 &cost);
- LLSelectNode* getFirstNode();
- LLSelectNode* getCurrentNode(); // Warning! This is NOT the same as the linked_list getCurrentNode
- LLSelectNode* getNextNode();
-
- LLSelectNode *getFirstRootNode();
- LLSelectNode *getNextRootNode();
-
- LLSelectNode* getFirstMoveableNode(BOOL get_root = FALSE);
-
- // iterate through objects
- LLViewerObject* getFirstObject();
- LLViewerObject* getNextObject();
-
- // iterate through root objects
- LLViewerObject *getFirstRootObject();
- LLViewerObject *getNextRootObject();
+ LLSelectNode* getFirstNode(LLSelectedNodeFunctor* func = NULL);
+ LLSelectNode* getFirstRootNode(LLSelectedNodeFunctor* func = NULL, BOOL non_root_ok = FALSE);
+ LLViewerObject* getFirstSelectedObject(LLSelectedNodeFunctor* func, BOOL get_parent = FALSE);
+ LLViewerObject* getFirstObject();
+ LLViewerObject* getFirstRootObject(BOOL non_root_ok = FALSE);
+
+ LLSelectNode* getFirstMoveableNode(BOOL get_root_first = FALSE);
- LLViewerObject* getFirstEditableObject(BOOL get_root = FALSE);
- LLViewerObject* getFirstCopyableObject(BOOL get_root = FALSE);
- LLViewerObject* getFirstDeleteableObject(BOOL get_root = FALSE);
- LLViewerObject* getFirstMoveableObject(BOOL get_root = FALSE);
+ LLViewerObject* getFirstEditableObject(BOOL get_parent = FALSE);
+ LLViewerObject* getFirstCopyableObject(BOOL get_parent = FALSE);
+ LLViewerObject* getFirstDeleteableObject();
+ LLViewerObject* getFirstMoveableObject(BOOL get_parent = FALSE);
LLViewerObject* getPrimaryObject() { return mPrimaryObject; }
// iterate through texture entries
- void getPrimaryTE(LLViewerObject* *object, S32 *te);
- void getFirstTE(LLViewerObject* *object, S32 *te);
- void getNextTE(LLViewerObject* *object, S32 *te);
- void getCurrentTE(LLViewerObject* *object, S32 *te);
-
+ template <typename T> bool getSelectedTEValue(LLSelectedTEGetFunctor<T>* func, T& res);
+
void addNode(LLSelectNode *nodep);
void addNodeAtEnd(LLSelectNode *nodep);
+ void moveNodeToFront(LLSelectNode *nodep);
void removeNode(LLSelectNode *nodep);
void deleteAllNodes(); // Delete all nodes
S32 getNumNodes();
@@ -178,21 +301,22 @@ public:
BOOL isAttachment();
// Apply functors to various subsets of the selected objects
- // Returns the AND of all apply() calls.
- bool applyToRootObjects(LLSelectedObjectFunctor* func);
- bool applyToObjects(LLSelectedObjectFunctor* func);
- bool applyToNodes(LLSelectedNodeFunctor* func);
+ // If firstonly is FALSE, returns the AND of all apply() calls.
+ // Else returns TRUE immediately if any apply() call succeeds (i.e. OR with early exit)
+ bool applyToRootObjects(LLSelectedObjectFunctor* func, bool firstonly = false);
+ bool applyToObjects(LLSelectedObjectFunctor* func, bool firstonly = false);
+ bool applyToTEs(LLSelectedTEFunctor* func, bool firstonly = false);
+ bool applyToRootNodes(LLSelectedNodeFunctor* func, bool firstonly = false);
+ bool applyToNodes(LLSelectedNodeFunctor* func, bool firstonly = false);
ESelectType getSelectType() { return mSelectType; }
private:
const LLObjectSelection &operator=(const LLObjectSelection &);
- LLPointer<LLViewerObject> mPrimaryObject;
- std::list<LLSelectNode*>::iterator mCurrentNode;
- S32 mCurrentTE;
- std::map<LLPointer<LLViewerObject>, LLSelectNode*> mSelectNodeMap;
- ESelectType mSelectType;
+ LLPointer<LLViewerObject> mPrimaryObject;
+ std::map<LLPointer<LLViewerObject>, LLSelectNode*> mSelectNodeMap;
+ ESelectType mSelectType;
};
typedef LLHandle<LLObjectSelection> LLObjectSelectionHandle;
@@ -239,6 +363,8 @@ public:
virtual void duplicate();
virtual BOOL canDuplicate();
+ void clearSelections();
+ void update();
void updateEffects(); // Update HUD effects
void overrideObjectUpdates();
@@ -261,7 +387,7 @@ public:
LLObjectSelectionHandle selectObjectAndFamily(LLViewerObject* object, BOOL add_to_end = FALSE);
// Same as above, but takes a list of objects. Used by rectangle select.
- LLObjectSelectionHandle selectObjectAndFamily(const LLDynamicArray<LLViewerObject*>& object_list, BOOL send_to_sim = TRUE);
+ LLObjectSelectionHandle selectObjectAndFamily(const std::vector<LLViewerObject*>& object_list, BOOL send_to_sim = TRUE);
// converts all objects currently highlighted to a selection, and returns it
LLObjectSelectionHandle selectHighlightedObjects();
@@ -270,7 +396,7 @@ public:
void highlightObjectOnly(LLViewerObject *objectp);
void highlightObjectAndFamily(LLViewerObject *objectp);
- void highlightObjectAndFamily(const LLDynamicArray<LLViewerObject*>& list);
+ void highlightObjectAndFamily(const std::vector<LLViewerObject*>& list);
////////////////////////////////////////////////////////////////
// Remove
@@ -317,7 +443,7 @@ public:
EGridMode getGridMode() { return mGridMode; }
void getGrid(LLVector3& origin, LLQuaternion& rotation, LLVector3 &scale);
- BOOL getTEMode() { return mTEMode; }
+ BOOL getTEMode() { return mTEMode; }
void setTEMode(BOOL b) { mTEMode = b; }
BOOL shouldShowSelection() { return mShowSelection; }
@@ -346,17 +472,7 @@ public:
void selectionDump();
BOOL selectionAllPCode(LLPCode code); // all objects have this PCode
- BOOL selectionGetMaterial(U8 *material); // all objects have same material
- BOOL selectionGetTexUUID(LLUUID& id); // true if all selected tes have same texture
- BOOL selectionGetColor(LLColor4 &color); // all tes have same color
- BOOL selectionGetTexScale(F32 *u, F32 *v); // true if all selected tes have same scale
- BOOL selectionGetTexOffset(F32 *u, F32 *v); // true if all selected tes have same offset
- BOOL selectionGetTexRotation(F32 *rad); // true if all selected tes have same rotation
- BOOL selectionGetBumpmap(U8 *bumpmap); // true if all selected tes have same
- BOOL selectionGetShiny(U8 *shiny); // true if all selected tes have same
- BOOL selectionGetFullbright(U8 *fullbright);// true if all selected tes have same
- bool selectionGetMediaType(U8 *media_type); // true if all selected tes have same
- BOOL selectionGetClickAction(U8* action);
+ BOOL selectionGetClickAction(U8 *out_action);
bool selectionGetIncludeInSearch(bool* include_in_search_out); // true if all selected objects have same
void selectionSetMaterial(U8 material);
@@ -381,9 +497,7 @@ public:
void selectionSetObjectSaleInfo(const LLSaleInfo& sale_info);
void selectionTexScaleAutofit(F32 repeats_per_meter);
- void selectionResetTexInfo(S32 te); // sets S,T to 1
void adjustTexturesByScale(BOOL send_to_sim, BOOL stretch);
- BOOL getTESTAxes(const LLViewerObject* object, const U8 te, U32* s_axis, U32* t_axis); // Only for flex boxes
void selectionResetRotation(); // sets rotation quat to identity
void selectionRotateAroundZ(F32 degrees);
@@ -396,7 +510,7 @@ public:
// returns TRUE if it is possible to select this object
BOOL canSelectObject(LLViewerObject* object);
- // Returns true if the viewer has information on all selected objects
+ // Returns TRUE if the viewer has information on all selected objects
BOOL selectGetAllRootsValid();
BOOL selectGetAllValid();
@@ -410,17 +524,17 @@ public:
// returns TRUE if selected objects can be copied.
BOOL selectGetRootsCopy();
- BOOL selectGetCreator(LLUUID& id, LLString& name); // true if all have same creator, returns id
- BOOL selectGetOwner(LLUUID& id, LLString& name); // true if all objects have same owner, returns id
- BOOL selectGetLastOwner(LLUUID& id, LLString& name); // true if all objects have same owner, returns id
+ BOOL selectGetCreator(LLUUID& id, LLString& name); // TRUE if all have same creator, returns id
+ BOOL selectGetOwner(LLUUID& id, LLString& name); // TRUE if all objects have same owner, returns id
+ BOOL selectGetLastOwner(LLUUID& id, LLString& name); // TRUE if all objects have same owner, returns id
// returns TRUE if all are the same. id is stuffed with
// the value found if available.
BOOL selectGetGroup(LLUUID& id);
- BOOL selectGetPerm( U8 which_perm, U32* mask_on, U32* mask_off); // true if all have data, returns two masks, each indicating which bits are all on and all off
+ BOOL selectGetPerm( U8 which_perm, U32* mask_on, U32* mask_off); // TRUE if all have data, returns two masks, each indicating which bits are all on and all off
BOOL selectGetOwnershipCost(S32* cost); // sum of all ownership costs
- BOOL selectIsGroupOwned(); // true if all root objects have valid data and are group owned.
+ BOOL selectIsGroupOwned(); // TRUE if all root objects have valid data and are group owned.
// returns TRUE if all the nodes are valid. Accumulates
// permissions in the parameter.
@@ -491,7 +605,7 @@ public:
void updatePointAt();
// Internal list maintenance functions. TODO: Make these private!
- void remove(LLDynamicArray<LLViewerObject*>& objects);
+ void remove(std::vector<LLViewerObject*>& objects);
void remove(LLViewerObject* object, S32 te = SELECT_ALL_TES, BOOL undoable = TRUE);
void removeAll();
void addAsIndividual(LLViewerObject* object, S32 te = SELECT_ALL_TES, BOOL undoable = TRUE);
@@ -501,7 +615,7 @@ public:
private:
void convertTransient(); // converts temporarily selected objects to full-fledged selections
ESelectType getSelectTypeForObject(LLViewerObject* object);
- void addAsFamily(LLDynamicArray<LLViewerObject*>& objects, BOOL add_to_end = FALSE);
+ void addAsFamily(std::vector<LLViewerObject*>& objects, BOOL add_to_end = FALSE);
void generateSilhouette(LLSelectNode *nodep, const LLVector3& view_point);
// Send one message to each region containing an object on selection list.
void sendListToRegions( const LLString& message_name,
@@ -574,78 +688,71 @@ private:
LLAnimPauseRequest mPauseRequest;
};
-
-// Contains information about a selected object, particularly which
-// tes are selected.
-class LLSelectNode
-{
-public:
- LLSelectNode(LLViewerObject* object, BOOL do_glow);
- LLSelectNode(const LLSelectNode& nodep);
- ~LLSelectNode();
-
- void selectAllTEs(BOOL b);
- void selectTE(S32 te_index, BOOL selected);
- BOOL isTESelected(S32 te_index);
- S32 getLastSelectedTE();
- void renderOneSilhouette(const LLColor4 &color);
- void setTransient(BOOL transient) { mTransient = transient; }
- BOOL isTransient() { return mTransient; }
- LLViewerObject *getObject();
- // *NOTE: invalidate stored textures and colors when # faces change
- void saveColors();
- void saveTextures(const std::vector<LLUUID>& textures);
- void saveTextureScaleRatios();
-
- BOOL allowOperationOnNode(PermissionBit op, U64 group_proxy_power) const;
-
-public:
- BOOL mIndividualSelection; // For root objects and objects individually selected
-
- BOOL mTransient;
- BOOL mValid; // is extra information valid?
- LLPermissions* mPermissions;
- LLSaleInfo mSaleInfo;
- LLAggregatePermissions mAggregatePerm;
- LLAggregatePermissions mAggregateTexturePerm;
- LLAggregatePermissions mAggregateTexturePermOwner;
- LLString mName;
- LLString mDescription;
- LLCategory mCategory;
- S16 mInventorySerial;
- LLVector3 mSavedPositionLocal; // for interactively modifying object position
- LLVector3 mLastPositionLocal;
- LLVector3d mSavedPositionGlobal; // for interactively modifying object position
- LLVector3 mSavedScale; // for interactively modifying object scale
- LLVector3 mLastScale;
- LLQuaternion mSavedRotation; // for interactively modifying object rotation
- LLQuaternion mLastRotation;
- BOOL mDuplicated;
- LLVector3d mDuplicatePos;
- LLQuaternion mDuplicateRot;
- LLUUID mItemID;
- LLUUID mFolderID;
- LLUUID mFromTaskID;
- LLString mTouchName;
- LLString mSitName;
- U64 mCreationDate;
- std::vector<LLColor4> mSavedColors;
- std::vector<LLUUID> mSavedTextures;
- std::vector<LLVector3> mTextureScaleRatios;
- std::vector<LLVector3> mSilhouetteVertices; // array of vertices to render silhouette of object
- std::vector<LLVector3> mSilhouetteNormals; // array of normals to render silhouette of object
- std::vector<S32> mSilhouetteSegments; // array of normals to render silhouette of object
- BOOL mSilhouetteExists; // need to generate silhouette?
-
-protected:
- LLPointer<LLViewerObject> mObject;
- BOOL mTESelected[SELECT_MAX_TES];
- S32 mLastTESelected;
-};
-
extern LLSelectMgr* gSelectMgr;
// Utilities
void dialog_refresh_all(); // Update subscribers to the selection list
+// Templates
+//-----------------------------------------------------------------------------
+// getSelectedTEValue
+//-----------------------------------------------------------------------------
+template <typename T> bool LLObjectSelection::getSelectedTEValue(LLSelectedTEGetFunctor<T>* func, T& res)
+{
+ bool have_first = false;
+ bool have_selected = false;
+ T selected_value = T();
+
+ // Now iterate through all TEs to test for sameness
+ bool identical = TRUE;
+ for (iterator iter = begin(); iter != end(); iter++)
+ {
+ LLSelectNode* node = *iter;
+ LLViewerObject* object = node->getObject();
+ S32 selected_te = -1;
+ if (object == getPrimaryObject())
+ {
+ selected_te = node->getLastSelectedTE();
+ }
+ for (S32 te = 0; te < object->getNumTEs(); ++te)
+ {
+ if (!node->isTESelected(te))
+ {
+ continue;
+ }
+ T value = func->get(object, te);
+ if (!have_first)
+ {
+ have_first = true;
+ if (!have_selected)
+ {
+ selected_value = value;
+ }
+ }
+ else
+ {
+ if ( value != selected_value )
+ {
+ identical = false;
+ }
+ if (te == selected_te)
+ {
+ selected_value = value;
+ have_selected = true;
+ }
+ }
+ }
+ if (!identical && have_selected)
+ {
+ break;
+ }
+ }
+ if (have_first || have_selected)
+ {
+ res = selected_value;
+ }
+ return identical;
+}
+
+
#endif
diff --git a/indra/newview/llstartup.cpp b/indra/newview/llstartup.cpp
index fc4754b0ae..4ade8c57ff 100644
--- a/indra/newview/llstartup.cpp
+++ b/indra/newview/llstartup.cpp
@@ -409,7 +409,7 @@ BOOL idle_startup()
}
if (!xml_ok)
{
- // XUI:translate (maybe - very unlikely error message)
+ // *TODO:translate (maybe - very unlikely error message)
// Note: alerts.xml may be invalid - if this gets translated it will need to be in the code
LLString bad_xui_msg = "An error occured while updating Second Life. Please download the latest version from www.secondlife.com.";
app_early_exit(bad_xui_msg);
@@ -537,7 +537,7 @@ BOOL idle_startup()
// LibXUL (Mozilla) initialization
//---------------------------------------------------------------------
#if LL_LIBXUL_ENABLED
- set_startup_status(0.48f, "Initializing embedded web browser...", gAgent.mMOTD.c_str());
+ set_startup_status(0.58f, "Initializing embedded web browser...", gAgent.mMOTD.c_str());
display_startup();
llinfos << "Initializing embedded web browser..." << llendl;
@@ -1649,12 +1649,17 @@ BOOL idle_startup()
gSky.init(initial_sun_direction);
}
- set_startup_status(0.45f, "Decoding UI images...", gAgent.mMOTD.c_str());
- display_startup();
llinfos << "Decoding images..." << llendl;
// For all images pre-loaded into viewer cache, decode them.
// Need to do this AFTER we init the sky
- gImageList.decodeAllImages(2.f);
+ const S32 DECODE_TIME_SEC = 2;
+ for (int i = 0; i < DECODE_TIME_SEC; i++)
+ {
+ F32 frac = (F32)i / (F32)DECODE_TIME_SEC;
+ set_startup_status(0.45f + frac*0.1f, "Decoding images...", gAgent.mMOTD.c_str());
+ display_startup();
+ gImageList.decodeAllImages(1.f);
+ }
LLStartUp::setStartupState( STATE_QUICKTIME_INIT );
// JC - Do this as late as possible to increase likelihood Purify
@@ -1704,7 +1709,7 @@ BOOL idle_startup()
{
// initialize quicktime libraries (fails gracefully if quicktime not installed ($QUICKTIME)
llinfos << "Initializing QuickTime...." << llendl;
- set_startup_status(0.47f, "Initializing QuickTime...", gAgent.mMOTD.c_str());
+ set_startup_status(0.57f, "Initializing QuickTime...", gAgent.mMOTD.c_str());
display_startup();
#if LL_WINDOWS
// Only necessary/available on Windows.
@@ -1713,12 +1718,12 @@ BOOL idle_startup()
// quicktime init failed - turn off media engine support
LLMediaEngine::getInstance ()->setAvailable ( FALSE );
llinfos << "...not found - unable to initialize." << llendl;
- set_startup_status(0.47f, "QuickTime not found - unable to initialize.", gAgent.mMOTD.c_str());
+ set_startup_status(0.57f, "QuickTime not found - unable to initialize.", gAgent.mMOTD.c_str());
}
else
{
llinfos << ".. initialized successfully." << llendl;
- set_startup_status(0.47f, "QuickTime initialized successfully.", gAgent.mMOTD.c_str());
+ set_startup_status(0.57f, "QuickTime initialized successfully.", gAgent.mMOTD.c_str());
};
#endif
EnterMovies ();
@@ -1736,7 +1741,7 @@ BOOL idle_startup()
if(STATE_WORLD_WAIT == LLStartUp::getStartupState())
{
//llinfos << "Waiting for simulator ack...." << llendl;
- set_startup_status(0.49f, "Waiting for region handshake...", gAgent.mMOTD.c_str());
+ set_startup_status(0.59f, "Waiting for region handshake...", gAgent.mMOTD.c_str());
if(gGotUseCircuitCodeAck)
{
LLStartUp::setStartupState( STATE_AGENT_SEND );
@@ -1755,7 +1760,7 @@ BOOL idle_startup()
if (STATE_AGENT_SEND == LLStartUp::getStartupState())
{
llinfos << "Connecting to region..." << llendl;
- set_startup_status(0.50f, "Connecting to region...", gAgent.mMOTD.c_str());
+ set_startup_status(0.60f, "Connecting to region...", gAgent.mMOTD.c_str());
// register with the message system so it knows we're
// expecting this message
LLMessageSystem* msg = gMessageSystem;
@@ -2118,6 +2123,7 @@ BOOL idle_startup()
gInitializationComplete = TRUE;
gRenderStartTime.reset();
+ gForegroundTime.reset();
// HACK: Inform simulator of window size.
// Do this here so it's less likely to race with RegisterNewAgent.
@@ -2198,7 +2204,7 @@ BOOL idle_startup()
else
{
update_texture_fetch();
- set_startup_status(0.50f + 0.50f * timeout_frac, "Precaching...",
+ set_startup_status(0.60f + 0.40f * timeout_frac, "Precaching...",
gAgent.mMOTD.c_str());
}
@@ -2325,11 +2331,8 @@ void login_show()
bUseDebugLogin,
login_callback, NULL );
- llinfos << "Decoding Images" << llendl;
+ // UI textures have been previously loaded in doPreloadImages()
- // Make sure all the UI textures are present and decoded.
- gImageList.decodeAllImages(2.f);
-
llinfos << "Setting Servers" << llendl;
if( USERSERVER_OTHER == gUserServerChoice )
@@ -2567,7 +2570,7 @@ void update_app(BOOL mandatory, const std::string& auth_msg)
std::ostringstream message;
- //XUI:translate
+ //*TODO:translate
std::string msg;
if (!auth_msg.empty())
{
@@ -2909,11 +2912,11 @@ void register_viewer_callbacks(LLMessageSystem* msg)
msg->setHandlerFuncFast(_PREHASH_GrantGodlikePowers, process_grant_godlike_powers);
msg->setHandlerFuncFast(_PREHASH_GroupAccountSummaryReply,
- LLGroupMoneyPlanningTabEventHandler::processGroupAccountSummaryReply);
+ LLPanelGroupLandMoney::processGroupAccountSummaryReply);
msg->setHandlerFuncFast(_PREHASH_GroupAccountDetailsReply,
- LLGroupMoneyDetailsTabEventHandler::processGroupAccountDetailsReply);
+ LLPanelGroupLandMoney::processGroupAccountDetailsReply);
msg->setHandlerFuncFast(_PREHASH_GroupAccountTransactionsReply,
- LLGroupMoneySalesTabEventHandler::processGroupAccountTransactionsReply);
+ LLPanelGroupLandMoney::processGroupAccountTransactionsReply);
msg->setHandlerFuncFast(_PREHASH_UserInfoReply,
process_user_info_reply);
@@ -3598,7 +3601,6 @@ void callback_choose_gender(S32 option, void* userdata)
gAgent.setGenderChosen(TRUE);
}
-// XUI:translate
void dialog_choose_gender_first_start()
{
if (!gNoRender
diff --git a/indra/newview/llstatusbar.cpp b/indra/newview/llstatusbar.cpp
index 9b7d31acb4..9bbb25fd2b 100644
--- a/indra/newview/llstatusbar.cpp
+++ b/indra/newview/llstatusbar.cpp
@@ -252,6 +252,8 @@ void LLStatusBar::refresh()
mSGBandwidth->setThreshold(1, bwtotal);
mSGBandwidth->setThreshold(2, bwtotal);
+ // *TODO: Localize / translate time
+
// Get current UTC time, adjusted for the user's clock
// being off.
U32 utc_time;
@@ -285,7 +287,7 @@ void LLStatusBar::refresh()
t << std::setfill(' ') << std::setw(2) << hour << ":"
<< std::setfill('0') << std::setw(2) << min
<< " " << am_pm << " " << tz;
- mTextTime->setText(t.str().c_str());
+ mTextTime->setText(t.str());
// Year starts at 1900, set the tooltip to have the date
std::ostringstream date;
@@ -462,13 +464,13 @@ void LLStatusBar::refresh()
pos_y -= pos_y % 2;
}
- if (parcel && parcel->getName())
+ if (parcel && !parcel->getName().empty())
{
location_name = region->getName()
+ llformat(" %d, %d, %d (%s) - %s",
pos_x, pos_y, pos_z,
region->getSimAccessString(),
- parcel->getName());
+ parcel->getName().c_str());
}
else
{
@@ -537,10 +539,8 @@ void LLStatusBar::setBalance(S32 balance)
void LLStatusBar::setHealth(S32 health)
{
- char buffer[MAX_STRING]; /* Flawfinder: ignore */
- snprintf(buffer, MAX_STRING, "%d%%", health); /* Flawfinder: ignore */
//llinfos << "Setting health to: " << buffer << llendl;
- mTextHealth->setText(buffer);
+ mTextHealth->setText(llformat("%d%%", health));
if( mHealth > health )
{
diff --git a/indra/newview/lltexturectrl.cpp b/indra/newview/lltexturectrl.cpp
index 2d013e04fb..b961053799 100644
--- a/indra/newview/lltexturectrl.cpp
+++ b/indra/newview/lltexturectrl.cpp
@@ -344,13 +344,12 @@ void LLFloaterTexturePicker::updateImageStats()
//RN: have we received header data for this image?
if (mTexturep->getWidth(0) > 0 && mTexturep->getHeight(0) > 0)
{
- std::ostringstream formatted_dims;
- formatted_dims << llformat("Dimensions: %d x %d", mTexturep->getWidth(0),mTexturep->getHeight(0));
- mResolutionLabel->setText(formatted_dims.str());
+ LLString formatted_dims = llformat("%d x %d", mTexturep->getWidth(0),mTexturep->getHeight(0));
+ mResolutionLabel->setTextArg("[DIMENSIONS]", formatted_dims);
}
else
{
- mResolutionLabel->setText("Dimensions: unknown");
+ mResolutionLabel->setTextArg("[DIMENSIONS]", LLString("[? x ?]"));
}
if (gAgent.isGodlike())
{
@@ -1454,3 +1453,4 @@ BOOL LLToolTexEyedropper::handleHover(S32 x, S32 y, MASK mask)
return TRUE;
}
+
diff --git a/indra/newview/lltextureview.cpp b/indra/newview/lltextureview.cpp
index 06c014a7e7..4df5444d66 100644
--- a/indra/newview/lltextureview.cpp
+++ b/indra/newview/lltextureview.cpp
@@ -641,16 +641,20 @@ void LLTextureView::draw()
#if 1
if (pri < HIGH_PRIORITY && gSelectMgr)
{
- S32 te;
- LLViewerObject *objectp;
- LLObjectSelectionHandle selection = gSelectMgr->getSelection();
- for (selection->getFirstTE(&objectp, &te); objectp; selection->getNextTE(&objectp, &te))
+ struct f : public LLSelectedTEFunctor
{
- if (imagep == objectp->getTEImage(te))
+ LLViewerImage* mImage;
+ f(LLViewerImage* image) : mImage(image) {}
+ virtual bool apply(LLViewerObject* object, S32 te)
{
- pri += 3*HIGH_PRIORITY;
- break;
+ return (mImage == object->getTEImage(te));
}
+ } func(imagep);
+ const bool firstonly = true;
+ bool match = gSelectMgr->getSelection()->applyToTEs(&func, firstonly);
+ if (match)
+ {
+ pri += 3*HIGH_PRIORITY;
}
}
#endif
diff --git a/indra/newview/lltoolbrush.cpp b/indra/newview/lltoolbrush.cpp
index f7b1405074..a56bf42cee 100644
--- a/indra/newview/lltoolbrush.cpp
+++ b/indra/newview/lltoolbrush.cpp
@@ -416,7 +416,7 @@ void LLToolBrushLand::handleSelect()
{
gEditMenuHandler = this;
- gFloaterTools->setStatusText("Click and hold to modify land");
+ gFloaterTools->setStatusText("modifyland");
// if (!mBrushSelected)
{
mLastShowParcelOwners = gSavedSettings.getBOOL("ShowParcelOwners");
@@ -432,7 +432,6 @@ void LLToolBrushLand::handleDeselect()
{
gEditMenuHandler = NULL;
}
- gFloaterTools->setStatusText("");
mLastShowParcelOwners = gSavedSettings.getBOOL("ShowParcelOwners");
gSavedSettings.setBOOL("ShowParcelOwners", mLastShowParcelOwners);
gParcelMgr->setSelectionVisible(TRUE);
diff --git a/indra/newview/lltoolcomp.cpp b/indra/newview/lltoolcomp.cpp
index 65182d366e..182ea5602e 100644
--- a/indra/newview/lltoolcomp.cpp
+++ b/indra/newview/lltoolcomp.cpp
@@ -250,11 +250,7 @@ void LLToolCompTranslate::pickCallback(S32 x, S32 y, MASK mask)
gEditMenuHandler = gSelectMgr;
}
- BOOL can_move = gToolTranslate->mManip->getSelection()->getObjectCount() != 0;
- for (LLViewerObject* objectp = gToolTranslate->mManip->getSelection()->getFirstObject(); objectp; objectp = gToolTranslate->mManip->getSelection()->getNextObject())
- {
- can_move = can_move && objectp->permMove() && (objectp->permModify() || !gSavedSettings.getBOOL("EditLinkedParts"));
- }
+ BOOL can_move = gToolTranslate->mManip->canAffectSelection();
if( LLManip::LL_NO_PART != gToolTranslate->mManip->getHighlightedPart() && can_move)
{
diff --git a/indra/newview/lltoolfocus.cpp b/indra/newview/lltoolfocus.cpp
index c4a8ac307f..2ac2b33945 100644
--- a/indra/newview/lltoolfocus.cpp
+++ b/indra/newview/lltoolfocus.cpp
@@ -94,17 +94,13 @@ void LLToolCamera::handleSelect()
{
if (gFloaterTools)
{
- gFloaterTools->setStatusText("Click and drag to change view");
+ gFloaterTools->setStatusText("camera");
}
}
// virtual
void LLToolCamera::handleDeselect()
{
- if (gFloaterTools)
- {
- gFloaterTools->setStatusText("");
- }
// gAgent.setLookingAtAvatar(FALSE);
}
diff --git a/indra/newview/lltoolgrab.cpp b/indra/newview/lltoolgrab.cpp
index e416e25777..13977ee3ac 100644
--- a/indra/newview/lltoolgrab.cpp
+++ b/indra/newview/lltoolgrab.cpp
@@ -101,7 +101,7 @@ void LLToolGrab::handleSelect()
if(gFloaterTools)
{
// viewer can crash during startup if we don't check.
- gFloaterTools->setStatusText("Drag to move objects, Ctrl to lift, Ctrl-Shift to spin");
+ gFloaterTools->setStatusText("grab");
}
gGrabBtnVertical = FALSE;
gGrabBtnSpin = FALSE;
@@ -114,7 +114,6 @@ void LLToolGrab::handleDeselect()
setMouseCapture( FALSE );
}
- gFloaterTools->setStatusText("");
}
BOOL LLToolGrab::handleDoubleClick(S32 x, S32 y, MASK mask)
diff --git a/indra/newview/lltoolindividual.cpp b/indra/newview/lltoolindividual.cpp
index 24bac8a7fe..3ec6b7d4d3 100644
--- a/indra/newview/lltoolindividual.cpp
+++ b/indra/newview/lltoolindividual.cpp
@@ -108,11 +108,8 @@ BOOL LLToolIndividual::handleDoubleClick(S32 x, S32 y, MASK mask)
void LLToolIndividual::handleSelect()
{
- LLViewerObject* obj = gSelectMgr->getSelection()->getFirstRootObject();
- if(!obj)
- {
- obj = gSelectMgr->getSelection()->getFirstObject();
- }
+ const BOOL children_ok = TRUE;
+ LLViewerObject* obj = gSelectMgr->getSelection()->getFirstRootObject(children_ok);
gSelectMgr->deselectAll();
if(obj)
{
diff --git a/indra/newview/lltoolmgr.cpp b/indra/newview/lltoolmgr.cpp
index 7391a53036..ae74eba026 100644
--- a/indra/newview/lltoolmgr.cpp
+++ b/indra/newview/lltoolmgr.cpp
@@ -338,18 +338,21 @@ LLTool* LLToolMgr::getCurrentTool()
cur_tool = mOverrideTool ? mOverrideTool : mBaseTool;
}
+ LLTool* prev_tool = mSelectedTool;
+ // Set the selected tool to avoid infinite recursion
+ mSelectedTool = cur_tool;
+
//update tool selection status
- if (mSelectedTool != cur_tool)
+ if (prev_tool != cur_tool)
{
- if (mSelectedTool)
+ if (prev_tool)
{
- mSelectedTool->handleDeselect();
+ prev_tool->handleDeselect();
}
if (cur_tool)
{
cur_tool->handleSelect();
}
- mSelectedTool = cur_tool;
}
return mSelectedTool;
diff --git a/indra/newview/lltoolpie.cpp b/indra/newview/lltoolpie.cpp
index cdf2b25a39..55692d1962 100644
--- a/indra/newview/lltoolpie.cpp
+++ b/indra/newview/lltoolpie.cpp
@@ -310,12 +310,12 @@ BOOL LLToolPie::pickAndShowMenu(S32 x, S32 y, MASK mask, BOOL always_show)
LLString name = avatar->getFullname();
if (gMuteListp->isMuted(avatar->getID(), name))
{
- gMenuHolder->childSetText("Avatar Mute", "Unmute");
+ gMenuHolder->childSetText("Avatar Mute", LLString("Unmute")); // *TODO:Translate
//gMutePieMenu->setLabel("Unmute");
}
else
{
- gMenuHolder->childSetText("Avatar Mute", "Mute");
+ gMenuHolder->childSetText("Avatar Mute", LLString("Mute")); // *TODO:Translate
//gMutePieMenu->setLabel("Mute");
}
@@ -336,12 +336,12 @@ BOOL LLToolPie::pickAndShowMenu(S32 x, S32 y, MASK mask, BOOL always_show)
}
if (gMuteListp->isMuted(object->getID(), name))
{
- gMenuHolder->childSetText("Object Mute", "Unmute");
+ gMenuHolder->childSetText("Object Mute", LLString("Unmute")); // *TODO:Translate
//gMuteObjectPieMenu->setLabel("Unmute");
}
else
{
- gMenuHolder->childSetText("Object Mute", "Mute");
+ gMenuHolder->childSetText("Object Mute", LLString("Mute")); // *TODO:Translate
//gMuteObjectPieMenu->setLabel("Mute");
}
@@ -675,3 +675,4 @@ void LLToolPie::render()
return;
}
+
diff --git a/indra/newview/lltoolplacer.cpp b/indra/newview/lltoolplacer.cpp
index f99bb3da22..ee5d08f128 100644
--- a/indra/newview/lltoolplacer.cpp
+++ b/indra/newview/lltoolplacer.cpp
@@ -148,12 +148,11 @@ BOOL LLToolPlacer::handleHover(S32 x, S32 y, MASK mask)
void LLToolPlacer::handleSelect()
{
- gFloaterTools->setStatusText("Click in the world to create, shift-click to select");
+ gFloaterTools->setStatusText("place");
}
void LLToolPlacer::handleDeselect()
{
- gFloaterTools->setStatusText("");
}
//////////////////////////////////////////////////////
diff --git a/indra/newview/lltoolselectland.cpp b/indra/newview/lltoolselectland.cpp
index f54caff738..dae8288810 100644
--- a/indra/newview/lltoolselectland.cpp
+++ b/indra/newview/lltoolselectland.cpp
@@ -219,7 +219,7 @@ void LLToolSelectLand::render()
void LLToolSelectLand::handleSelect()
{
- gFloaterTools->setStatusText("Click and drag to select land");
+ gFloaterTools->setStatusText("selectland");
mLastShowParcelOwners = gSavedSettings.getBOOL("ShowParcelOwners");
gSavedSettings.setBOOL("ShowParcelOwners", mLastShowParcelOwners);
}
@@ -227,7 +227,6 @@ void LLToolSelectLand::handleSelect()
void LLToolSelectLand::handleDeselect()
{
- gFloaterTools->setStatusText("");
mSelection = NULL;
mLastShowParcelOwners = gSavedSettings.getBOOL("ShowParcelOwners");
//gParcelMgr->deselectLand();
diff --git a/indra/newview/lltoolview.cpp b/indra/newview/lltoolview.cpp
index 1129479480..b3f0dc4883 100644
--- a/indra/newview/lltoolview.cpp
+++ b/indra/newview/lltoolview.cpp
@@ -75,7 +75,7 @@ LLToolView::~LLToolView()
mContainList.deleteAllData();
}
-//XUI: translate
+//*TODO:translate?
void LLToolView::addTool(const LLString& icon_off, const LLString& icon_on, LLPanel* panel, LLTool* tool, LLView* hoverView, const char* label)
{
llassert(tool);
@@ -195,3 +195,4 @@ void LLToolView::onClickToolButton(void* userdata)
gToolMgr->getCurrentToolset()->selectTool( clicked->mTool );
}
+
diff --git a/indra/newview/llviewercontrol.cpp b/indra/newview/llviewercontrol.cpp
index 7c69fc6648..79ec70fb1c 100644
--- a/indra/newview/llviewercontrol.cpp
+++ b/indra/newview/llviewercontrol.cpp
@@ -258,7 +258,7 @@ void LLFloaterSettingsDebug::updateControl(LLControlBase* controlp)
color_swatch->setVisible(FALSE);
childSetVisible("val_text", FALSE);
childSetVisible("boolean_combo", FALSE);
- mComment->setText("");
+ mComment->setText(LLString::null);
if (controlp)
{
@@ -294,7 +294,7 @@ void LLFloaterSettingsDebug::updateControl(LLControlBase* controlp)
{
case TYPE_U32:
spinner1->setVisible(TRUE);
- spinner1->setLabel("value");
+ spinner1->setLabel(LLString("value")); // Debug, don't translate
if (!spinner1->hasFocus())
{
spinner1->setValue(sd);
@@ -306,7 +306,7 @@ void LLFloaterSettingsDebug::updateControl(LLControlBase* controlp)
break;
case TYPE_S32:
spinner1->setVisible(TRUE);
- spinner1->setLabel("value");
+ spinner1->setLabel(LLString("value")); // Debug, don't translate
if (!spinner1->hasFocus())
{
spinner1->setValue(sd);
@@ -318,7 +318,7 @@ void LLFloaterSettingsDebug::updateControl(LLControlBase* controlp)
break;
case TYPE_F32:
spinner1->setVisible(TRUE);
- spinner1->setLabel("value");
+ spinner1->setLabel(LLString("value")); // Debug, don't translate
if (!spinner1->hasFocus())
{
spinner1->setPrecision(3);
@@ -352,11 +352,11 @@ void LLFloaterSettingsDebug::updateControl(LLControlBase* controlp)
LLVector3 v;
v.setValue(sd);
spinner1->setVisible(TRUE);
- spinner1->setLabel("X");
+ spinner1->setLabel(LLString("X"));
spinner2->setVisible(TRUE);
- spinner2->setLabel("Y");
+ spinner2->setLabel(LLString("Y"));
spinner3->setVisible(TRUE);
- spinner3->setLabel("Z");
+ spinner3->setLabel(LLString("Z"));
if (!spinner1->hasFocus())
{
spinner1->setPrecision(3);
@@ -379,11 +379,11 @@ void LLFloaterSettingsDebug::updateControl(LLControlBase* controlp)
LLVector3d v;
v.setValue(sd);
spinner1->setVisible(TRUE);
- spinner1->setLabel("X");
+ spinner1->setLabel(LLString("X"));
spinner2->setVisible(TRUE);
- spinner2->setLabel("Y");
+ spinner2->setLabel(LLString("Y"));
spinner3->setVisible(TRUE);
- spinner3->setLabel("Z");
+ spinner3->setLabel(LLString("Z"));
if (!spinner1->hasFocus())
{
spinner1->setPrecision(3);
@@ -406,13 +406,13 @@ void LLFloaterSettingsDebug::updateControl(LLControlBase* controlp)
LLRect r;
r.setValue(sd);
spinner1->setVisible(TRUE);
- spinner1->setLabel("Left");
+ spinner1->setLabel(LLString("Left"));
spinner2->setVisible(TRUE);
- spinner2->setLabel("Right");
+ spinner2->setLabel(LLString("Right"));
spinner3->setVisible(TRUE);
- spinner3->setLabel("Bottom");
+ spinner3->setLabel(LLString("Bottom"));
spinner4->setVisible(TRUE);
- spinner4->setLabel("Top");
+ spinner4->setLabel(LLString("Top"));
if (!spinner1->hasFocus())
{
spinner1->setPrecision(0);
@@ -462,7 +462,7 @@ void LLFloaterSettingsDebug::updateControl(LLControlBase* controlp)
color_swatch->set(LLColor4(sd), TRUE, FALSE);
}
spinner4->setVisible(TRUE);
- spinner4->setLabel("Alpha");
+ spinner4->setLabel(LLString("Alpha"));
if (!spinner4->hasFocus())
{
spinner4->setPrecision(3);
@@ -490,7 +490,7 @@ void LLFloaterSettingsDebug::updateControl(LLControlBase* controlp)
color_swatch->set(LLColor4(clr), TRUE, FALSE);
}
spinner4->setVisible(TRUE);
- spinner4->setLabel("Alpha");
+ spinner4->setLabel(LLString("Alpha"));
if(!spinner4->hasFocus())
{
spinner4->setPrecision(0);
@@ -504,7 +504,7 @@ void LLFloaterSettingsDebug::updateControl(LLControlBase* controlp)
break;
}
default:
- mComment->setText("unknown");
+ mComment->setText(LLString("unknown"));
break;
}
}
diff --git a/indra/newview/llviewerdisplay.cpp b/indra/newview/llviewerdisplay.cpp
index c7a892fe70..b4dc093f6a 100644
--- a/indra/newview/llviewerdisplay.cpp
+++ b/indra/newview/llviewerdisplay.cpp
@@ -242,6 +242,10 @@ void display(BOOL rebuild, F32 zoom_factor, int subfield)
LLVOAvatar::sRenderName = gSavedSettings.getS32("RenderName");
gPipeline.mBackfaceCull = TRUE;
gFrameCount++;
+ if (gFocusMgr.getAppHasFocus())
+ {
+ gForegroundFrameCount++;
+ }
//////////////////////////////////////////////////////////
//
diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp
index c1e2b5e9d3..28c504910b 100644
--- a/indra/newview/llviewermenu.cpp
+++ b/indra/newview/llviewermenu.cpp
@@ -636,10 +636,12 @@ void init_menus()
// flash when an item is triggered (the flash occurs in the holder)
gViewerWindow->getRootView()->addChild(gMenuHolder);
- gMenuHolder->childSetLabelArg("Upload Image", "[COST]", "10");
- gMenuHolder->childSetLabelArg("Upload Sound", "[COST]", "10");
- gMenuHolder->childSetLabelArg("Upload Animation", "[COST]", "10");
- gMenuHolder->childSetLabelArg("Bulk Upload", "[COST]", "10");
+ // *TODO:Get the cost info from the server
+ const LLString upload_cost("10");
+ gMenuHolder->childSetLabelArg("Upload Image", "[COST]", upload_cost);
+ gMenuHolder->childSetLabelArg("Upload Sound", "[COST]", upload_cost);
+ gMenuHolder->childSetLabelArg("Upload Animation", "[COST]", upload_cost);
+ gMenuHolder->childSetLabelArg("Bulk Upload", "[COST]", upload_cost);
gAFKMenu = (LLMenuItemCallGL*)gMenuBarView->getChildByName("Set Away", TRUE);
gBusyMenu = (LLMenuItemCallGL*)gMenuBarView->getChildByName("Set Busy", TRUE);
@@ -3395,31 +3397,33 @@ void derez_objects(EDeRezDestination dest, const LLUUID& dest_id)
}
//gInventoryView->setPanelOpen(TRUE);
- LLObjectSelectionHandle selection = gSelectMgr->getSelection();
- LLViewerObject* object = NULL;
- LLSelectNode* node = selection->getFirstRootNode();
- if(!node) return;
- object = node->getObject();
- if(!object) return;
- LLViewerRegion* region = object->getRegion();
- char* error = NULL;
-
+ std::string error;
+ LLDynamicArray<LLViewerObject*> derez_objects;
+
// Check conditions that we can't deal with, building a list of
// everything that we'll actually be derezzing.
- LLDynamicArray<LLViewerObject*> derez_objects;
- BOOL can_derez_current;
- for( ; node != NULL; node = selection->getNextRootNode())
+ LLViewerRegion* first_region = NULL;
+ for (LLObjectSelection::valid_root_iterator iter = gSelectMgr->getSelection()->valid_root_begin();
+ iter != gSelectMgr->getSelection()->valid_root_end(); iter++)
{
- object = node->getObject();
- if(!object || !node->mValid) continue;
- if(object->getRegion() != region)
+ LLSelectNode* node = *iter;
+ LLViewerObject* object = node->getObject();
+ LLViewerRegion* region = object->getRegion();
+ if (!first_region)
{
- // Derez doesn't work at all if the some of the objects
- // are in regions besides the first object selected.
-
- // ...crosses region boundaries
- error = "AcquireErrorObjectSpan";
- break;
+ first_region = region;
+ }
+ else
+ {
+ if(region != first_region)
+ {
+ // Derez doesn't work at all if the some of the objects
+ // are in regions besides the first object selected.
+
+ // ...crosses region boundaries
+ error = "AcquireErrorObjectSpan";
+ break;
+ }
}
if (object->isAvatar())
{
@@ -3440,7 +3444,7 @@ void derez_objects(EDeRezDestination dest, const LLUUID& dest_id)
*/
continue;
}
- can_derez_current = FALSE;
+ BOOL can_derez_current = FALSE;
switch(dest)
{
case DRD_TAKE_INTO_AGENT_INVENTORY:
@@ -3484,7 +3488,7 @@ void derez_objects(EDeRezDestination dest, const LLUUID& dest_id)
error = "AcquireErrorTooManyObjects";
}
- if(!error && derez_objects.count() > 0)
+ if(error.empty() && derez_objects.count() > 0)
{
U8 d = (U8)dest;
LLUUID tid;
@@ -3513,7 +3517,7 @@ void derez_objects(EDeRezDestination dest, const LLUUID& dest_id)
&& (objects_in_packet++ < MAX_ROOTS_PER_PACKET))
{
- object = derez_objects.get(object_index++);
+ LLViewerObject* object = derez_objects.get(object_index++);
msg->nextBlockFast(_PREHASH_ObjectData);
msg->addU32Fast(_PREHASH_ObjectLocalID, object->getLocalID());
// VEFFECT: DerezObject
@@ -3521,7 +3525,7 @@ void derez_objects(EDeRezDestination dest, const LLUUID& dest_id)
effectp->setPositionGlobal(object->getPositionGlobal());
effectp->setColor(LLColor4U(gAgent.getEffectColor()));
}
- msg->sendReliable(region->getHost());
+ msg->sendReliable(first_region->getHost());
}
make_ui_sound("UISndObjectRezOut");
@@ -3532,7 +3536,7 @@ void derez_objects(EDeRezDestination dest, const LLUUID& dest_id)
gViewerWindow->getWindow()->incBusyCount();
}
}
- else if(error)
+ else if(!error.empty())
{
gViewerWindow->alertXml(error);
}
@@ -3612,20 +3616,17 @@ class LLObjectEnableReturn : public view_listener_t
}
else
{
- LLObjectSelectionHandle selection = gSelectMgr->getSelection();
- LLViewerObject* obj = NULL;
- for(obj = selection->getFirstRootObject();
- obj;
- obj = selection->getNextRootObject())
+ struct f : public LLSelectedObjectFunctor
{
- if (obj->isOverAgentOwnedLand()
- || obj->isOverGroupOwnedLand()
- || obj->permModify())
+ virtual bool apply(LLViewerObject* obj)
{
- new_value = true;
- break;
+ return (obj->isOverAgentOwnedLand() ||
+ obj->isOverGroupOwnedLand() ||
+ obj->permModify());
}
- }
+ } func;
+ const bool firstonly = true;
+ new_value = gSelectMgr->getSelection()->applyToRootObjects(&func, firstonly);
}
}
}
@@ -3641,373 +3642,25 @@ void force_take_copy(void*)
const LLUUID& category_id = gInventory.findCategoryUUIDForType(LLAssetType::AT_OBJECT);
derez_objects(DRD_FORCE_TO_GOD_INVENTORY, category_id);
}
-#ifdef _CORY_TESTING
-
-void force_export_copy(void*)
-{
- LLViewerObject* object = NULL;
- LLSelectNode* node = gSelectMgr->getSelection()->getFirstNode();
- if(!node) return;
- object = node->getObject();
- if(!object) return;
-
-
- LLString proposed_name;
- proposed_name.append(node->mName);
- proposed_name.append( ".slg" );
-
- LLViewerRegion* region = object->getRegion();
-
- // Check conditions that we can't deal with, building a list of
- // everything that we'll actually be derezzing.
-
- std::vector<LLViewerObject*> export_objects;
- std::vector<std::string> export_names;
- std::vector<std::string> export_descriptions;
-
- S32 object_index = 0;
-
- for( ; node != NULL; node = gSelectMgr->getSelection()->getNextNode())
- {
- object = node->getObject();
- if(!object || !node->mValid)
- {
- // Clicked cancel
- return;
- }
- if(object->getRegion() != region)
- {
- // Clicked cancel
- return;
- }
- if (object->isAvatar())
- {
- continue;
- }
-
- if (object->getNVPair("AssetContainer"))
- {
- continue;
- }
- export_objects.push_back(node->getObject());
- export_names.push_back(node->mName);
- export_descriptions.push_back(node->mDescription);
- }
-
- if (export_objects.empty())
- {
- return;
- }
-
- // pick a save file
- LLFilePicker& picker = LLFilePicker::instance();
- if (!picker.getSaveFile(LLFilePicker::FFSAVE_GEOMETRY, proposed_name))
- {
- // Clicked cancel
- return;
- }
-
- // Copy the directory + file name
- char filepath[LL_MAX_PATH]; /* Flawfinder: ignore */
- strncpy(filepath, picker.getFirstFile(), LL_MAX_PATH -1); /* Flawfinder: ignore */
- filepath[LL_MAX_PATH -1] = '\0';
-
- apr_file_t* fp = ll_apr_file_open(filepath, LL_APR_W);
-
- if (!fp)
- {
- return;
- }
-
- object = export_objects[object_index];
- LLVector3 baseoffset = object->getPositionRegion();
-
- apr_file_printf(fp, "<?xml version=\"1.0\" encoding=\"US-ASCII\" standalone=\"yes\"?>\n");
- apr_file_printf(fp, "<LindenGeometry>\n");
-
- while(object_index < export_objects.size())
- {
- apr_file_printf(fp, "<Object\n");
- apr_file_printf(fp, "\tShape='%s'\n", export_names[object_index].c_str());
- apr_file_printf(fp, "\tDescription='%s'\n", export_descriptions[object_index].c_str());
-
- apr_file_printf(fp, "\tPCode='%d'\n", (U32)object->getPCode());
- apr_file_printf(fp, "\tMaterial='%d'\n", object->getMaterial());
- apr_file_printf(fp, "\tScale='%5f %5f %5f'\n", object->getScale().mV[VX], object->getScale().mV[VY], object->getScale().mV[VZ]);
- LLVector3 delta = object->getPositionRegion() - baseoffset;
- LLQuaternion rot = object->getRotationRegion();
- apr_file_printf(fp, "\tOffset='%5f %5f %5f'\n", delta.mV[VX], delta.mV[VY], delta.mV[VZ]);
- apr_file_printf(fp, "\tOrientation='%5f %5f %5f %5f'\n", rot.mQ[VX], rot.mQ[VY], rot.mQ[VZ], rot.mQ[VS]);
- const LLProfileParams pparams = object->getVolume()->getProfile().mParams;
- apr_file_printf(fp, "\tShapeProfile='%d %f %f %f'\n", pparams.getCurveType(), pparams.getBegin(), pparams.getEnd(), pparams.getHollow());
- const LLPathParams paparams = object->getVolume()->getPath().mParams;
- apr_file_printf(fp, "\tShapePath='%d %f %f %f %f %f %f %f %f %f %f %f %f %f'\n",
- paparams.getCurveType(), paparams.getBegin(), paparams.getEnd(), paparams.getTwist(), paparams.getTwistBegin(), paparams.getScaleX(), paparams.getScaleY(),
- paparams.getShearX(), paparams.getShearY(), paparams.getRadiusOffset(), paparams.getTaperX(), paparams.getTaperY(),
- paparams.getRevolutions(), paparams.getSkew());
- S32 face, numfaces;
- numfaces = object->getNumTEs();
- apr_file_printf(fp, "\tNumberOfFaces='%d'>\n", numfaces);
- for (face = 0; face < numfaces; face++)
- {
- const LLTextureEntry *te = object->getTE(face);
- LLColor4 color = te->getColor();
- apr_file_printf(fp, "\t<Face\n\t\tFaceColor='%d %5f %5f %5f %5f'\n", face, color.mV[VX], color.mV[VY], color.mV[VZ], color.mV[VW]);
-
- char texture[UUID_STR_LENGTH]; /* Flawfinder: ignore */
- LLUUID texid = te->getID();
- texid.toString(texture);
- F32 sx, sy, ox, oy;
- te->getScale(&sx, &sy);
- te->getOffset(&ox, &oy);
-
- apr_file_printf(fp, "\t\tFace='%d %5f %5f %5f %5f %5f %d %s'\n\t/>\n", face, sx, sy, ox, oy, te->getRotation(), te->getBumpShinyFullbright(), texture);
- }
- apr_file_printf(fp, "</Object>\n");
- object = export_objects[++object_index];
- }
- apr_file_printf(fp, "</LindenGeometry>\n");
-
- fclose(fp);
-}
-
-void undo_find_local_contact_point(LLVector3 &contact,
- const LLVector3& surface_norm,
- const LLQuaternion& rot,
- const LLVector3& scale )
-{
- LLVector3 local_norm = surface_norm;
- local_norm.rotVec( ~rot );
-
- LLVector3 v[6];
- v[0].mV[VX] = -1.f;
- v[1].mV[VX] = 1.f;
-
- v[2].mV[VY] = -1.f;
- v[3].mV[VY] = 1.f;
-
- v[4].mV[VZ] = -1.f;
- v[5].mV[VZ] = 1.f;
-
- contact = v[0];
- F32 cur_val = 0;
-
- for( S32 i = 0; i < 6; i++ )
- {
- F32 val = v[i] * local_norm;
- if( val < cur_val )
- {
- contact = v[i];
- cur_val = val;
- }
- }
-
- contact.mV[VX] *= 0.5f * scale.mV[VX];
- contact.mV[VY] *= 0.5f * scale.mV[VY];
- contact.mV[VZ] *= 0.5f * scale.mV[VZ];
- contact.rotVec( rot );
-}
-
-
-
-void force_import_geometry(void*)
+void handle_take()
{
- LLFilePicker& picker = LLFilePicker::instance();
- if (!picker.getOpenFile(LLFilePicker::FFLOAD_GEOMETRY))
- {
- llinfos << "Couldn't import objects from file" << llendl;
- return;
- }
-
- char directory[LL_MAX_PATH]; /* Flawfinder: ignore */
- strncpy(directory, picker.getFirstFile(), LL_MAX_PATH -1); /* Flawfinder: ignore */
- directory[LL_MAX_PATH -1] = '\0';
-
- llinfos << "Loading LSG file " << directory << llendl;
- LLXmlTree *xmlparser = new LLXmlTree();
- xmlparser->parseFile(directory, TRUE);
- LLXmlTreeNode *root = xmlparser->getRoot();
- if( !root )
- {
- return;
- }
- // header
- if( !root->hasName( "LindenGeometry" ) )
+ // we want to use the folder this was derezzed from if it's
+ // available. Otherwise, derez to the normal place.
+ if(gSelectMgr->getSelection()->isEmpty())
{
- llwarns << "Invalid LindenGeometry file header: " << directory << llendl;
return;
}
- // objects
- for (LLXmlTreeNode *child = root->getChildByName( "Object" );
- child;
- child = root->getNextNamedChild())
- {
- // get object data
- // *NOTE: This buffer size is hard coded into scanf() below.
- char name[255]; /* Flawfinder: ignore */ // Shape
- char description[255]; /* Flawfinder: ignore */ // Description
- U32 material; // Material
- F32 sx, sy, sz; // Scale
- LLVector3 scale;
- F32 ox, oy, oz; // Offset
- LLVector3 offset;
- F32 rx, ry, rz, rs; // Orientation
- LLQuaternion rot;
- U32 curve;
- F32 begin;
- F32 end;
- F32 hollow;
- F32 twist;
- F32 scx, scy;
- F32 shx, shy;
- F32 twist_begin;
- F32 radius_offset;
- F32 tx, ty;
- F32 revolutions;
- F32 skew;
- S32 faces;
- U32 pcode;
- U32 flags = FLAGS_CREATE_SELECTED;
-
- LLString attribute;
-
- S32 count = 0;
-
- child->getAttributeString("PCode", &attribute);
- pcode = atoi(attribute.c_str());
- child->getAttributeString("Shape", &attribute);
- sscanf( /* Flawfinder: ignore */
- attribute.c_str(), "%254s", name);
- child->getAttributeString("Description", &attribute);
- sscanf( /* Flawfinder: ignore */
- attribute.c_str(), "%254s", description);
- child->getAttributeString("Material", &attribute);
- material = atoi(attribute.c_str());
- child->getAttributeString("Scale", &attribute);
- sscanf(attribute.c_str(), "%f %f %f", &sx, &sy, &sz);
- scale.setVec(sx, sy, sz);
- child->getAttributeString("Offset", &attribute);
- sscanf(attribute.c_str(), "%f %f %f", &ox, &oy, &oz);
- offset.setVec(ox, oy, oz);
- child->getAttributeString("Orientation", &attribute);
- sscanf(attribute.c_str(), "%f %f %f %f", &rx, &ry, &rz, &rs);
- rot.mQ[VX] = rx;
- rot.mQ[VY] = ry;
- rot.mQ[VZ] = rz;
- rot.mQ[VS] = rs;
-
- child->getAttributeString("ShapeProfile", &attribute);
- sscanf(attribute.c_str(), "%d %f %f %f", &curve, &begin, &end, &hollow);
- LLProfileParams pparams(curve, begin, end, hollow);
- child->getAttributeString("ShapePath", &attribute);
- sscanf(attribute.c_str(), "%d %f %f %f %f %f %f %f %f %f %f %f %f %f",
- &curve, &begin, &end, &twist, &twist_begin, &scx, &scy, &shx, &shy, &radius_offset, &tx, &ty, &revolutions, &skew);
- LLPathParams paparams(curve, begin, end, scx, scy, shx, shy, twist, twist_begin, radius_offset, tx, ty, revolutions, skew);
- child->getAttributeString("NumberOfFaces", &attribute);
- faces = atoi(attribute.c_str());
-
-
-
- gMessageSystem->newMessageFast(_PREHASH_ObjectAdd);
- gMessageSystem->nextBlockFast(_PREHASH_AgentData);
- gMessageSystem->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
- gMessageSystem->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
- gMessageSystem->addUUIDFast(_PREHASH_GroupID, gAgent.getGroupID());
-
- gMessageSystem->nextBlockFast(_PREHASH_ObjectData);
- gMessageSystem->addU8Fast(_PREHASH_PCode, pcode);
- gMessageSystem->addU8Fast(_PREHASH_Material, material);
- gMessageSystem->addU32Fast(_PREHASH_AddFlags, flags );
- pparams.packMessage(gMessageSystem);
- paparams.packMessage(gMessageSystem);
-
- LLVector3 forward;
- forward.setVec(3.f, 0.f, 1.f);
- forward = forward * gAgent.getQuat();
-
- LLVector3 start = gAgent.getPositionAgent() + forward;
-
- start += offset;
-
- // offset position to make up for error introduced by placement code
- LLVector3 normal(0.f, 0.f, 1.f);
- LLVector3 delta;
-
- undo_find_local_contact_point(delta, normal, rot, scale);
-
- start += delta;
-
- gMessageSystem->addVector3Fast(_PREHASH_Scale, scale );
- gMessageSystem->addQuatFast(_PREHASH_Rotation, rot );
- gMessageSystem->addVector3Fast(_PREHASH_RayStart, start );
- gMessageSystem->addVector3Fast(_PREHASH_RayEnd, start );
- gMessageSystem->addBOOLFast(_PREHASH_BypassRaycast, TRUE );
- gMessageSystem->addBOOLFast(_PREHASH_RayEndIsIntersection, FALSE );
-
- U8 state = 0;
- gMessageSystem->addU8Fast(_PREHASH_State, state);
-
- LLUUID ray_target_id;
- gMessageSystem->addUUIDFast(_PREHASH_RayTargetID, ray_target_id );
- /* Setting TE info through ObjectAdd is no longer supported.
- LLPrimitive temp_primitive;
- temp_primitive.setNumTEs(faces);
- for (LLXmlTreeNode *face = child->getChildByName( "Face" );
- face;
- face = child->getNextNamedChild())
- {
- // read the faces
- U32 facenumber;
- LLColor4 color;
- // *NOTE: This buffer size is hard coded into scanf() below.
- char texture[UUID_STR_LENGTH];
- LLUUID texid;
- texid.toString(texture);
- F32 sx, sy, ox, oy, rot;
- U8 bump;
- LLTextureEntry te;
-
- face->getAttributeString("FaceColor", &attribute);
- sscanf(attribute, "%d %f %f %f %f", &facenumber, &color.mV[VX], &color.mV[VY], &color.mV[VZ], &color.mV[VW]);
- face->getAttributeString("Face", &attribute);
- sscanf(attribute, "%d %f %f %f %f %f %d %36s", &facenumber, &sx, &sy, &ox, &oy, &rot, &bump, texture);
- texid.set(texture);
- te.setColor(color);
- te.setBumpShinyFullbright(bump);
- te.setID(texid);
- te.setRotation(rot);
- te.setOffset(ox, oy);
- te.setScale(sx, sy);
-
- temp_primitive.setTE(facenumber, te);
- }
-
- temp_primitive.packTEMessage(gMessageSystem);
- */
- gMessageSystem->sendReliable(gAgent.getRegionHost());
- }
-
-}
-#endif
-
-void handle_take()
-{
- // we want to use the folder this was derezzed from if it's
- // available. Otherwise, derez to the normal place.
- if(gSelectMgr->getSelection()->isEmpty()) return;
- LLSelectNode* node = NULL;
- LLViewerObject* object = NULL;
BOOL you_own_everything = TRUE;
-
BOOL locked_but_takeable_object = FALSE;
LLUUID category_id;
- for(node = gSelectMgr->getSelection()->getFirstRootNode();
- node != NULL;
- node = gSelectMgr->getSelection()->getNextRootNode())
+
+ for (LLObjectSelection::root_iterator iter = gSelectMgr->getSelection()->root_begin();
+ iter != gSelectMgr->getSelection()->root_end(); iter++)
{
- object = node->getObject();
+ LLSelectNode* node = *iter;
+ LLViewerObject* object = node->getObject();
if(object)
{
if(!object->permYouOwner())
@@ -4016,11 +3669,8 @@ void handle_take()
}
if(!object->permMove())
-
{
-
locked_but_takeable_object = TRUE;
-
}
}
if(node->mFolderID.notNull())
@@ -4071,7 +3721,6 @@ void handle_take()
}
LLUUID* cat_id = new LLUUID(category_id);
if(locked_but_takeable_object ||
-
!you_own_everything)
{
if(locked_but_takeable_object && you_own_everything)
@@ -4124,13 +3773,11 @@ BOOL enable_take()
return FALSE;
}
- LLViewerObject* object = NULL;
- for(LLSelectNode* node = gSelectMgr->getSelection()->getFirstRootNode();
- node != NULL;
- node = gSelectMgr->getSelection()->getNextRootNode())
+ for (LLObjectSelection::valid_root_iterator iter = gSelectMgr->getSelection()->valid_root_begin();
+ iter != gSelectMgr->getSelection()->valid_root_end(); iter++)
{
- object = node->getObject();
- if(!object || !node->mValid) continue;
+ LLSelectNode* node = *iter;
+ LLViewerObject* object = node->getObject();
if (object->isAvatar())
{
// ...don't acquire avatars
@@ -4240,12 +3887,11 @@ class LLToolsEnableBuyOrTake : public view_listener_t
// FALSE if selection is a 'take'
BOOL is_selection_buy_not_take()
{
- LLViewerObject* obj = NULL;
- for(LLSelectNode* node = gSelectMgr->getSelection()->getFirstRootNode();
- node != NULL;
- node = gSelectMgr->getSelection()->getNextRootNode())
+ for (LLObjectSelection::root_iterator iter = gSelectMgr->getSelection()->root_begin();
+ iter != gSelectMgr->getSelection()->root_end(); iter++)
{
- obj = node->getObject();
+ LLSelectNode* node = *iter;
+ LLViewerObject* obj = node->getObject();
if(obj && !(obj->permYouOwner()) && (node->mSaleInfo.isForSale()))
{
// you do not own the object and it is for sale, thus,
@@ -4258,13 +3904,12 @@ BOOL is_selection_buy_not_take()
S32 selection_price()
{
- LLViewerObject* obj = NULL;
S32 total_price = 0;
- for(LLSelectNode* node = gSelectMgr->getSelection()->getFirstRootNode();
- node != NULL;
- node = gSelectMgr->getSelection()->getNextRootNode())
+ for (LLObjectSelection::root_iterator iter = gSelectMgr->getSelection()->root_begin();
+ iter != gSelectMgr->getSelection()->root_end(); iter++)
{
- obj = node->getObject();
+ LLSelectNode* node = *iter;
+ LLViewerObject* obj = node->getObject();
if(obj && !(obj->permYouOwner()) && (node->mSaleInfo.isForSale()))
{
// you do not own the object and it is for sale.
@@ -4404,12 +4049,11 @@ class LLToolsSnapObjectXY : public view_listener_t
{
F64 snap_size = (F64)gSavedSettings.getF32("GridResolution");
- LLViewerObject* obj;
- LLObjectSelectionHandle selection = gSelectMgr->getSelection();
- for (obj = selection->getFirstRootObject();
- obj != NULL;
- obj = selection->getNextRootObject())
+ for (LLObjectSelection::root_iterator iter = gSelectMgr->getSelection()->root_begin();
+ iter != gSelectMgr->getSelection()->root_end(); iter++)
{
+ LLSelectNode* node = *iter;
+ LLViewerObject* obj = node->getObject();
if (obj->permModify())
{
LLVector3d pos_global = obj->getPositionGlobal();
@@ -4466,17 +4110,15 @@ class LLToolsEnableLink : public view_listener_t
{
if(gSelectMgr->selectGetAllRootsValid() && gSelectMgr->getSelection()->getRootObjectCount() >= 2)
{
- LLObjectSelectionHandle selection = gSelectMgr->getSelection();
- for(LLViewerObject* object = selection->getFirstRootObject();
- object != NULL;
- object = selection->getNextRootObject())
+ struct f : public LLSelectedObjectFunctor
{
- if(object->permModify())
+ virtual bool apply(LLViewerObject* object)
{
- new_value = true;
- break;
+ return object->permModify();
}
- }
+ } func;
+ const bool firstonly = true;
+ new_value = gSelectMgr->getSelection()->applyToRootObjects(&func, firstonly);
}
}
gMenuHolder->findControl(userdata["control"].asString())->setValue(new_value);
@@ -4914,7 +4556,6 @@ void handle_export_selected( void * )
return;
}
llinfos << "Exporting selected objects:" << llendl;
- LLViewerObject *object = selection->getFirstRootObject();
gExporterRequestID.generate();
gExportDirectory = "";
@@ -4926,8 +4567,11 @@ void handle_export_selected( void * )
msg->addUUIDFast(_PREHASH_RequestID, gExporterRequestID);
msg->addS16Fast(_PREHASH_VolumeDetail, 4);
- for (; object != NULL; object = selection->getNextRootObject())
+ for (LLObjectSelection::root_iterator iter = selection->root_begin();
+ iter != selection->root_end(); iter++)
{
+ LLSelectNode* node = *iter;
+ LLViewerObject* object = node->getObject();
msg->nextBlockFast(_PREHASH_ObjectData);
msg->addUUIDFast(_PREHASH_ObjectID, object->getID());
llinfos << "Object: " << object->getID() << llendl;
@@ -5321,16 +4965,21 @@ void handle_force_unlock(void*)
gSelectMgr->sendOwner(LLUUID::null, LLUUID::null, TRUE);
// Second, lie to the viewer and mark it editable and unowned
- LLViewerObject* object;
- for (object = gSelectMgr->getSelection()->getFirstObject(); object; object = gSelectMgr->getSelection()->getNextObject() )
+
+ struct f : public LLSelectedObjectFunctor
{
- object->mFlags |= FLAGS_OBJECT_MOVE;
- object->mFlags |= FLAGS_OBJECT_MODIFY;
- object->mFlags |= FLAGS_OBJECT_COPY;
+ virtual bool apply(LLViewerObject* object)
+ {
+ object->mFlags |= FLAGS_OBJECT_MOVE;
+ object->mFlags |= FLAGS_OBJECT_MODIFY;
+ object->mFlags |= FLAGS_OBJECT_COPY;
- object->mFlags &= ~FLAGS_OBJECT_ANY_OWNER;
- object->mFlags &= ~FLAGS_OBJECT_YOU_OWNER;
- }
+ object->mFlags &= ~FLAGS_OBJECT_ANY_OWNER;
+ object->mFlags &= ~FLAGS_OBJECT_YOU_OWNER;
+ return true;
+ }
+ } func;
+ gSelectMgr->getSelection()->applyToObjects(&func);
}
// Fullscreen debug stuff
@@ -6169,11 +5818,16 @@ class LLAttachmentEnableDetach : public view_listener_t
BOOL object_selected_and_point_valid(void *user_data)
{
//LLViewerJointAttachment *attachment = (LLViewerJointAttachment *)user_data;
- if (gSelectMgr == NULL) return FALSE;
-
+ if (gSelectMgr == NULL)
+ {
+ return FALSE;
+ }
LLObjectSelectionHandle selection = gSelectMgr->getSelection();
- for (LLViewerObject *object = selection->getFirstRootObject(); object; object = selection->getNextRootObject())
+ for (LLObjectSelection::root_iterator iter = selection->root_begin();
+ iter != selection->root_end(); iter++)
{
+ LLSelectNode* node = *iter;
+ LLViewerObject* object = node->getObject();
for (U32 child_num = 0; child_num < object->mChildList.size(); child_num++ )
{
if (object->mChildList[child_num]->isAvatar())
@@ -6245,12 +5899,68 @@ BOOL enable_activate(void*)
return FALSE;
}
+namespace
+{
+ struct QueueObjects : public LLSelectedObjectFunctor
+ {
+ BOOL scripted;
+ BOOL modifiable;
+ LLFloaterScriptQueue* mQueue;
+ QueueObjects(LLFloaterScriptQueue* q) : mQueue(q), scripted(FALSE), modifiable(FALSE) {}
+ virtual bool apply(LLViewerObject* obj)
+ {
+ scripted = obj->flagScripted();
+ modifiable = obj->permModify();
+
+ if( scripted && modifiable )
+ {
+ mQueue->addObject(obj->getID());
+ return false;
+ }
+ else
+ {
+ return true; // fail: stop applying
+ }
+ }
+ };
+}
+
+void queue_actions(LLFloaterScriptQueue* q, const std::string& noscriptmsg, const std::string& nomodmsg)
+{
+ // Apply until an object fails
+ QueueObjects func(q);
+ const bool firstonly = true;
+ bool fail = gSelectMgr->getSelection()->applyToObjects(&func, firstonly);
+ if(fail)
+ {
+ if ( !func.scripted )
+ {
+ gViewerWindow->alertXml(noscriptmsg);
+ }
+ else if ( !func.modifiable )
+ {
+ gViewerWindow->alertXml(nomodmsg);
+ }
+ else
+ {
+ llerrs << "Bad logic." << llendl;
+ }
+ }
+ else
+ {
+ if (!q->start())
+ {
+ llwarns << "Unexpected script compile failure." << llendl;
+ }
+ }
+}
+
class LLToolsSelectedScriptAction : public view_listener_t
{
bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata)
{
LLString action = userdata.asString();
- LLFloaterScriptQueue *queue = NULL;
+ LLFloaterScriptQueue* queue = NULL;
if (action == "compile")
{
queue = LLFloaterCompileQueue::create();
@@ -6267,35 +5977,13 @@ class LLToolsSelectedScriptAction : public view_listener_t
{
queue = LLFloaterNotRunQueue::create();
}
- if (!queue) return true;
-
- BOOL scripted = FALSE;
- BOOL modifiable = FALSE;
-
- for(LLViewerObject* obj = gSelectMgr->getSelection()->getFirstObject();
- obj;
- obj = gSelectMgr->getSelection()->getNextObject())
+ if (!queue)
{
- scripted = obj->flagScripted();
- modifiable = obj->permModify();
-
- if( scripted && modifiable )
- queue->addObject(obj->getID());
- else
- break;
+ return true;
}
- if(!queue->start())
- {
- if ( ! scripted )
- {
- gViewerWindow->alertXml("CannotRecompileSelectObjectsNoScripts");
- }
- else if ( ! modifiable )
- {
- gViewerWindow->alertXml("CannotRecompileSelectObjectsNoPermission");
- }
- }
+ queue_actions(queue, "CannotRecompileSelectObjectsNoScripts", "CannotRecompileSelectObjectsNoPermission");
+
return true;
}
};
@@ -6303,109 +5991,28 @@ class LLToolsSelectedScriptAction : public view_listener_t
void handle_reset_selection(void*)
{
LLFloaterResetQueue* queue = LLFloaterResetQueue::create();
-
- BOOL scripted = FALSE;
- BOOL modifiable = FALSE;
-
- for(LLViewerObject* obj = gSelectMgr->getSelection()->getFirstObject();
- obj;
- obj = gSelectMgr->getSelection()->getNextObject())
- {
- scripted = obj->flagScripted();
- modifiable = obj->permModify();
-
- if( scripted && modifiable )
- queue->addObject(obj->getID());
- else
- break;
- }
-
- if(!queue->start())
- {
- if ( ! scripted )
- {
- gViewerWindow->alertXml("CannotResetSelectObjectsNoScripts");
- }
- else if ( ! modifiable )
- {
- gViewerWindow->alertXml("CannotResetSelectObjectsNoPermission");
- }
- }
+ queue_actions(queue, "CannotResetSelectObjectsNoScripts", "CannotResetSelectObjectsNoPermission");
}
void handle_set_run_selection(void*)
{
LLFloaterRunQueue* queue = LLFloaterRunQueue::create();
-
- BOOL scripted = FALSE;
- BOOL modifiable = FALSE;
-
- for(LLViewerObject* obj = gSelectMgr->getSelection()->getFirstObject();
- obj;
- obj = gSelectMgr->getSelection()->getNextObject())
- {
- scripted = obj->flagScripted();
- modifiable = obj->permModify();
-
- if( scripted && modifiable )
- queue->addObject(obj->getID());
- else
- break;
- }
-
- if(!queue->start())
- {
- if ( ! scripted )
- {
- gViewerWindow->alertXml("CannotSetRunningSelectObjectsNoScripts");
- }
- else if ( ! modifiable )
- {
- gViewerWindow->alertXml("CannotSerRunningSelectObjectsNoPermission");
- }
- }
+ queue_actions(queue, "CannotSetRunningSelectObjectsNoScripts", "CannotSerRunningSelectObjectsNoPermission");
}
void handle_set_not_run_selection(void*)
{
LLFloaterNotRunQueue* queue = LLFloaterNotRunQueue::create();
-
- BOOL scripted = FALSE;
- BOOL modifiable = FALSE;
-
- for(LLViewerObject* obj = gSelectMgr->getSelection()->getFirstObject();
- obj;
- obj = gSelectMgr->getSelection()->getNextObject())
- {
- scripted = obj->flagScripted();
- modifiable = obj->permModify();
-
- if( scripted && modifiable )
- queue->addObject(obj->getID());
- else
- break;
- }
-
- if(!queue->start())
- {
- if ( ! scripted )
- {
- gViewerWindow->alertXml("CannotSetRunningNotSelectObjectsNoScripts");
- }
- else if ( ! modifiable )
- {
- gViewerWindow->alertXml("CannotSerRunningNotSelectObjectsNoPermission");
- }
- }
+ queue_actions(queue, "CannotSetRunningNotSelectObjectsNoScripts", "CannotSerRunningNotSelectObjectsNoPermission");
}
void handle_selected_texture_info(void*)
{
- LLSelectNode* node = NULL;
- for (node = gSelectMgr->getSelection()->getFirstNode(); node != NULL; node = gSelectMgr->getSelection()->getNextNode())
+ for (LLObjectSelection::valid_iterator iter = gSelectMgr->getSelection()->valid_begin();
+ iter != gSelectMgr->getSelection()->valid_end(); iter++)
{
- if (!node->mValid) continue;
-
+ LLSelectNode* node = *iter;
+
std::string msg;
msg.assign("Texture info for: ");
msg.append(node->mName);
@@ -6625,51 +6232,52 @@ class LLToolsEnableTakeCopy : public view_listener_t
{
bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata)
{
- bool new_value = false;
+ bool all_valid = false;
if (gSelectMgr)
{
- new_value = true;
+ all_valid = true;
#ifndef HACKED_GODLIKE_VIEWER
# ifdef TOGGLE_HACKED_GODLIKE_VIEWER
if (gInProductionGrid || !gAgent.isGodlike())
# endif
{
- LLObjectSelectionHandle selection = gSelectMgr->getSelection();
- LLViewerObject* obj = selection->getFirstRootObject();
- if(obj)
+ struct f : public LLSelectedObjectFunctor
{
- for( ; obj; obj = selection->getNextRootObject())
+ virtual bool apply(LLViewerObject* obj)
{
- if(!(obj->permCopy()) || obj->isAttachment())
- {
- new_value = false;
- }
+ return (!obj->permCopy() || obj->isAttachment());
}
- }
+ } func;
+ const bool firstonly = true;
+ bool any_invalid = gSelectMgr->getSelection()->applyToRootObjects(&func, firstonly);
+ all_valid = !any_invalid;
}
#endif // HACKED_GODLIKE_VIEWER
}
- gMenuHolder->findControl(userdata["control"].asString())->setValue(new_value);
+ gMenuHolder->findControl(userdata["control"].asString())->setValue(all_valid);
return true;
}
};
BOOL enable_selection_you_own_all(void*)
{
- LLViewerObject *obj;
if (gSelectMgr)
{
- LLObjectSelectionHandle selection = gSelectMgr->getSelection();
- for (obj = selection->getFirstRootObject(); obj; obj = selection->getNextRootObject())
+ struct f : public LLSelectedObjectFunctor
{
- if (!obj->permYouOwner())
+ virtual bool apply(LLViewerObject* obj)
{
- return FALSE;
+ return (!obj->permYouOwner());
}
+ } func;
+ const bool firstonly = true;
+ bool no_perms = gSelectMgr->getSelection()->applyToRootObjects(&func, firstonly);
+ if (no_perms)
+ {
+ return FALSE;
}
}
-
return TRUE;
}
@@ -6677,17 +6285,21 @@ BOOL enable_selection_you_own_one(void*)
{
if (gSelectMgr)
{
- LLObjectSelectionHandle selection = gSelectMgr->getSelection();
- LLViewerObject *obj;
- for (obj = selection->getFirstRootObject(); obj; obj = selection->getNextRootObject())
+ struct f : public LLSelectedObjectFunctor
{
- if (obj->permYouOwner())
+ virtual bool apply(LLViewerObject* obj)
{
- return TRUE;
+ return (obj->permYouOwner());
}
+ } func;
+ const bool firstonly = true;
+ bool any_perms = gSelectMgr->getSelection()->applyToRootObjects(&func, firstonly);
+ if (!any_perms)
+ {
+ return FALSE;
}
}
- return FALSE;
+ return TRUE;
}
class LLHasAsset : public LLInventoryCollectFunctor
@@ -6718,13 +6330,13 @@ BOOL enable_save_into_inventory(void*)
{
if(gSelectMgr)
{
+ // *TODO: clean this up
// find the last root
LLSelectNode* last_node = NULL;
- for(LLSelectNode* node = gSelectMgr->getSelection()->getFirstRootNode();
- node != NULL;
- node = gSelectMgr->getSelection()->getNextRootNode())
+ for (LLObjectSelection::root_iterator iter = gSelectMgr->getSelection()->root_begin();
+ iter != gSelectMgr->getSelection()->root_end(); iter++)
{
- last_node = node;
+ last_node = *iter;
}
#ifdef HACKED_GODLIKE_VIEWER
@@ -7206,13 +6818,15 @@ class LLToolsUseSelectionForGrid : public view_listener_t
bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata)
{
gSelectMgr->clearGridObjects();
- LLObjectSelectionHandle selection = gSelectMgr->getSelection();
- for (LLViewerObject* objectp = selection->getFirstRootObject();
- objectp;
- objectp = selection->getNextRootObject())
+ struct f : public LLSelectedObjectFunctor
+ {
+ virtual bool apply(LLViewerObject* objectp)
{
gSelectMgr->addGridObject(objectp);
+ return true;
}
+ } func;
+ gSelectMgr->getSelection()->applyToRootObjects(&func);
gSelectMgr->setGridMode(GRID_MODE_REF_OBJECT);
if (gFloaterTools)
{
diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp
index 90bda38ec6..bd959b9dea 100644
--- a/indra/newview/llviewermessage.cpp
+++ b/indra/newview/llviewermessage.cpp
@@ -989,7 +989,7 @@ void inventory_offer_callback(S32 button, void* user_data)
itemp = (LLViewerInventoryItem*)gInventory.getItem(info->mObjectID);
}
- // XUI:translate
+ // *TODO:translate
LLString from_string; // Used in the pop-up.
LLString chatHistory_string; // Used in chat history.
if (info->mFromObject == TRUE)
@@ -1225,7 +1225,7 @@ void inventory_offer_handler(LLOfferInfo* info, BOOL from_task)
}
else
{
- // XUI:translate -> [FIRST] [LAST]
+ // *TODO:translate -> [FIRST] [LAST]
args["[NAME]"] = info->mFromName;
LLNotifyBox::showXml("UserGiveItem", args,
&inventory_offer_callback, (void*)info);
@@ -1329,7 +1329,7 @@ void process_improved_im(LLMessageSystem *msg, void **user_data)
S32 binary_bucket_size;
LLChat chat;
- //XUI:translate - need to fix the full name to first/last
+ //*TODO:translate - need to fix the full name to first/last (maybe)
msg->getUUIDFast(_PREHASH_AgentData, _PREHASH_AgentID, from_id);
msg->getBOOLFast(_PREHASH_MessageBlock, _PREHASH_FromGroup, from_group);
msg->getUUIDFast(_PREHASH_MessageBlock, _PREHASH_ToAgentID, to_id);
@@ -1379,7 +1379,7 @@ void process_improved_im(LLMessageSystem *msg, void **user_data)
case IM_CONSOLE_AND_CHAT_HISTORY:
// These are used for system messages, hence don't need the name,
// as it is always "Second Life".
- // XUI:translate
+ // *TODO:translate
args["[MESSAGE]"] = message;
// Note: don't put the message in the IM history, even though was sent
@@ -1528,7 +1528,7 @@ void process_improved_im(LLMessageSystem *msg, void **user_data)
case IM_MESSAGEBOX:
{
// This is a block, modeless dialog.
- //XUI:translate
+ //*TODO:translate
args["[MESSAGE]"] = message;
LLNotifyBox::showXml("SystemMessage", args);
}
@@ -1845,7 +1845,7 @@ void process_improved_im(LLMessageSystem *msg, void **user_data)
}
else
{
- // XUI:translate -> [FIRST] [LAST]
+ // *TODO:translate -> [FIRST] [LAST] (maybe)
LLLureInfo* info = new LLLureInfo(from_id, session_id, FALSE);
args["[NAME]"] = name;
args["[MESSAGE]"] = message;
@@ -4026,7 +4026,7 @@ void process_money_balance_reply( LLMessageSystem* msg, void** )
{
// Make the user confirm the transaction, since they might
// have missed something during an event.
- // XUI:translate
+ // *TODO:translate
LLString::format_map_t args;
args["[MESSAGE]"] = desc;
LLNotifyBox::showXml("SystemMessage", args);
@@ -4082,7 +4082,6 @@ void process_alert_core(const char* buffer, BOOL modal)
gViewerWindow->saveSnapshot(snap_filename, gViewerWindow->getWindowWidth(), gViewerWindow->getWindowHeight(), FALSE, FALSE);
}
- // Translate system messages here.
const char ALERT_PREFIX[] = "ALERT: ";
const size_t ALERT_PREFIX_LEN = sizeof(ALERT_PREFIX) - 1;
if (!strncmp(buffer, ALERT_PREFIX, ALERT_PREFIX_LEN))
@@ -4113,21 +4112,21 @@ void process_alert_core(const char* buffer, BOOL modal)
}
else
{
- //XUI:translate
+ // *TODO:translate
args["[MESSAGE]"] = text;
LLNotifyBox::showXml("SystemMessage", args);
}
}
else if (modal)
{
- //XUI:translate
+ // *TODO:translate
LLString::format_map_t args;
args["[ERROR_MESSAGE]"] = buffer;
gViewerWindow->alertXml("ErrorMessage", args);
}
else
{
- //XUI:translate
+ // *TODO:translate
LLString::format_map_t args;
args["[MESSAGE]"] = buffer;
LLNotifyBox::showXml("SystemMessageTip", args);
@@ -4428,7 +4427,7 @@ void script_question_cb(S32 option, void* user_data)
void process_script_question(LLMessageSystem *msg, void **user_data)
{
- // XUI:translate owner name -> [FIRST] [LAST]
+ // *TODO:translate owner name -> [FIRST] [LAST]
LLHost sender = msg->getSender();
diff --git a/indra/newview/llviewerobjectlist.cpp b/indra/newview/llviewerobjectlist.cpp
index c860dd9cdd..967f018f0d 100644
--- a/indra/newview/llviewerobjectlist.cpp
+++ b/indra/newview/llviewerobjectlist.cpp
@@ -592,12 +592,15 @@ void LLViewerObjectList::updateApparentAngles(LLAgent &agent)
}
// Selected
- LLObjectSelectionHandle selection = gSelectMgr->getSelection();
- for (objectp = selection->getFirstRootObject(); objectp; objectp = selection->getNextRootObject())
+ struct f : public LLSelectedObjectFunctor
{
- objectp->boostTexturePriority();
- }
-
+ virtual bool apply(LLViewerObject* objectp)
+ {
+ objectp->boostTexturePriority();
+ return true;
+ }
+ } func;
+ gSelectMgr->getSelection()->applyToRootObjects(&func);
// Iterate through some of the objects and lazy update their texture priorities
for (i = mCurLazyUpdateIndex; i < max_value; i++)
@@ -1028,7 +1031,7 @@ void LLViewerObjectList::renderObjectsForMap(LLNetMap &netmap)
for (S32 i = 0; i < mMapObjects.count(); i++)
{
LLViewerObject* objectp = mMapObjects[i];
- if (objectp->isOrphaned() || objectp->isAttachment())
+ if (!objectp->getRegion() || objectp->isOrphaned() || objectp->isAttachment())
{
continue;
}
diff --git a/indra/newview/llviewerparcelmgr.cpp b/indra/newview/llviewerparcelmgr.cpp
index 2a9ad2b456..f0e8132990 100644
--- a/indra/newview/llviewerparcelmgr.cpp
+++ b/indra/newview/llviewerparcelmgr.cpp
@@ -1252,7 +1252,7 @@ void LLViewerParcelMgr::makeLandmarkAtSelection()
}
*/
-const char* LLViewerParcelMgr::getAgentParcelName() const
+const LLString& LLViewerParcelMgr::getAgentParcelName() const
{
return mAgentParcel->getName();
}
diff --git a/indra/newview/llviewerparcelmgr.h b/indra/newview/llviewerparcelmgr.h
index b8238c3dbe..58a7067da4 100644
--- a/indra/newview/llviewerparcelmgr.h
+++ b/indra/newview/llviewerparcelmgr.h
@@ -280,7 +280,7 @@ public:
void sendParcelRelease();
// accessors for mAgentParcel
- const char *getAgentParcelName() const;
+ const LLString& getAgentParcelName() const;
// Create a landmark at the "appropriate" location for the
// currently selected parcel.
diff --git a/indra/newview/llviewerregion.cpp b/indra/newview/llviewerregion.cpp
index c3e0e56fb1..0a8d9a8e1d 100644
--- a/indra/newview/llviewerregion.cpp
+++ b/indra/newview/llviewerregion.cpp
@@ -451,6 +451,7 @@ std::string LLViewerRegion::regionFlagsToString(U32 flags)
return result;
}
+// *TODO:Translate
char* SIM_ACCESS_STR[] = { "Free Trial",
"PG",
"Mature",
@@ -1413,3 +1414,4 @@ void LLViewerRegion::logActiveCapabilities() const
llinfos << "Dumped " << count << " entries." << llendl;
}
+
diff --git a/indra/newview/llviewertexteditor.h b/indra/newview/llviewertexteditor.h
index f52ffe9795..e05a61c3a3 100644
--- a/indra/newview/llviewertexteditor.h
+++ b/indra/newview/llviewertexteditor.h
@@ -50,7 +50,7 @@ public:
LLViewerTextEditor(const LLString& name,
const LLRect& rect,
S32 max_length,
- const LLString& default_text = "",
+ const LLString& default_text = LLString(),
const LLFontGL* glfont = NULL,
BOOL allow_embedded_items = FALSE);
diff --git a/indra/newview/llviewerwindow.cpp b/indra/newview/llviewerwindow.cpp
index ae94dcc384..49abf130ac 100644
--- a/indra/newview/llviewerwindow.cpp
+++ b/indra/newview/llviewerwindow.cpp
@@ -1218,6 +1218,10 @@ void LLViewerWindow::handleFocus(LLWindow *window)
{
gKeyboard->resetMaskKeys();
}
+
+ // resume foreground running timer
+ // since we artifically limit framerate when not frontmost
+ gForegroundTime.unpause();
}
// The top-level window has lost focus (e.g. via ALT-TAB)
@@ -1251,6 +1255,9 @@ void LLViewerWindow::handleFocusLost(LLWindow *window)
{
gKeyboard->resetKeys();
}
+
+ // pause timer that tracks total foreground running time
+ gForegroundTime.pause();
}
@@ -1328,10 +1335,16 @@ BOOL LLViewerWindow::handleActivate(LLWindow *window, BOOL activated)
else
{
mActive = FALSE;
- if (gAllowIdleAFK) {
+ if (gAllowIdleAFK)
+ {
gAgent.setAFK();
}
+
+ // SL-53351: Make sure we're not in mouselook when minimised, to prevent control issues
+ gAgent.changeCameraToDefault();
+
send_agent_pause();
+
if (mWindow->getFullscreen() && !mIgnoreActivate)
{
llinfos << "Stopping GL during deactivation" << llendl;
@@ -3099,7 +3112,6 @@ void LLViewerWindow::saveLastMouse(const LLCoordGL &point)
// render_hud_elements: FALSE, FALSE, FALSE
void LLViewerWindow::renderSelections( BOOL for_gl_pick, BOOL pick_parcel_walls, BOOL for_hud )
{
- LLViewerObject* object;
LLObjectSelectionHandle selection = gSelectMgr->getSelection();
if (!for_hud && !for_gl_pick)
@@ -3155,34 +3167,41 @@ void LLViewerWindow::renderSelections( BOOL for_gl_pick, BOOL pick_parcel_walls,
F32 zoom = gAgent.getAvatarObject()->mHUDCurZoom;
glScalef(zoom, zoom, zoom);
}
- for( object = gSelectMgr->getSelection()->getFirstObject(); object; object = gSelectMgr->getSelection()->getNextObject() )
+
+ struct f : public LLSelectedObjectFunctor
{
- LLDrawable* drawable = object->mDrawable;
- if (drawable && drawable->isLight())
+ virtual bool apply(LLViewerObject* object)
{
- LLVOVolume* vovolume = drawable->getVOVolume();
- glPushMatrix();
+ LLDrawable* drawable = object->mDrawable;
+ if (drawable && drawable->isLight())
+ {
+ LLVOVolume* vovolume = drawable->getVOVolume();
+ glPushMatrix();
- LLVector3 center = drawable->getPositionAgent();
- glTranslatef(center[0], center[1], center[2]);
- F32 scale = vovolume->getLightRadius();
- glScalef(scale, scale, scale);
+ LLVector3 center = drawable->getPositionAgent();
+ glTranslatef(center[0], center[1], center[2]);
+ F32 scale = vovolume->getLightRadius();
+ glScalef(scale, scale, scale);
- LLColor4 color(vovolume->getLightColor(), .5f);
- glColor4fv(color.mV);
+ LLColor4 color(vovolume->getLightColor(), .5f);
+ glColor4fv(color.mV);
- F32 pixel_area = 100000.f;
- // Render Outside
- gSphere.render(pixel_area);
-
- // Render Inside
- glCullFace(GL_FRONT);
- gSphere.render(pixel_area);
- glCullFace(GL_BACK);
+ F32 pixel_area = 100000.f;
+ // Render Outside
+ gSphere.render(pixel_area);
+
+ // Render Inside
+ glCullFace(GL_FRONT);
+ gSphere.render(pixel_area);
+ glCullFace(GL_BACK);
- glPopMatrix();
+ glPopMatrix();
+ }
+ return true;
}
- }
+ } func;
+ gSelectMgr->getSelection()->applyToObjects(&func);
+
glPopMatrix();
}
@@ -3205,8 +3224,12 @@ void LLViewerWindow::renderSelections( BOOL for_gl_pick, BOOL pick_parcel_walls,
BOOL all_selected_objects_move = TRUE;
BOOL all_selected_objects_modify = TRUE;
BOOL selecting_linked_set = !gSavedSettings.getBOOL("EditLinkedParts");
- for( object = gSelectMgr->getSelection()->getFirstObject(); object; object = gSelectMgr->getSelection()->getNextObject() )
+
+ for (LLObjectSelection::iterator iter = gSelectMgr->getSelection()->begin();
+ iter != gSelectMgr->getSelection()->end(); iter++)
{
+ LLSelectNode* nodep = *iter;
+ LLViewerObject* object = nodep->getObject();
BOOL this_object_movable = FALSE;
if (object->permMove() && (object->permModify() || selecting_linked_set))
{
diff --git a/indra/newview/llviewerwindow.h b/indra/newview/llviewerwindow.h
index f97f36aa4a..fcd15974f6 100644
--- a/indra/newview/llviewerwindow.h
+++ b/indra/newview/llviewerwindow.h
@@ -220,7 +220,7 @@ public:
BOOL saveSnapshot(const LLString& filename, S32 image_width, S32 image_height, BOOL show_ui = TRUE, BOOL do_rebuild = FALSE, ESnapshotType type = SNAPSHOT_TYPE_COLOR);
BOOL rawSnapshot(LLImageRaw *raw, S32 image_width, S32 image_height, BOOL keep_window_aspect = TRUE,
BOOL show_ui = TRUE, BOOL do_rebuild = FALSE, ESnapshotType type = SNAPSHOT_TYPE_COLOR );
- BOOL saveImageNumbered(LLImageRaw *raw, const LLString& extension = "");
+ BOOL saveImageNumbered(LLImageRaw *raw, const LLString& extension = LLString());
void playSnapshotAnimAndSound();
diff --git a/indra/newview/llvoiceclient.h b/indra/newview/llvoiceclient.h
index ee7d18c0c8..ed256b6f8c 100644
--- a/indra/newview/llvoiceclient.h
+++ b/indra/newview/llvoiceclient.h
@@ -445,7 +445,7 @@ class LLVoiceClient: public LLSingleton<LLVoiceClient>
// It initiates the call to the server that gets the parcel channel.
void parcelChanged();
- void switchChannel(std::string uri = "", bool spatial = true, bool noReconnect = false, std::string hash = "");
+ void switchChannel(std::string uri = std::string(), bool spatial = true, bool noReconnect = false, std::string hash = "");
void joinSession(std::string handle, std::string uri);
std::string nameFromAvatar(LLVOAvatar *avatar);
@@ -526,3 +526,4 @@ extern LLVoiceClient *gVoiceClient;
#endif //LL_VOICE_CLIENT_H
+
diff --git a/indra/newview/llwearable.h b/indra/newview/llwearable.h
index 07ea638b7f..cd02843ccf 100644
--- a/indra/newview/llwearable.h
+++ b/indra/newview/llwearable.h
@@ -85,11 +85,11 @@ public:
EWearableType getType() const { return mType; }
void setType( EWearableType type ) { mType = type; }
- void setName( const std::string& name ) { mName = name; }
- const std::string& getName() { return mName; }
+ void setName( const LLString& name ) { mName = name; }
+ const LLString& getName() { return mName; }
- void setDescription( const std::string& desc ) { mDescription = desc; }
- const std::string& getDescription() { return mDescription; }
+ void setDescription( const LLString& desc ) { mDescription = desc; }
+ const LLString& getDescription() { return mDescription; }
void setPermissions( const LLPermissions& p ) { mPermissions = p; }
const LLPermissions& getPermissions() { return mPermissions; }
diff --git a/indra/newview/llwearablelist.cpp b/indra/newview/llwearablelist.cpp
index 06ad6bb470..39a6046f59 100644
--- a/indra/newview/llwearablelist.cpp
+++ b/indra/newview/llwearablelist.cpp
@@ -132,7 +132,7 @@ void LLWearableList::processGetAssetReply( const char* filename, const LLAssetID
else
{
LLString::format_map_t args;
- // XUI:translate
+ // *TODO:translate
args["[TYPE]"] = LLAssetType::lookupHumanReadable(data->mAssetType);
if (data->mName.empty())
{
@@ -170,7 +170,7 @@ void LLWearableList::processGetAssetReply( const char* filename, const LLAssetID
case LL_ERR_ASSET_REQUEST_NOT_IN_DATABASE:
{
LLString::format_map_t args;
- // XUI:translate
+ // *TODO:translate
args["[TYPE]"] = LLAssetType::lookupHumanReadable(data->mAssetType);
if (data->mName.empty())
{
diff --git a/indra/newview/llwearablelist.h b/indra/newview/llwearablelist.h
index 4866fb5eb7..303fcb7bd3 100644
--- a/indra/newview/llwearablelist.h
+++ b/indra/newview/llwearablelist.h
@@ -57,7 +57,7 @@ public:
LLWearable* createLegacyWearableFromAvatar( EWearableType type );
LLWearable* createWearableMatchedToInventoryItem( LLWearable* old_wearable, LLViewerInventoryItem* item );
- LLWearable* createCopyFromAvatar( LLWearable* old_wearable, const std::string& new_name = "" );
+ LLWearable* createCopyFromAvatar( LLWearable* old_wearable, const std::string& new_name = std::string() );
LLWearable* createCopy( LLWearable* old_wearable );
LLWearable* createNewWearable( EWearableType type );
diff --git a/indra/newview/llworldmapview.h b/indra/newview/llworldmapview.h
index 72e470e2f0..28ffb421b0 100644
--- a/indra/newview/llworldmapview.h
+++ b/indra/newview/llworldmapview.h
@@ -104,7 +104,7 @@ public:
// the view area.
void drawTracking( const LLVector3d& pos_global,
const LLColor4& color,
- BOOL draw_arrow = TRUE, LLString label = "", LLString tooltip = "", S32 vert_offset = 0);
+ BOOL draw_arrow = TRUE, LLString label = LLString(), LLString tooltip = "", S32 vert_offset = 0);
static void drawTrackingArrow(const LLRect& view_rect, S32 x, S32 y,
const LLColor4& color,
S32 arrow_size = DEFAULT_TRACKING_ARROW_SIZE);
diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp
index a9c5e36bf5..d336876ee1 100644
--- a/indra/newview/pipeline.cpp
+++ b/indra/newview/pipeline.cpp
@@ -1813,15 +1813,18 @@ void LLPipeline::postSort(LLCamera& camera)
// Draw face highlights for selected faces.
if (gSelectMgr->getTEMode())
{
- LLViewerObject *vobjp;
- S32 te;
- gSelectMgr->getSelection()->getFirstTE(&vobjp,&te);
-
- while (vobjp)
+ struct f : public LLSelectedTEFunctor
{
- mSelectedFaces.push_back(vobjp->mDrawable->getFace(te));
- gSelectMgr->getSelection()->getNextTE(&vobjp,&te);
- }
+ virtual bool apply(LLViewerObject* object, S32 te)
+ {
+ if (object->mDrawable)
+ {
+ gPipeline.mSelectedFaces.push_back(object->mDrawable->getFace(te));
+ }
+ return true;
+ }
+ } func;
+ gSelectMgr->getSelection()->applyToTEs(&func);
}
}