diff options
author | Kelly Washington <kelly@lindenlab.com> | 2007-06-21 22:40:22 +0000 |
---|---|---|
committer | Kelly Washington <kelly@lindenlab.com> | 2007-06-21 22:40:22 +0000 |
commit | e03bb0606a10f29c8b94909a713a5bb5c69e88b7 (patch) | |
tree | 6d8d07894579438c8cc70e08f5730c3c95dfe768 /indra | |
parent | 2638f12f95eea692502836cf6548b4a0b234d009 (diff) |
merge -r62831:64079 branches/maintenance to release
Diffstat (limited to 'indra')
170 files changed, 2997 insertions, 742 deletions
diff --git a/indra/llcharacter/llmotioncontroller.cpp b/indra/llcharacter/llmotioncontroller.cpp index 6540b8c959..fad69fc6e9 100644 --- a/indra/llcharacter/llmotioncontroller.cpp +++ b/indra/llcharacter/llmotioncontroller.cpp @@ -526,6 +526,7 @@ void LLMotionController::updateMotionsByType(LLMotion::LLMotionBlendType anim_ty { if (motionp->isStopped() && mTime > motionp->getStopTime() + motionp->getEaseOutDuration()) { + posep->setWeight(0.f); deactivateMotion(motionp); } continue; @@ -552,6 +553,7 @@ void LLMotionController::updateMotionsByType(LLMotion::LLMotionBlendType anim_ty } else { + posep->setWeight(0.f); deactivateMotion(motionp); continue; } @@ -802,7 +804,6 @@ BOOL LLMotionController::activateMotion(LLMotion *motion, F32 time) //----------------------------------------------------------------------------- BOOL LLMotionController::deactivateMotion(LLMotion *motion) { - motion->getPose()->setWeight(0.f); motion->deactivate(); mActiveMotions.remove(motion); diff --git a/indra/llcommon/llapr.h b/indra/llcommon/llapr.h index e89912279e..6e8912c461 100644 --- a/indra/llcommon/llapr.h +++ b/indra/llcommon/llapr.h @@ -15,7 +15,7 @@ #include <sys/param.h> // Need PATH_MAX in APR headers... #endif -#include "boost/noncopyable.hpp" +#include <boost/noncopyable.hpp> #include "apr-1/apr_thread_proc.h" #include "apr-1/apr_thread_mutex.h" diff --git a/indra/llcommon/llavatarconstants.h b/indra/llcommon/llavatarconstants.h index d66627c4b0..7f231014aa 100644 --- a/indra/llcommon/llavatarconstants.h +++ b/indra/llcommon/llavatarconstants.h @@ -1,5 +1,5 @@ /** - * @file indra_constants.h + * @file llavatarconstants.h * @brief some useful short term constants for Indra * * Copyright (c) 2001-$CurrentYear$, Linden Research, Inc. diff --git a/indra/llcommon/llchat.h b/indra/llcommon/llchat.h index 61bdc81907..eb9419de60 100644 --- a/indra/llcommon/llchat.h +++ b/indra/llcommon/llchat.h @@ -30,7 +30,8 @@ typedef enum e_chat_type CHAT_TYPE_START = 4, CHAT_TYPE_STOP = 5, CHAT_TYPE_DEBUG_MSG = 6, - CHAT_TYPE_REGION = 7 + CHAT_TYPE_REGION = 7, + CHAT_TYPE_OWNER = 8 } EChatType; typedef enum e_chat_audible_level diff --git a/indra/llcommon/lldefs.h b/indra/llcommon/lldefs.h index 45fb8b9f84..f55616479d 100644 --- a/indra/llcommon/lldefs.h +++ b/indra/llcommon/lldefs.h @@ -35,13 +35,15 @@ const U32 SOUTHWEST = 6; const U32 SOUTHEAST = 7; const U32 MIDDLE = 8; -const U8 LL_SOUND_FLAG_NONE = 0x00; -const U8 LL_SOUND_FLAG_LOOP = 0x01; -const U8 LL_SOUND_FLAG_SYNC_MASTER = 0x02; -const U8 LL_SOUND_FLAG_SYNC_SLAVE = 0x04; -const U8 LL_SOUND_FLAG_SYNC_PENDING = 0x08; -const U8 LL_SOUND_FLAG_SYNC_MASK = LL_SOUND_FLAG_SYNC_MASTER | LL_SOUND_FLAG_SYNC_SLAVE | LL_SOUND_FLAG_SYNC_PENDING; -const U8 LL_SOUND_FLAG_QUEUE = 0x10; +const U8 EAST_MASK = 0x1<<EAST; +const U8 NORTH_MASK = 0x1<<NORTH; +const U8 WEST_MASK = 0x1<<WEST; +const U8 SOUTH_MASK = 0x1<<SOUTH; + +const U8 NORTHEAST_MASK = NORTH_MASK | EAST_MASK; +const U8 NORTHWEST_MASK = NORTH_MASK | WEST_MASK; +const U8 SOUTHWEST_MASK = SOUTH_MASK | WEST_MASK; +const U8 SOUTHEAST_MASK = SOUTH_MASK | EAST_MASK; const U32 gDirOpposite[8] = {2, 3, 0, 1, 6, 7, 4, 5}; const U32 gDirAdjacent[8][2] = { @@ -67,15 +69,6 @@ const S32 gDirAxes[8][2] = { { 1,-1}, // se }; -const U8 EAST_MASK = 1; -const U8 NORTH_MASK = 2; -const U8 WEST_MASK = 4; -const U8 SOUTH_MASK = 8; -const U8 NORTHEAST_MASK = NORTH_MASK | EAST_MASK; -const U8 NORTHWEST_MASK = NORTH_MASK | WEST_MASK; -const U8 SOUTHWEST_MASK = SOUTH_MASK | WEST_MASK; -const U8 SOUTHEAST_MASK = SOUTH_MASK | EAST_MASK; - const S32 gDirMasks[8] = { EAST_MASK, NORTH_MASK, @@ -113,6 +106,14 @@ const U32 RIGHT_SIDE = 4; const U32 TOP_SIDE = 5; const U32 BOTTOM_SIDE = 6; +const U8 LL_SOUND_FLAG_NONE = 0x0; +const U8 LL_SOUND_FLAG_LOOP = 1<<0; +const U8 LL_SOUND_FLAG_SYNC_MASTER = 1<<1; +const U8 LL_SOUND_FLAG_SYNC_SLAVE = 1<<2; +const U8 LL_SOUND_FLAG_SYNC_PENDING = 1<<3; +const U8 LL_SOUND_FLAG_QUEUE = 1<<4; +const U8 LL_SOUND_FLAG_STOP = 1<<5; +const U8 LL_SOUND_FLAG_SYNC_MASK = LL_SOUND_FLAG_SYNC_MASTER | LL_SOUND_FLAG_SYNC_SLAVE | LL_SOUND_FLAG_SYNC_PENDING; // // *NOTE: These values may be used as hard-coded numbers in scanf() variants. diff --git a/indra/llcommon/llfile.cpp b/indra/llcommon/llfile.cpp index f43e57f467..8d0125f0c1 100644 --- a/indra/llcommon/llfile.cpp +++ b/indra/llcommon/llfile.cpp @@ -9,6 +9,7 @@ * $License$ */ +#include "linden_common.h" #include "llfile.h" #include "llstring.h" #include "llerror.h" diff --git a/indra/llcommon/llmortician.cpp b/indra/llcommon/llmortician.cpp index a144ac6d93..f475b83203 100644 --- a/indra/llcommon/llmortician.cpp +++ b/indra/llcommon/llmortician.cpp @@ -5,6 +5,7 @@ * $License$ */ +#include "linden_common.h" #include "llmortician.h" #include <list> diff --git a/indra/llcommon/llprocessor.cpp b/indra/llcommon/llprocessor.cpp index a6b859ad41..00f4a13c39 100644 --- a/indra/llcommon/llprocessor.cpp +++ b/indra/llcommon/llprocessor.cpp @@ -433,7 +433,7 @@ bool CProcessor::AnalyzeIntelProcessor() case 3: // Model = 8, Brand id = 3: Pentium III Xeon (on-die L2 cache) processor model strncat(strCPUName, "Intel Pentium III Xeon (0.18 micron process) with internal L2 cache", sizeof(strCPUName)-(strlen(strCPUName)-1)); /*Flawfinder: ignore*/ break; - default: // ...² + default: // ... strncat(strCPUName, "Intel Pentium III core (unknown model, 0.18 micron process) with internal L2 cache", sizeof(strCPUName)-(strlen(strCPUName)-1)); /*Flawfinder: ignore*/ break; } @@ -644,8 +644,8 @@ bool CProcessor::AnalyzeAMDProcessor() mov dword ptr [tmp+44], edx } // And copy it to the brand id string - strncpy(CPUInfo.strBrandID, tmp,sizeof(CPUInfo.strBrandID-1)); /* Flawfinder: ignore */ - CPUInfo.strBrandID[sizeof(CPUInfo.strBrandID-1)]='\0'; + strncpy(CPUInfo.strBrandID, tmp,sizeof(CPUInfo.strBrandID)-1); + CPUInfo.strBrandID[sizeof(CPUInfo.strBrandID)-1]='\0'; } else { @@ -1260,17 +1260,17 @@ void CProcessor::DecodeProcessorConfiguration(unsigned int cfg) CPUInfo._L1.Data.uiAssociativeWays = 4; CPUInfo._L1.Data.uiLineSize = 64; break; - case 0x70: // cfg = 0x70: trace L1 cache present, 12 KµOPs, 4 ways + case 0x70: // cfg = 0x70: trace L1 cache present, 12 KuOPs, 4 ways CPUInfo._Trace.bPresent = true; strcpy(CPUInfo._Trace.strSize, "12 K-micro-ops"); /* Flawfinder: ignore */ CPUInfo._Trace.uiAssociativeWays = 4; break; - case 0x71: // cfg = 0x71: trace L1 cache present, 16 KµOPs, 4 ways + case 0x71: // cfg = 0x71: trace L1 cache present, 16 KuOPs, 4 ways CPUInfo._Trace.bPresent = true; strcpy(CPUInfo._Trace.strSize, "16 K-micro-ops"); /* Flawfinder: ignore */ CPUInfo._Trace.uiAssociativeWays = 4; break; - case 0x72: // cfg = 0x72: trace L1 cache present, 32 KµOPs, 4 ways + case 0x72: // cfg = 0x72: trace L1 cache present, 32 KuOPs, 4 ways CPUInfo._Trace.bPresent = true; strcpy(CPUInfo._Trace.strSize, "32 K-micro-ops"); /* Flawfinder: ignore */ CPUInfo._Trace.uiAssociativeWays = 4; diff --git a/indra/llcommon/llsd.cpp b/indra/llcommon/llsd.cpp index e5f366c4a4..2fb9a0ab9c 100644 --- a/indra/llcommon/llsd.cpp +++ b/indra/llcommon/llsd.cpp @@ -6,6 +6,7 @@ * $License$ */ +#include "linden_common.h" #include "llsd.h" #include <sstream> diff --git a/indra/llcommon/llsdserialize_xml.cpp b/indra/llcommon/llsdserialize_xml.cpp index c5ab369d0f..de4f3197e6 100644 --- a/indra/llcommon/llsdserialize_xml.cpp +++ b/indra/llcommon/llsdserialize_xml.cpp @@ -378,7 +378,10 @@ S32 LLSDXMLParser::Impl::parse(std::istream& input, LLSD& data) status = XML_ParseBuffer(mParser, 0, true); if (status == XML_STATUS_ERROR && !mGracefullStop) { - ((char*) buffer)[count? count - 1 : 0] = '\0'; + if (buffer) + { + ((char*) buffer)[count ? count - 1 : 0] = '\0'; + } llinfos << "LLSDXMLParser::Impl::parse: XML_STATUS_ERROR parsing:" << (char*) buffer << llendl; data = LLSD(); return -1; diff --git a/indra/llcommon/llsdutil.cpp b/indra/llcommon/llsdutil.cpp index 5a0a76b3f3..e6d9396f7d 100644 --- a/indra/llcommon/llsdutil.cpp +++ b/indra/llcommon/llsdutil.cpp @@ -277,4 +277,4 @@ char* ll_pretty_print_sd(const LLSD& sd) strncpy(buffer, stream.str().c_str(), bufferSize); buffer[bufferSize - 1] = '\0'; return buffer; -}
\ No newline at end of file +} diff --git a/indra/llcommon/llstreamtools.cpp b/indra/llcommon/llstreamtools.cpp index a92f1c9388..447f80e617 100644 --- a/indra/llcommon/llstreamtools.cpp +++ b/indra/llcommon/llstreamtools.cpp @@ -6,6 +6,8 @@ * $License$ */ +#include "linden_common.h" + #include <iostream> #include <string> diff --git a/indra/llcommon/llstring.cpp b/indra/llcommon/llstring.cpp index c6f436a5bb..0b799b94ae 100644 --- a/indra/llcommon/llstring.cpp +++ b/indra/llcommon/llstring.cpp @@ -653,6 +653,26 @@ std::string mbcsstring_makeASCII(const std::string& wstr) } return out_str; } +std::string utf8str_removeCRLF(const std::string& utf8str) +{ + if (0 == utf8str.length()) + { + return std::string(); + } + const char CR = 13; + + std::string out; + out.reserve(utf8str.length()); + const S32 len = (S32)utf8str.length(); + for( S32 i = 0; i < len; i++ ) + { + if( utf8str[i] != CR ) + { + out.push_back(utf8str[i]); + } + } + return out; +} #if LL_WINDOWS /* If the size of the passed in buffer is not large enough to hold the string, diff --git a/indra/llcommon/llstring.h b/indra/llcommon/llstring.h index c8c6e9ce7a..3c798b25aa 100644 --- a/indra/llcommon/llstring.h +++ b/indra/llcommon/llstring.h @@ -437,6 +437,9 @@ std::string utf8str_makeASCII(const std::string& utf8str); // Hack - used for evil notecards. std::string mbcsstring_makeASCII(const std::string& str); +std::string utf8str_removeCRLF(const std::string& utf8str); + + template <class T> std::ostream& operator<<(std::ostream &s, const LLStringBase<T> &str) { diff --git a/indra/llcommon/lluri.cpp b/indra/llcommon/lluri.cpp index fc29e760be..5cb6067990 100644 --- a/indra/llcommon/lluri.cpp +++ b/indra/llcommon/lluri.cpp @@ -168,6 +168,55 @@ LLURI::LLURI(const std::string& escaped_str) } } +static BOOL isDefault(const std::string& scheme, U16 port) +{ + if (scheme == "http") + return port == 80; + if (scheme == "https") + return port == 443; + if (scheme == "ftp") + return port == 21; + + return FALSE; +} + +LLURI::LLURI(const std::string& scheme, + const std::string& userName, + const std::string& password, + const std::string& hostName, + U16 port, + const std::string& escapedPath, + const std::string& escapedQuery) + : mScheme(scheme), + mEscapedPath(escapedPath), + mEscapedQuery(escapedQuery) +{ + std::ostringstream auth; + std::ostringstream opaque; + + opaque << "//"; + + if (!userName.empty()) + { + auth << escape(userName); + if (!password.empty()) + { + auth << ':' << escape(password); + } + auth << '@'; + } + auth << hostName; + if (!isDefault(scheme, port)) + { + auth << ':' << port; + } + mEscapedAuthority = auth.str(); + + opaque << mEscapedAuthority << escapedPath << escapedQuery; + + mEscapedOpaque = opaque.str(); +} + LLURI::~LLURI() { } @@ -427,6 +476,35 @@ std::string LLURI::hostName() const return unescape(host); } +std::string LLURI::userName() const +{ + std::string user, userPass, host, port; + findAuthorityParts(mEscapedAuthority, userPass, host, port); + std::string::size_type pos = userPass.find(':'); + if (pos != std::string::npos) + { + user = userPass.substr(0, pos); + } + return unescape(user); +} + +std::string LLURI::password() const +{ + std::string pass, userPass, host, port; + findAuthorityParts(mEscapedAuthority, userPass, host, port); + std::string::size_type pos = userPass.find(':'); + if (pos != std::string::npos) + { + pass = userPass.substr(pos + 1); + } + return unescape(pass); +} + +BOOL LLURI::defaultPort() const +{ + return isDefault(mScheme, hostPort()); +} + U16 LLURI::hostPort() const { std::string user, host, port; diff --git a/indra/llcommon/lluri.h b/indra/llcommon/lluri.h index 0665255676..9ec51b4b1a 100644 --- a/indra/llcommon/lluri.h +++ b/indra/llcommon/lluri.h @@ -28,6 +28,14 @@ class LLURI public: LLURI(); LLURI(const std::string& escaped_str); + LLURI(const std::string& scheme, + const std::string& userName, + const std::string& password, + const std::string& hostName, + U16 hostPort, + const std::string& escapedPath, + const std::string& escapedQuery); + // construct from escaped string, as would be transmitted on the net ~LLURI(); @@ -48,8 +56,6 @@ public: const U32& port, const LLSD& path, const LLSD& query); - - std::string asString() const; // the whole URI, escaped as needed @@ -64,10 +70,15 @@ public: // for schemes that follow path like syntax (http, https, ftp) std::string authority() const; // ex.: "host.com:80" std::string hostName() const; // ex.: "host.com" + std::string userName() const; + std::string password() const; U16 hostPort() const; // ex.: 80, will include implicit port + BOOL defaultPort() const; // true if port is default for scheme + const std::string& escapedPath() const { return mEscapedPath; } std::string path() const; // ex.: "/abc/def", includes leading slash // LLSD pathArray() const; // above decoded into an array of strings std::string query() const; // ex.: "x=34", section after "?" + const std::string& escapedQuery() const { return mEscapedQuery; } LLSD queryMap() const; // above decoded into a map static LLSD queryMap(std::string escaped_query_string); static std::string mapToQueryString(const LLSD& queryMap); diff --git a/indra/llcommon/string_table.h b/indra/llcommon/string_table.h index 02ea4c34aa..4914e532a1 100644 --- a/indra/llcommon/string_table.h +++ b/indra/llcommon/string_table.h @@ -2,7 +2,7 @@ * @file string_table.h * @brief Legacy wrapper header. * - * Copyright (c) 2000-$CurrentYear$ Linden Research, Inc. + * Copyright (c) 2000-$CurrentYear$, Linden Research, Inc. * $License$ */ #include "llstringtable.h" diff --git a/indra/llcommon/timer.h b/indra/llcommon/timer.h index e4b799ee30..925b4c1a4e 100644 --- a/indra/llcommon/timer.h +++ b/indra/llcommon/timer.h @@ -2,7 +2,7 @@ * @file timer.h * @brief Legacy wrapper header. * - * Copyright (c) 2000-$CurrentYear$ Linden Research, Inc. + * Copyright (c) 2000-$CurrentYear$, Linden Research, Inc. * $License$ */ #include "lltimer.h" diff --git a/indra/llcommon/timing.cpp b/indra/llcommon/timing.cpp index 2c8a214b01..b8141fd4aa 100644 --- a/indra/llcommon/timing.cpp +++ b/indra/llcommon/timing.cpp @@ -2,6 +2,6 @@ * @file timing.cpp * @brief This file will be deprecated in the future. * - * Copyright (c) 2000-$CurrentYear$ Linden Research, Inc. + * Copyright (c) 2000-$CurrentYear$, Linden Research, Inc. * $License$ */ diff --git a/indra/llimage/llimage.cpp b/indra/llimage/llimage.cpp index b6f6cdfc24..5ef3e9de3b 100644 --- a/indra/llimage/llimage.cpp +++ b/indra/llimage/llimage.cpp @@ -1085,7 +1085,8 @@ file_extensions[] = { "jpg", IMG_CODEC_JPEG }, { "jpeg", IMG_CODEC_JPEG }, { "mip", IMG_CODEC_DXT }, - { "dxt", IMG_CODEC_DXT } + { "dxt", IMG_CODEC_DXT }, + { "png", IMG_CODEC_PNG } }; #define NUM_FILE_EXTENSIONS sizeof(file_extensions)/sizeof(file_extensions[0]) diff --git a/indra/llimage/llimage.h b/indra/llimage/llimage.h index 0e007c2c86..99e60c48a8 100644 --- a/indra/llimage/llimage.h +++ b/indra/llimage/llimage.h @@ -47,7 +47,8 @@ enum IMG_CODEC_TGA = 4, IMG_CODEC_JPEG = 5, IMG_CODEC_DXT = 6, - IMG_CODEC_EOF = 7 + IMG_CODEC_PNG = 7, + IMG_CODEC_EOF = 8 }; //============================================================================ diff --git a/indra/llimage/llimagepng.cpp b/indra/llimage/llimagepng.cpp new file mode 100644 index 0000000000..4d884822ed --- /dev/null +++ b/indra/llimage/llimagepng.cpp @@ -0,0 +1,127 @@ +/* + * @file llimagepng.cpp + * @brief LLImageFormatted glue to encode / decode PNG files. + * + * Copyright (c) 2007 Peekay Semyorka. + * Copyright (c) 2007-$CurrentYear$, Linden Research, Inc. + * $License$ + */ + +#include "linden_common.h" +#include "stdtypes.h" +#include "llerror.h" + +#include "llimage.h" +#include "llpngwrapper.h" +#include "llimagepng.h" + +// --------------------------------------------------------------------------- +// LLImagePNG +// --------------------------------------------------------------------------- +LLImagePNG::LLImagePNG() + : LLImageFormatted(IMG_CODEC_PNG), + mTmpWriteBuffer(NULL) +{ +} + +LLImagePNG::~LLImagePNG() +{ + if (mTmpWriteBuffer) + { + delete[] mTmpWriteBuffer; + } +} + +// Virtual +// Parse PNG image information and set the appropriate +// width, height and component (channel) information. +BOOL LLImagePNG::updateData() +{ + resetLastError(); + + // Check to make sure that this instance has been initialized with data + if (!getData() || (0 == getDataSize())) + { + setLastError("Uninitialized instance of LLImagePNG"); + return FALSE; + } + + // Decode the PNG data and extract sizing information + LLPngWrapper pngWrapper; + LLPngWrapper::ImageInfo infop; + if (! pngWrapper.readPng(getData(), NULL, &infop)) + { + setLastError(pngWrapper.getErrorMessage()); + return FALSE; + } + + setSize(infop.mWidth, infop.mHeight, infop.mComponents); + + return TRUE; +} + +// Virtual +// Decode an in-memory PNG image into the raw RGB or RGBA format +// used within SecondLife. +BOOL LLImagePNG::decode(LLImageRaw* raw_image, F32 decode_time) +{ + llassert_always(raw_image); + + resetLastError(); + + // Check to make sure that this instance has been initialized with data + if (!getData() || (0 == getDataSize())) + { + setLastError("LLImagePNG trying to decode an image with no data!"); + return FALSE; + } + + // Decode the PNG data into the raw image + LLPngWrapper pngWrapper; + if (! pngWrapper.readPng(getData(), raw_image)) + { + setLastError(pngWrapper.getErrorMessage()); + return FALSE; + } + + return TRUE; +} + +// Virtual +// Encode the in memory RGB image into PNG format. +BOOL LLImagePNG::encode(const LLImageRaw* raw_image, F32 encode_time) +{ + llassert_always(raw_image); + + resetLastError(); + + // Image logical size + setSize(raw_image->getWidth(), raw_image->getHeight(), raw_image->getComponents()); + + // Temporary buffer to hold the encoded image. Note: the final image + // size should be much smaller due to compression. + if (mTmpWriteBuffer) + { + delete[] mTmpWriteBuffer; + } + U32 bufferSize = getWidth() * getHeight() * getComponents() + 1024; + U8* mTmpWriteBuffer = new U8[ bufferSize ]; + + // Delegate actual encoding work to wrapper + LLPngWrapper pngWrapper; + if (! pngWrapper.writePng(raw_image, mTmpWriteBuffer)) + { + setLastError(pngWrapper.getErrorMessage()); + return FALSE; + } + + // Resize internal buffer and copy from temp + U32 encodedSize = pngWrapper.getFinalSize(); + allocateData(encodedSize); + memcpy(getData(), mTmpWriteBuffer, encodedSize); + + delete[] mTmpWriteBuffer; + + return TRUE; +} + diff --git a/indra/llimage/llimagepng.h b/indra/llimage/llimagepng.h new file mode 100644 index 0000000000..e12a5cc1f9 --- /dev/null +++ b/indra/llimage/llimagepng.h @@ -0,0 +1,31 @@ +/* + * @file llimagepng.h + * + * Copyright (c) 2007 Peekay Semyorka. + * Copyright (c) 2007-$CurrentYear$, Linden Research, Inc. + * $License$ + */ + +#ifndef LL_LLIMAGEPNG_H +#define LL_LLIMAGEPNG_H + +#include "stdtypes.h" +#include "llimage.h" + +class LLImagePNG : public LLImageFormatted +{ +protected: + ~LLImagePNG(); + +public: + LLImagePNG(); + + BOOL updateData(); + BOOL decode(LLImageRaw* raw_image, F32 decode_time = 0.0); + BOOL encode(const LLImageRaw* raw_image, F32 encode_time = 0.0); + +private: + U8* mTmpWriteBuffer; +}; + +#endif diff --git a/indra/llimage/llimageworker.cpp b/indra/llimage/llimageworker.cpp index 1e625fbe28..9a200cdf61 100644 --- a/indra/llimage/llimageworker.cpp +++ b/indra/llimage/llimageworker.cpp @@ -1,5 +1,5 @@ /** - * @file llimage.cpp + * @file llimageworker.cpp * @brief Base class for images. * * Copyright (c) 2001-$CurrentYear$, Linden Research, Inc. diff --git a/indra/llimage/llpngwrapper.cpp b/indra/llimage/llpngwrapper.cpp new file mode 100644 index 0000000000..462edc5974 --- /dev/null +++ b/indra/llimage/llpngwrapper.cpp @@ -0,0 +1,368 @@ +/* + * @file llpngwrapper.cpp + * @brief Encapsulates libpng read/write functionality. + * + * Copyright (c) 2007 Peekay Semyorka. + * Copyright (c) 2007-$CurrentYear$, Linden Research, Inc. + * $License$ + */ + +#include "linden_common.h" +#include "stdtypes.h" +#include "llerror.h" + +#include "llimage.h" +#include "llpngwrapper.h" + +// --------------------------------------------------------------------------- +// LLPngWrapper +// --------------------------------------------------------------------------- + +LLPngWrapper::LLPngWrapper() + : mReadPngPtr( NULL ), + mReadInfoPtr( NULL ), + mWritePngPtr( NULL ), + mWriteInfoPtr( NULL ), + mRowPointers( NULL ), + mBitDepth( 0 ), + mColorType( 0 ), + mChannels( 0 ), + mInterlaceType( 0 ), + mCompressionType( 0 ), + mFilterMethod( 0 ), + mFinalSize( 0 ) +{ +} + +LLPngWrapper::~LLPngWrapper() +{ + releaseResources(); +} + +// Checks the src for a valid PNG header +BOOL LLPngWrapper::isValidPng(U8* src) +{ + const int PNG_BYTES_TO_CHECK = 8; + + int sig = png_sig_cmp((png_bytep)src, (png_size_t)0, PNG_BYTES_TO_CHECK); + if (sig != 0) + { + mErrorMessage = "Invalid or corrupt PNG file"; + return FALSE; + } + + return TRUE; +} + +// Called by the libpng library when a fatal encoding or decoding error +// occurs. We simply throw the error message and let our try/catch +// block clean up. +void LLPngWrapper::errorHandler(png_structp png_ptr, png_const_charp msg) +{ + throw msg; +} + +// Called by the libpng library when reading (decoding) the PNG file. We +// copy the PNG data from our internal buffer into the PNG's data buffer. +void LLPngWrapper::readDataCallback(png_structp png_ptr, png_bytep dest, png_size_t length) +{ + PngDataInfo *dataInfo = (PngDataInfo *) png_get_io_ptr(png_ptr); + U8 *src = &dataInfo->mData[dataInfo->mOffset]; + memcpy(dest, src, length); + dataInfo->mOffset += static_cast<U32>(length); +} + +// Called by the libpng library when writing (encoding) the PNG file. We +// copy the encoded result into our data buffer. +void LLPngWrapper::writeDataCallback(png_structp png_ptr, png_bytep src, png_size_t length) +{ + PngDataInfo *dataInfo = (PngDataInfo *) png_get_io_ptr(png_ptr); + U8 *dest = &dataInfo->mData[dataInfo->mOffset]; + memcpy(dest, src, length); + dataInfo->mOffset += static_cast<U32>(length); +} + +// Flush the write output pointer +void LLPngWrapper::writeFlush(png_structp png_ptr) +{ + // no-op since we're just writing to memory +} + +// Read the PNG file using the libpng. The low-level interface is used here +// because we want to do various transformations (including setting the +// matte background if any, and applying gama) which can't be done with +// the high-level interface. The scanline also begins at the bottom of +// the image (per SecondLife conventions) instead of at the top, so we +// must assign row-pointers in "reverse" order. +BOOL LLPngWrapper::readPng(U8* src, LLImageRaw* rawImage, ImageInfo *infop) +{ + try + { + // Create and initialize the png structures + mReadPngPtr = png_create_read_struct(PNG_LIBPNG_VER_STRING, + this, &errorHandler, NULL); + if (mReadPngPtr == NULL) + { + throw "Problem creating png read structure"; + } + + // Allocate/initialize the memory for image information. + mReadInfoPtr = png_create_info_struct(mReadPngPtr); + + // Set up the input control + PngDataInfo dataPtr; + dataPtr.mData = src; + dataPtr.mOffset = 0; + + png_set_read_fn(mReadPngPtr, &dataPtr, &readDataCallback); + png_set_sig_bytes(mReadPngPtr, 0); + + // setup low-level read and get header information + png_read_info(mReadPngPtr, mReadInfoPtr); + png_get_IHDR(mReadPngPtr, mReadInfoPtr, &mWidth, &mHeight, + &mBitDepth, &mColorType, &mInterlaceType, + &mCompressionType, &mFilterMethod); + + // Normalize the image, then get updated image information + // after transformations have been applied + normalizeImage(); + updateMetaData(); + + // If a raw object is supplied, read the PNG image into its + // data space + if (rawImage != NULL) + { + rawImage->resize(static_cast<U16>(mWidth), + static_cast<U16>(mHeight), mChannels); + U8 *dest = rawImage->getData(); + int offset = mWidth * mChannels; + + // Set up the row pointers and read the image + mRowPointers = new U8* [mHeight]; + for (U32 i=0; i < mHeight; i++) + { + mRowPointers[i] = &dest[(mHeight-i-1)*offset]; + } + + png_read_image(mReadPngPtr, mRowPointers); + + // Finish up, ensures all metadata are updated + png_read_end(mReadPngPtr, NULL); + } + + // If an info object is supplied, copy the relevant info + if (infop != NULL) + { + infop->mHeight = static_cast<U16>(mHeight); + infop->mWidth = static_cast<U16>(mWidth); + infop->mComponents = mChannels; + } + + mFinalSize = dataPtr.mOffset; + } + catch (png_const_charp msg) + { + mErrorMessage = msg; + releaseResources(); + return (FALSE); + } + + // Clean up and return + releaseResources(); + return (TRUE); +} + +// Do transformations to normalize the input to 8-bpp RGBA +void LLPngWrapper::normalizeImage() +{ + // 1. Expand any palettes + // 2. Convert grayscales to RGB + // 3. Create alpha layer from transparency + // 4. Ensure 8-bpp for all images + // 5. Apply background matte if any + // 6. Set (or guess) gamma + + if (mColorType == PNG_COLOR_TYPE_PALETTE) + { + png_set_palette_to_rgb(mReadPngPtr); + } + if (mColorType == PNG_COLOR_TYPE_GRAY && mBitDepth < 8) + { + png_set_gray_1_2_4_to_8(mReadPngPtr); + } + if (mColorType == PNG_COLOR_TYPE_GRAY + || mColorType == PNG_COLOR_TYPE_GRAY_ALPHA) + { + png_set_gray_to_rgb(mReadPngPtr); + } + if (png_get_valid(mReadPngPtr, mReadInfoPtr, PNG_INFO_tRNS)) + { + png_set_tRNS_to_alpha(mReadPngPtr); + } + if (mBitDepth < 8) + { + png_set_packing(mReadPngPtr); + } + else if (mBitDepth == 16) + { + png_set_strip_16(mReadPngPtr); + } + mHasBKGD = png_get_bKGD(mReadPngPtr, mReadInfoPtr, &mBackgroundColor); + if (mHasBKGD) + { + png_set_background(mReadPngPtr, mBackgroundColor, + PNG_BACKGROUND_GAMMA_FILE, 1, 1.0); + } + +#if LL_DARWIN + const F64 SCREEN_GAMMA = 1.8; +#else + const F64 SCREEN_GAMMA = 2.2; +#endif + + if (png_get_gAMA(mReadPngPtr, mReadInfoPtr, &mGamma)) + { + png_set_gamma(mReadPngPtr, SCREEN_GAMMA, mGamma); + } + else + { + png_set_gamma(mReadPngPtr, SCREEN_GAMMA, 1/SCREEN_GAMMA); + } +} + +// Read out the image meta-data +void LLPngWrapper::updateMetaData() +{ + png_read_update_info(mReadPngPtr, mReadInfoPtr); + mWidth = png_get_image_width(mReadPngPtr, mReadInfoPtr); + mHeight = png_get_image_height(mReadPngPtr, mReadInfoPtr); + mBitDepth = png_get_bit_depth(mReadPngPtr, mReadInfoPtr); + mColorType = png_get_color_type(mReadPngPtr, mReadInfoPtr); + mChannels = png_get_channels(mReadPngPtr, mReadInfoPtr); + mHasBKGD = png_get_bKGD(mReadPngPtr, mReadInfoPtr, &mBackgroundColor); +} + +// Method to write raw image into PNG at dest. The raw scanline begins +// at the bottom of the image per SecondLife conventions. +BOOL LLPngWrapper::writePng(const LLImageRaw* rawImage, U8* dest) +{ + try + { + S8 numComponents = rawImage->getComponents(); + switch (numComponents) + { + case 1: + mColorType = PNG_COLOR_TYPE_GRAY; + break; + case 2: + mColorType = PNG_COLOR_TYPE_GRAY_ALPHA; + break; + case 3: + mColorType = PNG_COLOR_TYPE_RGB; + break; + case 4: + mColorType = PNG_COLOR_TYPE_RGB_ALPHA; + break; + default: + mColorType = -1; + } + + if (mColorType == -1) + { + throw "Unsupported image: unexpected number of channels"; + } + + mWritePngPtr = png_create_write_struct(PNG_LIBPNG_VER_STRING, + NULL, &errorHandler, NULL); + if (!mWritePngPtr) + { + throw "Problem creating png write structure"; + } + + mWriteInfoPtr = png_create_info_struct(mWritePngPtr); + + // Setup write function + PngDataInfo dataPtr; + dataPtr.mData = dest; + dataPtr.mOffset = 0; + png_set_write_fn(mWritePngPtr, &dataPtr, &writeDataCallback, &writeFlush); + + // Setup image params + mWidth = rawImage->getWidth(); + mHeight = rawImage->getHeight(); + mBitDepth = 8; // Fixed to 8-bpp in SL + mChannels = numComponents; + mInterlaceType = PNG_INTERLACE_NONE; + mCompressionType = PNG_COMPRESSION_TYPE_DEFAULT; + mFilterMethod = PNG_FILTER_TYPE_DEFAULT; + + // Write header + png_set_IHDR(mWritePngPtr, mWriteInfoPtr, mWidth, mHeight, + mBitDepth, mColorType, mInterlaceType, + mCompressionType, mFilterMethod); + + // Get data and compute row size + const U8* data = rawImage->getData(); + int offset = mWidth * mChannels; + + // Ready to write, start with the header + png_write_info(mWritePngPtr, mWriteInfoPtr); + + // Write image (sorry, must const-cast for libpng) + const U8 * rowPointer; + for (U32 i=0; i < mHeight; i++) + { + rowPointer = &data[(mHeight-1-i)*offset]; + png_write_row(mWritePngPtr, const_cast<png_bytep>(rowPointer)); + } + + // Finish up + png_write_end(mWritePngPtr, mWriteInfoPtr); + mFinalSize = dataPtr.mOffset; + } + catch (png_const_charp msg) + { + mErrorMessage = msg; + releaseResources(); + return (FALSE); + } + + releaseResources(); + return TRUE; +} + +// Cleanup various internal structures +void LLPngWrapper::releaseResources() +{ + if (mReadPngPtr || mReadInfoPtr) + { + png_destroy_read_struct(&mReadPngPtr, &mReadInfoPtr, png_infopp_NULL); + mReadPngPtr = NULL; + mReadInfoPtr = NULL; + } + + if (mWritePngPtr || mWriteInfoPtr) + { + png_destroy_write_struct(&mWritePngPtr, &mWriteInfoPtr); + mWritePngPtr = NULL; + mWriteInfoPtr = NULL; + } + + if (mRowPointers) + { + delete[] mRowPointers; + mRowPointers = NULL; + } +} + +// Get final image size after compression +U32 LLPngWrapper::getFinalSize() +{ + return mFinalSize; +} + +// Get last error message, if any +LLString LLPngWrapper::getErrorMessage() +{ + return mErrorMessage; +} diff --git a/indra/llimage/llpngwrapper.h b/indra/llimage/llpngwrapper.h new file mode 100644 index 0000000000..3d83992cfd --- /dev/null +++ b/indra/llimage/llpngwrapper.h @@ -0,0 +1,82 @@ +/* + * @file llpngwrapper.h + * + * Copyright (c) 2007 Peekay Semyorka. + * Copyright (c) 2007-$CurrentYear$, Linden Research, Inc. + * $License$ + */ + +#ifndef LL_LLPNGWRAPPER_H +#define LL_LLPNGWRAPPER_H + +#include "libpng12/png.h" +#include "llimage.h" + +class LLPngWrapper +{ +public: + LLPngWrapper(); + virtual ~LLPngWrapper(); + +public: + struct ImageInfo + { + U16 mWidth; + U16 mHeight; + S8 mComponents; + }; + + BOOL isValidPng(U8* src); + BOOL readPng(U8* src, LLImageRaw* rawImage, ImageInfo *infop = NULL); + BOOL writePng(const LLImageRaw* rawImage, U8* dst); + U32 getFinalSize(); + LLString getErrorMessage(); + +protected: + void normalizeImage(); + void updateMetaData(); + +private: + + // Structure for writing/reading PNG data to/from memory + // as opposed to using a file. + struct PngDataInfo + { + U8 *mData; + U32 mOffset; + }; + + static void writeFlush(png_structp png_ptr); + static void errorHandler(png_structp png_ptr, png_const_charp msg); + static void readDataCallback(png_structp png_ptr, png_bytep dest, png_size_t length); + static void writeDataCallback(png_structp png_ptr, png_bytep src, png_size_t length); + + void releaseResources(); + + png_structp mReadPngPtr; + png_infop mReadInfoPtr; + png_structp mWritePngPtr; + png_infop mWriteInfoPtr; + + U8 **mRowPointers; + + png_uint_32 mWidth; + png_uint_32 mHeight; + S32 mBitDepth; + S32 mColorType; + S32 mChannels; + S32 mInterlaceType; + S32 mCompressionType; + S32 mFilterMethod; + + U32 mFinalSize; + + BOOL mHasBKGD; + png_color_16p mBackgroundColor; + + F64 mGamma; + + LLString mErrorMessage; +}; + +#endif diff --git a/indra/llinventory/llparcel.cpp b/indra/llinventory/llparcel.cpp index 38b0cb06c6..6263f7ae11 100644 --- a/indra/llinventory/llparcel.cpp +++ b/indra/llinventory/llparcel.cpp @@ -1211,24 +1211,6 @@ BOOL LLParcel::exportStream(std::ostream& output_stream) return TRUE; } -// virtual -LLSD LLParcel::asLLSD() const -{ - LLSD p; - p["parcel-id"] = getID(); - p["name"] = getName(); - p["desc"] = getDesc(); - p["owner-id"] = getOwnerID(); - p["group-id"] = getGroupID(); - p["group-owned"] = (bool)getIsGroupOwned(); - p["auction-id"] = (S32)getAuctionID(); - p["snapshot-id"] = getSnapshotID(); - p["authorized-buyer-id"] = getAuthorizedBuyerID(); - p["sale-price"] = getSalePrice(); - p["parcel-flags"] = (S32)getParcelFlags(); - // NOTE: This list is incomplete, as this is used only for search. JC - return p; -} // Assumes we are in a block "ParcelData" void LLParcel::packMessage(LLMessageSystem* msg) diff --git a/indra/llinventory/llparcel.h b/indra/llinventory/llparcel.h index 1ad51dfd1e..fe51185153 100644 --- a/indra/llinventory/llparcel.h +++ b/indra/llinventory/llparcel.h @@ -244,7 +244,6 @@ public: BOOL importStream(std::istream& input_stream); BOOL importAccessEntry(std::istream& input_stream, LLAccessEntry* entry); BOOL exportStream(std::ostream& output_stream); - virtual LLSD asLLSD() const; void packMessage(LLMessageSystem* msg); void unpackMessage(LLMessageSystem* msg); diff --git a/indra/llinventory/llpermissions.h b/indra/llinventory/llpermissions.h index 76794e1ed9..131db1a635 100644 --- a/indra/llinventory/llpermissions.h +++ b/indra/llinventory/llpermissions.h @@ -120,7 +120,7 @@ public: const LLUUID& getOwner() const { return mOwner; } // return the group_id of the group associated with the - // object. group_id == owner_id if the object is group owned. + // object. const LLUUID& getGroup() const { return mGroup; } // return the agent_id of the last agent owner. Only returns diff --git a/indra/llinventory/lluserrelations.cpp b/indra/llinventory/lluserrelations.cpp index c10f6f610a..c42b1abc16 100644 --- a/indra/llinventory/lluserrelations.cpp +++ b/indra/llinventory/lluserrelations.cpp @@ -1,5 +1,5 @@ /** - * @file lluserrealations.cpp + * @file lluserrelations.cpp * @author Phoenix * @date 2006-10-12 * @brief Implementation of a simple cache of user relations. diff --git a/indra/llinventory/lluserrelations.h b/indra/llinventory/lluserrelations.h index 7c24254339..036f039105 100644 --- a/indra/llinventory/lluserrelations.h +++ b/indra/llinventory/lluserrelations.h @@ -1,5 +1,5 @@ /** - * @file llluserrelations.h + * @file lluserrelations.h * @author Phoenix * @date 2006-10-12 * @brief Declaration of a class for handling granted rights. diff --git a/indra/llmath/camera.h b/indra/llmath/camera.h index f130a036a1..63af2d794d 100644 --- a/indra/llmath/camera.h +++ b/indra/llmath/camera.h @@ -2,7 +2,7 @@ * @file camera.h * @brief Legacy wrapper header. * - * Copyright (c) 2000-$CurrentYear$ Linden Research, Inc. + * Copyright (c) 2000-$CurrentYear$, Linden Research, Inc. * $License$ */ diff --git a/indra/llmath/coordframe.h b/indra/llmath/coordframe.h index 5efab4b63e..a9a1ad9606 100644 --- a/indra/llmath/coordframe.h +++ b/indra/llmath/coordframe.h @@ -2,7 +2,7 @@ * @file coordframe.h * @brief Legacy wrapper header. * - * Copyright (c) 2000-$CurrentYear$ Linden Research, Inc. + * Copyright (c) 2000-$CurrentYear$, Linden Research, Inc. * $License$ */ diff --git a/indra/llmath/llquaternion.cpp b/indra/llmath/llquaternion.cpp index 56a3830bb3..8b2808164f 100644 --- a/indra/llmath/llquaternion.cpp +++ b/indra/llmath/llquaternion.cpp @@ -1,5 +1,5 @@ /** - * @file qmath.cpp + * @file llquaternion.cpp * @brief LLQuaternion class implementation. * * Copyright (c) 2000-$CurrentYear$, Linden Research, Inc. diff --git a/indra/llmath/llvolume.cpp b/indra/llmath/llvolume.cpp index 0d95c0492c..67ffb6d628 100644 --- a/indra/llmath/llvolume.cpp +++ b/indra/llmath/llvolume.cpp @@ -1779,6 +1779,8 @@ void LLVolume::createVolumeFaces() // sculpt replaces generate() for sculpted surfaces void LLVolume::sculpt(U16 sculpt_width, U16 sculpt_height, S8 sculpt_components, const U8* sculpt_data, S32 sculpt_level) { + U8 sculpt_type = mParams.getSculptType(); + BOOL data_is_empty = FALSE; if (sculpt_width == 0 || sculpt_height == 0 || sculpt_data == NULL) @@ -1860,6 +1862,7 @@ void LLVolume::sculpt(U16 sculpt_width, U16 sculpt_height, S8 sculpt_components, line += sizeT; } } + else { S32 line = 0; @@ -1874,18 +1877,52 @@ void LLVolume::sculpt(U16 sculpt_width, U16 sculpt_height, S8 sculpt_components, U32 x = (U32) ((F32)t/(sizeT-1) * (F32) sculpt_width); U32 y = (U32) ((F32)s/(sizeS-1) * (F32) sculpt_height); - if (y == sculpt_height) // stitch bottom row + if (y == 0) // top row stitching { - y = sculpt_height - 1; - x = sculpt_width / 2; + // pinch? + if (sculpt_type == LL_SCULPT_TYPE_SPHERE) + { + x = sculpt_width / 2; + } } - if (x == sculpt_width) // stitch sides - x = 0; + if (y == sculpt_height) // bottom row stitching + { + // wrap? + if (sculpt_type == LL_SCULPT_TYPE_TORUS) + { + y = 0; + } + else + { + y = sculpt_height - 1; + } - if (y == 0) // stitch top row - x = sculpt_width / 2; - + // pinch? + if (sculpt_type == LL_SCULPT_TYPE_SPHERE) + { + x = sculpt_width / 2; + } + } + + if (x == sculpt_width) // side stitching + { + // wrap? + if ((sculpt_type == LL_SCULPT_TYPE_SPHERE) || + (sculpt_type == LL_SCULPT_TYPE_TORUS) || + (sculpt_type == LL_SCULPT_TYPE_CYLINDER)) + { + x = 0; + } + + else + { + x = sculpt_width - 1; + } + } + + + U32 index = (x + y * sculpt_width) * sculpt_components; pt.mPos.mV[0] = sculpt_data[index ] / 256.f - 0.5f; pt.mPos.mV[1] = sculpt_data[index+1] / 256.f - 0.5f; @@ -4595,82 +4632,130 @@ BOOL LLVolumeFace::createSide() } } + // adjust normals based on wrapping and stitching + BOOL s_bottom_converges = ((mVertices[0].mPosition - mVertices[mNumS*(mNumT-2)].mPosition).magVecSquared() < 0.000001f); BOOL s_top_converges = ((mVertices[mNumS-1].mPosition - mVertices[mNumS*(mNumT-2)+mNumS-1].mPosition).magVecSquared() < 0.000001f); - - if (mVolumep->getPath().isOpen() == FALSE) { //wrap normals on T - for (S32 i = 0; i < mNumS; i++) { - LLVector3 norm = mVertices[i].mNormal + mVertices[mNumS*(mNumT-1)+i].mNormal; - mVertices[i].mNormal = norm; - mVertices[mNumS*(mNumT-1)+i].mNormal = norm; + U8 sculpt_type = mVolumep->getParams().getSculptType(); + + if (sculpt_type == LL_SCULPT_TYPE_NONE) // logic for non-sculpt volumes + { + if (mVolumep->getPath().isOpen() == FALSE) + { //wrap normals on T + for (S32 i = 0; i < mNumS; i++) + { + LLVector3 norm = mVertices[i].mNormal + mVertices[mNumS*(mNumT-1)+i].mNormal; + mVertices[i].mNormal = norm; + mVertices[mNumS*(mNumT-1)+i].mNormal = norm; + } } - } - if ((mVolumep->getProfile().isOpen() == FALSE) && - !(s_bottom_converges)) + if ((mVolumep->getProfile().isOpen() == FALSE) && !(s_bottom_converges)) { //wrap normals on S - for (S32 i = 0; i < mNumT; i++) { + for (S32 i = 0; i < mNumT; i++) + { LLVector3 norm = mVertices[mNumS*i].mNormal + mVertices[mNumS*i+mNumS-1].mNormal; mVertices[mNumS * i].mNormal = norm; mVertices[mNumS * i+mNumS-1].mNormal = norm; } } - if (mVolumep->getPathType() == LL_PCODE_PATH_CIRCLE && - ((mVolumep->getProfileType() & LL_PCODE_PROFILE_MASK) == LL_PCODE_PROFILE_CIRCLE_HALF)) - { - if (s_bottom_converges) - { //all lower S have same normal - for (S32 i = 0; i < mNumT; i++) { - mVertices[mNumS*i].mNormal = LLVector3(1,0,0); + if (mVolumep->getPathType() == LL_PCODE_PATH_CIRCLE && + ((mVolumep->getProfileType() & LL_PCODE_PROFILE_MASK) == LL_PCODE_PROFILE_CIRCLE_HALF)) + { + if (s_bottom_converges) + { //all lower S have same normal + for (S32 i = 0; i < mNumT; i++) + { + mVertices[mNumS*i].mNormal = LLVector3(1,0,0); + } } - } - if (s_top_converges) - { //all upper S have same normal - for (S32 i = 0; i < mNumT; i++) { - mVertices[mNumS*i+mNumS-1].mNormal = LLVector3(-1,0,0); + if (s_top_converges) + { //all upper S have same normal + for (S32 i = 0; i < mNumT; i++) + { + mVertices[mNumS*i+mNumS-1].mNormal = LLVector3(-1,0,0); + } } } } - - U8 sculpt_type = mVolumep->getParams().getSculptType(); - if (sculpt_type == LL_SCULPT_TYPE_SPHERE) + else // logic for sculpt volumes { - // average normals for north pole + BOOL average_poles = FALSE; + BOOL wrap_s = FALSE; + BOOL wrap_t = FALSE; + + if (sculpt_type == LL_SCULPT_TYPE_SPHERE) + average_poles = TRUE; + + if ((sculpt_type == LL_SCULPT_TYPE_SPHERE) || + (sculpt_type == LL_SCULPT_TYPE_TORUS) || + (sculpt_type == LL_SCULPT_TYPE_CYLINDER)) + wrap_s = TRUE; + + if (sculpt_type == LL_SCULPT_TYPE_TORUS) + wrap_t = TRUE; + - LLVector3 average(0.0, 0.0, 0.0); - for (S32 i = 0; i < mNumS; i++) + if (average_poles) { - average += mVertices[i].mNormal; - } + // average normals for north pole + + LLVector3 average(0.0, 0.0, 0.0); + for (S32 i = 0; i < mNumS; i++) + { + average += mVertices[i].mNormal; + } + + // set average + for (S32 i = 0; i < mNumS; i++) + { + mVertices[i].mNormal = average; + } + + // average normals for south pole + + average = LLVector3(0.0, 0.0, 0.0); + for (S32 i = 0; i < mNumS; i++) + { + average += mVertices[i + mNumS * (mNumT - 1)].mNormal; + } + + // set average + for (S32 i = 0; i < mNumS; i++) + { + mVertices[i + mNumS * (mNumT - 1)].mNormal = average; + } - // set average - for (S32 i = 0; i < mNumS; i++) - { - mVertices[i].mNormal = average; } - } - - if (sculpt_type == LL_SCULPT_TYPE_SPHERE) - { - // average normals for south pole - LLVector3 average(0.0, 0.0, 0.0); - for (S32 i = 0; i < mNumS; i++) + if (wrap_s) { - average += mVertices[i + mNumS * (mNumT - 1)].mNormal; + for (S32 i = 0; i < mNumT; i++) + { + LLVector3 norm = mVertices[mNumS*i].mNormal + mVertices[mNumS*i+mNumS-1].mNormal; + mVertices[mNumS * i].mNormal = norm; + mVertices[mNumS * i+mNumS-1].mNormal = norm; + } } - // set average - for (S32 i = 0; i < mNumS; i++) + + + if (wrap_t) { - mVertices[i + mNumS * (mNumT - 1)].mNormal = average; + for (S32 i = 0; i < mNumS; i++) + { + LLVector3 norm = mVertices[i].mNormal + mVertices[mNumS*(mNumT-1)+i].mNormal; + mVertices[i].mNormal = norm; + mVertices[mNumS*(mNumT-1)+i].mNormal = norm; + } + } - } + } //normalize normals and binormals here so the meshes that reference diff --git a/indra/llmath/llvolume.h b/indra/llmath/llvolume.h index 23c29ae310..a7d07bc712 100644 --- a/indra/llmath/llvolume.h +++ b/indra/llmath/llvolume.h @@ -154,7 +154,7 @@ const LLFaceID LL_FACE_OUTER_SIDE_3 = 0x1 << 8; const U8 LL_SCULPT_TYPE_NONE = 0; const U8 LL_SCULPT_TYPE_SPHERE = 1; const U8 LL_SCULPT_TYPE_TORUS = 2; -const U8 LL_SCULPT_TYPE_PLAIN = 3; +const U8 LL_SCULPT_TYPE_PLANE = 3; const U8 LL_SCULPT_TYPE_CYLINDER = 4; @@ -840,9 +840,6 @@ public: BOOL isUnique() const { return mUnique; } S32 getSculptLevel() const { return mSculptLevel; } - void setSculptLevel(S32 level) { mSculptLevel = level; } - - U8 getSculptType() const { return mSculptType; } S32 *getTriangleIndices(U32 &num_indices) const; void generateSilhouetteVertices(std::vector<LLVector3> &vertices, std::vector<LLVector3> &normals, std::vector<S32> &segments, const LLVector3& view_vec, @@ -888,7 +885,6 @@ protected: BOOL mUnique; F32 mDetail; S32 mSculptLevel; - U8 mSculptType; LLVolumeParams mParams; LLPath *mPathp; diff --git a/indra/llmath/v3color.cpp b/indra/llmath/v3color.cpp index d85006fa9c..7d5769bffc 100644 --- a/indra/llmath/v3color.cpp +++ b/indra/llmath/v3color.cpp @@ -90,4 +90,4 @@ void LLColor3::calcHSL(F32* hue, F32* saturation, F32* luminance) const if (hue) *hue = H; if (saturation) *saturation = S; if (luminance) *luminance = L; -}
\ No newline at end of file +} diff --git a/indra/llmessage/llblowfishcipher.cpp b/indra/llmessage/llblowfishcipher.cpp index d15e4fb69a..609c136d14 100644 --- a/indra/llmessage/llblowfishcipher.cpp +++ b/indra/llmessage/llblowfishcipher.cpp @@ -1,5 +1,5 @@ /** - * @file llblowcipher.cpp + * @file llblowfishcipher.cpp * @brief Wrapper around OpenSSL Blowfish encryption algorithm. * * We do not have OpenSSL headers or libraries on Windows, so this @@ -65,33 +65,33 @@ U32 LLBlowfishCipher::encrypt(const U8* src, U32 src_len, U8* dst, U32 dst_len) << " iv_len " << iv_length << llendl; - int output_len = 0;
- int temp_len = 0;
- if (!EVP_EncryptUpdate(&context,
- dst,
- &output_len,
- src,
- src_len))
- {
- llwarns << "LLBlowfishCipher::encrypt EVP_EncryptUpdate failure" << llendl;
- goto ERROR;
- }
-
- // There may be some final data left to encrypt if the input is
- // not an exact multiple of the block size.
- if (!EVP_EncryptFinal_ex(&context, (unsigned char*)(dst + output_len), &temp_len))
- {
- llwarns << "LLBlowfishCipher::encrypt EVP_EncryptFinal failure" << llendl;
- goto ERROR;
- }
- output_len += temp_len;
-
- EVP_CIPHER_CTX_cleanup(&context);
- return output_len;
-
-ERROR:
- EVP_CIPHER_CTX_cleanup(&context);
- return 0;
+ int output_len = 0; + int temp_len = 0; + if (!EVP_EncryptUpdate(&context, + dst, + &output_len, + src, + src_len)) + { + llwarns << "LLBlowfishCipher::encrypt EVP_EncryptUpdate failure" << llendl; + goto ERROR; + } + + // There may be some final data left to encrypt if the input is + // not an exact multiple of the block size. + if (!EVP_EncryptFinal_ex(&context, (unsigned char*)(dst + output_len), &temp_len)) + { + llwarns << "LLBlowfishCipher::encrypt EVP_EncryptFinal failure" << llendl; + goto ERROR; + } + output_len += temp_len; + + EVP_CIPHER_CTX_cleanup(&context); + return output_len; + +ERROR: + EVP_CIPHER_CTX_cleanup(&context); + return 0; } // virtual diff --git a/indra/llmessage/llcachename.cpp b/indra/llmessage/llcachename.cpp index 9c6e5e7f85..f1d2925026 100644 --- a/indra/llmessage/llcachename.cpp +++ b/indra/llmessage/llcachename.cpp @@ -46,132 +46,130 @@ LLCacheName* gCacheName = NULL; /// class LLCacheNameEntry /// --------------------------------------------------------------------------- -namespace { - class LLCacheNameEntry - { - public: - LLCacheNameEntry(); +class LLCacheNameEntry +{ +public: + LLCacheNameEntry(); - public: - bool mIsGroup; - U32 mCreateTime; // unix time_t - char mFirstName[DB_FIRST_NAME_BUF_SIZE]; /*Flawfinder: ignore*/ - char mLastName[DB_LAST_NAME_BUF_SIZE]; /*Flawfinder: ignore*/ - char mGroupName[DB_GROUP_NAME_BUF_SIZE]; /*Flawfinder: ignore*/ - }; +public: + bool mIsGroup; + U32 mCreateTime; // unix time_t + char mFirstName[DB_FIRST_NAME_BUF_SIZE]; /*Flawfinder: ignore*/ + char mLastName[DB_LAST_NAME_BUF_SIZE]; /*Flawfinder: ignore*/ + char mGroupName[DB_GROUP_NAME_BUF_SIZE]; /*Flawfinder: ignore*/ +}; - LLCacheNameEntry::LLCacheNameEntry() - { - mFirstName[0] = '\0'; - mLastName[0] = '\0'; - mGroupName[0] = '\0'; - } +LLCacheNameEntry::LLCacheNameEntry() +{ + mFirstName[0] = '\0'; + mLastName[0] = '\0'; + mGroupName[0] = '\0'; +} - class PendingReply - { - public: - LLUUID mID; - LLCacheNameCallback mCallback; - LLHost mHost; - void* mData; - PendingReply(const LLUUID& id, LLCacheNameCallback callback, void* data = NULL) - : mID(id), mCallback(callback), mData(data) - { } +class PendingReply +{ +public: + LLUUID mID; + LLCacheNameCallback mCallback; + LLHost mHost; + void* mData; + PendingReply(const LLUUID& id, LLCacheNameCallback callback, void* data = NULL) + : mID(id), mCallback(callback), mData(data) + { } - PendingReply(const LLUUID& id, const LLHost& host) - : mID(id), mCallback(0), mHost(host) - { } + PendingReply(const LLUUID& id, const LLHost& host) + : mID(id), mCallback(0), mHost(host) + { } - void done() { mID.setNull(); } - bool isDone() const { return mID.isNull() != FALSE; } - }; + void done() { mID.setNull(); } + bool isDone() const { return mID.isNull() != FALSE; } +}; - class ReplySender - { - public: - ReplySender(LLMessageSystem* msg); - ~ReplySender(); +class ReplySender +{ +public: + ReplySender(LLMessageSystem* msg); + ~ReplySender(); - void send(const LLUUID& id, - const LLCacheNameEntry& entry, const LLHost& host); + void send(const LLUUID& id, + const LLCacheNameEntry& entry, const LLHost& host); - private: - void flush(); +private: + void flush(); - LLMessageSystem* mMsg; - bool mPending; - bool mCurrIsGroup; - LLHost mCurrHost; - }; + LLMessageSystem* mMsg; + bool mPending; + bool mCurrIsGroup; + LLHost mCurrHost; +}; - ReplySender::ReplySender(LLMessageSystem* msg) - : mMsg(msg), mPending(false) - { } +ReplySender::ReplySender(LLMessageSystem* msg) + : mMsg(msg), mPending(false) +{ } - ReplySender::~ReplySender() - { - flush(); - } +ReplySender::~ReplySender() +{ + flush(); +} - void ReplySender::send(const LLUUID& id, - const LLCacheNameEntry& entry, const LLHost& host) +void ReplySender::send(const LLUUID& id, + const LLCacheNameEntry& entry, const LLHost& host) +{ + if (mPending) { - if (mPending) + if (mCurrIsGroup != entry.mIsGroup + || mCurrHost != host) { - if (mCurrIsGroup != entry.mIsGroup - || mCurrHost != host) - { - flush(); - } + flush(); } + } - if (!mPending) - { - mPending = true; - mCurrIsGroup = entry.mIsGroup; - mCurrHost = host; - - if(mCurrIsGroup) - mMsg->newMessageFast(_PREHASH_UUIDGroupNameReply); - else - mMsg->newMessageFast(_PREHASH_UUIDNameReply); - } + if (!mPending) + { + mPending = true; + mCurrIsGroup = entry.mIsGroup; + mCurrHost = host; - mMsg->nextBlockFast(_PREHASH_UUIDNameBlock); - mMsg->addUUIDFast(_PREHASH_ID, id); if(mCurrIsGroup) - { - mMsg->addStringFast(_PREHASH_GroupName, entry.mGroupName); - } + mMsg->newMessageFast(_PREHASH_UUIDGroupNameReply); else - { - mMsg->addStringFast(_PREHASH_FirstName, entry.mFirstName); - mMsg->addStringFast(_PREHASH_LastName, entry.mLastName); - } + mMsg->newMessageFast(_PREHASH_UUIDNameReply); + } - if(mMsg->isSendFullFast(_PREHASH_UUIDNameBlock)) - { - flush(); - } + mMsg->nextBlockFast(_PREHASH_UUIDNameBlock); + mMsg->addUUIDFast(_PREHASH_ID, id); + if(mCurrIsGroup) + { + mMsg->addStringFast(_PREHASH_GroupName, entry.mGroupName); + } + else + { + mMsg->addStringFast(_PREHASH_FirstName, entry.mFirstName); + mMsg->addStringFast(_PREHASH_LastName, entry.mLastName); } - void ReplySender::flush() + if(mMsg->isSendFullFast(_PREHASH_UUIDNameBlock)) { - if (mPending) - { - mMsg->sendReliable(mCurrHost); - mPending = false; - } + flush(); } +} +void ReplySender::flush() +{ + if (mPending) + { + mMsg->sendReliable(mCurrHost); + mPending = false; + } +} - typedef std::set<LLUUID> AskQueue; - typedef std::vector<PendingReply> ReplyQueue; - typedef std::map<LLUUID,U32> PendingQueue; - typedef std::map<LLUUID, LLCacheNameEntry*> Cache; - typedef std::vector<LLCacheNameCallback> Observers; -}; + +typedef std::set<LLUUID> AskQueue; +typedef std::vector<PendingReply> ReplyQueue; +typedef std::map<LLUUID,U32> PendingQueue; +typedef std::map<LLUUID, LLCacheNameEntry*> Cache; +typedef std::vector<LLCacheNameCallback> Observers; class LLCacheName::Impl { diff --git a/indra/llmessage/llcurl.cpp b/indra/llmessage/llcurl.cpp index ffc15d45f7..bf3ea1cd6f 100644 --- a/indra/llmessage/llcurl.cpp +++ b/indra/llmessage/llcurl.cpp @@ -8,6 +8,8 @@ * $License$ */ +#include "linden_common.h" + #include "llcurl.h" #include <iomanip> diff --git a/indra/llmessage/llhttpassetstorage.cpp b/indra/llmessage/llhttpassetstorage.cpp index bca4e2364d..aa91ebcd49 100644 --- a/indra/llmessage/llhttpassetstorage.cpp +++ b/indra/llmessage/llhttpassetstorage.cpp @@ -819,11 +819,12 @@ void LLHTTPAssetStorage::checkForTimeouts() if (curl_msg && curl_msg->msg == CURLMSG_DONE) { long curl_result = 0; - S32 xfer_result = 0; + S32 xfer_result = LL_ERR_NOERR; LLHTTPAssetRequest *req = NULL; curl_easy_getinfo(curl_msg->easy_handle, CURLINFO_PRIVATE, &req); + // TODO: Throw curl_result at all callbacks. curl_easy_getinfo(curl_msg->easy_handle, CURLINFO_HTTP_CODE, &curl_result); if (RT_UPLOAD == req->mRequestType || RT_LOCALUPLOAD == req->mRequestType) { diff --git a/indra/llmessage/llhttpnode.cpp b/indra/llmessage/llhttpnode.cpp index e7d441b22c..b1101f37ea 100644 --- a/indra/llmessage/llhttpnode.cpp +++ b/indra/llmessage/llhttpnode.cpp @@ -9,7 +9,7 @@ #include "linden_common.h" #include "llhttpnode.h" -#include "boost/tokenizer.hpp" +#include <boost/tokenizer.hpp> #include "llstl.h" diff --git a/indra/llmessage/lliohttpserver.cpp b/indra/llmessage/lliohttpserver.cpp index ca5fe849f7..07ca6a42a1 100644 --- a/indra/llmessage/lliohttpserver.cpp +++ b/indra/llmessage/lliohttpserver.cpp @@ -29,7 +29,7 @@ #include <sstream> -#include "boost/tokenizer.hpp" +#include <boost/tokenizer.hpp> static const char HTTP_VERSION_STR[] = "HTTP/1.0"; static const std::string CONTEXT_REQUEST("request"); diff --git a/indra/llmessage/lliosocket.cpp b/indra/llmessage/lliosocket.cpp index 6ccaa7fb1a..e96b23f134 100644 --- a/indra/llmessage/lliosocket.cpp +++ b/indra/llmessage/lliosocket.cpp @@ -421,6 +421,8 @@ LLIOPipe::EStatus LLIOSocketWriter::process_impl( #if LL_WINDOWS if (status == 730035) break; +#else + (void) status; #endif mLastWritten = segment.data() + len - 1; diff --git a/indra/llmessage/llmessagethrottle.cpp b/indra/llmessage/llmessagethrottle.cpp index 0cfaac3276..6a573381b3 100644 --- a/indra/llmessage/llmessagethrottle.cpp +++ b/indra/llmessage/llmessagethrottle.cpp @@ -6,6 +6,8 @@ * $License$ */ +#include "linden_common.h" + #include "llhash.h" #include "llmessagethrottle.h" diff --git a/indra/llmessage/llservicebuilder.cpp b/indra/llmessage/llservicebuilder.cpp index fbcf38ae35..8c34a506de 100644 --- a/indra/llmessage/llservicebuilder.cpp +++ b/indra/llmessage/llservicebuilder.cpp @@ -6,6 +6,7 @@ * $License$ */ +#include "linden_common.h" #include "llapp.h" #include "llfile.h" #include "llservicebuilder.h" diff --git a/indra/llmessage/lltemplatemessagereader.cpp b/indra/llmessage/lltemplatemessagereader.cpp index 892efb8697..bb3f4f4a15 100644 --- a/indra/llmessage/lltemplatemessagereader.cpp +++ b/indra/llmessage/lltemplatemessagereader.cpp @@ -594,7 +594,7 @@ BOOL LLTemplateMessageReader::decodeData(const U8* buffer, const LLHost& sender tsize = tsizeh; break; case 4: - htonmemcpy(&tsizeb, &buffer[decode_pos], MVT_U32, 4); + htonmemcpy(&tsize, &buffer[decode_pos], MVT_U32, 4); break; default: llerrs << "Attempting to read variable field with unknown size of " << data_size << llendl; diff --git a/indra/llmessage/message.cpp b/indra/llmessage/message.cpp index c00a0fe154..456851a3ec 100644 --- a/indra/llmessage/message.cpp +++ b/indra/llmessage/message.cpp @@ -1321,7 +1321,7 @@ LLMessageSystem::~LLMessageSystem() if (!mbError) { - end_net(); + end_net(mSocket); } delete mTemplateMessageReader; @@ -1335,6 +1335,9 @@ LLMessageSystem::~LLMessageSystem() delete mLLSDMessageReader; mLLSDMessageReader = NULL; + delete mLLSDMessageBuilder; + mLLSDMessageBuilder = NULL; + delete mPollInfop; mPollInfop = NULL; @@ -4144,11 +4147,13 @@ void LLMessageSystem::dumpPacketToLog() char line_buffer[256]; /* Flawfinder: ignore */ S32 i; S32 cur_line_pos = 0; - S32 cur_line = 0; + for (i = 0; i < mTrueReceiveSize; i++) { - snprintf(line_buffer + cur_line_pos*3, sizeof(line_buffer),"%02x ", mTrueReceiveBuffer[i]); /* Flawfinder: ignore */ + S32 offset = cur_line_pos * 3; + snprintf(line_buffer + offset, sizeof(line_buffer) - offset, + "%02x ", mTrueReceiveBuffer[i]); /* Flawfinder: ignore */ cur_line_pos++; if (cur_line_pos >= 16) { @@ -4325,11 +4330,6 @@ std::string get_shared_secret() typedef std::map<const char*, LLMessageBuilder*> BuilderMap; -static void setBuilder(BuilderMap& map, const char* name, LLMessageBuilder* builder) -{ - map[gMessageStringTable.getString(name)] = builder; -} - void LLMessageSystem::newMessageFast(const char *name) { if(LLMessageConfig::isMessageBuiltTemplate(name)) diff --git a/indra/llmessage/net.cpp b/indra/llmessage/net.cpp index 9e83ce1434..8cd7180f9a 100644 --- a/indra/llmessage/net.cpp +++ b/indra/llmessage/net.cpp @@ -269,8 +269,12 @@ S32 start_net(S32& socket_out, int& nPort) return 0; } -void end_net() +void end_net(S32& socket_out) { + if (socket_out < 0) + { + closesocket(socket_out); + } WSACleanup(); } @@ -437,8 +441,12 @@ S32 start_net(S32& socket_out, int& nPort) return 0; } -void end_net() +void end_net(S32& socket_out) { + if (socket_out < 0) + { + close(socket_out); + } } int receive_packet(int hSocket, char * receiveBuffer) diff --git a/indra/llmessage/net.h b/indra/llmessage/net.h index 1044807ba6..c544325dd2 100644 --- a/indra/llmessage/net.h +++ b/indra/llmessage/net.h @@ -20,7 +20,7 @@ class LLHost; // Returns 0 on success, non-zero on error. // Sets socket handler/descriptor, changes nPort if port requested is unavailable. S32 start_net(S32& socket_out, int& nPort); -void end_net(); +void end_net(S32& socket_out); // returns size of packet or -1 in case of error S32 receive_packet(int hSocket, char * receiveBuffer); diff --git a/indra/llrender/llvertexbuffer.cpp b/indra/llrender/llvertexbuffer.cpp index 6d0c57812d..7dc2c04f0b 100644 --- a/indra/llrender/llvertexbuffer.cpp +++ b/indra/llrender/llvertexbuffer.cpp @@ -144,56 +144,6 @@ void LLVertexBuffer::clientCopy(F64 max_time) //---------------------------------------------------------------------------- -// For debugging -struct VTNC /// Simple -{ - F32 v1,v2,v3; - F32 n1,n2,n3; - F32 t1,t2; - U32 c; -}; -static VTNC dbg_vtnc; - -struct VTUNCB // Simple + Bump -{ - F32 v1,v2,v3; - F32 n1,n2,n3; - F32 t1,t2; - F32 u1,u2; - F32 b1,b2,b3; - U32 c; -}; -static VTUNCB dbg_vtuncb; - -struct VTUNC // Surfacepatch -{ - F32 v1,v2,v3; - F32 n1,n2,n3; - F32 t1,t2; - F32 u1,u2; - U32 c; -}; -static VTUNC dbg_vtunc; - -struct VTNW /// Avatar -{ - F32 v1,v2,v3; - F32 n1,n2,n3; - F32 t1,t2; - F32 w; -}; -static VTNW dbg_vtnw; - -struct VTNPAD /// Avatar Output -{ - F32 v1,v2,v3,p1; - F32 n1,n2,n3,p2; - F32 t1,t2,p3,p4; -}; -static VTNPAD dbg_vtnpad; - -//---------------------------------------------------------------------------- - LLVertexBuffer::LLVertexBuffer(U32 typemask, S32 usage) : LLRefCount(), mNumVerts(0), mNumIndices(0), mUsage(usage), mGLBuffer(0), mGLIndices(0), diff --git a/indra/llui/llcombobox.cpp b/indra/llui/llcombobox.cpp index fae13dd700..d63a53fdff 100644 --- a/indra/llui/llcombobox.cpp +++ b/indra/llui/llcombobox.cpp @@ -46,8 +46,8 @@ LLComboBox::LLComboBox( const LLString& name, const LLRect &rect, const LLString mAllowTextEntry(FALSE), mMaxChars(20), mTextEntryTentative(TRUE), - mPrearrangeCallback( NULL ), mListPosition(BELOW), + mPrearrangeCallback( NULL ), mTextEntryCallback( NULL ) { // For now, all comboboxes don't take keyboard focus when clicked. diff --git a/indra/llui/llctrlselectioninterface.cpp b/indra/llui/llctrlselectioninterface.cpp index 61044aa7da..917250e0dd 100644 --- a/indra/llui/llctrlselectioninterface.cpp +++ b/indra/llui/llctrlselectioninterface.cpp @@ -5,6 +5,7 @@ * Copyright (c) 2006-$CurrentYear$, Linden Research, Inc. * $License$ */ +#include "linden_common.h" #include "llctrlselectioninterface.h" diff --git a/indra/llui/lleditmenuhandler.cpp b/indra/llui/lleditmenuhandler.cpp index 656eaff563..0981e818ab 100644 --- a/indra/llui/lleditmenuhandler.cpp +++ b/indra/llui/lleditmenuhandler.cpp @@ -6,7 +6,7 @@ * $License$ */ -#include "stdtypes.h" +#include "linden_common.h" #include "lleditmenuhandler.h" diff --git a/indra/llui/lllineeditor.cpp b/indra/llui/lllineeditor.cpp index 7e7999c9f9..5e043ecea3 100644 --- a/indra/llui/lllineeditor.cpp +++ b/indra/llui/lllineeditor.cpp @@ -200,6 +200,9 @@ LLString LLLineEditor::getWidgetTag() const void LLLineEditor::onFocusLost() { + // Need to notify early when loosing focus. + getWindow()->allowLanguageTextInput(FALSE); + LLUICtrl::onFocusLost(); if( mCommitOnFocusLost && mText.getString() != mPrevText) @@ -1110,7 +1113,7 @@ BOOL LLLineEditor::handleSpecialKey(KEY key, MASK mask) // handle ctrl-uparrow if we have a history enabled line editor. case KEY_UP: - if( mHaveHistory && ( MASK_CONTROL & mask ) ) + if( mHaveHistory && ( MASK_CONTROL == mask ) ) { if( mCurrentHistoryLine > 0 ) { @@ -1127,7 +1130,7 @@ BOOL LLLineEditor::handleSpecialKey(KEY key, MASK mask) // handle ctrl-downarrow if we have a history enabled line editor case KEY_DOWN: - if( mHaveHistory && ( MASK_CONTROL & mask ) ) + if( mHaveHistory && ( MASK_CONTROL == mask ) ) { if( !mLineHistory.empty() && mCurrentHistoryLine < mLineHistory.size() - 1 ) { @@ -1626,6 +1629,12 @@ void LLLineEditor::setFocus( BOOL new_state ) { BOOL old_state = hasFocus(); + if (!new_state) + { + getWindow()->allowLanguageTextInput(FALSE); + } + + // getting focus when we didn't have it before, and we want to select all if (!old_state && new_state && mSelectAllonFocusReceived) { @@ -1656,6 +1665,16 @@ void LLLineEditor::setFocus( BOOL new_state ) } LLUICtrl::setFocus( new_state ); + + if (new_state) + { + // Allow Language Text Input only when this LineEditor has + // no prevalidate function attached. This criterion works + // fine on 1.15.0.2, since all prevalidate func reject any + // non-ASCII characters. I'm not sure on future versions, + // however. + getWindow()->allowLanguageTextInput(mPrevalidateFunc == NULL); + } } //virtual diff --git a/indra/llui/llscrollcontainer.cpp b/indra/llui/llscrollcontainer.cpp index e5e31e45a9..0e3c73f633 100644 --- a/indra/llui/llscrollcontainer.cpp +++ b/indra/llui/llscrollcontainer.cpp @@ -272,7 +272,26 @@ BOOL LLScrollableContainerView::handleScrollWheel( S32 x, S32 y, S32 clicks ) // Opaque return TRUE; } +BOOL LLScrollableContainerView::needsToScroll(S32 x, S32 y, LLScrollableContainerView::SCROLL_ORIENTATION axis) +{ + if(mScrollbar[axis]->getVisible()) + { + LLRect inner_rect_local( 0, mInnerRect.getHeight(), mInnerRect.getWidth(), 0 ); + const S32 AUTOSCROLL_SIZE = 10; + if(mScrollbar[axis]->getVisible()) + { + inner_rect_local.mRight -= SCROLLBAR_SIZE; + inner_rect_local.mTop += AUTOSCROLL_SIZE; + inner_rect_local.mBottom = inner_rect_local.mTop - AUTOSCROLL_SIZE; + } + if( inner_rect_local.pointInRect( x, y ) && (mScrollbar[axis]->getDocPos() > 0) ) + { + return TRUE; + } + } + return FALSE; +} BOOL LLScrollableContainerView::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, EDragAndDropType cargo_type, diff --git a/indra/llui/llscrollcontainer.h b/indra/llui/llscrollcontainer.h index b63e3ffc07..6b69862f4f 100644 --- a/indra/llui/llscrollcontainer.h +++ b/indra/llui/llscrollcontainer.h @@ -15,6 +15,7 @@ #endif #include "stdenums.h" #include "llcoord.h" +#include "llscrollbar.h" //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // Class LLScrollableContainerView @@ -27,7 +28,6 @@ // This class is a decorator class. //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -class LLScrollbar; class LLViewBorder; class LLUICtrlFactory; @@ -35,6 +35,10 @@ class LLUICtrlFactory; class LLScrollableContainerView : public LLUICtrl { public: + // Note: vertical comes before horizontal because vertical + // scrollbars have priority for mouse and keyboard events. + enum SCROLL_ORIENTATION { VERTICAL, HORIZONTAL, SCROLLBAR_COUNT }; + LLScrollableContainerView( const LLString& name, const LLRect& rect, LLView* scrolled_view, BOOL is_opaque = FALSE, const LLColor4& bg_color = LLColor4(0,0,0,0) ); @@ -68,6 +72,8 @@ public: void goToBottom(); S32 getBorderWidth(); + BOOL needsToScroll(S32 x, S32 y, SCROLL_ORIENTATION axis); + // LLView functionality virtual void reshape(S32 width, S32 height, BOOL called_from_parent); virtual BOOL handleKey(KEY key, MASK mask, BOOL called_from_parent); @@ -90,10 +96,6 @@ protected: virtual void scrollVertical( S32 new_pos ); void updateScroll(); - // Note: vertical comes before horizontal because vertical - // scrollbars have priority for mouse and keyboard events. - enum { VERTICAL, HORIZONTAL, SCROLLBAR_COUNT }; - LLScrollbar* mScrollbar[SCROLLBAR_COUNT]; LLView* mScrolledView; S32 mSize; diff --git a/indra/llui/llscrolllistctrl.cpp b/indra/llui/llscrolllistctrl.cpp index 4c01387941..1d07d3f36b 100644 --- a/indra/llui/llscrolllistctrl.cpp +++ b/indra/llui/llscrolllistctrl.cpp @@ -78,8 +78,10 @@ protected: // // LLScrollListIcon // -LLScrollListIcon::LLScrollListIcon(LLImageGL* icon, S32 width, LLUUID image_id) : -mIcon(icon), mColor(LLColor4::white), mImageUUID(image_id.asString()) +LLScrollListIcon::LLScrollListIcon(LLImageGL* icon, S32 width, LLUUID image_id) + : mIcon(icon), + mImageUUID(image_id.asString()), + mColor(LLColor4::white) { if (width) { @@ -411,21 +413,20 @@ LLScrollListCtrl::LLScrollListCtrl(const LLString& name, const LLRect& rect, mFgUnselectedColor( LLUI::sColorsGroup->getColor("ScrollUnselectedColor") ), mFgDisabledColor( LLUI::sColorsGroup->getColor("ScrollDisabledColor") ), mHighlightedColor( LLUI::sColorsGroup->getColor("ScrollHighlightedColor") ), - mHighlightedItem(-1), mBorderThickness( 2 ), mOnDoubleClickCallback( NULL ), mOnMaximumSelectCallback( NULL ), mOnSortChangedCallback( NULL ), - mDrewSelected(FALSE), + mHighlightedItem(-1), mBorder(NULL), - mSearchColumn(0), mDefaultColumn("SIMPLE"), - + mSearchColumn(0), mNumDynamicWidthColumns(0), mTotalStaticColumnWidth(0), mSortColumn(-1), + mSortAscending(TRUE), mSorted(TRUE), - mSortAscending(TRUE) + mDrewSelected(FALSE) { mItemListRect.setOriginAndSize( mBorderThickness + LIST_BORDER_PAD, diff --git a/indra/llui/llscrolllistctrl.h b/indra/llui/llscrolllistctrl.h index dff522bc0b..711d3b0ce8 100644 --- a/indra/llui/llscrolllistctrl.h +++ b/indra/llui/llscrolllistctrl.h @@ -308,7 +308,7 @@ public: S32 getNumColumns() const { return mColumns.size(); } - LLScrollListCell *getColumn(const S32 i) const { if (i < (S32)mColumns.size()) { return mColumns[i]; } return NULL; } + LLScrollListCell *getColumn(const S32 i) const { if (0 <= i && i < (S32)mColumns.size()) { return mColumns[i]; } return NULL; } virtual BOOL handleClick(S32 x, S32 y, MASK mask); diff --git a/indra/llui/lltabcontainer.cpp b/indra/llui/lltabcontainer.cpp index 2844640291..ef527b32c2 100644 --- a/indra/llui/lltabcontainer.cpp +++ b/indra/llui/lltabcontainer.cpp @@ -31,6 +31,7 @@ #include "llglheaders.h" const F32 SCROLL_STEP_TIME = 0.4f; +const F32 SCROLL_DELAY_TIME = 0.5f; const S32 TAB_PADDING = 15; const S32 TABCNTR_TAB_MIN_WIDTH = 60; const S32 TABCNTR_TAB_MAX_WIDTH = 150; @@ -61,6 +62,7 @@ LLTabContainerCommon::LLTabContainerCommon( mLockedTabCount(0) { setMouseOpaque(FALSE); + mDragAndDropDelayTimer.stop(); } @@ -81,9 +83,11 @@ LLTabContainerCommon::LLTabContainerCommon( mCallbackUserdata( callback_userdata ), mTitleBox(NULL), mTopBorderHeight(LLPANEL_BORDER_WIDTH), - mTabPosition(pos) + mTabPosition(pos), + mLockedTabCount(0) { setMouseOpaque(FALSE); + mDragAndDropDelayTimer.stop(); } @@ -711,8 +715,8 @@ LLTabContainer::LLTabContainer( : LLTabContainerCommon(name, rect, pos, close_callback, callback_userdata, bordered), mLeftArrowBtn(NULL), - mRightArrowBtn(NULL), mJumpLeftArrowBtn(NULL), + mRightArrowBtn(NULL), mJumpRightArrowBtn(NULL), mRightTabBtnOffset(0), mMinTabWidth(TABCNTR_TAB_MIN_WIDTH), @@ -729,8 +733,8 @@ LLTabContainer::LLTabContainer( : LLTabContainerCommon(name, rect_control, pos, close_callback, callback_userdata, bordered), mLeftArrowBtn(NULL), - mRightArrowBtn(NULL), mJumpLeftArrowBtn(NULL), + mRightArrowBtn(NULL), mJumpRightArrowBtn(NULL), mRightTabBtnOffset(0), mMinTabWidth(TABCNTR_TAB_MIN_WIDTH), @@ -1556,43 +1560,48 @@ BOOL LLTabContainer::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, EDrag { BOOL has_scroll_arrows = (mMaxScrollPos > 0); - if (has_scroll_arrows) + if( mDragAndDropDelayTimer.getElapsedTimeF32() > SCROLL_DELAY_TIME ) { - if (mJumpLeftArrowBtn->getRect().pointInRect(x, y)) - { - S32 local_x = x - mJumpLeftArrowBtn->getRect().mLeft; - S32 local_y = y - mJumpLeftArrowBtn->getRect().mBottom; - mJumpLeftArrowBtn->handleHover(local_x, local_y, mask); - } - if (mJumpRightArrowBtn->getRect().pointInRect(x, y)) - { - S32 local_x = x - mJumpRightArrowBtn->getRect().mLeft; - S32 local_y = y - mJumpRightArrowBtn->getRect().mBottom; - mJumpRightArrowBtn->handleHover(local_x, local_y, mask); - } - if (mLeftArrowBtn->getRect().pointInRect(x, y)) - { - S32 local_x = x - mLeftArrowBtn->getRect().mLeft; - S32 local_y = y - mLeftArrowBtn->getRect().mBottom; - mLeftArrowBtn->handleHover(local_x, local_y, mask); - } - else if (mRightArrowBtn->getRect().pointInRect(x, y)) + + if (has_scroll_arrows) { - S32 local_x = x - mRightArrowBtn->getRect().mLeft; - S32 local_y = y - mRightArrowBtn->getRect().mBottom; - mRightArrowBtn->handleHover(local_x, local_y, mask); + if (mJumpLeftArrowBtn->getRect().pointInRect(x, y)) + { + S32 local_x = x - mJumpLeftArrowBtn->getRect().mLeft; + S32 local_y = y - mJumpLeftArrowBtn->getRect().mBottom; + mJumpLeftArrowBtn->handleHover(local_x, local_y, mask); + } + if (mJumpRightArrowBtn->getRect().pointInRect(x, y)) + { + S32 local_x = x - mJumpRightArrowBtn->getRect().mLeft; + S32 local_y = y - mJumpRightArrowBtn->getRect().mBottom; + mJumpRightArrowBtn->handleHover(local_x, local_y, mask); + } + if (mLeftArrowBtn->getRect().pointInRect(x, y)) + { + S32 local_x = x - mLeftArrowBtn->getRect().mLeft; + S32 local_y = y - mLeftArrowBtn->getRect().mBottom; + mLeftArrowBtn->handleHover(local_x, local_y, mask); + } + else if (mRightArrowBtn->getRect().pointInRect(x, y)) + { + S32 local_x = x - mRightArrowBtn->getRect().mLeft; + S32 local_y = y - mRightArrowBtn->getRect().mBottom; + mRightArrowBtn->handleHover(local_x, local_y, mask); + } } - } - for(tuple_list_t::iterator iter = mTabList.begin(); iter != mTabList.end(); ++iter) - { - LLTabTuple* tuple = *iter; - tuple->mButton->setVisible( TRUE ); - S32 local_x = x - tuple->mButton->getRect().mLeft; - S32 local_y = y - tuple->mButton->getRect().mBottom; - if (tuple->mButton->pointInView(local_x, local_y) && tuple->mButton->getEnabled() && !tuple->mTabPanel->getVisible()) + for(tuple_list_t::iterator iter = mTabList.begin(); iter != mTabList.end(); ++iter) { - tuple->mButton->onCommit(); + LLTabTuple* tuple = *iter; + tuple->mButton->setVisible( TRUE ); + S32 local_x = x - tuple->mButton->getRect().mLeft; + S32 local_y = y - tuple->mButton->getRect().mBottom; + if (tuple->mButton->pointInView(local_x, local_y) && tuple->mButton->getEnabled() && !tuple->mTabPanel->getVisible()) + { + tuple->mButton->onCommit(); + mDragAndDropDelayTimer.stop(); + } } } @@ -1621,4 +1630,4 @@ void LLTabContainer::setTabImage(LLPanel* child, std::string image_name) // tabs have changed size, might need to scroll to see current tab updateMaxScrollPos(); } -}
\ No newline at end of file +} diff --git a/indra/llui/lltabcontainer.h b/indra/llui/lltabcontainer.h index fbb73b951b..a395fd94af 100644 --- a/indra/llui/lltabcontainer.h +++ b/indra/llui/lltabcontainer.h @@ -97,7 +97,9 @@ public: virtual void setTabImage(LLPanel* child, std::string img_name); void setTitle( const LLString& title ); const LLString getPanelTitle(S32 index); - + + void setDragAndDropDelayTimer() { mDragAndDropDelayTimer.start(); } + virtual void setTopBorderHeight(S32 height); virtual void setTabChangeCallback(LLPanel* tab, void (*on_tab_clicked)(void*,bool)); @@ -155,6 +157,8 @@ protected: S32 mScrollPosPixels; S32 mMaxScrollPos; + LLFrameTimer mDragAndDropDelayTimer; + void (*mCloseCallback)(void*); void* mCallbackUserdata; diff --git a/indra/llui/lltexteditor.cpp b/indra/llui/lltexteditor.cpp index f8e1e33cad..7506559b98 100644 --- a/indra/llui/lltexteditor.cpp +++ b/indra/llui/lltexteditor.cpp @@ -26,6 +26,7 @@ #include "llclipboard.h" #include "llscrollbar.h" #include "llstl.h" +#include "llstring.h" #include "llkeyboard.h" #include "llkeywords.h" #include "llundo.h" @@ -494,8 +495,10 @@ void LLTextEditor::truncate() void LLTextEditor::setText(const LLString &utf8str) { - mUTF8Text = utf8str; - mWText = utf8str_to_wstring(utf8str); + // LLString::removeCRLF(utf8str); + mUTF8Text = utf8str_removeCRLF(utf8str); + // mUTF8Text = utf8str; + mWText = utf8str_to_wstring(mUTF8Text); mTextIsUpToDate = TRUE; truncate(); @@ -2471,6 +2474,8 @@ void LLTextEditor::redo() // virtual, from LLView void LLTextEditor::onFocusLost() { + getWindow()->allowLanguageTextInput(FALSE); + // Route menu back to the default if( gEditMenuHandler == this ) { @@ -3037,6 +3042,12 @@ void LLTextEditor::setFocus( BOOL new_state ) // Don't change anything if the focus state didn't change if (new_state == old_state) return; + // Notify early if we are loosing focus. + if (!new_state) + { + getWindow()->allowLanguageTextInput(FALSE); + } + LLUICtrl::setFocus( new_state ); if( new_state ) @@ -3057,6 +3068,12 @@ void LLTextEditor::setFocus( BOOL new_state ) endSelection(); } + + // Notify late if we are gaining focus. + if (new_state && !mReadOnly) + { + getWindow()->allowLanguageTextInput(TRUE); + } } BOOL LLTextEditor::acceptsTextInput() const diff --git a/indra/llui/llviewquery.cpp b/indra/llui/llviewquery.cpp index 650125d486..c7ae4245dd 100644 --- a/indra/llui/llviewquery.cpp +++ b/indra/llui/llviewquery.cpp @@ -6,6 +6,8 @@ * $License$ */ +#include "linden_common.h" + #include "llview.h" #include "lluictrl.h" #include "llviewquery.h" diff --git a/indra/llvfs/llvfs.cpp b/indra/llvfs/llvfs.cpp index 0ec71bfcb6..8b31a50bdb 100644 --- a/indra/llvfs/llvfs.cpp +++ b/indra/llvfs/llvfs.cpp @@ -484,7 +484,7 @@ LLVFS::LLVFS(const char *index_filename, const char *data_filename, const BOOL r } // Figure out where the last block ended. - U32 loc = last_file_block->mLocation+last_file_block->mLength; + S32 loc = last_file_block->mLocation+last_file_block->mLength; // Figure out how much space there is between where // the last block ended and this block begins. @@ -492,7 +492,7 @@ LLVFS::LLVFS(const char *index_filename, const char *data_filename, const BOOL r // Check for more errors... Seeing if the current // entry and the last entry make sense together. - if (length < 0 || loc < 0 || loc > data_size) + if (length < 0 || loc < 0 || (U32)loc > data_size) { // Invalid VFS unlockAndClose( mIndexFP ); @@ -1770,53 +1770,46 @@ void LLVFS::audit() delete[] buffer; - if (vfs_corrupt) + if (!vfs_corrupt) { - for (std::vector<LLVFSFileBlock*>::iterator iter = audit_blocks.begin(); - iter != audit_blocks.end(); ++iter) + for (fileblock_map::iterator it = mFileBlocks.begin(); it != mFileBlocks.end(); ++it) { - delete *iter; - } - audit_blocks.clear(); - return; - } - - for (fileblock_map::iterator it = mFileBlocks.begin(); it != mFileBlocks.end(); ++it) - { - LLVFSFileBlock* block = (*it).second; + LLVFSFileBlock* block = (*it).second; - if (block->mSize > 0) - { - if (! found_files.count(*block)) + if (block->mSize > 0) { - llwarns << "VFile " << block->mFileID << ":" << block->mFileType << " in memory, not on disk, loc " << block->mIndexLocation<< llendl; - fseek(mIndexFP, block->mIndexLocation, SEEK_SET); - U8 buf[LLVFSFileBlock::SERIAL_SIZE]; - fread(buf, LLVFSFileBlock::SERIAL_SIZE, 1, mIndexFP); + if (! found_files.count(*block)) + { + llwarns << "VFile " << block->mFileID << ":" << block->mFileType << " in memory, not on disk, loc " << block->mIndexLocation<< llendl; + fseek(mIndexFP, block->mIndexLocation, SEEK_SET); + U8 buf[LLVFSFileBlock::SERIAL_SIZE]; + fread(buf, LLVFSFileBlock::SERIAL_SIZE, 1, mIndexFP); - LLVFSFileBlock disk_block; - disk_block.deserialize(buf, block->mIndexLocation); + LLVFSFileBlock disk_block; + disk_block.deserialize(buf, block->mIndexLocation); - llwarns << "Instead found " << disk_block.mFileID << ":" << block->mFileType << llendl; - } - else - { - block = found_files.find(*block)->second; - found_files.erase(*block); - delete block; + llwarns << "Instead found " << disk_block.mFileID << ":" << block->mFileType << llendl; + } + else + { + block = found_files.find(*block)->second; + found_files.erase(*block); + } } } - } - for (std::map<LLVFSFileSpecifier, LLVFSFileBlock*>::iterator iter = found_files.begin(); - iter != found_files.end(); iter++) - { - LLVFSFileBlock* block = iter->second; - llwarns << "VFile " << block->mFileID << ":" << block->mFileType << " szie:" << block->mSize << " leftover" << llendl; - } + for (std::map<LLVFSFileSpecifier, LLVFSFileBlock*>::iterator iter = found_files.begin(); + iter != found_files.end(); iter++) + { + LLVFSFileBlock* block = iter->second; + llwarns << "VFile " << block->mFileID << ":" << block->mFileType << " szie:" << block->mSize << " leftover" << llendl; + } - llinfos << "VFS: audit OK" << llendl; - // mutex released by LLMutexLock() destructor. + llinfos << "VFS: audit OK" << llendl; + // mutex released by LLMutexLock() destructor. + } + + for_each(audit_blocks.begin(), audit_blocks.end(), DeletePointer()); } diff --git a/indra/llwindow/llwindow.cpp b/indra/llwindow/llwindow.cpp index 650398cb65..3cacc7df0f 100644 --- a/indra/llwindow/llwindow.cpp +++ b/indra/llwindow/llwindow.cpp @@ -221,7 +221,8 @@ LLWindow::LLWindow(BOOL fullscreen, U32 flags) mIsMouseClipping(FALSE), mSwapMethod(SWAP_METHOD_UNDEFINED), mHideCursorPermanent(FALSE), - mFlags(flags) + mFlags(flags), + mHighSurrogate(0) { for (U32 i = 0; i < 6; i++) { @@ -276,6 +277,53 @@ void LLWindow::setCallbacks(LLWindowCallbacks *callbacks) } } +#define UTF16_IS_HIGH_SURROGATE(U) ((U16)((U) - 0xD800) < 0x0400) +#define UTF16_IS_LOW_SURROGATE(U) ((U16)((U) - 0xDC00) < 0x0400) +#define UTF16_SURROGATE_PAIR_TO_UTF32(H,L) (((H) << 10) + (L) - (0xD800 << 10) - 0xDC00 + 0x00010000) + +void LLWindow::handleUnicodeUTF16(U16 utf16, MASK mask) +{ + // Note that we could discard unpaired surrogates, but I'm + // following the Unicode Consortium's recommendation here; + // that is, to preserve those unpaired surrogates in UTF-32 + // values. _To_preserve_ means to pass to the callback in our + // context. + + if (mHighSurrogate == 0) + { + if (UTF16_IS_HIGH_SURROGATE(utf16)) + { + mHighSurrogate = utf16; + } + else + { + mCallbacks->handleUnicodeChar(utf16, mask); + } + } + else + { + if (UTF16_IS_LOW_SURROGATE(utf16)) + { + /* A legal surrogate pair. */ + mCallbacks->handleUnicodeChar(UTF16_SURROGATE_PAIR_TO_UTF32(mHighSurrogate, utf16), mask); + mHighSurrogate = 0; + } + else if (UTF16_IS_HIGH_SURROGATE(utf16)) + { + /* Two consecutive high surrogates. */ + mCallbacks->handleUnicodeChar(mHighSurrogate, mask); + mHighSurrogate = utf16; + } + else + { + /* A non-low-surrogate preceeded by a high surrogate. */ + mCallbacks->handleUnicodeChar(mHighSurrogate, mask); + mHighSurrogate = 0; + mCallbacks->handleUnicodeChar(utf16, mask); + } + } +} + // // LLSplashScreen // diff --git a/indra/llwindow/llwindow.h b/indra/llwindow/llwindow.h index 6e26285e29..1347d8e94c 100644 --- a/indra/llwindow/llwindow.h +++ b/indra/llwindow/llwindow.h @@ -198,6 +198,10 @@ public: // return a platform-specific window reference (HWND on Windows, WindowRef on the Mac) virtual void *getPlatformWindow() = 0; + // control platform's Language Text Input mechanisms. + virtual void allowLanguageTextInput( BOOL b ) {}; + virtual void setLanguageTextInput( LLCoordWindow pos ) {}; + protected: LLWindow(BOOL fullscreen, U32 flags); virtual ~LLWindow() {} @@ -226,6 +230,15 @@ protected: U32 mFlags; F32 mJoyAxis[6]; U8 mJoyButtonState[16]; + U16 mHighSurrogate; + + // Handle a UTF-16 encoding unit received from keyboard. + // Converting the series of UTF-16 encoding units to UTF-32 data, + // this method passes the resulting UTF-32 data to mCallback's + // handleUnicodeChar. The mask should be that to be passed to the + // callback. This method uses mHighSurrogate as a dedicated work + // variable. + void handleUnicodeUTF16(U16 utf16, MASK mask); friend class LLWindowManager; }; diff --git a/indra/llwindow/llwindowmacosx.cpp b/indra/llwindow/llwindowmacosx.cpp index 62743d4d08..24c9149cb4 100644 --- a/indra/llwindow/llwindowmacosx.cpp +++ b/indra/llwindow/llwindowmacosx.cpp @@ -219,6 +219,10 @@ LLWindowMacOSX::LLWindowMacOSX(char *title, char *name, S32 x, S32 y, S32 width, mNeedsResize = FALSE; mOverrideAspectRatio = 0.f; mMinimized = FALSE; + mTSMDocument = NULL; // Just in case. + mLanguageTextInputAllowed = FALSE; + mTSMScriptCode = 0; + mTSMLangCode = 0; // For reasons that aren't clear to me, LLTimers seem to be created in the "started" state. // Since the started state of this one is used to track whether the NMRec has been installed, it wants to start out in the "stopped" state. @@ -459,6 +463,29 @@ BOOL LLWindowMacOSX::createContext(int x, int y, int width, int height, int bits } + { + // Create and initialize our TSM document for language text input. + // If an error occured, we can do nothing better than simply ignore it. + // mTSMDocument will be kept NULL in case. + if (mTSMDocument) + { + DeactivateTSMDocument(mTSMDocument); + DeleteTSMDocument(mTSMDocument); + mTSMDocument = NULL; + } + static InterfaceTypeList types = { kUnicodeDocument }; + OSErr err = NewTSMDocument(1, types, &mTSMDocument, 0); + if (err != noErr) + { + llwarns << "createContext: couldn't create a TSMDocument (" << err << ")" << llendl; + } + if (mTSMDocument) + { + UseInputWindow(mTSMDocument, TRUE); + ActivateTSMDocument(mTSMDocument); + } + } + if(mContext == NULL) { AGLRendererInfo rendererInfo = NULL; @@ -904,6 +931,15 @@ void LLWindowMacOSX::destroyContext() mWindowHandlerRef = NULL; } + // Cleanup any TSM document we created. + if(mTSMDocument != NULL) + { + llinfos << "destroyContext: deleting TSM document" << llendl; + DeactivateTSMDocument(mTSMDocument); + DeleteTSMDocument(mTSMDocument); + mTSMDocument = NULL; + } + // Close the window if(mWindow != NULL) { @@ -1509,7 +1545,7 @@ void LLWindowMacOSX::flashIcon(F32 seconds) OSErr err; mBounceTime = seconds; - memset(&mBounceRec, sizeof(mBounceRec), 0); + memset(&mBounceRec, 0, sizeof(mBounceRec)); mBounceRec.qType = nmType; mBounceRec.nmMark = 1; err = NMInstall(&mBounceRec); @@ -2221,6 +2257,10 @@ OSStatus LLWindowMacOSX::eventHandler (EventHandlerCallRef myHandler, EventRef e switch(evtKind) { case kEventWindowActivated: + if (mTSMDocument) + { + ActivateTSMDocument(mTSMDocument); + } mCallbacks->handleFocus(this); break; case kEventWindowDeactivated: @@ -2932,4 +2972,37 @@ static long getDictLong (CFDictionaryRef refDict, CFStringRef key) return int_value; // otherwise return the long value } +void LLWindowMacOSX::allowLanguageTextInput(BOOL b) +{ + ScriptLanguageRecord script_language; + + if (b == mLanguageTextInputAllowed) + { + return; + } + mLanguageTextInputAllowed = b; + + if (b) + { + if (mTSMScriptCode != smRoman) + { + script_language.fScript = mTSMScriptCode; + script_language.fLanguage = mTSMLangCode; + SetTextServiceLanguage(&script_language); + } + } + else + { + GetTextServiceLanguage(&script_language); + mTSMScriptCode = script_language.fScript; + mTSMLangCode = script_language.fLanguage; + if (mTSMScriptCode != smRoman) + { + script_language.fScript = smRoman; + script_language.fLanguage = langEnglish; + SetTextServiceLanguage(&script_language); + } + } +} + #endif // LL_DARWIN diff --git a/indra/llwindow/llwindowmacosx.h b/indra/llwindow/llwindowmacosx.h index 1927f9bf31..fd9e5c8484 100644 --- a/indra/llwindow/llwindowmacosx.h +++ b/indra/llwindow/llwindowmacosx.h @@ -88,6 +88,8 @@ public: /*virtual*/ void *getPlatformWindow(); /*virtual*/ void bringToFront() {}; + /*virtual*/ void allowLanguageTextInput(BOOL b); + protected: LLWindowMacOSX( char *title, char *name, int x, int y, int width, int height, U32 flags, @@ -163,6 +165,12 @@ protected: NMRec mBounceRec; LLTimer mBounceTimer; + // Imput method management through Text Service Manager. + TSMDocumentID mTSMDocument; + BOOL mLanguageTextInputAllowed; + ScriptCode mTSMScriptCode; + LangCode mTSMLangCode; + friend class LLWindowManager; }; diff --git a/indra/llwindow/llwindowsdl.cpp b/indra/llwindow/llwindowsdl.cpp index 6c1ee967df..3ccf0d1250 100644 --- a/indra/llwindow/llwindowsdl.cpp +++ b/indra/llwindow/llwindowsdl.cpp @@ -22,7 +22,9 @@ #include "indra_constants.h" #if LL_GTK +extern "C" { # include "gtk/gtk.h" +} #endif // LL_GTK #if LL_LINUX @@ -1964,7 +1966,10 @@ void LLWindowSDL::gatherInput() SDLReallyCaptureInput(TRUE); if (event.key.keysym.unicode) - mCallbacks->handleUnicodeChar(event.key.keysym.unicode, gKeyboard->currentMask(FALSE)); + { + handleUnicodeUTF16(event.key.keysym.unicode, + gKeyboard->currentMask(FALSE)); + } break; case SDL_KEYUP: diff --git a/indra/llwindow/llwindowwin32.cpp b/indra/llwindow/llwindowwin32.cpp index 095b2113a7..afa78984ea 100644 --- a/indra/llwindow/llwindowwin32.cpp +++ b/indra/llwindow/llwindowwin32.cpp @@ -17,6 +17,7 @@ #include <mapi.h> #include <process.h> // for _spawn #include <shellapi.h> +#include <Imm.h> // Require DirectInput version 8 #define DIRECTINPUT_VERSION 0x0800 @@ -64,6 +65,98 @@ void show_window_creation_error(const char* title) //static BOOL LLWindowWin32::sIsClassRegistered = FALSE; +BOOL LLWindowWin32::sLanguageTextInputAllowed = TRUE; /* XXX */ +BOOL LLWindowWin32::sWinIMEOpened = FALSE; +HKL LLWindowWin32::sWinInputLocale; +DWORD LLWindowWin32::sWinIMEConversionMode; +DWORD LLWindowWin32::sWinIMESentenceMode; + +// The following class LLWinImm delegates Windows IMM APIs. +// We need this because some language versions of Windows, +// e.g., US version of Windows XP, doesn't install IMM32.DLL +// as a default, and we can't link against imm32.lib statically. +// I believe DLL loading of this type is best suited to do +// in a static initialization of a class. What I'm not sure is +// whether it follows the Linden Conding Standard... +// See http://wiki.secondlife.com/wiki/Coding_standards#Static_Members + +class LLWinImm +{ +public: + static bool isAvailable() { return sTheInstance.mHImmDll != NULL; } + +public: + // Wrappers for IMM API. + static BOOL isIME(HKL hkl) { return sTheInstance.mImmIsIME(hkl); } + static HIMC getContext(HWND hwnd) { return sTheInstance.mImmGetContext(hwnd); } + static BOOL releaseContext(HWND hwnd, HIMC himc) { return sTheInstance.mImmReleaseContext(hwnd, himc); } + static BOOL getOpenStatus(HIMC himc) { return sTheInstance.mImmGetOpenStatus(himc); } + static BOOL setOpenStatus(HIMC himc, BOOL status) { return sTheInstance.mImmSetOpenStatus(himc, status); } + static BOOL getConversionStatus(HIMC himc, LPDWORD conversion, LPDWORD sentence) { return sTheInstance.mImmGetConversionStatus(himc, conversion, sentence); } + static BOOL setConversionStatus(HIMC himc, DWORD conversion, DWORD sentence) { return sTheInstance.mImmSetConversionStatus(himc, conversion, sentence); } + +private: + LLWinImm(); + ~LLWinImm(); + +private: + // Pointers to IMM API. + BOOL (WINAPI *mImmIsIME)(HKL); + HIMC (WINAPI *mImmGetContext)(HWND); + BOOL (WINAPI *mImmReleaseContext)(HWND, HIMC); + BOOL (WINAPI *mImmGetOpenStatus)(HIMC); + BOOL (WINAPI *mImmSetOpenStatus)(HIMC, BOOL); + BOOL (WINAPI *mImmGetConversionStatus)(HIMC, LPDWORD, LPDWORD); + BOOL (WINAPI *mImmSetConversionStatus)(HIMC, DWORD, DWORD); + +private: + HMODULE mHImmDll; + static LLWinImm sTheInstance; +}; + +LLWinImm LLWinImm::sTheInstance; + +LLWinImm::LLWinImm() +{ + mHImmDll = LoadLibraryA("Imm32"); + if (mHImmDll != NULL) + { + mImmIsIME = (BOOL (WINAPI *)(HKL)) GetProcAddress(mHImmDll, "ImmIsIME"); + mImmGetContext = (HIMC (WINAPI *)(HWND)) GetProcAddress(mHImmDll, "ImmGetContext"); + mImmReleaseContext = (BOOL (WINAPI *)(HWND, HIMC)) GetProcAddress(mHImmDll, "ImmReleaseContext"); + mImmGetOpenStatus = (BOOL (WINAPI *)(HIMC)) GetProcAddress(mHImmDll, "ImmGetOpenStatus"); + mImmSetOpenStatus = (BOOL (WINAPI *)(HIMC, BOOL)) GetProcAddress(mHImmDll, "ImmSetOpenStatus"); + mImmGetConversionStatus = (BOOL (WINAPI *)(HIMC, LPDWORD, LPDWORD)) GetProcAddress(mHImmDll, "ImmGetConversionStatus"); + mImmSetConversionStatus = (BOOL (WINAPI *)(HIMC, DWORD, DWORD)) GetProcAddress(mHImmDll, "ImmSetConversionStatus"); + if (mImmIsIME == NULL || + mImmGetContext == NULL || + mImmReleaseContext == NULL || + mImmGetOpenStatus == NULL || + mImmSetOpenStatus == NULL || + mImmGetConversionStatus == NULL || + mImmSetConversionStatus == NULL) + { + // If any of the above API entires are not found, we can't use IMM API. + // So, turn off the IMM support. We should log some warning message in + // the case, since it is very unusual; these APIs are available from + // the beginning, and all versions of IMM32.DLL should have them all. + // Unfortunately, this code may be executed before initialization of + // the logging channel (llwarns), and we can't do it here... Yes, this + // is one of disadvantages to use static constraction to DLL loading. + FreeLibrary(mHImmDll); + mHImmDll = NULL; + } + } +} + +LLWinImm::~LLWinImm() +{ + if (mHImmDll != NULL) + { + FreeLibrary(mHImmDll); + mHImmDll = NULL; + } +} LPDIRECTINPUT8 g_pDI = NULL; @@ -91,6 +184,10 @@ LLWindowWin32::LLWindowWin32(char *title, char *name, S32 x, S32 y, S32 width, // Initialize the keyboard gKeyboard = new LLKeyboardWin32(); + // Initialize (boot strap) the Language text input management, + // based on the system's (user's) default settings. + allowLanguageTextInput(FALSE); + GLuint pixel_format; WNDCLASS wc; DWORD dw_ex_style; @@ -327,7 +424,6 @@ LLWindowWin32::LLWindowWin32(char *title, char *name, S32 x, S32 y, S32 width, if (!mWindowHandle) { - DestroyWindow(mWindowHandle); OSMessageBox("Window creation error", "Error", OSMB_OK); return; } @@ -1906,6 +2002,15 @@ LRESULT CALLBACK LLWindowWin32::mainWindowProc(HWND h_wnd, UINT u_msg, WPARAM w_ case WM_CHAR: // Should really use WM_UNICHAR eventually, but it requires a specific Windows version and I need // to figure out how that works. - Doug + // + // ... Well, I don't think so. + // How it works is explained in Win32 API document, but WM_UNICHAR didn't work + // as specified at least on Windows XP SP1 Japanese version. I have never used + // it since then, and I'm not sure whether it has been fixed now, but I don't think + // it is worth trying. The good old WM_CHAR works just fine even for supplementary + // characters. We just need to take care of surrogate pairs sent as two WM_CHAR's + // by ourselves. It is not that tough. -- Alissa Sabre @ SL + // // llinfos << "WM_CHAR: " << w_param << llendl; if (gDebugWindowProc) { @@ -1913,11 +2018,10 @@ LRESULT CALLBACK LLWindowWin32::mainWindowProc(HWND h_wnd, UINT u_msg, WPARAM w_ << " key " << S32(w_param) << llendl; } - if (window_imp->mCallbacks->handleUnicodeChar(w_param, gKeyboard->currentMask(FALSE))) - { - return 0; - } - break; + // Even if LLWindowCallbacks::handleUnicodeChar(llwchar, BOOL) returned FALSE, + // we *did* processed the event, so I believe we should not pass it to DefWindowProc... + window_imp->handleUnicodeUTF16((U16)w_param, gKeyboard->currentMask(FALSE)); + return 0; case WM_LBUTTONDOWN: { @@ -2951,7 +3055,7 @@ void spawn_web_browser(const char* escaped_url ) char reg_path_str[256]; /* Flawfinder: ignore */ snprintf(reg_path_str, sizeof(reg_path_str), "%s\\shell\\open\\command", gURLProtocolWhitelistHandler[i]); /* Flawfinder: ignore */ WCHAR reg_path_wstr[256]; - mbstowcs(reg_path_wstr, reg_path_str, 1024); + mbstowcs(reg_path_wstr, reg_path_str, sizeof(reg_path_wstr)/sizeof(reg_path_wstr[0])); HKEY key; WCHAR browser_open_wstr[1024]; @@ -3082,6 +3186,58 @@ void LLWindowWin32::bringToFront() void LLWindowWin32::focusClient() { SetFocus ( mWindowHandle ); -}; +} + +void LLWindowWin32::allowLanguageTextInput(BOOL b) +{ + if (b == sLanguageTextInputAllowed || !LLWinImm::isAvailable()) + { + /* Not actually allowing/disallowing. Do nothing. */ + return; + } + sLanguageTextInputAllowed = b; + + if (b) + { + /* Allowing: Restore the previous IME status, + so that the user has a feeling that the previous + text input continues naturally. Be careful, however, + the IME status is meaningful only during the user keeps + using same Input Locale (aka Keyboard Layout). */ + if (sWinIMEOpened && GetKeyboardLayout(0) == sWinInputLocale) + { + HIMC himc = LLWinImm::getContext(mWindowHandle); + LLWinImm::setOpenStatus(himc, TRUE); + LLWinImm::setConversionStatus(himc, sWinIMEConversionMode, sWinIMESentenceMode); + LLWinImm::releaseContext(mWindowHandle, himc); + } + } + else + { + /* Disallowing: Turn off the IME so that succeeding + key events bypass IME and come to us directly. + However, do it after saving the current IME + status. We need to restore the status when + allowing language text input again. */ + sWinInputLocale = GetKeyboardLayout(0); + sWinIMEOpened = LLWinImm::isIME(sWinInputLocale); + if (sWinIMEOpened) + { + HIMC himc = LLWinImm::getContext(mWindowHandle); + sWinIMEOpened = LLWinImm::getOpenStatus(himc); + if (sWinIMEOpened) + { + LLWinImm::getConversionStatus(himc, &sWinIMEConversionMode, &sWinIMESentenceMode); + + /* We need both ImmSetConversionStatus and ImmSetOpenStatus here + to surely disable IME's keyboard hooking, because Some IME reacts + only on the former and some other on the latter... */ + LLWinImm::setConversionStatus(himc, IME_CMODE_NOCONVERSION, sWinIMESentenceMode); + LLWinImm::setOpenStatus(himc, FALSE); + } + LLWinImm::releaseContext(mWindowHandle, himc); + } + } +} #endif // LL_WINDOWS diff --git a/indra/llwindow/llwindowwin32.h b/indra/llwindow/llwindowwin32.h index 487c1f09e7..5eb2cfbb79 100644 --- a/indra/llwindow/llwindowwin32.h +++ b/indra/llwindow/llwindowwin32.h @@ -86,6 +86,8 @@ public: /*virtual*/ void bringToFront(); /*virtual*/ void focusClient(); + /*virtual*/ void allowLanguageTextInput(BOOL b); + protected: LLWindowWin32( char *title, char *name, int x, int y, int width, int height, U32 flags, @@ -154,6 +156,15 @@ protected: BOOL mMousePositionModified; BOOL mInputProcessingPaused; + // The following five variables are for Language Text Input control. + // They are all static, since one context is shared by all LLWindowWin32 + // instances. + static BOOL sLanguageTextInputAllowed; + static BOOL sWinIMEOpened; + static HKL sWinInputLocale; + static DWORD sWinIMEConversionMode; + static DWORD sWinIMESentenceMode; + friend class LLWindowManager; }; diff --git a/indra/llxml/llxmlnode.cpp b/indra/llxml/llxmlnode.cpp index 02c762cbe0..29e7214020 100644 --- a/indra/llxml/llxmlnode.cpp +++ b/indra/llxml/llxmlnode.cpp @@ -21,6 +21,7 @@ #include "v3dmath.h" #include "v4math.h" #include "llquaternion.h" +#include "llstring.h" #include "lluuid.h" const S32 MAX_COLUMN_WIDTH = 80; @@ -3068,6 +3069,8 @@ LLString LLXMLNode::getTextContents() const msg = mValue.substr(start); } } + // Convert any internal CR to LF + msg = utf8str_removeCRLF(msg); } } return msg; diff --git a/indra/llxml/llxmlparser.cpp b/indra/llxml/llxmlparser.cpp index e54b1c400d..459e27e542 100644 --- a/indra/llxml/llxmlparser.cpp +++ b/indra/llxml/llxmlparser.cpp @@ -2,7 +2,7 @@ * @file llxmlparser.cpp * @brief LLXmlParser implementation * - * Copyright (c) 2002-$CurrentYear$`, Linden Research, Inc. + * Copyright (c) 2002-$CurrentYear$, Linden Research, Inc. * $License$ */ diff --git a/indra/lscript/lscript_compile/indra.l b/indra/lscript/lscript_compile/indra.l index 37435c2e97..e8aa073c63 100644 --- a/indra/lscript/lscript_compile/indra.l +++ b/indra/lscript/lscript_compile/indra.l @@ -1,8 +1,7 @@ -D [-]?[0-9] N [0-9] L [a-zA-Z_] H [a-fA-F0-9] -E [Ee][+-]?{D}+ +E [Ee][+-]?{N}+ FS (f|F) %e 10000 %n 4000 @@ -41,7 +40,7 @@ void parse_string(); #define YYLMAX 16384 #define YY_NEVER_INTERACTIVE 1 /* stops flex from calling isatty() */ - + #if defined(__cplusplus) extern "C" { int yylex( void ); } extern "C" { int yyparse( void ); } @@ -111,7 +110,7 @@ extern "C" { int yyerror(const char *fmt, ...); } 0[xX]{H}+ { count(); yylval.ival = strtoul(yytext, NULL, 0); return(INTEGER_CONSTANT); } -{D}+ { count(); yylval.ival = strtoul(yytext, NULL, 10); return(INTEGER_CONSTANT); } +{N}+ { count(); yylval.ival = strtoul(yytext, NULL, 10); return(INTEGER_CONSTANT); } "TRUE" { count(); yylval.ival = 1; return(INTEGER_TRUE); } "FALSE" { count(); yylval.ival = 0; return(INTEGER_FALSE); } "STATUS_PHYSICS" { count(); yylval.ival = 0x1; return(INTEGER_CONSTANT); } @@ -571,9 +570,9 @@ extern "C" { int yyerror(const char *fmt, ...); } {L}({L}|{N})* { count(); yylval.sval = new char[strlen(yytext) + 1]; strcpy(yylval.sval, yytext); return(IDENTIFIER); } -{D}+{E} { count(); yylval.fval = (F32)atof(yytext); return(FP_CONSTANT); } -{D}*"."{D}+({E})?{FS}? { count(); yylval.fval = (F32)atof(yytext); return(FP_CONSTANT); } -{D}+"."{D}*({E})?{FS}? { count(); yylval.fval = (F32)atof(yytext); return(FP_CONSTANT); } +{N}+{E} { count(); yylval.fval = (F32)atof(yytext); return(FP_CONSTANT); } +{N}*"."{N}+({E})?{FS}? { count(); yylval.fval = (F32)atof(yytext); return(FP_CONSTANT); } +{N}+"."{N}*({E})?{FS}? { count(); yylval.fval = (F32)atof(yytext); return(FP_CONSTANT); } L?\"(\\.|[^\\"])*\" { parse_string(); count(); return(STRING_CONSTANT); } @@ -751,6 +750,10 @@ BOOL lscript_compile(char *filename, BOOL is_god_like = FALSE) S32 yywrap() { +#ifdef FLEX_SCANNER + // get gcc to stop complaining about lack of use of yyunput + (void) yyunput; +#endif return(1); } diff --git a/indra/lscript/lscript_compile/indra.y b/indra/lscript/lscript_compile/indra.y index 7744649a92..c7a4fd6289 100644 --- a/indra/lscript/lscript_compile/indra.y +++ b/indra/lscript/lscript_compile/indra.y @@ -143,6 +143,8 @@ %type <assignable> simple_assignable %type <assignable> simple_assignable_no_list %type <constant> constant +%type <ival> integer_constant +%type <fval> fp_constant %type <assignable> special_constant %type <assignable> vector_constant %type <assignable> quaternion_constant @@ -352,30 +354,50 @@ simple_assignable_no_list ; constant - : INTEGER_CONSTANT + : integer_constant { $$ = new LLScriptConstantInteger(gLine, gColumn, $1); gAllocationManager->addAllocation($$); } - | INTEGER_TRUE + | fp_constant { - $$ = new LLScriptConstantInteger(gLine, gColumn, $1); + $$ = new LLScriptConstantFloat(gLine, gColumn, $1); gAllocationManager->addAllocation($$); } - | INTEGER_FALSE + | STRING_CONSTANT { - $$ = new LLScriptConstantInteger(gLine, gColumn, $1); + $$ = new LLScriptConstantString(gLine, gColumn, $1); gAllocationManager->addAllocation($$); } - | FP_CONSTANT + ; + +fp_constant + : FP_CONSTANT { - $$ = new LLScriptConstantFloat(gLine, gColumn, $1); - gAllocationManager->addAllocation($$); + $$ = $1; } - | STRING_CONSTANT + | '-' FP_CONSTANT { - $$ = new LLScriptConstantString(gLine, gColumn, $1); - gAllocationManager->addAllocation($$); + $$ = -$2; + } + ; + +integer_constant + : INTEGER_CONSTANT + { + $$ = $1; + } + | INTEGER_TRUE + { + $$ = $1; + } + | INTEGER_FALSE + { + $$ = $1; + } + | '-' INTEGER_CONSTANT + { + $$ = -$2; } ; diff --git a/indra/lscript/lscript_execute/lscript_execute.cpp b/indra/lscript/lscript_execute/lscript_execute.cpp index 94dc9329b1..196ca07d1d 100644 --- a/indra/lscript/lscript_execute/lscript_execute.cpp +++ b/indra/lscript/lscript_execute/lscript_execute.cpp @@ -1367,7 +1367,7 @@ void integer_integer_operation(U8 *buffer, LSCRIPTOpCodesEnum opcode) break; case LOPC_DIV: if (rside){ - if( ( rside == -1 ) || ( rside == 0xffffffff ) )// division by -1 can have funny results: multiplication is OK: SL-31252 + if( ( rside == -1 ) || ( rside == (S32) 0xffffffff ) )// division by -1 can have funny results: multiplication is OK: SL-31252 { result = -1 * lside; } diff --git a/indra/newview/fmodwrapper.cpp b/indra/newview/fmodwrapper.cpp index 99fd95434f..452d2fb9d7 100644 --- a/indra/newview/fmodwrapper.cpp +++ b/indra/newview/fmodwrapper.cpp @@ -16,4 +16,4 @@ void* fmodwrapper(void) // When building the fmodwrapper library, the linker doesn't seem to want to bring in libfmod.a unless I explicitly // reference at least one symbol in the library. This seemed like the simplest way. return (void*)&FSOUND_Init; -}
\ No newline at end of file +} diff --git a/indra/newview/licenses-linux.txt b/indra/newview/licenses-linux.txt index 1892b810f1..826e044d0a 100644 --- a/indra/newview/licenses-linux.txt +++ b/indra/newview/licenses-linux.txt @@ -547,3 +547,96 @@ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +============== +libpng license +============== + +COPYRIGHT NOTICE, DISCLAIMER, and LICENSE: + +If you modify libpng you may insert additional notices immediately following +this sentence. + +libpng versions 1.2.6, August 15, 2004, through 1.2.18, May 15, 2007, are +Copyright (c) 2004, 2006-2007 Glenn Randers-Pehrson, and are +distributed according to the same disclaimer and license as libpng-1.2.5 +with the following individual added to the list of Contributing Authors: + + Cosmin Truta + +libpng versions 1.0.7, July 1, 2000, through 1.2.5, October 3, 2002, are +Copyright (c) 2000-2002 Glenn Randers-Pehrson, and are +distributed according to the same disclaimer and license as libpng-1.0.6 +with the following individuals added to the list of Contributing Authors: + + Simon-Pierre Cadieux + Eric S. Raymond + Gilles Vollant + +and with the following additions to the disclaimer: + + There is no warranty against interference with your enjoyment of the + library or against infringement. There is no warranty that our + efforts or the library will fulfill any of your particular purposes + or needs. This library is provided with all faults, and the entire + risk of satisfactory quality, performance, accuracy, and effort is with + the user. + +libpng versions 0.97, January 1998, through 1.0.6, March 20, 2000, are +Copyright (c) 1998, 1999, 2000 Glenn Randers-Pehrson, and are +distributed according to the same disclaimer and license as libpng-0.96, +with the following individuals added to the list of Contributing Authors: + + Tom Lane + Glenn Randers-Pehrson + Willem van Schaik + +libpng versions 0.89, June 1996, through 0.96, May 1997, are +Copyright (c) 1996, 1997 Andreas Dilger +Distributed according to the same disclaimer and license as libpng-0.88, +with the following individuals added to the list of Contributing Authors: + + John Bowler + Kevin Bracey + Sam Bushell + Magnus Holmgren + Greg Roelofs + Tom Tanner + +libpng versions 0.5, May 1995, through 0.88, January 1996, are +Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc. + +For the purposes of this copyright and license, "Contributing Authors" +is defined as the following set of individuals: + + Andreas Dilger + Dave Martindale + Guy Eric Schalnat + Paul Schmidt + Tim Wegner + +The PNG Reference Library is supplied "AS IS". The Contributing Authors +and Group 42, Inc. disclaim all warranties, expressed or implied, +including, without limitation, the warranties of merchantability and of +fitness for any purpose. The Contributing Authors and Group 42, Inc. +assume no liability for direct, indirect, incidental, special, exemplary, +or consequential damages, which may result from the use of the PNG +Reference Library, even if advised of the possibility of such damage. + +Permission is hereby granted to use, copy, modify, and distribute this +source code, or portions hereof, for any purpose, without fee, subject +to the following restrictions: + +1. The origin of this source code must not be misrepresented. + +2. Altered versions must be plainly marked as such and +must not be misrepresented as being the original source. + +3. This Copyright notice may not be removed or altered from + any source or altered source distribution. + +The Contributing Authors and Group 42, Inc. specifically permit, without +fee, and encourage the use of this source code as a component to +supporting the PNG file format in commercial products. If you use this +source code in a product, acknowledgment is not required but would be +appreciated. diff --git a/indra/newview/licenses-mac.txt b/indra/newview/licenses-mac.txt index 6fcf461933..24539e52b0 100644 --- a/indra/newview/licenses-mac.txt +++ b/indra/newview/licenses-mac.txt @@ -432,3 +432,96 @@ jloup@gzip.org Mark Adler madler@alumni.caltech.edu + +============== +libpng license +============== + +COPYRIGHT NOTICE, DISCLAIMER, and LICENSE: + +If you modify libpng you may insert additional notices immediately following +this sentence. + +libpng versions 1.2.6, August 15, 2004, through 1.2.18, May 15, 2007, are +Copyright (c) 2004, 2006-2007 Glenn Randers-Pehrson, and are +distributed according to the same disclaimer and license as libpng-1.2.5 +with the following individual added to the list of Contributing Authors: + + Cosmin Truta + +libpng versions 1.0.7, July 1, 2000, through 1.2.5, October 3, 2002, are +Copyright (c) 2000-2002 Glenn Randers-Pehrson, and are +distributed according to the same disclaimer and license as libpng-1.0.6 +with the following individuals added to the list of Contributing Authors: + + Simon-Pierre Cadieux + Eric S. Raymond + Gilles Vollant + +and with the following additions to the disclaimer: + + There is no warranty against interference with your enjoyment of the + library or against infringement. There is no warranty that our + efforts or the library will fulfill any of your particular purposes + or needs. This library is provided with all faults, and the entire + risk of satisfactory quality, performance, accuracy, and effort is with + the user. + +libpng versions 0.97, January 1998, through 1.0.6, March 20, 2000, are +Copyright (c) 1998, 1999, 2000 Glenn Randers-Pehrson, and are +distributed according to the same disclaimer and license as libpng-0.96, +with the following individuals added to the list of Contributing Authors: + + Tom Lane + Glenn Randers-Pehrson + Willem van Schaik + +libpng versions 0.89, June 1996, through 0.96, May 1997, are +Copyright (c) 1996, 1997 Andreas Dilger +Distributed according to the same disclaimer and license as libpng-0.88, +with the following individuals added to the list of Contributing Authors: + + John Bowler + Kevin Bracey + Sam Bushell + Magnus Holmgren + Greg Roelofs + Tom Tanner + +libpng versions 0.5, May 1995, through 0.88, January 1996, are +Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc. + +For the purposes of this copyright and license, "Contributing Authors" +is defined as the following set of individuals: + + Andreas Dilger + Dave Martindale + Guy Eric Schalnat + Paul Schmidt + Tim Wegner + +The PNG Reference Library is supplied "AS IS". The Contributing Authors +and Group 42, Inc. disclaim all warranties, expressed or implied, +including, without limitation, the warranties of merchantability and of +fitness for any purpose. The Contributing Authors and Group 42, Inc. +assume no liability for direct, indirect, incidental, special, exemplary, +or consequential damages, which may result from the use of the PNG +Reference Library, even if advised of the possibility of such damage. + +Permission is hereby granted to use, copy, modify, and distribute this +source code, or portions hereof, for any purpose, without fee, subject +to the following restrictions: + +1. The origin of this source code must not be misrepresented. + +2. Altered versions must be plainly marked as such and +must not be misrepresented as being the original source. + +3. This Copyright notice may not be removed or altered from + any source or altered source distribution. + +The Contributing Authors and Group 42, Inc. specifically permit, without +fee, and encourage the use of this source code as a component to +supporting the PNG file format in commercial products. If you use this +source code in a product, acknowledgment is not required but would be +appreciated. diff --git a/indra/newview/licenses-win32.txt b/indra/newview/licenses-win32.txt index 6fcf461933..24539e52b0 100644 --- a/indra/newview/licenses-win32.txt +++ b/indra/newview/licenses-win32.txt @@ -432,3 +432,96 @@ jloup@gzip.org Mark Adler madler@alumni.caltech.edu + +============== +libpng license +============== + +COPYRIGHT NOTICE, DISCLAIMER, and LICENSE: + +If you modify libpng you may insert additional notices immediately following +this sentence. + +libpng versions 1.2.6, August 15, 2004, through 1.2.18, May 15, 2007, are +Copyright (c) 2004, 2006-2007 Glenn Randers-Pehrson, and are +distributed according to the same disclaimer and license as libpng-1.2.5 +with the following individual added to the list of Contributing Authors: + + Cosmin Truta + +libpng versions 1.0.7, July 1, 2000, through 1.2.5, October 3, 2002, are +Copyright (c) 2000-2002 Glenn Randers-Pehrson, and are +distributed according to the same disclaimer and license as libpng-1.0.6 +with the following individuals added to the list of Contributing Authors: + + Simon-Pierre Cadieux + Eric S. Raymond + Gilles Vollant + +and with the following additions to the disclaimer: + + There is no warranty against interference with your enjoyment of the + library or against infringement. There is no warranty that our + efforts or the library will fulfill any of your particular purposes + or needs. This library is provided with all faults, and the entire + risk of satisfactory quality, performance, accuracy, and effort is with + the user. + +libpng versions 0.97, January 1998, through 1.0.6, March 20, 2000, are +Copyright (c) 1998, 1999, 2000 Glenn Randers-Pehrson, and are +distributed according to the same disclaimer and license as libpng-0.96, +with the following individuals added to the list of Contributing Authors: + + Tom Lane + Glenn Randers-Pehrson + Willem van Schaik + +libpng versions 0.89, June 1996, through 0.96, May 1997, are +Copyright (c) 1996, 1997 Andreas Dilger +Distributed according to the same disclaimer and license as libpng-0.88, +with the following individuals added to the list of Contributing Authors: + + John Bowler + Kevin Bracey + Sam Bushell + Magnus Holmgren + Greg Roelofs + Tom Tanner + +libpng versions 0.5, May 1995, through 0.88, January 1996, are +Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc. + +For the purposes of this copyright and license, "Contributing Authors" +is defined as the following set of individuals: + + Andreas Dilger + Dave Martindale + Guy Eric Schalnat + Paul Schmidt + Tim Wegner + +The PNG Reference Library is supplied "AS IS". The Contributing Authors +and Group 42, Inc. disclaim all warranties, expressed or implied, +including, without limitation, the warranties of merchantability and of +fitness for any purpose. The Contributing Authors and Group 42, Inc. +assume no liability for direct, indirect, incidental, special, exemplary, +or consequential damages, which may result from the use of the PNG +Reference Library, even if advised of the possibility of such damage. + +Permission is hereby granted to use, copy, modify, and distribute this +source code, or portions hereof, for any purpose, without fee, subject +to the following restrictions: + +1. The origin of this source code must not be misrepresented. + +2. Altered versions must be plainly marked as such and +must not be misrepresented as being the original source. + +3. This Copyright notice may not be removed or altered from + any source or altered source distribution. + +The Contributing Authors and Group 42, Inc. specifically permit, without +fee, and encourage the use of this source code as a component to +supporting the PNG file format in commercial products. If you use this +source code in a product, acknowledgment is not required but would be +appreciated. diff --git a/indra/newview/linux_tools/wrapper.sh b/indra/newview/linux_tools/wrapper.sh index 048aaf6382..d77da8814c 100755 --- a/indra/newview/linux_tools/wrapper.sh +++ b/indra/newview/linux_tools/wrapper.sh @@ -38,7 +38,7 @@ export LL_GL_BASICEXT=x ## you're building your own viewer, bear in mind that the executable ## in the bin directory will be stripped: you should replace it with ## an unstripped binary before you run. -#export LL_WRAPPER='valgrind --log-file=secondlife.vg --leak-check=full --suppressions=/usr/lib/valgrind/glibc-2.5.supp --suppressions=secondlife-i686.supp' +#export LL_WRAPPER='valgrind --smc-check=all --log-file=secondlife.vg --leak-check=full --suppressions=/usr/lib/valgrind/glibc-2.5.supp --suppressions=secondlife-i686.supp' ## - Avoids an often-buggy X feature that doesn't really benefit us anyway. export SDL_VIDEO_X11_DGAMOUSE=0 diff --git a/indra/newview/llagent.cpp b/indra/newview/llagent.cpp index c6155197f6..f2cb9ea9ca 100644 --- a/indra/newview/llagent.cpp +++ b/indra/newview/llagent.cpp @@ -1999,11 +1999,6 @@ void LLAgent::setAFK() return; } - if (!gAllowAFK) - { - return; - } - if (!gAgent.getRegion()) { // Don't set AFK if we're not talking to a region yet. diff --git a/indra/newview/llagent.h b/indra/newview/llagent.h index 4b6e8c6996..2ee6634467 100644 --- a/indra/newview/llagent.h +++ b/indra/newview/llagent.h @@ -220,7 +220,7 @@ public: const LLUUID &getGroupID() const { return mGroupID; } ECameraMode getCameraMode() const { return mCameraMode; } BOOL getFocusOnAvatar() const { return mFocusOnAvatar; } - LLViewerObject* getFocusObject() const { return mFocusObject; } + LLPointer<LLViewerObject>& getFocusObject() { return mFocusObject; } F32 getFocusObjectDist() const { return mFocusObjectDist; } BOOL inPrelude(); BOOL canManageEstate() const; diff --git a/indra/newview/llassetuploadresponders.cpp b/indra/newview/llassetuploadresponders.cpp index 789beaae39..79faec1211 100644 --- a/indra/newview/llassetuploadresponders.cpp +++ b/indra/newview/llassetuploadresponders.cpp @@ -122,7 +122,7 @@ void LLAssetUploadResponder::uploadUpload(const LLSD& content) else { LLHTTPClient::postFile(uploader, mFileName, this); - }
+ } } void LLAssetUploadResponder::uploadFailure(const LLSD& content) diff --git a/indra/newview/llchatbar.cpp b/indra/newview/llchatbar.cpp index 4beea0d112..1a65903dcd 100644 --- a/indra/newview/llchatbar.cpp +++ b/indra/newview/llchatbar.cpp @@ -427,7 +427,7 @@ void LLChatBar::sendChat( EChatType type ) if (!text.empty()) { // store sent line in history, duplicates will get filtered - mInputEditor->updateHistory(); + if (mInputEditor) mInputEditor->updateHistory(); // Check if this is destined for another channel S32 channel = 0; stripChannelNumber(text, &channel); diff --git a/indra/newview/lldebugmessagebox.cpp b/indra/newview/lldebugmessagebox.cpp index 938a6ebd11..c62459f461 100644 --- a/indra/newview/lldebugmessagebox.cpp +++ b/indra/newview/lldebugmessagebox.cpp @@ -57,6 +57,9 @@ LLDebugVarMessageBox::LLDebugVarMessageBox(const std::string& title, EDebugVarTy addChild(mSlider2); addChild(mSlider3); break; + default: + llwarns << "Unhandled var type " << var_type << llendl; + break; } mAnimateButton = new LLButton("Animate", LLRect(20, 45, 180, 25), "", onAnimateClicked, this); @@ -165,12 +168,17 @@ void LLDebugVarMessageBox::slider_changed(LLUICtrl* ctrl, void* user_data) *((S32*)msg_box->mVarData) = (S32)msg_box->mSlider1->getValue().asInteger(); break; case VAR_TYPE_VEC3: + { LLVector3* vec_p = (LLVector3*)msg_box->mVarData; vec_p->setVec((F32)msg_box->mSlider1->getValue().asReal(), (F32)msg_box->mSlider2->getValue().asReal(), (F32)msg_box->mSlider3->getValue().asReal()); break; } + default: + llwarns << "Unhandled var type " << msg_box->mVarType << llendl; + break; + } } void LLDebugVarMessageBox::onAnimateClicked(void* user_data) @@ -197,10 +205,15 @@ void LLDebugVarMessageBox::draw() snprintf(text, sizeof(text), "%d", *((S32*)mVarData)); /* Flawfinder: ignore */ 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: + llwarns << "Unhandled var type " << mVarType << llendl; + break; + } mText->setText(text); if(mAnimate) diff --git a/indra/newview/lldrawable.cpp b/indra/newview/lldrawable.cpp index 5af5353c1b..16f463c32a 100644 --- a/indra/newview/lldrawable.cpp +++ b/indra/newview/lldrawable.cpp @@ -1304,7 +1304,7 @@ void LLSpatialBridge::setVisible(LLCamera& camera_in, std::vector<LLDrawable*>* if (parent) { - av = (LLVOAvatar*) parent->getVObj(); + av = (LLVOAvatar*) parent->getVObj().get(); if (!av->isVisible()) { diff --git a/indra/newview/lldrawable.h b/indra/newview/lldrawable.h index 6192d405af..782775d338 100644 --- a/indra/newview/lldrawable.h +++ b/indra/newview/lldrawable.h @@ -62,8 +62,8 @@ public: const LLViewerRegion* getRegion() const { return mVObjp->getRegion(); } const LLTextureEntry* getTextureEntry(U8 which) const { return mVObjp->getTE(which); } - LLViewerObject* getVObj() { return mVObjp; } - const LLViewerObject* getVObj() const { return mVObjp; } + LLPointer<LLViewerObject>& getVObj() { return mVObjp; } + const LLViewerObject *getVObj() const { return mVObjp; } LLVOVolume* getVOVolume() const; // cast mVObjp tp LLVOVolume if OK const LLMatrix4& getWorldMatrix() const { return mXform.getWorldMatrix(); } diff --git a/indra/newview/lldrawpool.cpp b/indra/newview/lldrawpool.cpp index b2e7272336..2626a8bd31 100644 --- a/indra/newview/lldrawpool.cpp +++ b/indra/newview/lldrawpool.cpp @@ -466,15 +466,20 @@ void LLRenderPass::renderInvisible(U32 mask) std::vector<LLDrawInfo*>& draw_info = gPipeline.mRenderMap[LLRenderPass::PASS_INVISIBLE]; - U32* indices_pointer = NULL; for (std::vector<LLDrawInfo*>::iterator i = draw_info.begin(); i != draw_info.end(); ++i) { LLDrawInfo& params = **i; - params.mVertexBuffer->setBuffer(mask); - indices_pointer = (U32*) params.mVertexBuffer->getIndicesPointer(); - glDrawRangeElements(GL_TRIANGLES, params.mStart, params.mEnd, params.mCount, - GL_UNSIGNED_INT, indices_pointer+params.mOffset); - gPipeline.mTrianglesDrawn += params.mCount/3; + + if (params.mVertexBuffer) + { + params.mVertexBuffer->setBuffer(mask); + U32 *indices_pointer = + (U32 *) params.mVertexBuffer->getIndicesPointer(); + glDrawRangeElements(GL_TRIANGLES, params.mStart, params.mEnd, + params.mCount, GL_UNSIGNED_INT, + indices_pointer + params.mOffset); + gPipeline.mTrianglesDrawn += params.mCount / 3; + } } } diff --git a/indra/newview/lldrawpoolavatar.cpp b/indra/newview/lldrawpoolavatar.cpp index ee0ed22e35..f484cebe72 100644 --- a/indra/newview/lldrawpoolavatar.cpp +++ b/indra/newview/lldrawpoolavatar.cpp @@ -299,7 +299,7 @@ void LLDrawPoolAvatar::renderAvatars(LLVOAvatar* single_avatar, S32 pass) { return; } - avatarp = (LLVOAvatar *)(facep->getDrawable()->getVObj()); + avatarp = (LLVOAvatar *)facep->getDrawable()->getVObj().get(); } if (avatarp->isDead() || avatarp->mDrawable.isNull()) @@ -505,7 +505,7 @@ void LLDrawPoolAvatar::renderForSelect() { return; } - LLVOAvatar *avatarp = (LLVOAvatar *)(facep->getDrawable()->getVObj()); + LLVOAvatar *avatarp = (LLVOAvatar *)facep->getDrawable()->getVObj().get(); if (avatarp->isDead() || avatarp->mIsDummy || avatarp->mDrawable.isNull()) { diff --git a/indra/newview/lldrawpooltree.cpp b/indra/newview/lldrawpooltree.cpp index 350ad6a652..e6e0f5c965 100644 --- a/indra/newview/lldrawpooltree.cpp +++ b/indra/newview/lldrawpooltree.cpp @@ -144,7 +144,7 @@ void LLDrawPoolTree::renderTree(BOOL selecting) U32* indicesp = (U32*) face->mVertexBuffer->getIndicesPointer(); // Render each of the trees - LLVOTree *treep = (LLVOTree *)drawablep->getVObj(); + LLVOTree *treep = (LLVOTree *)drawablep->getVObj().get(); LLColor4U color(255,255,255,255); diff --git a/indra/newview/lldriverparam.h b/indra/newview/lldriverparam.h index 06850e3eaf..8cdaa893c8 100644 --- a/indra/newview/lldriverparam.h +++ b/indra/newview/lldriverparam.h @@ -84,7 +84,7 @@ protected: typedef std::vector<LLDrivenEntry> entry_list_t; entry_list_t mDriven; LLViewerVisualParam* mCurrentDistortionParam; - LLVOAvatar* mAvatarp; + LLPointer<LLVOAvatar> mAvatarp; }; #endif // LL_LLDRIVERPARAM_H diff --git a/indra/newview/lleventpoll.cpp b/indra/newview/lleventpoll.cpp index 6d1c384b5a..4452a134ae 100644 --- a/indra/newview/lleventpoll.cpp +++ b/indra/newview/lleventpoll.cpp @@ -1,8 +1,8 @@ -/** +/** * @file lleventpoll.cpp - * @brief Implementation of the LLEventPoll class. + * @brief Implementation of the LLEventPoll class. * - * Copyright (c) 2006-$CurrentYear$, Linden Research, Inc. + * Copyright (c) 2006-$CurrentYear$, Linden Research, Inc. * $License$ */ diff --git a/indra/newview/llface.cpp b/indra/newview/llface.cpp index 044ae33ccc..14f3d4ad2b 100644 --- a/indra/newview/llface.cpp +++ b/indra/newview/llface.cpp @@ -1378,7 +1378,7 @@ void LLFace::enableLights() const } if (isState(LIGHT)) { - const LLVOVolume* vovolume = (const LLVOVolume*)(mDrawablep->getVObj()); + const LLVOVolume* vovolume = (const LLVOVolume*)mDrawablep->getVObj(); gPipeline.setAmbient(vovolume->getLightColor()); } } diff --git a/indra/newview/llfilepicker.cpp b/indra/newview/llfilepicker.cpp index 6f43460f70..51e918e1d5 100644 --- a/indra/newview/llfilepicker.cpp +++ b/indra/newview/llfilepicker.cpp @@ -29,7 +29,7 @@ LLFilePicker LLFilePicker::sInstance; #if LL_WINDOWS #define SOUND_FILTER L"Sounds (*.wav)\0*.wav\0" -#define IMAGE_FILTER L"Images (*.tga; *.bmp; *.jpg; *.jpeg)\0*.tga;*.bmp;*.jpg;*.jpeg\0" +#define IMAGE_FILTER L"Images (*.tga; *.bmp; *.jpg; *.jpeg; *.png)\0*.tga;*.bmp;*.jpg;*.jpeg;*.png\0" #define ANIM_FILTER L"Animations (*.bvh)\0*.bvh\0" #ifdef _CORY_TESTING #define GEOMETRY_FILTER L"SL Geometry (*.slg)\0*.slg\0" @@ -491,10 +491,12 @@ Boolean LLFilePicker::navOpenFilterProc(AEDesc *theItem, void *info, void *callB if (fileInfo.filetype != 'JPEG' && fileInfo.filetype != 'JPG ' && fileInfo.filetype != 'BMP ' && fileInfo.filetype != 'TGA ' && fileInfo.filetype != 'BMPf' && fileInfo.filetype != 'TPIC' && + fileInfo.filetype != 'PNG ' && (fileInfo.extension && (CFStringCompare(fileInfo.extension, CFSTR("jpeg"), kCFCompareCaseInsensitive) != kCFCompareEqualTo && CFStringCompare(fileInfo.extension, CFSTR("jpg"), kCFCompareCaseInsensitive) != kCFCompareEqualTo && CFStringCompare(fileInfo.extension, CFSTR("bmp"), kCFCompareCaseInsensitive) != kCFCompareEqualTo && - CFStringCompare(fileInfo.extension, CFSTR("tga"), kCFCompareCaseInsensitive) != kCFCompareEqualTo)) + CFStringCompare(fileInfo.extension, CFSTR("tga"), kCFCompareCaseInsensitive) != kCFCompareEqualTo && + CFStringCompare(fileInfo.extension, CFSTR("png"), kCFCompareCaseInsensitive) != kCFCompareEqualTo)) ) { result = false; @@ -1149,7 +1151,7 @@ BOOL LLFilePicker::getOpenFile( ELoadFilter filter ) case FFLOAD_ANIM: caption += "Animations (*.bvh)"; break; case FFLOAD_IMAGE: - caption += "Images (*.tga; *.bmp; *.jpg; *.jpeg)"; break; + caption += "Images (*.tga; *.bmp; *.jpg; *.jpeg; *.png)"; break; default:; break; } diff --git a/indra/newview/llfirstuse.cpp b/indra/newview/llfirstuse.cpp index 4a4e1a9ed4..9f05e59ac8 100644 --- a/indra/newview/llfirstuse.cpp +++ b/indra/newview/llfirstuse.cpp @@ -40,6 +40,18 @@ void LLFirstUse::disableFirstUse() } } +// static +void LLFirstUse::resetFirstUse() +{ + // Set all first-use warnings to disabled + for (std::set<LLString>::iterator iter = sConfigVariables.begin(); + iter != sConfigVariables.end(); ++iter) + { + gSavedSettings.setWarning(*iter, TRUE); + } +} + + // Called whenever the viewer detects that your balance went up void LLFirstUse::useBalanceIncrease(S32 delta) { @@ -194,3 +206,25 @@ void LLFirstUse::useFlexible() } } +// static +void LLFirstUse::useDebugMenus() +{ + if (gSavedSettings.getWarning("FirstDebugMenus")) + { + gSavedSettings.setWarning("FirstDebugMenus", FALSE); + + LLNotifyBox::showXml("FirstDebugMenus"); + } +} + +// static +void LLFirstUse::useSculptedPrim() +{ + if (gSavedSettings.getWarning("FirstSculptedPrim")) + { + gSavedSettings.setWarning("FirstSculptedPrim", FALSE); + + LLNotifyBox::showXml("FirstSculptedPrim"); + + } +} diff --git a/indra/newview/llfirstuse.h b/indra/newview/llfirstuse.h index b367619196..134699d1ec 100644 --- a/indra/newview/llfirstuse.h +++ b/indra/newview/llfirstuse.h @@ -46,6 +46,10 @@ object or from inventory. 11. FIrst time you run the client on a system without QuickTime installed. 12. First time you create a flexible object. + +13. First time you open the debug menus (ctrl-alt-shift D) + +14. First time you create/edit a sculpted prim. */ class LLFirstUse @@ -56,6 +60,7 @@ public: // Sets all controls back to show the dialogs. static void disableFirstUse(); + static void resetFirstUse(); // These methods are called each time the appropriate action is // taken. The functions themselves handle only showing the dialog @@ -74,6 +79,8 @@ public: static void useInventory(); static void useSandbox(); static void useFlexible(); + static void useDebugMenus(); + static void useSculptedPrim(); protected: static std::set<LLString> sConfigVariables; diff --git a/indra/newview/llflexibleobject.cpp b/indra/newview/llflexibleobject.cpp index 5a7a12c38d..3107b062b7 100644 --- a/indra/newview/llflexibleobject.cpp +++ b/indra/newview/llflexibleobject.cpp @@ -232,12 +232,6 @@ void LLVolumeImplFlexible::onSetVolume(const LLVolumeParams &volume_params, cons //--------------------------------------------------------------------------------- BOOL LLVolumeImplFlexible::doIdleUpdate(LLAgent &agent, LLWorld &world, const F64 &time) { - if (!gPipeline.hasRenderDebugFeatureMask(LLPipeline::RENDER_DEBUG_FEATURE_FLEXIBLE)) - { - return FALSE; // (we are not initialized or updated) - } - - LLFastTimer ftm(LLFastTimer::FTM_FLEXIBLE_UPDATE); if (mVO->mDrawable.isNull()) { @@ -252,6 +246,8 @@ BOOL LLVolumeImplFlexible::doIdleUpdate(LLAgent &agent, LLWorld &world, const F6 LLViewerObject* parent = (LLViewerObject*) mVO->getParent(); parent->mDrawable->mQuietCount = 0; } + + LLFastTimer ftm(LLFastTimer::FTM_FLEXIBLE_UPDATE); S32 new_res = mAttributes->getSimulateLOD(); @@ -264,6 +260,8 @@ BOOL LLVolumeImplFlexible::doIdleUpdate(LLAgent &agent, LLWorld &world, const F6 { mRenderRes = FLEXIBLE_OBJECT_MAX_SECTIONS; } + + // Bottom cap at 1/4 the original number of sections if (mRenderRes < mAttributes->getSimulateLOD()-1) { @@ -281,6 +279,10 @@ BOOL LLVolumeImplFlexible::doIdleUpdate(LLAgent &agent, LLWorld &world, const F6 setAttributesOfAllSections(); mInitialized = TRUE; } + if (!gPipeline.hasRenderDebugFeatureMask(LLPipeline::RENDER_DEBUG_FEATURE_FLEXIBLE)) + { + return FALSE; // (we are not initialized or updated) + } if (mVO->mDrawable->isVisible() && !mVO->mDrawable->isState(LLDrawable::IN_REBUILD_Q1) && @@ -604,7 +606,7 @@ void LLVolumeImplFlexible::onSetScale(const LLVector3& scale, BOOL damped) BOOL LLVolumeImplFlexible::doUpdateGeometry(LLDrawable *drawable) { - LLVOVolume *volume = (LLVOVolume*)mVO; + LLVOVolume *volume = (LLVOVolume*)mVO.get(); if (volume->mDrawable.isNull()) // Not sure why this is happening, but it is... { @@ -720,7 +722,7 @@ void LLVolumeImplFlexible::updateRelativeXform() { LLQuaternion delta_rot; LLVector3 delta_pos, delta_scale; - LLVOVolume* vo = (LLVOVolume*) mVO; + LLVOVolume* vo = (LLVOVolume*) mVO.get(); //matrix from local space to parent relative/global space delta_rot = vo->mDrawable->isSpatialRoot() ? LLQuaternion() : vo->mDrawable->getRotation(); diff --git a/indra/newview/llflexibleobject.h b/indra/newview/llflexibleobject.h index 5a782bc617..3a26604913 100644 --- a/indra/newview/llflexibleobject.h +++ b/indra/newview/llflexibleobject.h @@ -91,7 +91,7 @@ class LLVolumeImplFlexible : public LLVolumeInterface //-------------------------------------- // private members //-------------------------------------- - LLViewerObject* mVO; + LLPointer<LLViewerObject> mVO; LLTimer mTimer; LLVector3 mAnchorPosition; LLVector3 mParentPosition; diff --git a/indra/newview/llfloateranimpreview.h b/indra/newview/llfloateranimpreview.h index 858d586274..fe6f19e962 100644 --- a/indra/newview/llfloateranimpreview.h +++ b/indra/newview/llfloateranimpreview.h @@ -41,7 +41,7 @@ protected: F32 mCameraZoom; LLVector3 mCameraOffset; LLVector3 mCameraRelPos; - LLVOAvatar* mDummyAvatar; + LLPointer<LLVOAvatar> mDummyAvatar; }; class LLFloaterAnimPreview : public LLFloaterNameDesc diff --git a/indra/newview/llfloaterchat.cpp b/indra/newview/llfloaterchat.cpp index 93eb24f36d..75c68acb78 100644 --- a/indra/newview/llfloaterchat.cpp +++ b/indra/newview/llfloaterchat.cpp @@ -130,12 +130,22 @@ void add_timestamped_line(LLViewerTextEditor* edit, const LLString& line, const edit->appendColoredText(line, false, prepend_newline, color); } +void log_chat_text(const LLChat& chat) +{ + LLString histstr; + if (gSavedPerAccountSettings.getBOOL("LogChatTimestamp")) + histstr = LLLogChat::timestamp(gSavedPerAccountSettings.getBOOL("LogTimestampDate")) + chat.mText; + else + histstr = chat.mText; + + LLLogChat::saveHistory("chat",histstr); +} // static void LLFloaterChat::addChatHistory(const LLChat& chat, bool log_to_file) { if ( gSavedPerAccountSettings.getBOOL("LogChat") && log_to_file) { - LLLogChat::saveHistory("chat",chat.mText); + log_chat_text(chat); } LLColor4 color = get_text_color(chat); @@ -344,10 +354,14 @@ void LLFloaterChat::addChat(const LLChat& chat, gConsole->addLine(chat.mText, size, text_color); } - if( !from_instant_message || gSavedSettings.getBOOL("IMInChatHistory") ) - { + if(from_instant_message && gSavedPerAccountSettings.getBOOL("LogChatIM")) + log_chat_text(chat); + + if(from_instant_message && gSavedSettings.getBOOL("IMInChatHistory")) + addChatHistory(chat,false); + + if(!from_instant_message) addChatHistory(chat); - } } LLColor4 get_text_color(const LLChat& chat) @@ -380,6 +394,10 @@ LLColor4 get_text_color(const LLChat& chat) { text_color = gSavedSettings.getColor4("ScriptErrorColor"); } + else if ( chat.mChatType == CHAT_TYPE_OWNER ) + { + text_color = gSavedSettings.getColor4("llOwnerSayChatColor"); + } else { text_color = gSavedSettings.getColor4("ObjectChatColor"); diff --git a/indra/newview/llfloaterimagepreview.cpp b/indra/newview/llfloaterimagepreview.cpp index 4f7ef34fe1..457a87adb2 100644 --- a/indra/newview/llfloaterimagepreview.cpp +++ b/indra/newview/llfloaterimagepreview.cpp @@ -13,6 +13,7 @@ #include "llimagebmp.h" #include "llimagetga.h" #include "llimagejpeg.h" +#include "llimagepng.h" #include "llagent.h" #include "llbutton.h" @@ -305,6 +306,10 @@ bool LLFloaterImagePreview::loadImage(const char *src_filename) { codec = IMG_CODEC_JPEG; } + else if( 0 == strnicmp(ext, ".png", 4) ) + { + codec = IMG_CODEC_PNG; + } LLPointer<LLImageRaw> raw_image = new LLImageRaw; @@ -362,6 +367,21 @@ bool LLFloaterImagePreview::loadImage(const char *src_filename) } } break; + case IMG_CODEC_PNG: + { + LLPointer<LLImagePNG> png_image = new LLImagePNG; + + if (!png_image->load(src_filename)) + { + return false; + } + + if (!png_image->decode(raw_image)) + { + return false; + } + } + break; default: return false; } diff --git a/indra/newview/llfloaterinspect.cpp b/indra/newview/llfloaterinspect.cpp index 233357453d..daf3067d7b 100644 --- a/indra/newview/llfloaterinspect.cpp +++ b/indra/newview/llfloaterinspect.cpp @@ -2,7 +2,7 @@ * @file llfloaterinspect.cpp * @brief Floater for object inspection tool * - * Copyright (c) 2002-$CurrentYear$, Linden Research, Inc. + * Copyright (c) 2006-$CurrentYear$, Linden Research, Inc. * $License$ */ diff --git a/indra/newview/llfloaterinspect.h b/indra/newview/llfloaterinspect.h index d221879d0e..99bae0f73b 100644 --- a/indra/newview/llfloaterinspect.h +++ b/indra/newview/llfloaterinspect.h @@ -1,10 +1,10 @@ /** -* @file llfloaterfriends.h +* @file llfloaterinspect.h * @author Cube * @date 2006-12-16 * @brief Declaration of class for displaying object attributes * -* Copyright (c) 2005-$CurrentYear$, Linden Research, Inc. +* Copyright (c) 2006-$CurrentYear$, Linden Research, Inc. * $License$ */ diff --git a/indra/newview/llfloaterland.cpp b/indra/newview/llfloaterland.cpp index 9f990d47b7..b1143c4e7b 100644 --- a/indra/newview/llfloaterland.cpp +++ b/indra/newview/llfloaterland.cpp @@ -1537,6 +1537,13 @@ void LLPanelLandObjects::processParcelObjectOwnersReply(LLMessageSystem *msg, vo { LLPanelLandObjects* self = LLFloaterLand::getCurrentPanelLandObjects(); + if (!self) + { + llwarns << "Received message for nonexistent LLPanelLandObject" + << llendl; + return; + } + const LLFontGL* FONT = LLFontGL::sSansSerif; // Extract all of the owners. diff --git a/indra/newview/llfloaterpostcard.cpp b/indra/newview/llfloaterpostcard.cpp index ecab84f5d9..3eaff0101c 100644 --- a/indra/newview/llfloaterpostcard.cpp +++ b/indra/newview/llfloaterpostcard.cpp @@ -56,12 +56,12 @@ LLFloaterPostcard::LLFloaterPostcard(LLImageJPEG* jpeg, LLImageGL *img, const LL mJPEGImage(jpeg), mViewerImage(img), mImageScale(img_scale), - mPosTakenGlobal(pos_taken_global) + mPosTakenGlobal(pos_taken_global), + mHasFirstMsgFocus(false) { init(); } - void LLFloaterPostcard::init() { // pick up the user's up-to-date email address @@ -108,25 +108,24 @@ BOOL LLFloaterPostcard::postBuild() gAgent.buildFullname(name_string); childSetValue("name_form", LLSD(name_string)); - - // XUI:translate - LLString msg("Postcard from "); - msg += gSecondLife; - childSetValue("subject_form", LLSD(msg)); LLTextEditor *MsgField = LLUICtrlFactory::getTextEditorByName(this, "msg_form"); if (MsgField) { - MsgField->setText("Check this out!"); MsgField->setWordWrap(TRUE); - } - childSetFocus("to_form", TRUE); + // For the first time a user focusess to .the msg box, all text will be selected. + MsgField->setFocusChangedCallback(onMsgFormFocusRecieved); + MsgField->setCallbackUserData(this); + } + childSetFocus("to_form", TRUE); + return TRUE; } + // static LLFloaterPostcard* LLFloaterPostcard::showFromSnapshot(LLImageJPEG *jpeg, LLImageGL *img, const LLVector2 &image_scale, const LLVector3d& pos_taken_global) { @@ -247,46 +246,16 @@ void LLFloaterPostcard::onClickSend(void* data) return; } - if (self->mJPEGImage.notNull()) + LLString subject(self->childGetValue("subject_form").asString().c_str()); + if(subject.empty() || !self->mHasFirstMsgFocus) { - self->mTransactionID.generate(); - self->mAssetID = self->mTransactionID.makeAssetID(gAgent.getSecureSessionID()); - LLVFile::writeFile(self->mJPEGImage->getData(), self->mJPEGImage->getDataSize(), gVFS, self->mAssetID, LLAssetType::AT_IMAGE_JPEG); - - // upload the image - std::string url = gAgent.getRegion()->getCapability("SendPostcard"); - if(!url.empty()) - { - llinfos << "Send Postcard via capability" << llendl; - LLSD body = LLSD::emptyMap(); - // the capability already encodes: agent ID, region ID - body["pos-global"] = self->mPosTakenGlobal.getValue(); - body["to"] = self->childGetValue("to_form").asString(); - body["from"] = self->childGetValue("from_form").asString(); - body["name"] = self->childGetValue("name_form").asString(); - body["subject"] = self->childGetValue("subject_form").asString(); - body["msg"] = self->childGetValue("msg_form").asString(); - body["allow-publish"] = self->childGetValue("allow_publish_check").asBoolean(); - body["mature-publish"] = self->childGetValue("mature_check").asBoolean(); - LLHTTPClient::post(url, body, new LLSendPostcardResponder(body, self->mAssetID, LLAssetType::AT_IMAGE_JPEG)); - } - else - { - gAssetStorage->storeAssetData(self->mTransactionID, LLAssetType::AT_IMAGE_JPEG, &uploadCallback, (void *)self, FALSE); - } - - LLUploadDialog::modalUploadDialog("Uploading...\n\nPostcard"); - - // don't destroy the window until the upload is done - // this way we keep the information in the form - self->setVisible(FALSE); + gViewerWindow->alertXml("PromptMissingSubjMsg", missingSubjMsgAlertCallback, self); + return; + } - // also remove any dependency on another floater - // so that we can be sure to outlive it while we - // need to. - LLFloater* dependee = self->getDependee(); - if (dependee) - dependee->removeDependentFloater(self); + if (self->mJPEGImage.notNull()) + { + self->sendPostcard(); } else { @@ -355,3 +324,86 @@ void LLFloaterPostcard::updateUserInfo(const char *email) } } } + +void LLFloaterPostcard::onMsgFormFocusRecieved(LLUICtrl* receiver, void* data) +{ + LLFloaterPostcard* self = (LLFloaterPostcard *)data; + if(self) + { + LLTextEditor* msgForm = LLUICtrlFactory::getTextEditorByName(self, "msg_form"); + if(msgForm && msgForm == receiver && msgForm->hasFocus() && !(self->mHasFirstMsgFocus)) + { + self->mHasFirstMsgFocus = true; + msgForm->setText(LLString("")); + } + } +} + +void LLFloaterPostcard::missingSubjMsgAlertCallback(S32 option, void* data) +{ + if(data) + { + LLFloaterPostcard* self = static_cast<LLFloaterPostcard*>(data); + if(0 == option) + { + // User clicked OK + if((self->childGetValue("subject_form").asString()).empty()) + { + // Stuff the subject back into the form. + self->childSetValue("subject_form", self->childGetText("default_subject")); + } + + if(!self->mHasFirstMsgFocus) + { + // The user never switched focus to the messagee window. + // Using the default string. + // XUI: translate + self->childSetValue("msg_form", self->childGetText("default_message")); + } + + self->sendPostcard(); + } + } +} + +void LLFloaterPostcard::sendPostcard() +{ + mTransactionID.generate(); + mAssetID = mTransactionID.makeAssetID(gAgent.getSecureSessionID()); + LLVFile::writeFile(mJPEGImage->getData(), mJPEGImage->getDataSize(), gVFS, mAssetID, LLAssetType::AT_IMAGE_JPEG); + + // upload the image + std::string url = gAgent.getRegion()->getCapability("SendPostcard"); + if(!url.empty()) + { + llinfos << "Send Postcard via capability" << llendl; + LLSD body = LLSD::emptyMap(); + // the capability already encodes: agent ID, region ID + body["pos-global"] = mPosTakenGlobal.getValue(); + body["to"] = childGetValue("to_form").asString(); + body["from"] = childGetValue("from_form").asString(); + body["name"] = childGetValue("name_form").asString(); + body["subject"] = childGetValue("subject_form").asString(); + body["msg"] = childGetValue("msg_form").asString(); + body["allow-publish"] = childGetValue("allow_publish_check").asBoolean(); + body["mature-publish"] = childGetValue("mature_check").asBoolean(); + LLHTTPClient::post(url, body, new LLSendPostcardResponder(body, mAssetID, LLAssetType::AT_IMAGE_JPEG)); + } + else + { + gAssetStorage->storeAssetData(mTransactionID, LLAssetType::AT_IMAGE_JPEG, &uploadCallback, (void *)this, FALSE); + } + + LLUploadDialog::modalUploadDialog("Uploading...\n\nPostcard"); + + // don't destroy the window until the upload is done + // this way we keep the information in the form + setVisible(FALSE); + + // also remove any dependency on another floater + // so that we can be sure to outlive it while we + // need to. + LLFloater* dependee = getDependee(); + if (dependee) + dependee->removeDependentFloater(this); +} diff --git a/indra/newview/llfloaterpostcard.h b/indra/newview/llfloaterpostcard.h index 542d117403..7ca1278776 100644 --- a/indra/newview/llfloaterpostcard.h +++ b/indra/newview/llfloaterpostcard.h @@ -29,7 +29,7 @@ public: virtual void init(); virtual BOOL postBuild(); virtual void draw(); - + static LLFloaterPostcard* showFromSnapshot(LLImageJPEG *jpeg, LLImageGL *img, const LLVector2& img_scale, const LLVector3d& pos_taken_global); static void onClickCancel(void* data); @@ -42,6 +42,11 @@ public: static void updateUserInfo(const char *email); + static void onMsgFormFocusRecieved(LLUICtrl* receiver, void* data); + static void missingSubjMsgAlertCallback(S32 option, void* data); + + void sendPostcard(); + protected: LLPointer<LLImageJPEG> mJPEGImage; @@ -50,6 +55,7 @@ protected: LLAssetID mAssetID; LLVector2 mImageScale; LLVector3d mPosTakenGlobal; + boolean mHasFirstMsgFocus; static LLLinkedList<LLFloaterPostcard> sInstances; }; diff --git a/indra/newview/llfloaterreporter.cpp b/indra/newview/llfloaterreporter.cpp index f377fae8af..71491f16e6 100644 --- a/indra/newview/llfloaterreporter.cpp +++ b/indra/newview/llfloaterreporter.cpp @@ -305,6 +305,8 @@ void LLFloaterReporter::getObjectInfo(const LLUUID& object_id) } childSetText("object_name", object_owner); childSetText("owner_name", object_owner); + childSetText("abuser_name_edit", object_owner); + mAbuserID = object_id; } else { @@ -556,10 +558,12 @@ LLFloaterReporter* LLFloaterReporter::createNewBugReporter() -void LLFloaterReporter::setPickedObjectProperties(const char *object_name, const char *owner_name) +void LLFloaterReporter::setPickedObjectProperties(const char *object_name, const char *owner_name, const LLUUID owner_id) { childSetText("object_name", object_name); childSetText("owner_name", owner_name); + childSetText("abuser_name_edit", owner_name); + mAbuserID = owner_id; } diff --git a/indra/newview/llfloaterreporter.h b/indra/newview/llfloaterreporter.h index e8483b98ef..30de56fb87 100644 --- a/indra/newview/llfloaterreporter.h +++ b/indra/newview/llfloaterreporter.h @@ -86,7 +86,7 @@ public: // static static void processRegionInfo(LLMessageSystem* msg); - void setPickedObjectProperties(const char *object_name, const char *owner_name); + void setPickedObjectProperties(const char *object_name, const char *owner_name, const LLUUID owner_id); private: void takeScreenshot(); diff --git a/indra/newview/llfloatertools.cpp b/indra/newview/llfloatertools.cpp index 224bd4650f..b708a4261f 100644 --- a/indra/newview/llfloatertools.cpp +++ b/indra/newview/llfloatertools.cpp @@ -196,7 +196,7 @@ BOOL LLFloaterTools::postBuild() mRadioSelectFace = LLUICtrlFactory::getCheckBoxByName(this,"radio select face"); childSetCommitCallback("radio select face",commit_select_tool,gToolFace); mCheckSelectIndividual = LLUICtrlFactory::getCheckBoxByName(this,"checkbox edit linked parts"); - childSetValue("checkbox edit linked parts",(BOOL)!gSavedSettings.getBOOL("SelectLinkedSet")); + childSetValue("checkbox edit linked parts",(BOOL)gSavedSettings.getBOOL("EditLinkedParts")); childSetCommitCallback("checkbox edit linked parts",commit_select_component,this); mCheckSnapToGrid = LLUICtrlFactory::getCheckBoxByName(this,"checkbox snap to grid"); childSetValue("checkbox snap to grid",(BOOL)gSavedSettings.getBOOL("SnapEnabled")); @@ -436,7 +436,7 @@ void LLFloaterTools::draw() mDirty = FALSE; } - mCheckSelectIndividual->set(!gSavedSettings.getBOOL("SelectLinkedSet")); + // mCheckSelectIndividual->set(gSavedSettings.getBOOL("EditLinkedParts")); LLFloater::draw(); } @@ -547,7 +547,7 @@ void LLFloaterTools::updatePopup(LLCoordGL center, MASK mask) if (mCheckSelectIndividual) { mCheckSelectIndividual->setVisible(edit_visible); - mCheckSelectIndividual->set(!gSavedSettings.getBOOL("SelectLinkedSet")); + //mCheckSelectIndividual->set(gSavedSettings.getBOOL("EditLinkedParts")); } mRadioPosition ->set( tool == gToolTranslate ); @@ -726,7 +726,7 @@ void LLFloaterTools::onClose(bool app_quitting) // exit component selection mode gSelectMgr->promoteSelectionToRoot(); - gSavedSettings.setBOOL("SelectLinkedSet", TRUE); + gSavedSettings.setBOOL("EditLinkedParts", FALSE); gViewerWindow->showCursor(); @@ -902,7 +902,7 @@ void commit_select_component(LLUICtrl *ctrl, void *data) } BOOL select_individuals = floaterp->mCheckSelectIndividual->get(); - gSavedSettings.setBOOL("SelectLinkedSet", !select_individuals); + gSavedSettings.setBOOL("EditLinkedParts", select_individuals); floaterp->dirty(); if (select_individuals) diff --git a/indra/newview/llfolderview.cpp b/indra/newview/llfolderview.cpp index f712067492..d50c54b938 100644 --- a/indra/newview/llfolderview.cpp +++ b/indra/newview/llfolderview.cpp @@ -2502,6 +2502,7 @@ LLFolderView::LLFolderView( const LLString& name, LLViewerImage* root_folder_ico mLastScrollItem( NULL ), mNeedsAutoSelect( FALSE ), mAutoSelectOverride(FALSE), + mNeedsAutoRename(FALSE), mDebugFilters(FALSE), mSortOrder(LLInventoryFilter::SO_FOLDERS_BY_NAME), // This gets overridden by a pref immediately mFilter(name), @@ -4934,3 +4935,39 @@ LLString LLInventoryFilter::getFilterText() } return mFilterText; } + +void LLInventoryFilter::toLLSD(LLSD& data) +{ + data["filter_types"] = (LLSD::Integer)getFilterTypes(); + data["min_date"] = (LLSD::Integer)getMinDate(); + data["max_date"] = (LLSD::Integer)getMaxDate(); + data["hours_ago"] = (LLSD::Integer)getHoursAgo(); + data["show_folder_state"] = (LLSD::Integer)getShowFolderState(); + data["permissions"] = (LLSD::Integer)getFilterPermissions(); + data["substring"] = (LLSD::String)getFilterSubString(); + data["sort_order"] = (LLSD::Integer)getSortOrder(); +} + +void LLInventoryFilter::fromLLSD(LLSD& data) +{ + if(data.has("filter_types")) + setFilterTypes((U32)data["filter_types"].asInteger()); + + if(data.has("min_date") && data.has("max_date")) + setDateRange((U32)data["min_date"].asInteger(), (U32)data["max_date"].asInteger()); + + if(data.has("hours_ago")) + setHoursAgo((U32)data["hours_ago"].asInteger()); + + if(data.has("show_folder_state")) + setShowFolderState((EFolderShow)data["show_folder_state"].asInteger()); + + if(data.has("permissions")) + setFilterPermissions((PermissionMask)data["permissions"].asInteger()); + + if(data.has("substring")) + setFilterSubString(LLString(data["substring"].asString())); + + if(data.has("sort_order")) + setSortOrder((U32)data["sort_order"].asInteger()); +} diff --git a/indra/newview/llfolderview.h b/indra/newview/llfolderview.h index 248118dfdf..97071862de 100644 --- a/indra/newview/llfolderview.h +++ b/indra/newview/llfolderview.h @@ -216,6 +216,9 @@ public: //RN: this is public to allow system to externally force a global refilter void setModified(EFilterBehavior behavior = FILTER_RESTART); + void toLLSD(LLSD& data); + void fromLLSD(LLSD& data); + protected: struct filter_ops { @@ -839,6 +842,9 @@ public: static void idle(void* user_data); BOOL needsAutoSelect() { return mNeedsAutoSelect && !mAutoSelectOverride; } + BOOL needsAutoRename() { return mNeedsAutoRename; } + void setNeedsAutoRename(BOOL val) { mNeedsAutoRename = val; } + BOOL getDebugFilters() { return mDebugFilters; } // DEBUG only @@ -870,6 +876,7 @@ protected: LLCoordGL mLastScrollOffset; BOOL mNeedsAutoSelect; BOOL mAutoSelectOverride; + BOOL mNeedsAutoRename; BOOL mDebugFilters; U32 mSortOrder; diff --git a/indra/newview/llhudeffectlookat.cpp b/indra/newview/llhudeffectlookat.cpp index c95faed438..350a20607c 100644 --- a/indra/newview/llhudeffectlookat.cpp +++ b/indra/newview/llhudeffectlookat.cpp @@ -456,6 +456,7 @@ void LLHUDEffectLookAt::calcTargetPosition() { //sets the lookat point in front of the avatar mTargetOffsetGlobal.setVec(5.0, 0.0, 0.0); + local_offset.setVec(mTargetOffsetGlobal); } mTargetPos = avatarp->mHeadp->getWorldPosition(); diff --git a/indra/newview/llhudicon.cpp b/indra/newview/llhudicon.cpp index 02a3576dff..3beff41cd4 100644 --- a/indra/newview/llhudicon.cpp +++ b/indra/newview/llhudicon.cpp @@ -45,7 +45,8 @@ LLHUDIcon::LLHUDIcon(const U8 type) : LLHUDObject(type), mImagep(NULL), mPickID(0), - mScale(0.1f) + mScale(0.1f), + mHidden(FALSE) { sIconInstances.push_back(this); } @@ -61,6 +62,9 @@ void LLHUDIcon::renderIcon(BOOL for_select) LLGLDepthTest gls_depth(GL_TRUE); LLGLState no_texture(GL_TEXTURE_2D, for_select ? FALSE : TRUE); + if (mHidden) + return; + if (mSourceObject.isNull() || mImagep.isNull()) { markDead(); diff --git a/indra/newview/llhudicon.h b/indra/newview/llhudicon.h index 9835ff455b..c61e3951da 100644 --- a/indra/newview/llhudicon.h +++ b/indra/newview/llhudicon.h @@ -51,6 +51,9 @@ public: static BOOL iconsNearby(); + BOOL getHidden() const { return mHidden; } + void setHidden( BOOL hide ) { mHidden = hide; } + protected: LLHUDIcon(const U8 type); ~LLHUDIcon(); @@ -64,6 +67,7 @@ private: F32 mDistance; S32 mPickID; F32 mScale; + BOOL mHidden; typedef std::vector<LLPointer<LLHUDIcon> > icon_instance_t; static icon_instance_t sIconInstances; diff --git a/indra/newview/llhudtext.cpp b/indra/newview/llhudtext.cpp index bb261e6a96..aba3401d3c 100644 --- a/indra/newview/llhudtext.cpp +++ b/indra/newview/llhudtext.cpp @@ -73,7 +73,8 @@ LLHUDText::LLHUDText(const U8 type) : mOffsetY(0), mTextAlignment(ALIGN_TEXT_CENTER), mVertAlignment(ALIGN_VERT_CENTER), - mLOD(0) + mLOD(0), + mHidden(FALSE) { mColor = LLColor4(1.f, 1.f, 1.f, 1.f); mDoFade = TRUE; @@ -113,7 +114,7 @@ void LLHUDText::renderForSelect() void LLHUDText::renderText(BOOL for_select) { - if (!mVisible) + if (!mVisible || mHidden) { return; } diff --git a/indra/newview/llhudtext.h b/indra/newview/llhudtext.h index a2e328acd1..3e4474378b 100644 --- a/indra/newview/llhudtext.h +++ b/indra/newview/llhudtext.h @@ -95,8 +95,9 @@ public: void setUseBubble(BOOL use_bubble) { mUseBubble = use_bubble; } S32 getLOD() { return mLOD; } BOOL getVisible() { return mVisible; } + BOOL getHidden() const { return mHidden; } + void setHidden( BOOL hide ) { mHidden = hide; } void setOnHUDAttachment(BOOL on_hud) { mOnHUDAttachment = on_hud; } - static void renderAllHUD(); static void addPickable(std::set<LLViewerObject*> &pick_list); static void reshape(); @@ -144,6 +145,7 @@ private: ETextAlignment mTextAlignment; EVertAlignment mVertAlignment; S32 mLOD; + BOOL mHidden; static std::set<LLPointer<LLHUDText> > sTextObjects; static std::vector<LLPointer<LLHUDText> > sVisibleTextObjects; diff --git a/indra/newview/llimpanel.cpp b/indra/newview/llimpanel.cpp index a7c110fec4..b2278f2752 100644 --- a/indra/newview/llimpanel.cpp +++ b/indra/newview/llimpanel.cpp @@ -154,6 +154,8 @@ LLFloaterIMPanel::LLFloaterIMPanel(const std::string& name, mInputEditor(NULL), mHistoryEditor(NULL), mSessionUUID(session_id), + mSessionInitRequested(FALSE), + mSessionInitialized(FALSE), mOtherParticipantUUID(other_participant_id), mDialog(dialog), mTyping(FALSE), @@ -161,9 +163,7 @@ LLFloaterIMPanel::LLFloaterIMPanel(const std::string& name, mTypingLineStartIndex(0), mSentTypingState(TRUE), mFirstKeystrokeTimer(), - mLastKeystrokeTimer(), - mSessionInitialized(FALSE), - mSessionInitRequested(FALSE) + mLastKeystrokeTimer() { init(session_label); } @@ -179,6 +179,8 @@ LLFloaterIMPanel::LLFloaterIMPanel(const std::string& name, mInputEditor(NULL), mHistoryEditor(NULL), mSessionUUID(session_id), + mSessionInitRequested(FALSE), + mSessionInitialized(FALSE), mOtherParticipantUUID(other_participant_id), mDialog(dialog), mTyping(FALSE), @@ -186,9 +188,7 @@ LLFloaterIMPanel::LLFloaterIMPanel(const std::string& name, mTypingLineStartIndex(0), mSentTypingState(TRUE), mFirstKeystrokeTimer(), - mLastKeystrokeTimer(), - mSessionInitialized(FALSE), - mSessionInitRequested(FALSE) + mLastKeystrokeTimer() { mSessionInitialTargetIDs = ids; init(session_label); @@ -407,7 +407,11 @@ void LLFloaterIMPanel::addHistoryLine(const std::string &utf8msg, const LLColor4 if (log_to_file && gSavedPerAccountSettings.getBOOL("LogInstantMessages") ) { - LLString histstr = timestring + utf8msg; + LLString histstr; + if (gSavedPerAccountSettings.getBOOL("IMLogTimestamp")) + histstr = LLLogChat::timestamp(gSavedPerAccountSettings.getBOOL("LogTimestampDate")) + utf8msg; + else + histstr = utf8msg; LLLogChat::saveHistory(getTitle(),histstr); } diff --git a/indra/newview/lllogchat.cpp b/indra/newview/lllogchat.cpp index 2c26fede2d..5e77a2f7f9 100644 --- a/indra/newview/lllogchat.cpp +++ b/indra/newview/lllogchat.cpp @@ -9,18 +9,40 @@ #include "llviewerprecompiledheaders.h" #include "lllogchat.h" - +#include "viewer.h" + const S32 LOG_RECALL_SIZE = 2048; //static LLString LLLogChat::makeLogFileName(LLString filename) { - filename = gDirUtilp->getExpandedFilename(LL_PATH_PER_ACCOUNT_CHAT_LOGS,filename.c_str()); filename += ".txt"; return filename; } +LLString LLLogChat::timestamp(bool withdate) +{ + U32 utc_time; + utc_time = time_corrected(); + + // There's only one internal tm buffer. + struct tm* timep; + + // Convert to Pacific, based on server's opinion of whether + // it's daylight savings time there. + timep = utc_to_pacific_time(utc_time, gPacificDaylightTime); + + LLString text; + if (withdate) + text = llformat("[%d/%02d/%02d %d:%02d] ", (timep->tm_year-100)+2000, timep->tm_mon+1, timep->tm_mday, timep->tm_hour, timep->tm_min); + else + text = llformat("[%d:%02d] ", timep->tm_hour, timep->tm_min); + + return text; +} + + //static void LLLogChat::saveHistory(LLString filename, LLString line) { diff --git a/indra/newview/lllogchat.h b/indra/newview/lllogchat.h index ac2d710b64..a1bd6a247f 100644 --- a/indra/newview/lllogchat.h +++ b/indra/newview/lllogchat.h @@ -13,6 +13,7 @@ class LLLogChat { public: + static LLString timestamp(bool withdate = false); static LLString makeLogFileName(LLString(filename)); static void saveHistory(LLString filename, LLString line); static void loadHistory(LLString filename, void (*callback)(LLString,void*),void* userdata); diff --git a/indra/newview/llmanip.cpp b/indra/newview/llmanip.cpp index a9ddcd9f1c..4d646cba0c 100644 --- a/indra/newview/llmanip.cpp +++ b/indra/newview/llmanip.cpp @@ -540,7 +540,7 @@ void LLManip::renderTickValue(const LLVector3& pos, F32 value, const char* suffi LLGLEnable tex(GL_TEXTURE_2D); if (fractional_portion != 0) { - snprintf(fraction_string, sizeof(fraction_string), "%c%d%s", gResMgr->getDecimalPoint(), fractional_portion, suffix); /* Flawfinder: ignore */ + snprintf(fraction_string, sizeof(fraction_string), "%c%02d%s", gResMgr->getDecimalPoint(), fractional_portion, suffix); /* Flawfinder: ignore */ gViewerWindow->setupViewport(1, -1); hud_render_utf8text(val_string, render_pos, *big_fontp, LLFontGL::NORMAL, -1.f * big_fontp->getWidthF32(val_string), 3.f, shadow_color, hud_selection); diff --git a/indra/newview/llmaniprotate.cpp b/indra/newview/llmaniprotate.cpp index 5a52fc5b0a..416f5b6f6a 100644 --- a/indra/newview/llmaniprotate.cpp +++ b/indra/newview/llmaniprotate.cpp @@ -361,7 +361,7 @@ BOOL LLManipRotate::handleMouseDownOnPart( S32 x, S32 y, MASK mask ) objectp; objectp = mObjectSelection->getNextObject()) { - can_rotate = can_rotate && objectp->permMove() && (objectp->permModify() || gSavedSettings.getBOOL("SelectLinkedSet")); + can_rotate = can_rotate && objectp->permMove() && (objectp->permModify() || !gSavedSettings.getBOOL("EditLinkedParts")); } if (!can_rotate) diff --git a/indra/newview/llmanipscale.cpp b/indra/newview/llmanipscale.cpp index 14da426d9a..f975aa76ed 100644 --- a/indra/newview/llmanipscale.cpp +++ b/indra/newview/llmanipscale.cpp @@ -1202,7 +1202,7 @@ void LLManipScale::sendUpdates( BOOL send_position_update, BOOL send_scale_updat mLastUpdateFlags = update_flags; // enforce minimum update delay and don't stream updates on sub-object selections - if( elapsed_time > UPDATE_DELAY && gSavedSettings.getBOOL("SelectLinkedSet") ) + if( elapsed_time > UPDATE_DELAY && !gSavedSettings.getBOOL("EditLinkedParts") ) { gSelectMgr->sendMultipleUpdate( update_flags ); update_timer.reset(); diff --git a/indra/newview/llmaniptranslate.cpp b/indra/newview/llmaniptranslate.cpp index 6171971c16..bdb6380368 100644 --- a/indra/newview/llmaniptranslate.cpp +++ b/indra/newview/llmaniptranslate.cpp @@ -278,7 +278,7 @@ BOOL LLManipTranslate::handleMouseDownOnPart( S32 x, S32 y, MASK mask ) objectp; objectp = mObjectSelection->getNextObject()) { - can_move = can_move && objectp->permMove() && (objectp->permModify() || gSavedSettings.getBOOL("SelectLinkedSet")); + can_move = can_move && objectp->permMove() && (objectp->permModify() || !gSavedSettings.getBOOL("EditLinkedParts")); } if (!can_move) diff --git a/indra/newview/llmutelist.cpp b/indra/newview/llmutelist.cpp index 75be1be4a6..8b07dfbfeb 100644 --- a/indra/newview/llmutelist.cpp +++ b/indra/newview/llmutelist.cpp @@ -356,8 +356,10 @@ BOOL LLMuteList::loadFromFile(const LLString& filename) id_buffer[0] = '\0'; name_buffer[0] = '\0'; S32 type = 0; + U32 flags = 0; sscanf( /* Flawfinder: ignore */ - buffer, " %d %254s %254[^|]", &type, id_buffer, name_buffer); + buffer, " %d %254s %254[^|]| %u\n", &type, id_buffer, name_buffer, + &flags); LLUUID id = LLUUID(id_buffer); LLMute mute(id, name_buffer, (LLMute::EType)type); if (mute.mID.isNull() diff --git a/indra/newview/llpanelobject.cpp b/indra/newview/llpanelobject.cpp index ea18b2838f..f699027835 100644 --- a/indra/newview/llpanelobject.cpp +++ b/indra/newview/llpanelobject.cpp @@ -47,6 +47,7 @@ #include "pipeline.h" #include "viewer.h" #include "llvieweruictrlfactory.h" +#include "llfirstuse.h" #include "lldrawpool.h" @@ -236,32 +237,36 @@ BOOL LLPanelObject::postBuild() // Sculpt mCtrlSculptTexture = LLUICtrlFactory::getTexturePickerByName(this,"sculpt texture control"); - mCtrlSculptTexture->setDefaultImageAssetID(LLUUID(SCULPT_DEFAULT_TEXTURE)); - mCtrlSculptTexture->setCommitCallback( LLPanelObject::onCommitSculpt ); - mCtrlSculptTexture->setOnCancelCallback( LLPanelObject::onCancelSculpt ); - mCtrlSculptTexture->setOnSelectCallback( LLPanelObject::onSelectSculpt ); - mCtrlSculptTexture->setDropCallback(LLPanelObject::onDropSculpt); - mCtrlSculptTexture->setCallbackUserData( this ); - // Don't allow (no copy) or (no transfer) textures to be selected during immediate mode - mCtrlSculptTexture->setImmediateFilterPermMask(PERM_COPY | PERM_TRANSFER); - // Allow any texture to be used during non-immediate mode. - mCtrlSculptTexture->setNonImmediateFilterPermMask(PERM_NONE); - LLAggregatePermissions texture_perms; - if (gSelectMgr->selectGetAggregateTexturePermissions(texture_perms)) - { - BOOL can_copy = - texture_perms.getValue(PERM_COPY) == LLAggregatePermissions::AP_EMPTY || - texture_perms.getValue(PERM_COPY) == LLAggregatePermissions::AP_ALL; - BOOL can_transfer = - texture_perms.getValue(PERM_TRANSFER) == LLAggregatePermissions::AP_EMPTY || - texture_perms.getValue(PERM_TRANSFER) == LLAggregatePermissions::AP_ALL; - mCtrlSculptTexture->setCanApplyImmediately(can_copy && can_transfer); - } - else - { - mCtrlSculptTexture->setCanApplyImmediately(FALSE); + if (mCtrlSculptTexture) + { + mCtrlSculptTexture->setDefaultImageAssetID(LLUUID(SCULPT_DEFAULT_TEXTURE)); + mCtrlSculptTexture->setCommitCallback( LLPanelObject::onCommitSculpt ); + mCtrlSculptTexture->setOnCancelCallback( LLPanelObject::onCancelSculpt ); + mCtrlSculptTexture->setOnSelectCallback( LLPanelObject::onSelectSculpt ); + mCtrlSculptTexture->setDropCallback(LLPanelObject::onDropSculpt); + mCtrlSculptTexture->setCallbackUserData( this ); + // Don't allow (no copy) or (no transfer) textures to be selected during immediate mode + mCtrlSculptTexture->setImmediateFilterPermMask(PERM_COPY | PERM_TRANSFER); + // Allow any texture to be used during non-immediate mode. + mCtrlSculptTexture->setNonImmediateFilterPermMask(PERM_NONE); + LLAggregatePermissions texture_perms; + if (gSelectMgr->selectGetAggregateTexturePermissions(texture_perms)) + { + BOOL can_copy = + texture_perms.getValue(PERM_COPY) == LLAggregatePermissions::AP_EMPTY || + texture_perms.getValue(PERM_COPY) == LLAggregatePermissions::AP_ALL; + BOOL can_transfer = + texture_perms.getValue(PERM_TRANSFER) == LLAggregatePermissions::AP_EMPTY || + texture_perms.getValue(PERM_TRANSFER) == LLAggregatePermissions::AP_ALL; + mCtrlSculptTexture->setCanApplyImmediately(can_copy && can_transfer); + } + else + { + mCtrlSculptTexture->setCanApplyImmediately(FALSE); + } } + // Start with everyone disabled clearCtrls(); @@ -327,9 +332,9 @@ void LLPanelObject::getState( ) } // can move or rotate only linked group with move permissions, or sub-object with move and modify perms - BOOL enable_move = objectp->permMove() && !objectp->isAttachment() && (objectp->permModify() || gSavedSettings.getBOOL("SelectLinkedSet")); + BOOL enable_move = objectp->permMove() && !objectp->isAttachment() && (objectp->permModify() || !gSavedSettings.getBOOL("EditLinkedParts")); BOOL enable_scale = objectp->permMove() && objectp->permModify(); - BOOL enable_rotate = objectp->permMove() && ( (objectp->permModify() && !objectp->isAttachment()) || gSavedSettings.getBOOL("SelectLinkedSet")); + BOOL enable_rotate = objectp->permMove() && ( (objectp->permModify() && !objectp->isAttachment()) || !gSavedSettings.getBOOL("EditLinkedParts")); LLVector3 vec; if (enable_move) @@ -618,6 +623,7 @@ void LLPanelObject::getState( ) if (objectp->getParameterEntryInUse(LLNetworkData::PARAMS_SCULPT)) { selected_item = MI_SCULPT; + LLFirstUse::useSculptedPrim(); } @@ -1024,7 +1030,11 @@ void LLPanelObject::getState( ) { mTextureCtrl->setTentative(FALSE); mTextureCtrl->setEnabled(editable); - mTextureCtrl->setImageAssetID(sculpt_params->getSculptTexture()); + if (editable) + mTextureCtrl->setImageAssetID(sculpt_params->getSculptTexture()); + else + mTextureCtrl->setImageAssetID(LLUUID::null); + if (mObject != objectp) // we've just selected a new object, so save for undo mSculptTextureRevert = sculpt_params->getSculptTexture(); diff --git a/indra/newview/llpolymesh.h b/indra/newview/llpolymesh.h index 2874f11798..577f5c7dfb 100644 --- a/indra/newview/llpolymesh.h +++ b/indra/newview/llpolymesh.h @@ -340,7 +340,7 @@ protected: typedef LLAssocList<std::string, LLPolyMeshSharedData*> LLPolyMeshSharedDataTable; static LLPolyMeshSharedDataTable sGlobalSharedMeshList; - LLVOAvatar* mAvatarp; + LLPointer<LLVOAvatar> mAvatarp; }; //----------------------------------------------------------------------------- @@ -406,7 +406,7 @@ protected: joint_vec_map_t mJointScales; joint_vec_map_t mJointOffsets; LLVector3 mDefaultVec; - LLVOAvatar* mAvatar; + LLPointer<LLVOAvatar> mAvatar; }; #endif // LL_LLPOLYMESH_H diff --git a/indra/newview/llselectmgr.cpp b/indra/newview/llselectmgr.cpp index 6698ee7505..274da6d3d1 100644 --- a/indra/newview/llselectmgr.cpp +++ b/indra/newview/llselectmgr.cpp @@ -375,9 +375,9 @@ LLObjectSelectionHandle LLSelectMgr::selectObjectAndFamily(LLViewerObject* obj, root->resetRot(); // leave component mode - if (!gSavedSettings.getBOOL("SelectLinkedSet")) + if (gSavedSettings.getBOOL("EditLinkedParts")) { - gSavedSettings.setBOOL("SelectLinkedSet", TRUE); + gSavedSettings.setBOOL("EditLinkedParts", FALSE); promoteSelectionToRoot(); } @@ -443,9 +443,9 @@ LLObjectSelectionHandle LLSelectMgr::selectObjectAndFamily(const LLDynamicArray< } // leave component mode - if (!gSavedSettings.getBOOL("SelectLinkedSet")) + if (gSavedSettings.getBOOL("EditLinkedParts")) { - gSavedSettings.setBOOL("SelectLinkedSet", TRUE); + gSavedSettings.setBOOL("EditLinkedParts", FALSE); promoteSelectionToRoot(); } @@ -928,7 +928,7 @@ LLObjectSelectionHandle LLSelectMgr::selectHighlightedObjects() void LLSelectMgr::deselectHighlightedObjects() { - BOOL select_linked_set = gSavedSettings.getBOOL("SelectLinkedSet"); + BOOL select_linked_set = !gSavedSettings.getBOOL("EditLinkedParts"); for (std::set<LLPointer<LLViewerObject> >::iterator iter = mRectSelectedObjects.begin(); iter != mRectSelectedObjects.end(); iter++) { @@ -3229,7 +3229,7 @@ void LLSelectMgr::sendMultipleUpdate(U32 type) { if (type == UPD_NONE) return; // send individual updates when selecting textures or individual objects - ESendType send_type = (gSavedSettings.getBOOL("SelectLinkedSet") && !getTEMode()) ? SEND_ONLY_ROOTS : SEND_ROOTS_FIRST; + ESendType send_type = (!gSavedSettings.getBOOL("EditLinkedParts") && !getTEMode()) ? SEND_ONLY_ROOTS : SEND_ROOTS_FIRST; if (send_type == SEND_ONLY_ROOTS) { // tell simulator to apply to whole linked sets @@ -4486,7 +4486,7 @@ void LLSelectMgr::processObjectPropertiesFamily(LLMessageSystem* msg, void** use LLString fullname(first_name); fullname.append(" "); fullname.append(last_name); - reporterp->setPickedObjectProperties(name, fullname.c_str()); + reporterp->setPickedObjectProperties(name, fullname.c_str(), owner_id); } } @@ -4649,7 +4649,7 @@ void LLSelectMgr::updateSilhouettes() // persists from frame to frame to avoid regenerating object silhouettes // mHighlightedObjects includes all siblings of rect selected objects - BOOL select_linked_set = gSavedSettings.getBOOL("SelectLinkedSet"); + BOOL select_linked_set = !gSavedSettings.getBOOL("EditLinkedParts"); // generate list of roots from current object selection for (std::set<LLPointer<LLViewerObject> >::iterator iter = mRectSelectedObjects.begin(); @@ -5599,7 +5599,7 @@ BOOL LLSelectMgr::canUndo() //----------------------------------------------------------------------------- void LLSelectMgr::undo() { - BOOL select_linked_set = gSavedSettings.getBOOL("SelectLinkedSet"); + BOOL select_linked_set = !gSavedSettings.getBOOL("EditLinkedParts"); LLUUID group_id(gAgent.getGroupID()); sendListToRegions("Undo", packAgentAndSessionAndGroupID, packObjectID, &group_id, select_linked_set ? SEND_ONLY_ROOTS : SEND_CHILDREN_FIRST); } @@ -5617,7 +5617,7 @@ BOOL LLSelectMgr::canRedo() //----------------------------------------------------------------------------- void LLSelectMgr::redo() { - BOOL select_linked_set = gSavedSettings.getBOOL("SelectLinkedSet"); + BOOL select_linked_set = !gSavedSettings.getBOOL("EditLinkedParts"); LLUUID group_id(gAgent.getGroupID()); sendListToRegions("Redo", packAgentAndSessionAndGroupID, packObjectID, &group_id, select_linked_set ? SEND_ONLY_ROOTS : SEND_CHILDREN_FIRST); } @@ -5794,7 +5794,7 @@ void LLObjectSelection::deleteAllNodes() LLSelectNode* LLObjectSelection::findNode(LLViewerObject* objectp) { - std::map<LLViewerObject*, LLSelectNode*>::iterator found_it = mSelectNodeMap.find(objectp); + std::map<LLPointer<LLViewerObject>, LLSelectNode*>::iterator found_it = mSelectNodeMap.find(objectp); if (found_it != mSelectNodeMap.end()) { return found_it->second; diff --git a/indra/newview/llselectmgr.h b/indra/newview/llselectmgr.h index 65f58da1cc..33c8371cb7 100644 --- a/indra/newview/llselectmgr.h +++ b/indra/newview/llselectmgr.h @@ -168,7 +168,7 @@ private: LLPointer<LLViewerObject> mPrimaryObject; std::list<LLSelectNode*>::iterator mCurrentNode; S32 mCurrentTE; - std::map<LLViewerObject*, LLSelectNode*> mSelectNodeMap; + std::map<LLPointer<LLViewerObject>, LLSelectNode*> mSelectNodeMap; ESelectType mSelectType; }; diff --git a/indra/newview/llspatialpartition.cpp b/indra/newview/llspatialpartition.cpp index 43417d0006..039124c6fd 100644 --- a/indra/newview/llspatialpartition.cpp +++ b/indra/newview/llspatialpartition.cpp @@ -1504,7 +1504,7 @@ public: for (LLSpatialGroup::element_iter i = group->getData().begin(); i != group->getData().end(); ++i) { LLDrawable* drawable = *i; - if (drawable->getVObj() && !group->mSpatialPartition->mRenderByGroup) + if (drawable->getVObj().notNull() && !group->mSpatialPartition->mRenderByGroup) { gPipeline.markRebuild(drawable, LLDrawable::REBUILD_ALL, TRUE); } diff --git a/indra/newview/llsrv.cpp b/indra/newview/llsrv.cpp new file mode 100644 index 0000000000..cd05d9c107 --- /dev/null +++ b/indra/newview/llsrv.cpp @@ -0,0 +1,193 @@ +/** + * @file llsrv.cpp + * @brief Wrapper for DNS SRV record lookups + * + * Copyright (c) 2007-$CurrentYear$, Linden Research, Inc. + * $License$ + */ + +#include "llviewerprecompiledheaders.h" + +#include "llsrv.h" + +using namespace std; + +#if LL_WINDOWS + +#undef UNICODE +#include <winsock2.h> +#include <windns.h> + +vector<LLSRVRecord> LLSRV::query(const string& name) +{ + vector<LLSRVRecord> recs; + DNS_RECORD *rec; + DNS_STATUS status; + + status = DnsQuery(name.c_str(), DNS_TYPE_SRV, DNS_QUERY_STANDARD, NULL, &rec, NULL); + if (!status) + { + for (DNS_RECORD *cur = rec; cur != NULL; cur = cur->pNext) + { + if (cur->wType != DNS_TYPE_SRV) + { + continue; + } + recs.push_back(LLSRVRecord(cur->Data.Srv.wPriority, + cur->Data.Srv.wWeight, + cur->Data.Srv.pNameTarget, + cur->Data.Srv.wPort)); + } + DnsRecordListFree(rec, DnsFreeRecordListDeep); + } + + return recs; +} + +#else // !LL_WINDOWS + +#include <netinet/in.h> +#include <arpa/nameser.h> +#include <arpa/nameser_compat.h> +#include <resolv.h> + +#include <netdb.h> + +vector<LLSRVRecord> LLSRV::query(const string& queryName) +{ + unsigned char response[16384]; + vector<LLSRVRecord> recs; + char name[1024]; + int len; + + len = res_query(queryName.c_str(), ns_c_in, ns_t_srv, response, + sizeof(response)); + + if (len == -1) + { + llinfos << "Query failed for " << queryName << llendl; + return recs; + } + else if (len > (int) sizeof(response)) + { + llinfos << "Response too big for " << queryName + << " (capacity " << sizeof(response) + << ", response " << len << ")" << llendl; + return recs; + } + + // We "should" be using libresolv's ns_initparse and ns_parserr to + // parse the result of our query. However, libresolv isn't + // packaged correctly on Linux (as of BIND 9), so neither of these + // functions is available without statically linking against + // libresolv. Ugh! So we parse the response ourselves. + + const unsigned char *pos = response + sizeof(HEADER); + const unsigned char *end = response + len; + const HEADER *hdr = (const HEADER *) response; + + // Skip over the query embedded in the response. + + for (int q = ntohs(hdr->qdcount); q > 0; --q) + { + len = dn_expand(response, end, pos, name, sizeof(name)); + + if (len == -1) + { + llinfos << "Could not expand queried name in RR response" << llendl; + return recs; + } + + pos += len + NS_QFIXEDSZ; + } + + for (int a = ntohs(hdr->ancount); a > 0; --a) + { + static const ns_rr *rr; + + len = dn_expand(response, end, pos, name, sizeof(name) - 1); + if (len == -1) + { + llinfos << "Could not expand response name in RR response" << llendl; + return recs; + } + + // Skip over the resource name and headers we don't care about. + + pos += len + sizeof(rr->type) + sizeof(rr->rr_class) + + sizeof(rr->ttl) + sizeof(rr->rdlength); + + U16 prio; + U16 weight; + U16 port; + + NS_GET16(prio, pos); + NS_GET16(weight, pos); + NS_GET16(port, pos); + + len = dn_expand(response, end, pos, name, sizeof(name) - 1); + + if (len == -1) + { + llinfos << "Could not expand name in RR response" << llendl; + return recs; + } + + recs.push_back(LLSRVRecord(prio, weight, name, port)); + } + + // There are likely to be more records in the response, but we + // don't care about those, at least for now. + + return recs; +} + +#endif // LL_WINDOWS + +vector<string> LLSRV::rewriteURI(const string& uriStr) +{ + LLURI uri(uriStr); + const string& scheme = uri.scheme(); + llinfos << "Rewriting " << uriStr << llendl; + string serviceName("_" + scheme + "._tcp." + uri.hostName()); + llinfos << "Querying for " << serviceName << llendl; + vector<LLSRVRecord> srvs(LLSRV::query(serviceName)); + vector<string> rewritten; + + if (srvs.empty()) + { + llinfos << "No query results; using " << uriStr << llendl; + rewritten.push_back(uriStr); + } + else + { + vector<LLSRVRecord>::const_iterator iter; + size_t maxSrvs = 3; + size_t i; + + llinfos << "Got " << srvs.size() << " results" << llendl; + if (srvs.size() > maxSrvs) + { + llinfos << "Clamping to " << maxSrvs << llendl; + } + + for (iter = srvs.begin(), i = 0; + iter != srvs.end() && i < maxSrvs; ++iter, ++i) + { + LLURI newUri(scheme, + uri.userName(), + uri.password(), + iter->target(), + uri.defaultPort() ? iter->port() : uri.hostPort(), + uri.escapedPath(), + uri.escapedQuery()); + string newUriStr(newUri.asString()); + + llinfos << "Rewrite[" << i << "] " << newUriStr << llendl; + + rewritten.push_back(newUriStr); + } + } + + return rewritten; +} diff --git a/indra/newview/llsrv.h b/indra/newview/llsrv.h new file mode 100644 index 0000000000..14a64e639e --- /dev/null +++ b/indra/newview/llsrv.h @@ -0,0 +1,46 @@ +/** + * @file llsrv.h + * @brief Wrapper for DNS SRV record lookups + * + * Copyright (c) 2007-$CurrentYear$, Linden Research, Inc. + * $License$ + */ + +#ifndef LL_LLSRV_H +#define LL_LLSRV_H + +class LLSRV; + +class LLSRVRecord +{ + friend class LLSRV; + +protected: + U16 mPriority; + U16 mWeight; + std::string mTarget; + U16 mPort; + + LLSRVRecord(U16 priority, U16 weight, const std::string& target, + U16 port) : + mPriority(priority), + mWeight(weight), + mTarget(target), + mPort(port) { + } + +public: + U16 priority() const { return mPriority; } + U16 weight() const { return mWeight; } + const std::string& target() const { return mTarget; } + U16 port() const { return mPort; } +}; + +class LLSRV +{ +public: + static std::vector<LLSRVRecord> query(const std::string& name); + static std::vector<std::string> rewriteURI(const std::string& uri); +}; + +#endif // LL_LLSRV_H diff --git a/indra/newview/llstartup.cpp b/indra/newview/llstartup.cpp index f2d0d594f8..cce0d17e96 100644 --- a/indra/newview/llstartup.cpp +++ b/indra/newview/llstartup.cpp @@ -97,6 +97,7 @@ #include "llpreviewscript.h" #include "llselectmgr.h" #include "llsky.h" +#include "llsrv.h" #include "llstatview.h" #include "llsurface.h" #include "lltexturecache.h" @@ -265,7 +266,8 @@ BOOL idle_startup() // auth/transform loop will do. static F32 progress = 0.10f; - static std::string auth_uri; + static std::vector<std::string> auth_uris; + static int auth_uri_num = -1; static std::string auth_method; static std::string auth_desc; static std::string auth_message; @@ -1089,7 +1091,11 @@ BOOL idle_startup() gSavedSettings.setBOOL("UseDebugMenus", TRUE); requested_options.push_back("god-connect"); } - auth_uri = getLoginURI(); + if (auth_uris.empty()) + { + auth_uris = getLoginURIs(); + } + auth_uri_num = 0; auth_method = "login_to_simulator"; auth_desc = "Logging in. "; auth_desc += gSecondLife; @@ -1132,7 +1138,7 @@ BOOL idle_startup() hashed_mac.hex_digest(hashed_mac_string); gUserAuthp->authenticate( - auth_uri.c_str(), + auth_uris[auth_uri_num].c_str(), auth_method.c_str(), firstname.c_str(), lastname.c_str(), @@ -1228,7 +1234,8 @@ BOOL idle_startup() else if(login_response && (0 == strcmp(login_response, "indeterminate"))) { llinfos << "Indeterminate login..." << llendl; - auth_uri = gUserAuthp->getResponse("next_url"); + auth_uris = LLSRV::rewriteURI(gUserAuthp->getResponse("next_url")); + auth_uri_num = 0; auth_method = gUserAuthp->getResponse("next_method"); auth_message = gUserAuthp->getResponse("message"); if(auth_method.substr(0, 5) == "login") @@ -1331,13 +1338,33 @@ BOOL idle_startup() case LLUserAuth::E_SSL_PEER_CERTIFICATE: case LLUserAuth::E_UNHANDLED_ERROR: default: - emsg << "Unable to connect to " << gSecondLife << ".\n"; - emsg << gUserAuthp->errorMessage(); + if (auth_uri_num >= (int) auth_uris.size()) + { + emsg << "Unable to connect to " << gSecondLife << ".\n"; + emsg << gUserAuthp->errorMessage(); + } else { + std::ostringstream s; + s << "Logging in (attempt " << (auth_uri_num + 1) << "). "; + auth_desc = s.str(); + gStartupState = STATE_LOGIN_AUTHENTICATE; + auth_uri_num++; + return do_normal_idle; + } break; case LLUserAuth::E_SSL_CACERT: case LLUserAuth::E_SSL_CONNECT_ERROR: - emsg << "Unable to establish a secure connection to the login server.\n"; - emsg << gUserAuthp->errorMessage(); + if (auth_uri_num >= (int) auth_uris.size()) + { + emsg << "Unable to establish a secure connection to the login server.\n"; + emsg << gUserAuthp->errorMessage(); + } else { + std::ostringstream s; + s << "Logging in (attempt " << (auth_uri_num + 1) << "). "; + auth_desc = s.str(); + gStartupState = STATE_LOGIN_AUTHENTICATE; + auth_uri_num++; + return do_normal_idle; + } break; } diff --git a/indra/newview/lltexlayer.cpp b/indra/newview/lltexlayer.cpp index 178c83f61e..11a95d4837 100644 --- a/indra/newview/lltexlayer.cpp +++ b/indra/newview/lltexlayer.cpp @@ -2294,7 +2294,7 @@ LLColor4 LLTexParamColor::getNetColor() { llassert( getInfo()->mNumColors >= 1 ); - F32 effective_weight = ( mAvatar && (mAvatar->getSex() & getSex()) ) ? mCurWeight : getDefaultWeight(); + F32 effective_weight = ( mAvatar.notNull() && (mAvatar->getSex() & getSex()) ) ? mCurWeight : getDefaultWeight(); S32 index_last = getInfo()->mNumColors - 1; F32 scaled_weight = effective_weight * index_last; diff --git a/indra/newview/lltexlayer.h b/indra/newview/lltexlayer.h index bda865eb2e..1dd0f0b657 100644 --- a/indra/newview/lltexlayer.h +++ b/indra/newview/lltexlayer.h @@ -266,7 +266,7 @@ protected: typedef std::vector<LLTexLayer *> layer_list_t; layer_list_t mLayerList; LLTexLayerSetBuffer* mComposite; - LLVOAvatar* mAvatar; + LLPointer<LLVOAvatar> mAvatar; BOOL mUpdatesEnabled; BOOL mHasBump; @@ -423,7 +423,7 @@ public: protected: typedef std::vector<LLTexParamColor *> param_list_t; param_list_t mParamList; - LLVOAvatar* mAvatar; + LLPointer<LLVOAvatar> mAvatar; LLTexGlobalColorInfo *mInfo; }; @@ -469,7 +469,7 @@ protected: LLVector3 mAvgDistortionVec; LLTexGlobalColor* mTexGlobalColor; // either has mTexGlobalColor or mTexLayer as its parent LLTexLayer* mTexLayer; - LLVOAvatar* mAvatar; // redundant, but simplifies the code + LLPointer<LLVOAvatar> mAvatar; // redundant, but simplifies the code }; //----------------------------------------------------------------------------- @@ -549,7 +549,7 @@ public: ~LLBakedUploadData() {} LLUUID mID; - LLVOAvatar* mAvatar; + LLPointer<LLVOAvatar> mAvatar; LLTexLayerSetBuffer* mLayerSetBuffer; LLUUID mWearableAssets[WT_COUNT]; }; diff --git a/indra/newview/lltexturecache.cpp b/indra/newview/lltexturecache.cpp index 1a3fe79551..11034798a0 100644 --- a/indra/newview/lltexturecache.cpp +++ b/indra/newview/lltexturecache.cpp @@ -1,5 +1,5 @@ /** - * @file texturecache.cpp + * @file lltexturecache.cpp * @brief Object which handles local texture caching * * Copyright (c) 2000-$CurrentYear$, Linden Research, Inc. @@ -1264,6 +1264,7 @@ LLTextureCache::handle_t LLTextureCache::writeToCache(const LLUUID& id, U32 prio { if (mReadOnly) { + delete responder; return LLWorkerThread::nullHandle(); } if (mDoPurge) @@ -1285,6 +1286,7 @@ LLTextureCache::handle_t LLTextureCache::writeToCache(const LLUUID& id, U32 prio mWriters[handle] = worker; return handle; } + delete responder; return LLWorkerThread::nullHandle(); } diff --git a/indra/newview/lltexturectrl.cpp b/indra/newview/lltexturectrl.cpp index 958635c796..4ac08f2a81 100644 --- a/indra/newview/lltexturectrl.cpp +++ b/indra/newview/lltexturectrl.cpp @@ -99,7 +99,8 @@ public: // LLFloater overrides virtual void onClose(bool app_quitting); - + virtual BOOL postBuild(); + // New functions void setImageID( const LLUUID& image_asset_id); void updateImageStats(); @@ -143,6 +144,8 @@ protected: LLUUID mSpecialCurrentImageAssetID; // Used when the asset id has no corresponding texture in the user's inventory. LLUUID mOriginalImageAssetID; + std::string mLabel; + LLTextBox* mTentativeLabel; LLTextBox* mResolutionLabel; @@ -177,6 +180,7 @@ LLFloaterTexturePicker::LLFloaterTexturePicker( mImageAssetID( owner->getImageAssetID() ), mWhiteImageAssetID( gSavedSettings.getString( "UIImgWhiteUUID" ) ), mOriginalImageAssetID(owner->getImageAssetID()), + mLabel(label), mTentativeLabel(NULL), mResolutionLabel(NULL), mIsDirty( FALSE ), @@ -436,6 +440,21 @@ void LLFloaterTexturePicker::onClose(bool app_quitting) } // virtual +BOOL LLFloaterTexturePicker::postBuild() +{ + LLFloater::postBuild(); + + if (!mLabel.empty()) + { + std::string pick = childGetText("pick title"); + + setTitle(pick + mLabel); + } + + return TRUE; +} + +// virtual void LLFloaterTexturePicker::draw() { if (mOwner) diff --git a/indra/newview/lltexturefetch.cpp b/indra/newview/lltexturefetch.cpp index ce5649e06e..8d9d2b88a5 100644 --- a/indra/newview/lltexturefetch.cpp +++ b/indra/newview/lltexturefetch.cpp @@ -1,5 +1,5 @@ /** - * @file lltexturecache.cpp + * @file lltexturefetch.cpp * @brief Object which fetches textures from the cache and/or network * * Copyright (c) 2000-$CurrentYear$, Linden Research, Inc. diff --git a/indra/newview/lltoolcomp.cpp b/indra/newview/lltoolcomp.cpp index f3b253a4e5..353862dd54 100644 --- a/indra/newview/lltoolcomp.cpp +++ b/indra/newview/lltoolcomp.cpp @@ -101,7 +101,7 @@ BOOL LLToolComposite::isSelecting() void LLToolComposite::handleSelect() { - if (gSavedSettings.getBOOL("SelectLinkedSet")) + if (!gSavedSettings.getBOOL("EditLinkedParts")) { gSelectMgr->promoteSelectionToRoot(); } @@ -142,7 +142,7 @@ void LLToolCompInspect::pickCallback(S32 x, S32 y, MASK mask) if (!gToolInspect->mMouseDown) { // fast click on object, but mouse is already up...just do select - gToolInspect->mSelectRect->handleObjectSelection(hit_obj, mask, !gSavedSettings.getBOOL("SelectLinkedSet"), FALSE); + gToolInspect->mSelectRect->handleObjectSelection(hit_obj, mask, gSavedSettings.getBOOL("EditLinkedParts"), FALSE); return; } @@ -216,7 +216,7 @@ void LLToolCompTranslate::pickCallback(S32 x, S32 y, MASK mask) if (!gToolTranslate->mMouseDown) { // fast click on object, but mouse is already up...just do select - gToolTranslate->mSelectRect->handleObjectSelection(hit_obj, mask, !gSavedSettings.getBOOL("SelectLinkedSet"), FALSE); + gToolTranslate->mSelectRect->handleObjectSelection(hit_obj, mask, gSavedSettings.getBOOL("EditLinkedParts"), FALSE); return; } @@ -230,7 +230,7 @@ void LLToolCompTranslate::pickCallback(S32 x, S32 y, MASK mask) 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("SelectLinkedSet")); + can_move = can_move && objectp->permMove() && (objectp->permModify() || !gSavedSettings.getBOOL("EditLinkedParts")); } if( LLManip::LL_NO_PART != gToolTranslate->mManip->getHighlightedPart() && can_move) @@ -344,7 +344,7 @@ void LLToolCompScale::pickCallback(S32 x, S32 y, MASK mask) if (!gToolStretch->mMouseDown) { // fast click on object, but mouse is already up...just do select - gToolStretch->mSelectRect->handleObjectSelection(hit_obj, mask, !gSavedSettings.getBOOL("SelectLinkedSet"), FALSE); + gToolStretch->mSelectRect->handleObjectSelection(hit_obj, mask, gSavedSettings.getBOOL("EditLinkedParts"), FALSE); return; } @@ -545,7 +545,7 @@ void LLToolCompRotate::pickCallback(S32 x, S32 y, MASK mask) if (!gToolRotate->mMouseDown) { // fast click on object, but mouse is already up...just do select - gToolRotate->mSelectRect->handleObjectSelection(hit_obj, mask, !gSavedSettings.getBOOL("SelectLinkedSet"), FALSE); + gToolRotate->mSelectRect->handleObjectSelection(hit_obj, mask, gSavedSettings.getBOOL("EditLinkedParts"), FALSE); return; } diff --git a/indra/newview/lltoolpie.cpp b/indra/newview/lltoolpie.cpp index 68eec329aa..5b17848a4c 100644 --- a/indra/newview/lltoolpie.cpp +++ b/indra/newview/lltoolpie.cpp @@ -42,7 +42,7 @@ LLToolPie *gToolPie = NULL; -LLViewerObject* LLToolPie::sClickActionObject = NULL; +LLPointer<LLViewerObject> LLToolPie::sClickActionObject; LLHandle<LLObjectSelection> LLToolPie::sLeftClickSelection = NULL; U8 LLToolPie::sClickAction = 0; diff --git a/indra/newview/lltoolpie.h b/indra/newview/lltoolpie.h index 6c3a200dbc..e19cd749f4 100644 --- a/indra/newview/lltoolpie.h +++ b/indra/newview/lltoolpie.h @@ -53,7 +53,7 @@ protected: BOOL mHitLand; LLUUID mHitObjectID; BOOL mMouseOutsideSlop; // for this drag, has mouse moved outside slop region - static LLViewerObject* sClickActionObject; + static LLPointer<LLViewerObject> sClickActionObject; static U8 sClickAction; static LLHandle<LLObjectSelection> sLeftClickSelection; }; diff --git a/indra/newview/lltoolselect.cpp b/indra/newview/lltoolselect.cpp index 1223bc5104..475fc4a0d1 100644 --- a/indra/newview/lltoolselect.cpp +++ b/indra/newview/lltoolselect.cpp @@ -209,7 +209,7 @@ LLHandle<LLObjectSelection> LLToolSelect::handleObjectSelection(LLViewerObject * BOOL LLToolSelect::handleMouseUp(S32 x, S32 y, MASK mask) { - mIgnoreGroup = !gSavedSettings.getBOOL("SelectLinkedSet"); + mIgnoreGroup = gSavedSettings.getBOOL("EditLinkedParts"); LLViewerObject* object = gObjectList.findObject(mSelectObjectID); LLToolSelect::handleObjectSelection(object, mask, mIgnoreGroup, FALSE); diff --git a/indra/newview/llviewerinventory.cpp b/indra/newview/llviewerinventory.cpp index cc31aaef67..959af911b7 100644 --- a/indra/newview/llviewerinventory.cpp +++ b/indra/newview/llviewerinventory.cpp @@ -551,7 +551,7 @@ U32 LLInventoryCallbackManager::registerCB(LLPointer<LLInventoryCallback> cb) void LLInventoryCallbackManager::fire(U32 callback_id, const LLUUID& item_id) { - if (!callback_id) + if (!callback_id || item_id.isNull()) return; std::map<U32, LLPointer<LLInventoryCallback> >::iterator i; diff --git a/indra/newview/llviewerjointattachment.h b/indra/newview/llviewerjointattachment.h index e0354a8c10..d52d522b59 100644 --- a/indra/newview/llviewerjointattachment.h +++ b/indra/newview/llviewerjointattachment.h @@ -59,7 +59,7 @@ public: S32 getGroup() { return mGroup; } S32 getPieSlice() { return mPieSlice; } - BOOL getAttachmentDirty() { return mAttachmentDirty && mAttachedObject; } + BOOL getAttachmentDirty() { return mAttachmentDirty && mAttachedObject.notNull(); } LLViewerObject *getObject() { return mAttachedObject; } S32 getNumObjects() { return (mAttachedObject ? 1 : 0); } const LLUUID& getItemID() { return mItemID; } @@ -79,7 +79,7 @@ protected: protected: LLJoint* mJoint; - LLViewerObject* mAttachedObject; + LLPointer<LLViewerObject> mAttachedObject; BOOL mAttachmentDirty; // does attachment drawable need to be fixed up? BOOL mVisibleInFirst; LLVector3 mOriginalPos; diff --git a/indra/newview/llviewerkeyboard.cpp b/indra/newview/llviewerkeyboard.cpp index 17c9a1fc10..8129e41727 100644 --- a/indra/newview/llviewerkeyboard.cpp +++ b/indra/newview/llviewerkeyboard.cpp @@ -101,11 +101,7 @@ void agent_slide_left( EKeystate s ) if( time < NUDGE_TIME || frame_count <= NUDGE_FRAMES) { - if (frame_count == 0) - { - // only send nudge on first frame - gAgent.moveLeftNudge(1); - } + gAgent.moveLeftNudge(1); } else { @@ -122,11 +118,7 @@ void agent_slide_right( EKeystate s ) if( time < NUDGE_TIME || frame_count <= NUDGE_FRAMES) { - if (frame_count == 0) - { - // only send nudge on first frame - gAgent.moveLeftNudge(-1); - } + gAgent.moveLeftNudge(-1); } else { diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp index 9aaac2af66..d18859e356 100644 --- a/indra/newview/llviewermenu.cpp +++ b/indra/newview/llviewermenu.cpp @@ -224,7 +224,7 @@ const LLString SAVE_INTO_TASK_INVENTORY("Save Object Back to Object Contents"); #if LL_WINDOWS static const char* SOUND_EXTENSIONS = ".wav"; -static const char* IMAGE_EXTENSIONS = ".tga .bmp .jpg .jpeg"; +static const char* IMAGE_EXTENSIONS = ".tga .bmp .jpg .jpeg .png"; static const char* ANIM_EXTENSIONS = ".bvh"; #ifdef _CORY_TESTING static const char* GEOMETRY_EXTENSIONS = ".slg"; @@ -1239,7 +1239,7 @@ void init_debug_avatar_menu(LLMenuGL* menu) sub_menu = new LLMenuGL("Character Tests"); sub_menu->append(new LLMenuItemToggleGL("Go Away/AFK When Idle", - &gAllowAFK)); + &gAllowIdleAFK)); sub_menu->append(new LLMenuItemCallGL("Appearance To XML", &LLVOAvatar::dumpArchetypeXML)); @@ -4130,7 +4130,7 @@ class LLToolsBuyOrTake : public view_listener_t { S32 total_price = selection_price(); - if (total_price <= gStatusBar->getBalance()) + if (total_price <= gStatusBar->getBalance() || total_price == 0) { handle_buy(NULL); } @@ -4422,7 +4422,7 @@ class LLToolsEnableLink : public view_listener_t // user can modify at least one of the selected objects. // in component mode, can't link - if (gSavedSettings.getBOOL("SelectLinkedSet")) + if (!gSavedSettings.getBOOL("EditLinkedParts")) { if(gSelectMgr->selectGetAllRootsValid() && gSelectMgr->getSelection()->getRootObjectCount() >= 2) { @@ -4822,6 +4822,12 @@ void show_debug_menus() if ( gMenuBarView ) { BOOL debug = gSavedSettings.getBOOL("UseDebugMenus"); + + if(debug) + { + LLFirstUse::useDebugMenus(); + } + gMenuBarView->setItemVisible(CLIENT_MENU_NAME, debug); gMenuBarView->setItemEnabled(CLIENT_MENU_NAME, debug); gMenuBarView->setItemVisible(SERVER_MENU_NAME, debug); @@ -6907,6 +6913,23 @@ class LLToolsShowSelectionLightRadius : public view_listener_t } }; +class LLToolsEditLinkedParts : public view_listener_t +{ + bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata) + { + BOOL select_individuals = gSavedSettings.getBOOL("EditLinkedParts"); + if (select_individuals) + { + gSelectMgr->demoteSelectionToIndividuals(); + } + else + { + gSelectMgr->promoteSelectionToRoot(); + } + return true; + } +}; + void reload_personal_settings_overrides(void *) { llinfos << "Loading overrides from " << gDirUtilp->getExpandedFilename(LL_PATH_PER_SL_ACCOUNT,"overrides.xml") << llendl; @@ -7600,6 +7623,7 @@ void initialize_menus() addMenu(new LLToolsSelectBySurrounding(), "Tools.SelectBySurrounding"); addMenu(new LLToolsShowHiddenSelection(), "Tools.ShowHiddenSelection"); addMenu(new LLToolsShowSelectionLightRadius(), "Tools.ShowSelectionLightRadius"); + addMenu(new LLToolsEditLinkedParts(), "Tools.EditLinkedParts"); addMenu(new LLToolsSnapObjectXY(), "Tools.SnapObjectXY"); addMenu(new LLToolsUseSelectionForGrid(), "Tools.UseSelectionForGrid"); addMenu(new LLToolsLink(), "Tools.Link"); diff --git a/indra/newview/llviewermenufile.cpp b/indra/newview/llviewermenufile.cpp index eec6c8f481..2b69c20d15 100644 --- a/indra/newview/llviewermenufile.cpp +++ b/indra/newview/llviewermenufile.cpp @@ -541,6 +541,21 @@ void upload_new_resource(const LLString& src_filename, std::string name, return; } } + else if( LLString::compareInsensitive(ext.c_str(),".png") == 0 ) + { + asset_type = LLAssetType::AT_TEXTURE; + if (!LLViewerImageList::createUploadFile(src_filename, + filename, + IMG_CODEC_PNG )) + { + sprintf(error_message, "Problem with file %s:\n\n%s\n", + src_filename.c_str(), LLImageBase::getLastError().c_str()); + args["[FILE]"] = src_filename; + args["[ERROR]"] = LLImageBase::getLastError(); + upload_error(error_message, "ProblemWithFile", filename, args); + return; + } + } else if(LLString::compareInsensitive(ext.c_str(),".wav") == 0) { asset_type = LLAssetType::AT_SOUND; // tag it as audio diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp index 3b28148c4f..aa6993098d 100644 --- a/indra/newview/llviewermessage.cpp +++ b/indra/newview/llviewermessage.cpp @@ -134,6 +134,22 @@ LLFrameTimer gThrottleTimer; const U32 OFFER_THROTTLE_MAX_COUNT=5; //number of items per time period const F32 OFFER_THROTTLE_TIME=10.f; //time period in seconds +//script permissions +const LLString SCRIPT_QUESTIONS[SCRIPT_PERMISSION_EOF] = + { + "ScriptTakeMoney", + "ActOnControlInputs", + "RemapControlInputs", + "AnimateYourAvatar", + "AttachToYourAvatar", + "ReleaseOwnership", + "LinkAndDelink", + "AddAndRemoveJoints", + "ChangePermissions", + "TrackYourCamera", + "ControlYourCamera" + }; + struct LLFriendshipOffer { LLUUID mFromID; @@ -4223,8 +4239,8 @@ void process_economy_data(LLMessageSystem *msg, void** /*user_data*/) class LLScriptQuestionCBData { public: - LLScriptQuestionCBData(const LLUUID &taskid, const LLUUID &itemid, const LLHost &sender, S32 questions) - : mTaskID(taskid), mItemID(itemid), mSender(sender), mQuestions(questions) + LLScriptQuestionCBData(const LLUUID &taskid, const LLUUID &itemid, const LLHost &sender, S32 questions, const char *object_name, const char *owner_name) + : mTaskID(taskid), mItemID(itemid), mSender(sender), mQuestions(questions), mObjectName(object_name), mOwnerName(owner_name) { } @@ -4232,17 +4248,138 @@ public: LLUUID mItemID; LLHost mSender; S32 mQuestions; + LLString mObjectName; + LLString mOwnerName; }; +void notify_cautioned_script_question(LLScriptQuestionCBData* cbdata, S32 orig_questions, BOOL granted) +{ + // only continue if at least some permissions were requested + if (orig_questions) + { + // "'[OBJECTNAME]', an object owned by '[OWNERNAME]', + // located in [REGIONNAME] at [REGIONPOS], + // has been <granted|denied> permission to: [PERMISSIONS]." + + LLUIString notice(LLNotifyBox::getTemplateMessage(granted ? "ScriptQuestionCautionChatGranted" : "ScriptQuestionCautionChatDenied")); + + // always include the object name and owner name + notice.setArg("[OBJECTNAME]", cbdata->mObjectName); + notice.setArg("[OWNERNAME]", cbdata->mOwnerName); + + // try to lookup viewerobject that corresponds to the object that + // requested permissions (here, taskid->requesting object id) + BOOL foundpos = FALSE; + LLViewerObject* viewobj = gObjectList.findObject(cbdata->mTaskID); + if (viewobj) + { + // found the viewerobject, get it's position in its region + LLVector3 objpos(viewobj->getPosition()); + + // try to lookup the name of the region the object is in + LLViewerRegion* viewregion = viewobj->getRegion(); + if (viewregion) + { + // got the region, so include the region and 3d coordinates of the object + notice.setArg("[REGIONNAME]", viewregion->getName()); + LLString formatpos = llformat("%.1f, %.1f,%.1f", objpos[VX], objpos[VY], objpos[VZ]); + notice.setArg("[REGIONPOS]", formatpos); + + foundpos = TRUE; + } + } + + if (!foundpos) + { + // unable to determine location of the object + notice.setArg("[REGIONNAME]", "(unknown region)"); + notice.setArg("[REGIONPOS]", "(unknown position)"); + } + + // check each permission that was requested, and list each + // permission that has been flagged as a caution permission + BOOL caution = FALSE; + S32 count = 0; + LLString perms; + for (S32 i = 0; i < SCRIPT_PERMISSION_EOF; i++) + { + if ((orig_questions & LSCRIPTRunTimePermissionBits[i]) && LLNotifyBox::getTemplateIsCaution(SCRIPT_QUESTIONS[i])) + { + count++; + caution = TRUE; + + // add a comma before the permission description if it is not the first permission + // added to the list or the last permission to check + if ((count > 1) && (i < SCRIPT_PERMISSION_EOF)) + { + perms.append(", "); + } + + perms.append(LLNotifyBox::getTemplateMessage(SCRIPT_QUESTIONS[i])); + } + } + + notice.setArg("[PERMISSIONS]", perms); + + // log a chat message as long as at least one requested permission + // is a caution permission + if (caution) + { + LLChat chat(notice.getString()); + LLFloaterChat::addChat(chat, FALSE, FALSE); + } + } +} + +void script_question_decline_cb(S32 option, void* user_data) +{ + LLMessageSystem *msg = gMessageSystem; + LLScriptQuestionCBData *cbdata = (LLScriptQuestionCBData *)user_data; + + // remember the permissions requested so they can be checked + // when it comes time to log a chat message + S32 orig = cbdata->mQuestions; + + // this callback will always decline all permissions requested + // (any question flags set in the ScriptAnswerYes message + // will be interpreted as having been granted, so clearing all + // the bits will deny every permission) + cbdata->mQuestions = 0; + + // respond with the permissions denial + msg->newMessageFast(_PREHASH_ScriptAnswerYes); + msg->nextBlockFast(_PREHASH_AgentData); + msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID()); + msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID()); + msg->nextBlockFast(_PREHASH_Data); + msg->addUUIDFast(_PREHASH_TaskID, cbdata->mTaskID); + msg->addUUIDFast(_PREHASH_ItemID, cbdata->mItemID); + msg->addS32Fast(_PREHASH_Questions, cbdata->mQuestions); + msg->sendReliable(cbdata->mSender); + + // log a chat message, if appropriate + notify_cautioned_script_question(cbdata, orig, FALSE); + + delete cbdata; +} void script_question_cb(S32 option, void* user_data) { LLMessageSystem *msg = gMessageSystem; LLScriptQuestionCBData *cbdata = (LLScriptQuestionCBData *)user_data; + S32 orig = cbdata->mQuestions; + + // check whether permissions were granted or denied + BOOL allowed = TRUE; + // the "yes/accept" button is the first button in the template, making it button 0 + // if any other button was clicked, the permissions were denied if (option != 0) { cbdata->mQuestions = 0; - } + allowed = FALSE; + } + + // reply with the permissions granted or denied msg->newMessageFast(_PREHASH_ScriptAnswerYes); msg->nextBlockFast(_PREHASH_AgentData); msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID()); @@ -4252,27 +4389,20 @@ void script_question_cb(S32 option, void* user_data) msg->addUUIDFast(_PREHASH_ItemID, cbdata->mItemID); msg->addS32Fast(_PREHASH_Questions, cbdata->mQuestions); msg->sendReliable(cbdata->mSender); + + // only log a chat message if caution prompts are enabled + if (gSavedSettings.getBOOL("PermissionsCautionEnabled")) + { + // log a chat message, if appropriate + notify_cautioned_script_question(cbdata, orig, allowed); + } + delete cbdata; } - void process_script_question(LLMessageSystem *msg, void **user_data) { // XUI:translate owner name -> [FIRST] [LAST] - const LLString script_questions[SCRIPT_PERMISSION_EOF] = - { - "ScriptTakeMoney", - "ActOnControlInputs", - "RemapControlInputs", - "AnimateYourAvatar", - "AttachToYourAvatar", - "ReleaseOwnership", - "LinkAndDelink", - "AddAndRemoveJoints", - "ChangePermissions", - "TrackYourCamera", - "ControlYourCamera" - }; LLHost sender = msg->getSender(); @@ -4282,7 +4412,9 @@ void process_script_question(LLMessageSystem *msg, void **user_data) char object_name[255]; /* Flawfinder: ignore */ char owner_name[DB_FULL_NAME_BUF_SIZE]; /* Flawfinder: ignore */ + // taskid -> object key of object requesting permissions msg->getUUIDFast(_PREHASH_Data, _PREHASH_TaskID, taskid ); + // itemid -> script asset key of script requesting permissions msg->getUUIDFast(_PREHASH_Data, _PREHASH_ItemID, itemid ); msg->getStringFast(_PREHASH_Data, _PREHASH_ObjectName, 255, object_name); msg->getStringFast(_PREHASH_Data, _PREHASH_ObjectOwner, DB_FULL_NAME_BUF_SIZE, owner_name); @@ -4291,23 +4423,48 @@ void process_script_question(LLMessageSystem *msg, void **user_data) LLString script_question; if (questions) { + BOOL caution = FALSE; S32 count = 0; LLString::format_map_t args; args["[OBJECTNAME]"] = object_name; args["[NAME]"] = owner_name; + + // check the received permission flags against each permission for (S32 i = 0; i < SCRIPT_PERMISSION_EOF; i++) { if (questions & LSCRIPTRunTimePermissionBits[i]) { count++; - script_question += " " + LLNotifyBox::getTemplateMessage(script_questions[i]) + "\n"; + script_question += " " + LLNotifyBox::getTemplateMessage(SCRIPT_QUESTIONS[i]) + "\n"; + + // check whether permission question should cause special caution dialog + caution |= LLNotifyBox::getTemplateIsCaution(SCRIPT_QUESTIONS[i]); } } args["[QUESTIONS]"] = script_question; - LLScriptQuestionCBData *cbdata = new LLScriptQuestionCBData(taskid, itemid, sender, questions); + LLScriptQuestionCBData *cbdata = new LLScriptQuestionCBData(taskid, itemid, sender, questions, object_name, owner_name); + + // check whether cautions are even enabled or not + if (gSavedSettings.getBOOL("PermissionsCautionEnabled")) + { + if (caution) + { + // display the caution permissions prompt + LLNotifyBox::showXml("ScriptQuestionCaution", args, TRUE, script_question_cb, cbdata); + } + else + { + // display the permissions request normally + LLNotifyBox::showXml("ScriptQuestion", args, FALSE, script_question_cb, cbdata); + } + } + else + { + // fall back to default behavior if cautions are entirely disabled + LLNotifyBox::showXml("ScriptQuestion", args, FALSE, script_question_cb, cbdata); + } - LLNotifyBox::showXml("ScriptQuestion", args, script_question_cb, cbdata); } } diff --git a/indra/newview/llviewerobject.cpp b/indra/newview/llviewerobject.cpp index 710ba186f9..e53f779473 100644 --- a/indra/newview/llviewerobject.cpp +++ b/indra/newview/llviewerobject.cpp @@ -1551,7 +1551,7 @@ U32 LLViewerObject::processUpdateMessage(LLMessageSystem *mesgsys, // Bad, we got a cycle somehow. // Kill both the parent and the child, and // set cache misses for both of them. - llwarns << "Attempting to recover from parenting cycle!" << llendl + llwarns << "Attempting to recover from parenting cycle!" << llendl; llwarns << "Killing " << sent_parentp->getID() << " and " << getID() << llendl; llwarns << "Adding to cache miss list" << llendl; setParent(NULL); @@ -1575,6 +1575,24 @@ U32 LLViewerObject::processUpdateMessage(LLMessageSystem *mesgsys, sent_parentp->addChild(this); } + if( mPartSourcep.notNull() ) + { + LLViewerPartSourceScript *partSourceScript = mPartSourcep.get(); + partSourceScript->setSuspended( FALSE ); + } + + if( mText.notNull() ) + { + LLHUDText *hudText = mText.get(); + hudText->setHidden( FALSE ); + } + + if( mIcon.notNull() ) + { + LLHUDIcon *hudIcon = mIcon.get(); + hudIcon->setHidden( FALSE ); + } + setChanged(MOVED | SILHOUETTE); } else @@ -1589,6 +1607,23 @@ U32 LLViewerObject::processUpdateMessage(LLMessageSystem *mesgsys, U32 port = mesgsys->getSenderPort(); gObjectList.orphanize(this, parent_id, ip, port); + if( mPartSourcep.notNull() ) + { + LLViewerPartSourceScript *partSourceScript = mPartSourcep.get(); + partSourceScript->setSuspended( TRUE ); + } + + if( mText.notNull() ) + { + LLHUDText *hudText = mText.get(); + hudText->setHidden( TRUE ); + } + + if( mIcon.notNull() ) + { + LLHUDIcon *hudIcon = mIcon.get(); + hudIcon->setHidden( TRUE ); + } } } } @@ -1666,7 +1701,7 @@ U32 LLViewerObject::processUpdateMessage(LLMessageSystem *mesgsys, // Bad, we got a cycle somehow. // Kill both the parent and the child, and // set cache misses for both of them. - llwarns << "Attempting to recover from parenting cycle!" << llendl + llwarns << "Attempting to recover from parenting cycle!" << llendl; llwarns << "Killing " << sent_parentp->getID() << " and " << getID() << llendl; llwarns << "Adding to cache miss list" << llendl; setParent(NULL); @@ -4128,7 +4163,11 @@ void LLViewerObject::setAttachedSound(const LLUUID &audio_uuid, const LLUUID& ow if (audio_uuid.isNull()) { - if (mAudioSourcep && mAudioSourcep->isLoop() && !mAudioSourcep->hasPendingPreloads()) + if (!mAudioSourcep) + { + return; + } + if (mAudioSourcep->isLoop() && !mAudioSourcep->hasPendingPreloads()) { // We don't clear the sound if it's a loop, it'll go away on its own. // At least, this appears to be how the scripts work. @@ -4138,29 +4177,22 @@ void LLViewerObject::setAttachedSound(const LLUUID &audio_uuid, const LLUUID& ow gAudiop->cleanupAudioSource(mAudioSourcep); mAudioSourcep = NULL; } - else if (mAudioSourcep) - { - if (mAudioSourcep->isLoop()) - { - // Just shut off the sound - mAudioSourcep->play(LLUUID::null); - } + else if (flags & LL_SOUND_FLAG_STOP) + { + // Just shut off the sound + mAudioSourcep->play(LLUUID::null); } return; } - if (flags & LL_SOUND_FLAG_LOOP) + if (flags & LL_SOUND_FLAG_LOOP + && mAudioSourcep && mAudioSourcep->isLoop() && mAudioSourcep->getCurrentData() + && mAudioSourcep->getCurrentData()->getID() == audio_uuid) { - if (mAudioSourcep && mAudioSourcep->isLoop() && mAudioSourcep->getCurrentData()) - { - if (mAudioSourcep->getCurrentData()->getID() == audio_uuid) - { - //llinfos << "Already playing this sound on a loop, ignoring" << llendl; - return; - } - } + //llinfos << "Already playing this sound on a loop, ignoring" << llendl; + return; } - // don't clean up before previous sound is done. Solves: SL-33486 + // don't clean up before previous sound is done. Solves: SL-33486 if ( mAudioSourcep && mAudioSourcep->isDone() ) { gAudiop->cleanupAudioSource(mAudioSourcep); @@ -4171,11 +4203,16 @@ void LLViewerObject::setAttachedSound(const LLUUID &audio_uuid, const LLUUID& ow if (mAudioSourcep) { + BOOL queue = flags & LL_SOUND_FLAG_QUEUE; mAudioSourcep->setGain(gain); - mAudioSourcep->setLoop((flags & LL_SOUND_FLAG_LOOP) ? TRUE : FALSE); - mAudioSourcep->setSyncMaster((flags & LL_SOUND_FLAG_SYNC_MASTER) ? TRUE : FALSE); - mAudioSourcep->setSyncSlave((flags & LL_SOUND_FLAG_SYNC_SLAVE) ? TRUE : FALSE); - mAudioSourcep->setQueueSounds((flags & LL_SOUND_FLAG_QUEUE) ? TRUE : FALSE); + mAudioSourcep->setLoop(flags & LL_SOUND_FLAG_LOOP); + mAudioSourcep->setSyncMaster(flags & LL_SOUND_FLAG_SYNC_MASTER); + mAudioSourcep->setSyncSlave(flags & LL_SOUND_FLAG_SYNC_SLAVE); + mAudioSourcep->setQueueSounds(queue); + if(!queue) // stop any current sound first to avoid "farts of doom" (SL-1541) -MG + { + mAudioSourcep->play(LLUUID::null); + } //llinfos << "Playing attached sound " << audio_uuid << llendl; mAudioSourcep->play(audio_uuid); } diff --git a/indra/newview/llviewerpartsource.cpp b/indra/newview/llviewerpartsource.cpp index 01c835dbf0..96e8863ec8 100644 --- a/indra/newview/llviewerpartsource.cpp +++ b/indra/newview/llviewerpartsource.cpp @@ -27,6 +27,7 @@ LLViewerPartSource::LLViewerPartSource(const U32 type) : mLastUpdateTime = 0.f; mLastPartTime = 0.f; mIsDead = FALSE; + mIsSuspended = FALSE; static U32 id_seed = 0; mID = ++id_seed; } @@ -73,6 +74,9 @@ void LLViewerPartSourceScript::setDead() void LLViewerPartSourceScript::update(const F32 dt) { + if( mIsSuspended ) + return; + LLMemType mt(LLMemType::MTYPE_PARTICLES); F32 old_update_time = mLastUpdateTime; mLastUpdateTime += dt; diff --git a/indra/newview/llviewerpartsource.h b/indra/newview/llviewerpartsource.h index 30ea00809a..807f73e2ab 100644 --- a/indra/newview/llviewerpartsource.h +++ b/indra/newview/llviewerpartsource.h @@ -41,9 +41,10 @@ public: virtual void update(const F32 dt); // Return FALSE if this source is dead... virtual void setDead(); - BOOL isDead() const { return mIsDead; } - - U32 getType() const { return mType; } + BOOL isDead() const { return mIsDead; } + void setSuspended( BOOL state ) { mIsSuspended = state; } + BOOL isSuspended() const { return mIsSuspended; } + U32 getType() const { return mType; } static void updatePart(LLViewerPart &part, const F32 dt); void setOwnerUUID(const LLUUID& owner_id) { mOwnerUUID = owner_id; } LLUUID getOwnerUUID() const { return mOwnerUUID; } @@ -57,6 +58,7 @@ public: protected: U32 mType; BOOL mIsDead; + BOOL mIsSuspended; F32 mLastUpdateTime; F32 mLastPartTime; LLUUID mOwnerUUID; diff --git a/indra/newview/llviewertexteditor.cpp b/indra/newview/llviewertexteditor.cpp index cc0345b79a..3969230197 100644 --- a/indra/newview/llviewertexteditor.cpp +++ b/indra/newview/llviewertexteditor.cpp @@ -1405,7 +1405,8 @@ LLView* LLViewerTextEditor::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlF LLFontGL* font = LLView::selectFont(node); - LLString text = node->getValue(); + // LLString text = node->getValue(); + LLString text = node->getTextContents().substr(0, max_text_length - 1); if (text.size() > max_text_length) { diff --git a/indra/newview/llviewerwindow.cpp b/indra/newview/llviewerwindow.cpp index 682490440c..75d7a97372 100644 --- a/indra/newview/llviewerwindow.cpp +++ b/indra/newview/llviewerwindow.cpp @@ -2380,13 +2380,13 @@ BOOL LLViewerWindow::handleKey(KEY key, MASK mask) case KEY_RIGHT: case KEY_UP: // let CTRL UP through for chat line history - if( MASK_CONTROL & mask ) + if( MASK_CONTROL == mask ) { break; } case KEY_DOWN: // let CTRL DOWN through for chat line history - if( MASK_CONTROL & mask ) + if( MASK_CONTROL == mask ) { break; } @@ -3153,7 +3153,7 @@ void LLViewerWindow::renderSelections( BOOL for_gl_pick, BOOL pick_parcel_walls, BOOL moveable_object_selected = FALSE; BOOL all_selected_objects_move = TRUE; BOOL all_selected_objects_modify = TRUE; - BOOL selecting_linked_set = gSavedSettings.getBOOL("SelectLinkedSet"); + BOOL selecting_linked_set = !gSavedSettings.getBOOL("EditLinkedParts"); for( object = gSelectMgr->getSelection()->getFirstObject(); object; object = gSelectMgr->getSelection()->getNextObject() ) { BOOL this_object_movable = FALSE; @@ -3512,6 +3512,18 @@ void LLViewerWindow::performPick() objectp = gObjectList.getSelectedObject(name); if (objectp) { + LLViewerObject* parent = (LLViewerObject*)(objectp->getParent()); + if (NULL == parent) { + // if you are the parent + parent = objectp; + } + std::vector<LLPointer<LLViewerObject>,std::allocator<LLPointer<LLViewerObject> > > children = parent->getChildren(); + for( std::vector<LLPointer<LLViewerObject>,std::allocator<LLPointer<LLViewerObject> > >::iterator i= children.begin(); i!= children.end(); ++i ) + { + //go through + LLViewerObject* foo = *i; + foo->getRotation(); + } if (objectp->mbCanSelect) { te_offset = (te_offset == 16) ? NO_FACE : te_offset; diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index 0236abf127..540cd1f04b 100644 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -5719,6 +5719,7 @@ void LLVOAvatar::requestLayerSetUpdate( LLVOAvatar::ELocTexIndex i ) break; + case LOCTEX_UPPER_JACKET: case LOCTEX_LOWER_JACKET: if( mUpperBodyLayerSet ) { @@ -5730,6 +5731,10 @@ void LLVOAvatar::requestLayerSetUpdate( LLVOAvatar::ELocTexIndex i ) mLowerBodyLayerSet->requestUpdate(); } break; + + case LOCTEX_NUM_ENTRIES: + llerrs << "Bogus texture value " << i << llendl; + break; } } @@ -7389,6 +7394,24 @@ void LLVOAvatar::setCachedBakedTexture( ETextureIndex te, const LLUUID& uuid ) mSkirtLayerSet->cancelUpload(); } break; + + case TEX_HEAD_BODYPAINT: + case TEX_UPPER_SHIRT: + case TEX_LOWER_PANTS: + case TEX_EYES_IRIS: + case TEX_HAIR: + case TEX_UPPER_BODYPAINT: + case TEX_LOWER_BODYPAINT: + case TEX_LOWER_SHOES: + case TEX_LOWER_SOCKS: + case TEX_UPPER_JACKET: + case TEX_LOWER_JACKET: + case TEX_UPPER_GLOVES: + case TEX_UPPER_UNDERSHIRT: + case TEX_LOWER_UNDERPANTS: + case TEX_SKIRT: + case TEX_NUM_ENTRIES: + break; } } diff --git a/indra/newview/llvoavatar.h b/indra/newview/llvoavatar.h index 3257e921bc..c98826d15b 100644 --- a/indra/newview/llvoavatar.h +++ b/indra/newview/llvoavatar.h @@ -236,8 +236,7 @@ public: (1 << LLVertexBuffer::TYPE_TEXCOORD) | (1 << LLVertexBuffer::TYPE_WEIGHT) | (1 << LLVertexBuffer::TYPE_CLOTHWEIGHT) - } - eVertexDataMask; + }; LLVOAvatar(const LLUUID &id, const LLPCode pcode, LLViewerRegion *regionp); /*virtual*/ void markDead(); diff --git a/indra/newview/llvoinventorylistener.cpp b/indra/newview/llvoinventorylistener.cpp index a0b623db71..13cf596280 100644 --- a/indra/newview/llvoinventorylistener.cpp +++ b/indra/newview/llvoinventorylistener.cpp @@ -13,7 +13,7 @@ void LLVOInventoryListener::removeVOInventoryListener() { - if (mListenerVObject != NULL) + if (mListenerVObject) { mListenerVObject->removeInventoryListener(this); mListenerVObject = NULL; @@ -32,7 +32,7 @@ void LLVOInventoryListener::registerVOInventoryListener(LLViewerObject* object, void LLVOInventoryListener::requestVOInventory() { - if (mListenerVObject != NULL) + if (mListenerVObject) { mListenerVObject->requestInventory(); } diff --git a/indra/newview/llvoinventorylistener.h b/indra/newview/llvoinventorylistener.h index 1cca42fc93..7f14b5d74a 100644 --- a/indra/newview/llvoinventorylistener.h +++ b/indra/newview/llvoinventorylistener.h @@ -36,7 +36,7 @@ protected: void requestVOInventory(); private: - LLViewerObject* mListenerVObject; + LLPointer<LLViewerObject> mListenerVObject; }; #endif diff --git a/indra/newview/llvopartgroup.cpp b/indra/newview/llvopartgroup.cpp index c0df55b670..9995a8e462 100644 --- a/indra/newview/llvopartgroup.cpp +++ b/indra/newview/llvopartgroup.cpp @@ -401,7 +401,7 @@ void LLParticlePartition::addGeometryCount(LLSpatialGroup* group, U32& vertex_co continue; } - LLAlphaObject* obj = (LLAlphaObject*) drawablep->getVObj(); + LLAlphaObject* obj = (LLAlphaObject*) drawablep->getVObj().get(); obj->mDepth = 0.f; if (drawablep->isAnimating()) diff --git a/indra/newview/llvopartgroup.h b/indra/newview/llvopartgroup.h index df1631cbc7..11fcf64b1b 100644 --- a/indra/newview/llvopartgroup.h +++ b/indra/newview/llvopartgroup.h @@ -19,14 +19,13 @@ class LLViewerPartGroup; class LLVOPartGroup : public LLAlphaObject { public: - enum + enum { VERTEX_DATA_MASK = (1 << LLVertexBuffer::TYPE_VERTEX) | (1 << LLVertexBuffer::TYPE_NORMAL) | (1 << LLVertexBuffer::TYPE_TEXCOORD) | (1 << LLVertexBuffer::TYPE_COLOR) - } - eVertexDataMask; + }; LLVOPartGroup(const LLUUID &id, const LLPCode pcode, LLViewerRegion *regionp); diff --git a/indra/newview/llvosurfacepatch.h b/indra/newview/llvosurfacepatch.h index af6653e556..1264cc5b8e 100644 --- a/indra/newview/llvosurfacepatch.h +++ b/indra/newview/llvosurfacepatch.h @@ -19,15 +19,14 @@ class LLVector2; class LLVOSurfacePatch : public LLStaticViewerObject { public: - enum + enum { VERTEX_DATA_MASK = (1 << LLVertexBuffer::TYPE_VERTEX) | (1 << LLVertexBuffer::TYPE_NORMAL) | (1 << LLVertexBuffer::TYPE_TEXCOORD) | (1 << LLVertexBuffer::TYPE_TEXCOORD2) | (1 << LLVertexBuffer::TYPE_COLOR) - } - eVertexDataMask; + }; LLVOSurfacePatch(const LLUUID &id, const LLPCode pcode, LLViewerRegion *regionp); diff --git a/indra/newview/llvotree.h b/indra/newview/llvotree.h index e10abbfb27..509d23d011 100644 --- a/indra/newview/llvotree.h +++ b/indra/newview/llvotree.h @@ -23,13 +23,12 @@ protected: ~LLVOTree(); public: - enum + enum { VERTEX_DATA_MASK = (1 << LLVertexBuffer::TYPE_VERTEX) | (1 << LLVertexBuffer::TYPE_NORMAL) | (1 << LLVertexBuffer::TYPE_TEXCOORD) - } - eVertexDataMask; + }; LLVOTree(const LLUUID &id, const LLPCode pcode, LLViewerRegion *regionp); diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp index ec64cc23b3..a126237e00 100644 --- a/indra/newview/llvovolume.cpp +++ b/indra/newview/llvovolume.cpp @@ -46,6 +46,7 @@ const S32 MIN_QUIET_FRAMES_COALESCE = 30; const F32 FORCE_SIMPLE_RENDER_AREA = 512.f; const F32 FORCE_CULL_AREA = 8.f; +const S32 SCULPT_REZ = 128; BOOL gAnimateTextures = TRUE; extern BOOL gHideSelectedObjects; @@ -252,9 +253,9 @@ U32 LLVOVolume::processUpdateMessage(LLMessageSystem *mesgsys, void LLVOVolume::animateTextures() { F32 off_s = 0.f, off_t = 0.f, scale_s = 1.f, scale_t = 1.f, rot = 0.f; - S32 result; + S32 result = mTextureAnimp->animateTextures(off_s, off_t, scale_s, scale_t, rot); - if (result = mTextureAnimp->animateTextures(off_s, off_t, scale_s, scale_t, rot)) + if (result) { if (!mTexAnimMode) { @@ -464,10 +465,11 @@ void LLVOVolume::updateTextures() mSculptTexture = gImageList.getImage(id); if (mSculptTexture.notNull()) { - mSculptTexture->addTextureStats(mPixelArea); + mSculptTexture->addTextureStats(SCULPT_REZ * SCULPT_REZ); + mSculptTexture->setBoostLevel(LLViewerImage::BOOST_SCULPTED); } - S32 desired_discard = MAX_LOD - mLOD; + S32 desired_discard = 0; // lower discard levels have MUCH less resolution - (old=MAX_LOD - mLOD) S32 current_discard = getVolume()->getSculptLevel(); if (desired_discard != current_discard) @@ -681,7 +683,7 @@ void LLVOVolume::sculpt() if (mSculptTexture.notNull()) { S32 discard_level; - S32 desired_discard = MAX_LOD - mLOD; // desired + S32 desired_discard = 0; // lower discard levels have MUCH less resolution discard_level = desired_discard; @@ -2190,7 +2192,7 @@ void LLVolumeGeometryManager::rebuildGeom(LLSpatialGroup* group) { LLDrawable* drawablep = *drawable_iter; - if (drawablep->isDead()) + if (drawablep->isDead() || drawablep->isState(LLDrawable::FORCE_INVISIBLE) ) { continue; } diff --git a/indra/newview/llvovolume.h b/indra/newview/llvovolume.h index 6ee6d255c4..7ce2f95de9 100644 --- a/indra/newview/llvovolume.h +++ b/indra/newview/llvovolume.h @@ -63,8 +63,7 @@ public: (1 << LLVertexBuffer::TYPE_TEXCOORD) | (1 << LLVertexBuffer::TYPE_TEXCOORD2) | (1 << LLVertexBuffer::TYPE_COLOR) - } - eVertexDataMask; + }; public: LLVOVolume(const LLUUID &id, const LLPCode pcode, LLViewerRegion *regionp); diff --git a/indra/newview/llvowater.h b/indra/newview/llvowater.h index fd140fda56..e3df822037 100644 --- a/indra/newview/llvowater.h +++ b/indra/newview/llvowater.h @@ -32,8 +32,7 @@ public: VERTEX_DATA_MASK = (1 << LLVertexBuffer::TYPE_VERTEX) | (1 << LLVertexBuffer::TYPE_NORMAL) | (1 << LLVertexBuffer::TYPE_TEXCOORD) - } - eVertexDataMask; + }; LLVOWater(const LLUUID &id, const LLPCode pcode, LLViewerRegion *regionp); diff --git a/indra/newview/llworld.cpp b/indra/newview/llworld.cpp index f6116eb718..1d2e9af3b6 100644 --- a/indra/newview/llworld.cpp +++ b/indra/newview/llworld.cpp @@ -481,6 +481,8 @@ F32 LLWorld::resolveStepHeightGlobal(const LLVOAvatar* avatarp, const LLVector3d land_intersection.mdV[VZ] = regionp->getLand().resolveHeightGlobal(point_a); normalized_land_distance = (F32)(point_a.mdV[VZ] - land_intersection.mdV[VZ]) / segment_length; + intersection = land_intersection; + intersection_normal = resolveLandNormalGlobal(land_intersection); if (avatarp && !avatarp->mFootPlane.isExactlyClear()) { @@ -491,17 +493,13 @@ F32 LLWorld::resolveStepHeightGlobal(const LLVOAvatar* avatarp, const LLVector3d norm_dist_from_plane = llclamp(norm_dist_from_plane / segment_length, 0.f, 1.f); if (norm_dist_from_plane < normalized_land_distance) { + // collided with object before land normalized_land_distance = norm_dist_from_plane; intersection = point_a; intersection.mdV[VZ] -= norm_dist_from_plane * segment_length; intersection_normal = foot_plane_normal; } } - else - { - intersection = land_intersection; - intersection_normal = resolveLandNormalGlobal(land_intersection); - } return normalized_land_distance; } diff --git a/indra/newview/llxmlrpctransaction.cpp b/indra/newview/llxmlrpctransaction.cpp index cf57ae3cd0..294df75f2a 100644 --- a/indra/newview/llxmlrpctransaction.cpp +++ b/indra/newview/llxmlrpctransaction.cpp @@ -208,22 +208,22 @@ void LLXMLRPCTransaction::Impl::init(XMLRPC_REQUEST request, bool useGzip) // tell curl about the settings curl_easy_setopt(mCurl, CURLOPT_PROXY, mProxyAddress.c_str()); - curl_easy_setopt(mCurl, CURLOPT_PROXYPORT, (long)port); - curl_easy_setopt(mCurl, CURLOPT_PROXYTYPE, CURLPROXY_HTTP); + curl_easy_setopt(mCurl, CURLOPT_PROXYPORT, (long) port); + curl_easy_setopt(mCurl, CURLOPT_PROXYTYPE, (long) CURLPROXY_HTTP); }; -// curl_easy_setopt(mCurl, CURLOPT_VERBOSE, 1); // usefull for debugging - curl_easy_setopt(mCurl, CURLOPT_NOSIGNAL, 1); +// curl_easy_setopt(mCurl, CURLOPT_VERBOSE, 1L); // usefull for debugging + curl_easy_setopt(mCurl, CURLOPT_NOSIGNAL, 1L); curl_easy_setopt(mCurl, CURLOPT_WRITEFUNCTION, &curlDownloadCallback); curl_easy_setopt(mCurl, CURLOPT_WRITEDATA, this); curl_easy_setopt(mCurl, CURLOPT_ERRORBUFFER, &mCurlErrorBuffer); curl_easy_setopt(mCurl, CURLOPT_CAINFO, gDirUtilp->getCAFile().c_str()); - curl_easy_setopt(mCurl, CURLOPT_SSL_VERIFYPEER, gVerifySSLCert); - curl_easy_setopt(mCurl, CURLOPT_SSL_VERIFYHOST, gVerifySSLCert? 2 : 0); + curl_easy_setopt(mCurl, CURLOPT_SSL_VERIFYPEER, (long) gVerifySSLCert); + curl_easy_setopt(mCurl, CURLOPT_SSL_VERIFYHOST, gVerifySSLCert? 2L : 0L); /* Setting the DNS cache timeout to -1 disables it completely. This might help with bug #503 */ - curl_easy_setopt(mCurl, CURLOPT_DNS_CACHE_TIMEOUT, -1); + curl_easy_setopt(mCurl, CURLOPT_DNS_CACHE_TIMEOUT, -1L); mHeaders = curl_slist_append(mHeaders, "Content-Type: text/xml"); curl_easy_setopt(mCurl, CURLOPT_URL, mURI.c_str()); @@ -237,7 +237,7 @@ void LLXMLRPCTransaction::Impl::init(XMLRPC_REQUEST request, bool useGzip) if (mRequestText) { curl_easy_setopt(mCurl, CURLOPT_POSTFIELDS, mRequestText); - curl_easy_setopt(mCurl, CURLOPT_POSTFIELDSIZE, mRequestTextSize); + curl_easy_setopt(mCurl, CURLOPT_POSTFIELDSIZE, (long) mRequestTextSize); } else { diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp index c3841a4790..d4d5cfc624 100644 --- a/indra/newview/pipeline.cpp +++ b/indra/newview/pipeline.cpp @@ -1386,7 +1386,7 @@ void LLPipeline::stateSort(LLDrawable* drawablep, LLCamera& camera) if (gHideSelectedObjects) { - if (drawablep->getVObj() && + if (drawablep->getVObj().notNull() && drawablep->getVObj()->isSelected()) { return; @@ -1415,7 +1415,7 @@ void LLPipeline::stateSort(LLDrawable* drawablep, LLCamera& camera) } else if (drawablep->isAvatar() && drawablep->isVisible()) { - LLVOAvatar* vobj = (LLVOAvatar*) drawablep->getVObj(); + LLVOAvatar* vobj = (LLVOAvatar*) drawablep->getVObj().get(); vobj->updateVisibility(FALSE); } @@ -3478,7 +3478,7 @@ BOOL LLPipeline::getRenderSoundBeacons(void*) LLViewerObject* LLPipeline::pickObject(const LLVector3 &start, const LLVector3 &end, LLVector3 &collision) { LLDrawable* drawable = mObjectPartition[PARTITION_VOLUME]->pickDrawable(start, end, collision); - return drawable ? drawable->getVObj() : NULL; + return drawable ? drawable->getVObj().get() : NULL; } LLSpatialPartition* LLPipeline::getSpatialPartition(LLViewerObject* vobj) diff --git a/indra/newview/viewer_manifest.py b/indra/newview/viewer_manifest.py index c714ad627d..eba306a248 100755 --- a/indra/newview/viewer_manifest.py +++ b/indra/newview/viewer_manifest.py @@ -410,7 +410,6 @@ class Linux_i686Manifest(LinuxManifest): self.path("libssl.so.0.9.7") self.path("libexpat.so.1") self.path("libstdc++.so.6") - self.path("libelfio.so") self.path("libuuid.so", "libuuid.so.1") self.path("libSDL-1.2.so.0") self.path("libtcmalloc.so.0") @@ -422,7 +421,8 @@ class Linux_i686Manifest(LinuxManifest): class Linux_x86_64Manifest(LinuxManifest): def construct(self): super(Linux_x86_64Manifest, self).construct() - self.path("secondlife-x86_64-bin-stripped","bin/secondlife-bin") + self.path("secondlife-x86_64-bin-stripped","bin/do-not-directly-run-secondlife-bin") + self.path("../linux_crash_logger/linux-crash-logger-x86_64-bin-stripped","linux-crash-logger.bin") # TODO: I get the sense that this isn't fully fleshed out if self.prefix("../../libraries/x86_64-linux/lib_release_client", "lib"): self.path("libkdu_v42R.so") diff --git a/indra/test/llhttpnode_tut.cpp b/indra/test/llhttpnode_tut.cpp index 9350645d2a..30165cb769 100644 --- a/indra/test/llhttpnode_tut.cpp +++ b/indra/test/llhttpnode_tut.cpp @@ -1,5 +1,5 @@ /** - * @file lliohttpserver_tut.cpp + * @file lliohttpnode_tut.cpp * @date May 2006 * @brief HTTP server unit tests * diff --git a/indra/test/llmessageconfig_tut.cpp b/indra/test/llmessageconfig_tut.cpp index c9a62e5230..f7eede73a3 100644 --- a/indra/test/llmessageconfig_tut.cpp +++ b/indra/test/llmessageconfig_tut.cpp @@ -19,7 +19,7 @@ namespace tut { ///var/tmp/babbage/dev/message-liberation/etc static const char file_name[] = "/tmp/message.xml"; - static const F32 refreshRate = 6.0*1000.0; // milliseconds + static const long refreshRateMillis = 6000; struct LLMessageConfigTestData { @@ -45,7 +45,7 @@ namespace tut LLSDSerialize::toPrettyXML(config, file); } file.close(); - ms_sleep(refreshRate); + ms_sleep(refreshRateMillis); LLFrameTimer::updateFrameTime(); } }; |