diff --git a/indra/llappearance/llpolymesh.h b/indra/llappearance/llpolymesh.h index d006e389c..a1ad68e4f 100644 --- a/indra/llappearance/llpolymesh.h +++ b/indra/llappearance/llpolymesh.h @@ -36,7 +36,7 @@ #include "llquaternion.h" #include "llpolymorph.h" #include "lljoint.h" -//#include "lldarray.h" +#include "lldarray.h" class LLSkinJoint; class LLAvatarAppearance; diff --git a/indra/llappearance/lltexglobalcolor.cpp b/indra/llappearance/lltexglobalcolor.cpp index f38b98210..c3abbfd90 100644 --- a/indra/llappearance/lltexglobalcolor.cpp +++ b/indra/llappearance/lltexglobalcolor.cpp @@ -105,7 +105,8 @@ LLTexParamGlobalColor::LLTexParamGlobalColor(LLTexGlobalColor* tex_global_color) void LLTexParamGlobalColor::onGlobalColorChanged(bool upload_bake) { - mAvatarAppearance->onGlobalColorChanged(mTexGlobalColor, upload_bake); + if (mAvatarAppearance) + mAvatarAppearance->onGlobalColorChanged(mTexGlobalColor, upload_bake); } //----------------------------------------------------------------------------- diff --git a/indra/llcharacter/llcharacter.h b/indra/llcharacter/llcharacter.h index f618b446f..bfa1c0bd8 100644 --- a/indra/llcharacter/llcharacter.h +++ b/indra/llcharacter/llcharacter.h @@ -269,6 +269,9 @@ public: static std::vector< LLCharacter* > sInstances; static BOOL sAllowInstancesChange ; //debug use + virtual void setHoverOffset(const LLVector3& hover_offset, bool send_update=true) { mHoverOffset = hover_offset; } + const LLVector3& getHoverOffset() const { return mHoverOffset; } + protected: LLMotionController mMotionController; @@ -293,6 +296,8 @@ private: visual_param_index_map_t mVisualParamIndexMap; visual_param_name_map_t mVisualParamNameMap; static LLStringTable sVisualParamNames; + + LLVector3 mHoverOffset; }; #endif // LL_LLCHARACTER_H diff --git a/indra/llcharacter/lljoint.h b/indra/llcharacter/lljoint.h index f633fc32d..2196f47bb 100644 --- a/indra/llcharacter/lljoint.h +++ b/indra/llcharacter/lljoint.h @@ -31,17 +31,16 @@ // Header Files //----------------------------------------------------------------------------- #include +#include -#include "linked_lists.h" #include "v3math.h" #include "v4math.h" #include "m4math.h" #include "llquaternion.h" #include "xform.h" -#include "lldarray.h" const S32 LL_CHARACTER_MAX_JOINTS_PER_MESH = 15; -const U32 LL_CHARACTER_MAX_JOINTS = 32; // must be divisible by 16! +const U32 LL_CHARACTER_MAX_JOINTS = 32; // must be divisible by 4! const U32 LL_HAND_JOINT_NUM = 31; const U32 LL_FACE_JOINT_NUM = 30; const S32 LL_CHARACTER_MAX_PRIORITY = 7; @@ -84,6 +83,7 @@ protected: LLXformMatrix mDefaultXform; LLUUID mId; + public: U32 mDirtyFlags; BOOL mUpdateXform; diff --git a/indra/llcharacter/llkeyframemotion.cpp b/indra/llcharacter/llkeyframemotion.cpp index 4be835dce..e223b329d 100644 --- a/indra/llcharacter/llkeyframemotion.cpp +++ b/indra/llcharacter/llkeyframemotion.cpp @@ -1047,7 +1047,8 @@ void LLKeyframeMotion::applyConstraint(JointConstraint* constraint, F32 time, U8 { case CONSTRAINT_TARGET_TYPE_GROUND: target_pos = mCharacter->getPosAgentFromGlobal(constraint->mGroundPos); -// llinfos << "Target Pos " << constraint->mGroundPos << " on " << mCharacter->findCollisionVolume(shared_data->mSourceConstraintVolume)->getName() << llendl; + target_pos += mCharacter->getHoverOffset(); +// LL_INFOS() << "Target Pos " << constraint->mGroundPos << " on " << mCharacter->findCollisionVolume(shared_data->mSourceConstraintVolume)->getName() << LL_ENDL; break; case CONSTRAINT_TARGET_TYPE_BODY: target_pos = mCharacter->getVolumePos(shared_data->mTargetConstraintVolume, shared_data->mTargetConstraintOffset); @@ -1111,7 +1112,7 @@ void LLKeyframeMotion::applyConstraint(JointConstraint* constraint, F32 time, U8 LLVector3 source_to_target = target_pos - keyframe_source_pos; - S32 max_iteration_count = llmath::llround(clamp_rescale( + S32 max_iteration_count = ll_round(clamp_rescale( mCharacter->getPixelArea(), MAX_PIXEL_AREA_CONSTRAINTS, MIN_PIXEL_AREA_CONSTRAINTS, diff --git a/indra/llcharacter/llmotioncontroller.cpp b/indra/llcharacter/llmotioncontroller.cpp index 2764405e5..03162ff94 100644 --- a/indra/llcharacter/llmotioncontroller.cpp +++ b/indra/llcharacter/llmotioncontroller.cpp @@ -876,12 +876,12 @@ void LLMotionController::updateMotions(bool force_update) // // This old code is nonsense. - //S32 quantum_count = llmax(0, llmath::llround((update_time - time_interval) / mTimeStep)) + 1; - // (update_time - time_interval) / mTimeStep is an integer! We need llround to get rid of floating point errors, not llfloor. - // Moreover, just rounding off to the nearest integer with llmath::llround(update_time / mTimeStep) makes a lot more sense: + //S32 quantum_count = llmax(0, ll_round((update_time - time_interval) / mTimeStep)) + 1; + // (update_time - time_interval) / mTimeStep is an integer! We need ll_round to get rid of floating point errors, not llfloor. + // Moreover, just rounding off to the nearest integer with ll_round(update_time / mTimeStep) makes a lot more sense: // it is the best we can do to get as close to what we should draw as possible. // However, mAnimTime may only be incremented; therefore make sure of that with the llmax. - S32 quantum_count = llmax(llmath::llround(update_time / mTimeStep), llceil(mAnimTime / mTimeStep)); + S32 quantum_count = llmax(ll_round(update_time / mTimeStep), llceil(mAnimTime / mTimeStep)); // if (quantum_count == mTimeStepCount) { diff --git a/indra/llcharacter/llmultigesture.cpp b/indra/llcharacter/llmultigesture.cpp index d8290681a..ef42576dc 100644 --- a/indra/llcharacter/llmultigesture.cpp +++ b/indra/llcharacter/llmultigesture.cpp @@ -49,6 +49,7 @@ LLMultiGesture::LLMultiGesture() mReplaceText(), mSteps(), mPlaying(FALSE), + mLocal(false), mCurrentStep(0), mDoneCallback(NULL) { @@ -63,6 +64,7 @@ LLMultiGesture::~LLMultiGesture() void LLMultiGesture::reset() { mPlaying = FALSE; + mLocal = false; mCurrentStep = 0; mWaitTimer.reset(); mWaitingTimer = FALSE; diff --git a/indra/llcharacter/llmultigesture.h b/indra/llcharacter/llmultigesture.h index 4c5a29cf0..8e4821357 100644 --- a/indra/llcharacter/llmultigesture.h +++ b/indra/llcharacter/llmultigesture.h @@ -79,6 +79,9 @@ public: // Is the gesture currently playing? BOOL mPlaying; + // Is the gesture to be played locally? + bool mLocal; + // "instruction pointer" for steps S32 mCurrentStep; diff --git a/indra/llcommon/CMakeLists.txt b/indra/llcommon/CMakeLists.txt index db4823329..23ffd221b 100644 --- a/indra/llcommon/CMakeLists.txt +++ b/indra/llcommon/CMakeLists.txt @@ -69,6 +69,7 @@ set(llcommon_SOURCE_FILES llmetrics.cpp llmortician.cpp lloptioninterface.cpp + llpredicate.cpp llprocesslauncher.cpp llprocessor.cpp llptrto.cpp @@ -177,7 +178,6 @@ set(llcommon_HEADER_FILES llformat.h llframetimer.h llhandle.h - llhash.h llheartbeat.h llhttpstatuscodes.h llindexedqueue.h @@ -199,6 +199,7 @@ set(llcommon_HEADER_FILES llnametable.h lloptioninterface.h llpointer.h + llpredicate.h llpreprocessor.h llpriqueuemap.h llprocesslauncher.h @@ -241,7 +242,6 @@ set(llcommon_HEADER_FILES lltypeinfolookup.h lluri.h lluuid.h - sguuidhash.h llversionviewer.h.in llworkerthread.h metaclass.h diff --git a/indra/llcommon/indra_constants.h b/indra/llcommon/indra_constants.h index ea8c91155..7e7bdaa85 100644 --- a/indra/llcommon/indra_constants.h +++ b/indra/llcommon/indra_constants.h @@ -140,10 +140,6 @@ const U32 DEFAULT_CGI_SERVICES_PORT = 12045; // on a single host for map tile generation. JC const U32 DEFAULT_MAPSERVER_PORT = 12124; -// For automatic port discovery when running multiple viewers on one host -const U32 PORT_DISCOVERY_RANGE_MIN = 13000; -const U32 PORT_DISCOVERY_RANGE_MAX = PORT_DISCOVERY_RANGE_MIN + 50; - const char LAND_LAYER_CODE = 'L'; const char WATER_LAYER_CODE = 'W'; const char WIND_LAYER_CODE = '7'; diff --git a/indra/llcommon/llatomic.h b/indra/llcommon/llatomic.h index 525deaa2a..3ffd7e125 100644 --- a/indra/llcommon/llatomic.h +++ b/indra/llcommon/llatomic.h @@ -50,7 +50,7 @@ #include "boost/atomic.hpp" template struct impl_atomic_type { typedef boost::atomic type; }; -#elif defined(USE_STD_ATOMIC) && (__cplusplus >= 201103L || _MSC_VER >= 1800) +#elif defined(USE_STD_ATOMIC) && defined(LL_CPP11) #include template struct impl_atomic_type { typedef std::atomic type; }; diff --git a/indra/llcommon/llbase32.h b/indra/llcommon/llbase32.h index 0697f7b8e..417cd930a 100644 --- a/indra/llcommon/llbase32.h +++ b/indra/llcommon/llbase32.h @@ -3,31 +3,25 @@ * @brief base32 encoding that returns a std::string * @author James Cook * - * $LicenseInfo:firstyear=2007&license=viewergpl$ - * - * Copyright (c) 2007-2009, Linden Research, Inc. - * + * $LicenseInfo:firstyear=2007&license=viewerlgpl$ * Second Life Viewer Source Code - * The source code in this file ("Source Code") is provided by Linden Lab - * to you under the terms of the GNU General Public License, version 2.0 - * ("GPL"), unless you have obtained a separate licensing agreement - * ("Other License"), formally executed by you and Linden Lab. Terms of - * the GPL can be found in doc/GPL-license.txt in this distribution, or - * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2 + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. * - * There are special exceptions to the terms and conditions of the GPL as - * it is applied to this Source Code. View the full text of the exception - * in the file doc/FLOSS-exception.txt in this software distribution, or - * online at - * http://secondlifegrid.net/programs/open_source/licensing/flossexception + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * By copying, modifying or distributing this software, you acknowledge - * that you have read and understood your obligations described above, - * and agree to abide by those obligations. - * - * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO - * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, - * COMPLETENESS OR PERFORMANCE. + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * $/LicenseInfo$ */ diff --git a/indra/llcommon/llbase64.cpp b/indra/llcommon/llbase64.cpp index 7020a79a2..4e75e4591 100644 --- a/indra/llcommon/llbase64.cpp +++ b/indra/llcommon/llbase64.cpp @@ -3,31 +3,25 @@ * @brief Wrapper for apr base64 encoding that returns a std::string * @author James Cook * - * $LicenseInfo:firstyear=2007&license=viewergpl$ - * - * Copyright (c) 2007-2009, Linden Research, Inc. - * + * $LicenseInfo:firstyear=2007&license=viewerlgpl$ * Second Life Viewer Source Code - * The source code in this file ("Source Code") is provided by Linden Lab - * to you under the terms of the GNU General Public License, version 2.0 - * ("GPL"), unless you have obtained a separate licensing agreement - * ("Other License"), formally executed by you and Linden Lab. Terms of - * the GPL can be found in doc/GPL-license.txt in this distribution, or - * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2 + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * There are special exceptions to the terms and conditions of the GPL as - * it is applied to this Source Code. View the full text of the exception - * in the file doc/FLOSS-exception.txt in this software distribution, or - * online at - * http://secondlifegrid.net/programs/open_source/licensing/flossexception - * - * By copying, modifying or distributing this software, you acknowledge - * that you have read and understood your obligations described above, - * and agree to abide by those obligations. - * - * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO - * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, - * COMPLETENESS OR PERFORMANCE. + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * $/LicenseInfo$ */ @@ -36,32 +30,72 @@ #include "llbase64.h" #include - #include "apr_base64.h" - // static std::string LLBase64::encode(const U8* input, size_t input_size) { - std::string output; - if (input - && input_size > 0) - { - // Yes, it returns int. - int b64_buffer_length = apr_base64_encode_len(input_size); - char* b64_buffer = new char[b64_buffer_length]; - - // This is faster than apr_base64_encode() if you know - // you're not on an EBCDIC machine. Also, the output is - // null terminated, even though the documentation doesn't - // specify. See apr_base64.c for details. JC - b64_buffer_length = apr_base64_encode_binary( - b64_buffer, - input, - input_size); - output.assign(b64_buffer); - delete[] b64_buffer; - } - return output; + if (!(input && input_size > 0)) return LLStringUtil::null; + + // Yes, it returns int. + int b64_buffer_length = apr_base64_encode_len(input_size); + char* b64_buffer = new char[b64_buffer_length]; + + // This is faster than apr_base64_encode() if you know + // you're not on an EBCDIC machine. Also, the output is + // null terminated, even though the documentation doesn't + // specify. See apr_base64.c for details. JC + b64_buffer_length = apr_base64_encode_binary( + b64_buffer, + input, + input_size); + std::string result; + result.assign(b64_buffer); + delete[] b64_buffer; + + return result; +} + +// static +std::string LLBase64::encode(const std::string& in_str) +{ + size_t data_size = in_str.size(); + std::vector data; + data.resize(data_size); + memcpy(&data[0], in_str.c_str(), data_size); + return encode(&data[0], data_size); +} + +// static +size_t LLBase64::decode(const std::string& input, U8 * buffer, size_t buffer_size) +{ + if (input.empty()) return 0; + + size_t bytes_written = apr_base64_decode_binary(buffer, input.data()); + + return bytes_written; +} + +std::string LLBase64::decode(const std::string& input) +{ + U32 buffer_len = LLBase64::requiredDecryptionSpace(input); + std::vector buffer(buffer_len); + buffer_len = LLBase64::decode(input, &buffer[0], buffer_len); + buffer.resize(buffer_len); + return std::string(reinterpret_cast(&buffer[0]), buffer_len); +} + +// static +size_t LLBase64::requiredDecryptionSpace(const std::string& str) +{ + size_t len = str.length(); + U32 padding = 0; + + if (str[len - 1] == '=' && str[len - 2] == '=') //last two chars are = + padding = 2; + else if (str[len - 1] == '=') //last char is = + padding = 1; + + return len * 0.75 - padding; } diff --git a/indra/llcommon/llbase64.h b/indra/llcommon/llbase64.h index c48fea247..74e5b4645 100644 --- a/indra/llcommon/llbase64.h +++ b/indra/llcommon/llbase64.h @@ -3,31 +3,25 @@ * @brief Wrapper for apr base64 encoding that returns a std::string * @author James Cook * - * $LicenseInfo:firstyear=2007&license=viewergpl$ - * - * Copyright (c) 2007-2009, Linden Research, Inc. - * + * $LicenseInfo:firstyear=2007&license=viewerlgpl$ * Second Life Viewer Source Code - * The source code in this file ("Source Code") is provided by Linden Lab - * to you under the terms of the GNU General Public License, version 2.0 - * ("GPL"), unless you have obtained a separate licensing agreement - * ("Other License"), formally executed by you and Linden Lab. Terms of - * the GPL can be found in doc/GPL-license.txt in this distribution, or - * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2 + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * There are special exceptions to the terms and conditions of the GPL as - * it is applied to this Source Code. View the full text of the exception - * in the file doc/FLOSS-exception.txt in this software distribution, or - * online at - * http://secondlifegrid.net/programs/open_source/licensing/flossexception - * - * By copying, modifying or distributing this software, you acknowledge - * that you have read and understood your obligations described above, - * and agree to abide by those obligations. - * - * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO - * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, - * COMPLETENESS OR PERFORMANCE. + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * $/LicenseInfo$ */ @@ -37,7 +31,11 @@ class LL_COMMON_API LLBase64 { public: + static std::string encode(const std::string& in_str); static std::string encode(const U8* input, size_t input_size); + static size_t decode(const std::string& input, U8 * buffer, size_t buffer_size); + static std::string decode(const std::string& input); + static size_t requiredDecryptionSpace(const std::string& str); }; #endif diff --git a/indra/llcommon/llhash.h b/indra/llcommon/llhash.h deleted file mode 100644 index 748bc9291..000000000 --- a/indra/llcommon/llhash.h +++ /dev/null @@ -1,72 +0,0 @@ -/** - * @file llhash.h - * @brief Wrapper for a hash function. - * - * $LicenseInfo:firstyear=2004&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2010, Linden Research, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; - * version 2.1 of the License only. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA - * $/LicenseInfo$ - */ - -#ifndef LL_LLHASH_H -#define LL_LLHASH_H - -#include "llpreprocessor.h" // for GCC_VERSION - -#if (LL_WINDOWS) -#include -#include -#elif LL_DARWIN || LL_LINUX -#if GCC_VERSION >= 40300 || LL_ICC || LL_CLANG// gcc 4.3 or icc 11 and up -# include -#elif GCC_VERSION >= 30400 // gcc 3.4 and up -# include -#elif __GNUC__ >= 3 -# include -#else -# include -#endif -#elif LL_SOLARIS -#include -#else -#error Please define your platform. -#endif - -// Warning - an earlier template-based version of this routine did not do -// the correct thing on Windows. Since this is only used to get -// a string hash, it was converted to a regular routine and -// unit tests added. - -inline size_t llhash( const char * value ) -{ -#if LL_WINDOWS - return stdext::hash_value(value); -#elif ( (defined _STLPORT_VERSION) || ((LL_LINUX) && (__GNUC__ <= 2)) ) - std::hash H; - return H(value); -#elif LL_DARWIN || LL_LINUX || LL_SOLARIS - __gnu_cxx::hash H; - return H(value); -#else -#error Please define your platform. -#endif -} - -#endif - diff --git a/indra/llcommon/llinitparam.cpp b/indra/llcommon/llinitparam.cpp index 89c831d29..dbd4eba7a 100644 --- a/indra/llcommon/llinitparam.cpp +++ b/indra/llcommon/llinitparam.cpp @@ -28,10 +28,17 @@ #include "linden_common.h" #include "llinitparam.h" +#include "llformat.h" namespace LLInitParam { + + predicate_rule_t default_parse_rules() + { + return ll_make_predicate(PROVIDED) && !ll_make_predicate(EMPTY); + } + // // Param // @@ -196,6 +203,9 @@ namespace LLInitParam bool BaseBlock::validateBlock(bool emit_errors) const { + // only validate block when it hasn't already passed validation with current data + if (!mValidated) + { const BlockDescriptor& block_data = mostDerivedBlockDescriptor(); for (BlockDescriptor::param_validation_list_t::const_iterator it = block_data.mValidationList.begin(); it != block_data.mValidationList.end(); ++it) { @@ -209,11 +219,18 @@ namespace LLInitParam return false; } } - return true; + mValidated = true; + } + return mValidated; } - void BaseBlock::serializeBlock(Parser& parser, Parser::name_stack_t& name_stack, const LLInitParam::BaseBlock* diff_block) const + bool BaseBlock::serializeBlock(Parser& parser, Parser::name_stack_t& name_stack, const predicate_rule_t predicate_rule, const LLInitParam::BaseBlock* diff_block) const { + bool serialized = false; + if (!predicate_rule.check(ll_make_predicate(PROVIDED, isProvided()))) + { + return false; + } // named param is one like LLView::Params::follows // unnamed param is like LLView::Params::rect - implicit const BlockDescriptor& block_data = mostDerivedBlockDescriptor(); @@ -225,10 +242,10 @@ namespace LLInitParam param_handle_t param_handle = (*it)->mParamHandle; const Param* param = getParamFromHandle(param_handle); ParamDescriptor::serialize_func_t serialize_func = (*it)->mSerializeFunc; - if (serialize_func) + if (serialize_func && predicate_rule.check(ll_make_predicate(PROVIDED, param->anyProvided()))) { const Param* diff_param = diff_block ? diff_block->getParamFromHandle(param_handle) : NULL; - serialize_func(*param, parser, name_stack, diff_param); + serialized |= serialize_func(*param, parser, name_stack, predicate_rule, diff_param); } } @@ -239,7 +256,7 @@ namespace LLInitParam param_handle_t param_handle = it->second->mParamHandle; const Param* param = getParamFromHandle(param_handle); ParamDescriptor::serialize_func_t serialize_func = it->second->mSerializeFunc; - if (serialize_func && param->anyProvided()) + if (serialize_func && predicate_rule.check(ll_make_predicate(PROVIDED, param->anyProvided()))) { // Ensure this param has not already been serialized // Prevents from being serialized as its own tag. @@ -264,10 +281,17 @@ namespace LLInitParam name_stack.push_back(std::make_pair(it->first, !duplicate)); const Param* diff_param = diff_block ? diff_block->getParamFromHandle(param_handle) : NULL; - serialize_func(*param, parser, name_stack, diff_param); + serialized |= serialize_func(*param, parser, name_stack, predicate_rule, diff_param); name_stack.pop_back(); } } + + if (!serialized && predicate_rule.check(ll_make_predicate(EMPTY))) + { + serialized |= parser.writeValue(Flag(), name_stack); + } + // was anything serialized in this block? + return serialized; } bool BaseBlock::inspectBlock(Parser& parser, Parser::name_stack_t name_stack, S32 min_count, S32 max_count) const diff --git a/indra/llcommon/llinitparam.h b/indra/llcommon/llinitparam.h index 7870fd750..24f59c44a 100644 --- a/indra/llcommon/llinitparam.h +++ b/indra/llcommon/llinitparam.h @@ -29,14 +29,17 @@ #define LL_LLPARAM_H #include +#include #include +#include #include #include #include -#include #include "llerror.h" #include "llstl.h" +#include "llpredicate.h" +#include "llsd.h" namespace LLTypeTags { @@ -195,6 +198,8 @@ namespace LLInitParam return mValue; } + bool isValid() const { return true; } + protected: T mValue; }; @@ -209,13 +214,11 @@ namespace LLInitParam typedef T value_t; ParamValue() - : T(), - mValidated(false) + : T() {} ParamValue(const default_value_t& other) - : T(other), - mValidated(false) + : T(other) {} void setValue(const value_t& val) @@ -232,9 +235,6 @@ namespace LLInitParam { return *this; } - - protected: - mutable bool mValidated; // lazy validation flag }; @@ -435,7 +435,7 @@ namespace LLInitParam typedef self_t type_value_t; TypeValuesHelper(const std::string& val) - : base_t(val) + : base_t::TypeValuesHelper(val) // Fix invalid blah gcc {} void operator ()(const std::string& name) @@ -579,6 +579,19 @@ namespace LLInitParam class Param; + enum ESerializePredicates + { + PROVIDED, + REQUIRED, + VALID, + HAS_DEFAULT_VALUE, + EMPTY + }; + + typedef LLPredicate::Rule predicate_rule_t; + + LL_COMMON_API predicate_rule_t default_parse_rules(); + // various callbacks and constraints associated with an individual param struct LL_COMMON_API ParamDescriptor { @@ -589,7 +602,7 @@ namespace LLInitParam typedef bool(*merge_func_t)(Param&, const Param&, bool); typedef bool(*deserialize_func_t)(Param&, Parser&, Parser::name_stack_range_t&, bool); - typedef void(*serialize_func_t)(const Param&, Parser&, Parser::name_stack_t&, const Param* diff_param); + typedef bool(*serialize_func_t)(const Param&, Parser&, Parser::name_stack_t&, const predicate_rule_t rules, const Param* diff_param); typedef void(*inspect_func_t)(const Param&, Parser&, Parser::name_stack_t&, S32 min_count, S32 max_count); typedef bool(*validation_func_t)(const Param*); @@ -829,12 +842,28 @@ namespace LLInitParam LOG_CLASS(BaseBlock); friend class Param; + BaseBlock() + : mValidated(false), + mParamProvided(false) + {} + virtual ~BaseBlock() {} bool submitValue(Parser::name_stack_t& name_stack, Parser& p, bool silent=false); param_handle_t getHandleFromParam(const Param* param) const; bool validateBlock(bool emit_errors = true) const; + bool isProvided() const + { + return mParamProvided; + } + + bool isValid() const + { + return validateBlock(false); + } + + Param* getParamFromHandle(const param_handle_t param_handle) { if (param_handle == 0) return NULL; @@ -852,10 +881,19 @@ namespace LLInitParam void addSynonym(Param& param, const std::string& synonym); // Blocks can override this to do custom tracking of changes - virtual void paramChanged(const Param& changed_param, bool user_provided) {} + virtual void paramChanged(const Param& changed_param, bool user_provided) + { + if (user_provided) + { + // a child param has been explicitly changed + // so *some* aspect of this block is now provided + mValidated = false; + mParamProvided = true; + } + } bool deserializeBlock(Parser& p, Parser::name_stack_range_t& name_stack_range, bool new_name); - void serializeBlock(Parser& p, Parser::name_stack_t& name_stack, const BaseBlock* diff_block = NULL) const; + bool serializeBlock(Parser& p, Parser::name_stack_t& name_stack, const predicate_rule_t rule, const BaseBlock* diff_block = NULL) const; bool inspectBlock(Parser& p, Parser::name_stack_t name_stack = Parser::name_stack_t(), S32 min_count = 0, S32 max_count = S32_MAX) const; virtual const BlockDescriptor& mostDerivedBlockDescriptor() const { return getBlockDescriptor(); } @@ -893,6 +931,9 @@ namespace LLInitParam return mergeBlock(block_data, source, overwrite); } + mutable bool mValidated; // lazy validation flag + bool mParamProvided; + private: const std::string& getParamName(const BlockDescriptor& block_data, const Param* paramp) const; }; @@ -986,6 +1027,8 @@ namespace LLInitParam bool isProvided() const { return Param::anyProvided(); } + bool isValid() const { return true; } + static bool deserializeParam(Param& param, Parser& parser, Parser::name_stack_range_t& name_stack_range, bool new_name) { self_t& typed_param = static_cast(param); @@ -1014,10 +1057,23 @@ namespace LLInitParam return false; } - static void serializeParam(const Param& param, Parser& parser, Parser::name_stack_t& name_stack, const Param* diff_param) + static bool serializeParam(const Param& param, Parser& parser, Parser::name_stack_t& name_stack, const predicate_rule_t predicate_rule, const Param* diff_param) { + bool serialized = false; const self_t& typed_param = static_cast(param); - if (!typed_param.isProvided()) return; + const self_t* diff_typed_param = static_cast(diff_param); + + LLPredicate::Value predicate; + if (diff_typed_param && ParamCompare::equals(typed_param.getValue(), diff_typed_param->getValue())) + { + predicate.set(HAS_DEFAULT_VALUE); + } + + predicate.set(VALID, typed_param.isValid()); + predicate.set(PROVIDED, typed_param.anyProvided()); + predicate.set(EMPTY, false); + + if (!predicate_rule.check(predicate)) return false; if (!name_stack.empty()) { @@ -1030,25 +1086,27 @@ namespace LLInitParam if (!key.empty()) { - if (!diff_param || !ParamCompare::equals(static_cast(diff_param)->getValueName(), key)) + if (!diff_typed_param || !ParamCompare::equals(diff_typed_param->getValueName(), key)) { - parser.writeValue(key, name_stack); + serialized = parser.writeValue(key, name_stack); } } // then try to serialize value directly - else if (!diff_param || !ParamCompare::equals(typed_param.getValue(), static_cast(diff_param)->getValue())) + else if (!diff_typed_param || ParamCompare::equals(typed_param.getValue(), diff_typed_param->getValue())) { - if (!parser.writeValue(typed_param.getValue(), name_stack)) + serialized = parser.writeValue(typed_param.getValue(), name_stack); + if (!serialized) { std::string calculated_key = typed_param.calcValueName(typed_param.getValue()); if (calculated_key.size() - && (!diff_param + && (!diff_typed_param || !ParamCompare::equals(static_cast(diff_param)->getValueName(), calculated_key))) { - parser.writeValue(calculated_key, name_stack); + serialized = parser.writeValue(calculated_key, name_stack); } } } + return serialized; } static void inspectParam(const Param& param, Parser& parser, Parser::name_stack_t& name_stack, S32 min_count, S32 max_count) @@ -1065,7 +1123,7 @@ namespace LLInitParam void set(const value_t& val, bool flag_as_provided = true) { named_value_t::clearValueName(); - this->setValue(val); + named_value_t::setValue(val); setProvided(flag_as_provided); } @@ -1113,15 +1171,15 @@ namespace LLInitParam }; // parameter that is a block - template - class TypedParam + template + class TypedParam : public Param, public NAME_VALUE_LOOKUP::type_value_t { protected: - typedef ParamValue::value_t> param_value_t; + typedef ParamValue::value_t> param_value_t; typedef typename param_value_t::default_value_t default_value_t; - typedef TypedParam self_t; + typedef TypedParam self_t; typedef typename NAME_VALUE_LOOKUP::type_value_t named_value_t; public: using named_value_t::operator(); @@ -1166,10 +1224,16 @@ namespace LLInitParam return false; } - static void serializeParam(const Param& param, Parser& parser, Parser::name_stack_t& name_stack, const Param* diff_param) + static bool serializeParam(const Param& param, Parser& parser, Parser::name_stack_t& name_stack, const predicate_rule_t predicate_rule, const Param* diff_param) { const self_t& typed_param = static_cast(param); - if (!typed_param.isProvided()) return; + + LLPredicate::Value predicate; + + predicate.set(VALID, typed_param.isValid()); + predicate.set(PROVIDED, typed_param.anyProvided()); + + if (!predicate_rule.check(predicate)) return false; if (!name_stack.empty()) { @@ -1182,12 +1246,15 @@ namespace LLInitParam if (!diff_param || !ParamCompare::equals(static_cast(diff_param)->getValueName(), key)) { parser.writeValue(key, name_stack); + return true; } } else { - typed_param.serializeBlock(parser, name_stack, static_cast(diff_param)); + return typed_param.serializeBlock(parser, name_stack, predicate_rule, static_cast(diff_param)); } + + return false; } static void inspectParam(const Param& param, Parser& parser, Parser::name_stack_t& name_stack, S32 min_count, S32 max_count) @@ -1209,23 +1276,19 @@ namespace LLInitParam // *and* the block as a whole validates bool isProvided() const { - // only validate block when it hasn't already passed validation with current data - if (Param::anyProvided() && !param_value_t::mValidated) - { - // a sub-block is "provided" when it has been filled in enough to be valid - param_value_t::mValidated = param_value_t::validateBlock(false); - } - return Param::anyProvided() && param_value_t::mValidated; + return Param::anyProvided() && isValid(); + } + + bool isValid() const + { + return param_value_t::isValid(); } // assign block contents to this param-that-is-a-block void set(const value_t& val, bool flag_as_provided = true) { - this->setValue(val); + named_value_t::setValue(val); named_value_t::clearValueName(); - // force revalidation of block - // next call to isProvided() will update provision status based on validity - param_value_t::mValidated = false; setProvided(flag_as_provided); } @@ -1242,9 +1305,6 @@ namespace LLInitParam if (user_provided) { - // a child param has been explicitly changed - // so *some* aspect of this block is now provided - param_value_t::mValidated = false; setProvided(); named_value_t::clearValueName(); } @@ -1296,13 +1356,13 @@ namespace LLInitParam }; // list of non-block parameters - template - class TypedParam + template + class TypedParam : public Param { protected: - typedef TypedParam self_t; - typedef ParamValue::value_t> param_value_t; + typedef TypedParam self_t; + typedef ParamValue::value_t> param_value_t; typedef typename std::vector container_t; typedef container_t default_value_t; typedef typename NAME_VALUE_LOOKUP::type_value_t named_value_t; @@ -1311,7 +1371,9 @@ namespace LLInitParam typedef typename param_value_t::value_t value_t; TypedParam(BlockDescriptor& block_descriptor, const char* name, const default_value_t& value, ParamDescriptor::validation_func_t validate_func, S32 min_count, S32 max_count) - : Param(block_descriptor.mCurrentBlockPtr) + : Param(block_descriptor.mCurrentBlockPtr), + mMinCount(min_count), + mMaxCount(max_count) { std::copy(value.begin(), value.end(), std::back_inserter(mValues)); @@ -1322,7 +1384,13 @@ namespace LLInitParam } } - bool isProvided() const { return Param::anyProvided(); } + bool isProvided() const { return Param::anyProvided() && isValid(); } + + bool isValid() const + { + size_t num_elements = numValidElements(); + return mMinCount < num_elements && num_elements < mMaxCount; + } static bool deserializeParam(Param& param, Parser& parser, Parser::name_stack_range_t& name_stack_range, bool new_name) { @@ -1337,7 +1405,7 @@ namespace LLInitParam } // no further names in stack, attempt to parse value now - if (name_stack_range.first == name_stack_range.second) + if (new_name_stack_range.first == new_name_stack_range.second) { std::string name; @@ -1359,10 +1427,19 @@ namespace LLInitParam return false; } - static void serializeParam(const Param& param, Parser& parser, Parser::name_stack_t& name_stack, const Param* diff_param) + static bool serializeParam(const Param& param, Parser& parser, Parser::name_stack_t& name_stack, const predicate_rule_t predicate_rule, const Param* diff_param) { + bool serialized = false; const self_t& typed_param = static_cast(param); - if (!typed_param.isProvided()) return; + + LLPredicate::Value predicate; + + predicate.set(REQUIRED, typed_param.mMinCount > 0); + predicate.set(VALID, typed_param.isValid()); + predicate.set(PROVIDED, typed_param.anyProvided()); + predicate.set(EMPTY, typed_param.mValues.empty()); + + if (!predicate_rule.check(predicate)) return false; for (const_iterator it = typed_param.mValues.begin(), end_it = typed_param.mValues.end(); it != end_it; @@ -1378,7 +1455,11 @@ namespace LLInitParam if (!value_written) { std::string calculated_key = it->calcValueName(it->getValue()); - if (!parser.writeValue(calculated_key, name_stack)) + if (parser.writeValue(calculated_key, name_stack)) + { + serialized = true; + } + else { break; } @@ -1386,19 +1467,23 @@ namespace LLInitParam } else { - if(!parser.writeValue(key, name_stack)) + if(parser.writeValue(key, name_stack)) + { + serialized = true; + } + else { break; } } - - name_stack.pop_back(); } + + return serialized; } static void inspectParam(const Param& param, Parser& parser, Parser::name_stack_t& name_stack, S32 min_count, S32 max_count) { - parser.inspectValue(name_stack, min_count, max_count, NULL); + parser.inspectValue(name_stack, min_count, max_count, NULL); if (named_value_t::getPossibleValues()) { parser.inspectValue(name_stack, min_count, max_count, named_value_t::getPossibleValues()); @@ -1453,7 +1538,7 @@ namespace LLInitParam bool empty() const { return mValues.empty(); } size_t size() const { return mValues.size(); } - U32 numValidElements() const + size_t numValidElements() const { return mValues.size(); } @@ -1483,6 +1568,8 @@ namespace LLInitParam } container_t mValues; + size_t mMinCount, + mMaxCount; private: void init( BlockDescriptor &block_descriptor, ParamDescriptor::validation_func_t validate_func, S32 min_count, S32 max_count, const char* name ) @@ -1500,13 +1587,13 @@ namespace LLInitParam }; // list of block parameters - template - class TypedParam + template + class TypedParam : public Param { protected: - typedef TypedParam self_t; - typedef ParamValue::value_t> param_value_t; + typedef TypedParam self_t; + typedef ParamValue::value_t> param_value_t; typedef typename std::vector container_t; typedef typename NAME_VALUE_LOOKUP::type_value_t named_value_t; typedef container_t default_value_t; @@ -1516,7 +1603,9 @@ namespace LLInitParam typedef typename param_value_t::value_t value_t; TypedParam(BlockDescriptor& block_descriptor, const char* name, const default_value_t& value, ParamDescriptor::validation_func_t validate_func, S32 min_count, S32 max_count) - : Param(block_descriptor.mCurrentBlockPtr) + : Param(block_descriptor.mCurrentBlockPtr), + mMinCount(min_count), + mMaxCount(max_count) { std::copy(value.begin(), value.end(), back_inserter(mValues)); @@ -1526,7 +1615,14 @@ namespace LLInitParam } } - bool isProvided() const { return Param::anyProvided(); } + bool isProvided() const { return Param::anyProvided() && isValid(); } + + bool isValid() const + { + size_t num_elements = numValidElements(); + return mMinCount < num_elements && num_elements < mMaxCount; + } + static bool deserializeParam(Param& param, Parser& parser, Parser::name_stack_range_t& name_stack_range, bool new_name) { @@ -1549,7 +1645,7 @@ namespace LLInitParam } param_value_t& value = typed_param.mValues.back(); - if (name_stack_range.first == name_stack_range.second) + if (new_name_stack_range.first == new_name_stack_range.second) { // try to parse a known named value std::string name; @@ -1559,6 +1655,10 @@ namespace LLInitParam { typed_param.mValues.back().setValueName(name); typed_param.setProvided(); + if (new_array_value) + { + name_stack_range.first->second = false; + } return true; } } @@ -1583,10 +1683,18 @@ namespace LLInitParam return false; } - static void serializeParam(const Param& param, Parser& parser, Parser::name_stack_t& name_stack, const Param* diff_param) + static bool serializeParam(const Param& param, Parser& parser, Parser::name_stack_t& name_stack, const predicate_rule_t predicate_rule, const Param* diff_param) { + bool serialized = false; const self_t& typed_param = static_cast(param); - if (!typed_param.isProvided()) return; + LLPredicate::Value predicate; + + predicate.set(REQUIRED, typed_param.mMinCount > 0); + predicate.set(VALID, typed_param.isValid()); + predicate.set(PROVIDED, typed_param.anyProvided()); + predicate.set(EMPTY, typed_param.mValues.empty()); + + if (!predicate_rule.check(predicate)) return false; for (const_iterator it = typed_param.mValues.begin(), end_it = typed_param.mValues.end(); it != end_it; @@ -1597,17 +1705,24 @@ namespace LLInitParam std::string key = it->getValueName(); if (!key.empty()) { - parser.writeValue(key, name_stack); + serialized |= parser.writeValue(key, name_stack); } // Not parsed via named values, write out value directly - // NOTE: currently we don't worry about removing default values in Multiple + // NOTE: currently we don't do diffing of Multiples else { - it->serializeBlock(parser, name_stack, NULL); + serialized = it->serializeBlock(parser, name_stack, predicate_rule, NULL); } name_stack.pop_back(); } + + if (!serialized && predicate_rule.check(ll_make_predicate(EMPTY))) + { + serialized |= parser.writeValue(Flag(), name_stack); + } + + return serialized; } static void inspectParam(const Param& param, Parser& parser, Parser::name_stack_t& name_stack, S32 min_count, S32 max_count) @@ -1670,14 +1785,14 @@ namespace LLInitParam bool empty() const { return mValues.empty(); } size_t size() const { return mValues.size(); } - U32 numValidElements() const + size_t numValidElements() const { - U32 count = 0; + size_t count = 0; for (const_iterator it = mValues.begin(), end_it = mValues.end(); it != end_it; ++it) { - if(it->validateBlock(false)) count++; + if(it->isValid()) count++; } return count; } @@ -1709,6 +1824,8 @@ namespace LLInitParam } container_t mValues; + size_t mMinCount, + mMaxCount; private: void init( BlockDescriptor &block_descriptor, ParamDescriptor::validation_func_t validate_func, S32 min_count, S32 max_count, const char* name ) @@ -1937,7 +2054,7 @@ namespace LLInitParam Optional& operator =(const value_t& val) { - this->set(val); + super_t::set(val); return *this; } @@ -1967,7 +2084,7 @@ namespace LLInitParam Mandatory& operator =(const value_t& val) { - this->set(val); + super_t::set(val); return *this; } @@ -2003,7 +2120,7 @@ namespace LLInitParam Multiple& operator =(const container_t& val) { - set(val); + super_t::set(val); return *this; } @@ -2015,7 +2132,7 @@ namespace LLInitParam static bool validate(const Param* paramp) { - U32 num_valid = ((super_t*)paramp)->numValidElements(); + size_t num_valid = ((super_t*)paramp)->numValidElements(); return RANGE::minCount <= num_valid && num_valid <= RANGE::maxCount; } }; @@ -2158,13 +2275,11 @@ namespace LLInitParam typedef T default_value_t; ParamValue() - : mValue(), - mValidated(false) + : mValue() {} ParamValue(const default_value_t& value) - : mValue(value), - mValidated(false) + : mValue(value) {} void setValue(const value_t& val) @@ -2191,12 +2306,12 @@ namespace LLInitParam return mValue.deserializeBlock(p, name_stack_range, new_name); } - void serializeBlock(Parser& p, Parser::name_stack_t& name_stack, const self_t* diff_block = NULL) const + bool serializeBlock(Parser& p, Parser::name_stack_t& name_stack, const predicate_rule_t predicate_rule, const self_t* diff_block = NULL) const { const BaseBlock* base_block = diff_block ? &(diff_block->mValue) : NULL; - mValue.serializeBlock(p, name_stack, base_block); + return mValue.serializeBlock(p, name_stack, predicate_rule, base_block); } bool inspectBlock(Parser& p, Parser::name_stack_t name_stack = Parser::name_stack_t(), S32 min_count = 0, S32 max_count = S32_MAX) const @@ -2213,8 +2328,6 @@ namespace LLInitParam resetToDefault(); return mValue.mergeBlock(block_data, source.getValue(), overwrite); } - - return mValue.mergeBlock(block_data, source.getValue(), overwrite); } @@ -2223,14 +2336,17 @@ namespace LLInitParam return mValue.validateBlock(emit_errors); } + bool isValid() const + { + return validateBlock(false); + } + static BlockDescriptor& getBlockDescriptor() { return value_t::getBlockDescriptor(); } - mutable bool mValidated; // lazy validation flag - private: void resetToDefault() { @@ -2251,15 +2367,13 @@ namespace LLInitParam typedef T default_value_t; ParamValue() - : mValue(), - mValidated(false) + : mValue() { mCurParam = getBlockDescriptor().mAllParams.begin(); } ParamValue(const default_value_t& value) - : mValue(value), - mValidated(false) + : mValue(value) { mCurParam = getBlockDescriptor().mAllParams.begin(); } @@ -2311,12 +2425,12 @@ namespace LLInitParam } } - void serializeBlock(Parser& p, Parser::name_stack_t& name_stack, const self_t* diff_block = NULL) const + bool serializeBlock(Parser& p, Parser::name_stack_t& name_stack, const predicate_rule_t predicate_rule, const self_t* diff_block = NULL) const { const BaseBlock* base_block = diff_block ? &(diff_block->mValue) : NULL; - mValue.serializeBlock(p, name_stack, base_block); + return mValue.serializeBlock(p, name_stack, predicate_rule, base_block); } bool inspectBlock(Parser& p, Parser::name_stack_t name_stack = Parser::name_stack_t(), S32 min_count = 0, S32 max_count = S32_MAX) const @@ -2334,13 +2448,16 @@ namespace LLInitParam return mValue.validateBlock(emit_errors); } + bool isValid() const + { + return validateBlock(false); + } + static BlockDescriptor& getBlockDescriptor() { return value_t::getBlockDescriptor(); } - mutable bool mValidated; // lazy validation flag - private: BlockDescriptor::all_params_list_t::iterator mCurParam; @@ -2358,16 +2475,14 @@ namespace LLInitParam typedef T default_value_t; ParamValue() - : T(), - mValidated(false) + : T() {} ParamValue(const default_value_t& value) - : T(value.getValue()), - mValidated(false) + : T(value.getValue()) {} - mutable bool mValidated; // lazy validation flag + bool isValid() const { return true; } }; template @@ -2380,18 +2495,15 @@ namespace LLInitParam typedef LazyValue default_value_t; ParamValue() - : mValue(), - mValidated(false) + : mValue() {} ParamValue(const default_value_t& other) - : mValue(other), - mValidated(false) + : mValue(other) {} ParamValue(const T& value) - : mValue(value), - mValidated(false) + : mValue(value) {} void setValue(const value_t& val) @@ -2414,14 +2526,14 @@ namespace LLInitParam return mValue.get().deserializeBlock(p, name_stack_range, new_name); } - void serializeBlock(Parser& p, Parser::name_stack_t& name_stack, const self_t* diff_block = NULL) const + bool serializeBlock(Parser& p, Parser::name_stack_t& name_stack, const predicate_rule_t predicate_rule, const self_t* diff_block = NULL) const { - if (mValue.empty()) return; + if (mValue.empty()) return false; const BaseBlock* base_block = (diff_block && !diff_block->mValue.empty()) ? &(diff_block->mValue.get().getValue()) : NULL; - mValue.get().serializeBlock(p, name_stack, base_block); + return mValue.get().serializeBlock(p, name_stack, predicate_rule, base_block); } bool inspectBlock(Parser& p, Parser::name_stack_t name_stack = Parser::name_stack_t(), S32 min_count = 0, S32 max_count = S32_MAX) const @@ -2439,13 +2551,16 @@ namespace LLInitParam return mValue.empty() || mValue.get().validateBlock(emit_errors); } + bool isValid() const + { + return validateBlock(false); + } + static BlockDescriptor& getBlockDescriptor() { return value_t::getBlockDescriptor(); } - mutable bool mValidated; // lazy validation flag - private: LazyValue mValue; }; @@ -2460,18 +2575,15 @@ namespace LLInitParam typedef LazyValue default_value_t; ParamValue() - : mValue(), - mValidated(false) + : mValue() {} ParamValue(const default_value_t& other) - : mValue(other), - mValidated(false) + : mValue(other) {} ParamValue(const T& value) - : mValue(value), - mValidated(false) + : mValue(value) {} void setValue(const value_t& val) @@ -2489,7 +2601,10 @@ namespace LLInitParam return mValue.get().getValue(); } - mutable bool mValidated; // lazy validation flag + bool isValid() const + { + return true; + } private: LazyValue mValue; @@ -2504,12 +2619,10 @@ namespace LLInitParam typedef LLSD default_value_t; ParamValue() - : mValidated(false) {} ParamValue(const default_value_t& other) - : mValue(other), - mValidated(false) + : mValue(other) {} void setValue(const value_t& val) { mValue = val; } @@ -2519,16 +2632,13 @@ namespace LLInitParam // block param interface LL_COMMON_API bool deserializeBlock(Parser& p, Parser::name_stack_range_t& name_stack_range, bool new_name); - LL_COMMON_API void serializeBlock(Parser& p, Parser::name_stack_t& name_stack, const BaseBlock* diff_block = NULL) const; + LL_COMMON_API bool serializeBlock(Parser& p, Parser::name_stack_t& name_stack, const predicate_rule_t predicate_rule, const BaseBlock* diff_block = NULL) const; bool inspectBlock(Parser& p, Parser::name_stack_t name_stack = Parser::name_stack_t(), S32 min_count = 0, S32 max_count = S32_MAX) const { //TODO: implement LLSD params as schema type Any return true; } - protected: - mutable bool mValidated; // lazy validation flag - private: static void serializeElement(Parser& p, const LLSD& sd, Parser::name_stack_t& name_stack); @@ -2547,9 +2657,9 @@ namespace LLInitParam BLOCK_AUTHORITATIVE // mValue is derived from the block parameters, which are authoritative } EValueAge; - typedef ParamValue derived_t; + typedef TypeValues derived_t; typedef CustomParamValue self_t; - typedef Block block_t; + typedef Block > block_t; typedef T default_value_t; typedef T value_t; typedef void baseblock_base_class_t; @@ -2557,8 +2667,7 @@ namespace LLInitParam CustomParamValue(const default_value_t& value = T()) : mValue(value), - mValueAge(VALUE_AUTHORITATIVE), - mValidated(false) + mValueAge(VALUE_AUTHORITATIVE) {} bool deserializeBlock(Parser& parser, Parser::name_stack_range_t& name_stack_range, bool new_name) @@ -2580,16 +2689,30 @@ namespace LLInitParam return typed_param.BaseBlock::deserializeBlock(parser, name_stack_range, new_name); } - void serializeBlock(Parser& parser, Parser::name_stack_t& name_stack, const BaseBlock* diff_block = NULL) const + bool serializeBlock(Parser& parser, Parser::name_stack_t& name_stack, const predicate_rule_t predicate_rule, const BaseBlock* diff_block = NULL) const { const derived_t& typed_param = static_cast(*this); const derived_t* diff_param = static_cast(diff_block); + //std::string key = typed_param.getValueName(); + + //// first try to write out name of name/value pair + //if (!key.empty()) + //{ + // if (!diff_param || !ParamCompare::equals(diff_param->getValueName(), key)) + // { + // return parser.writeValue(key, name_stack); + // } + //} // then try to serialize value directly if (!diff_param || !ParamCompare::equals(typed_param.getValue(), diff_param->getValue())) { - if (!parser.writeValue(typed_param.getValue(), name_stack)) + if (parser.writeValue(typed_param.getValue(), name_stack)) + { + return true; + } + else { //RN: *always* serialize provided components of BlockValue (don't pass diff_param on), // since these tend to be viewed as the constructor arguments for the value T. It seems @@ -2606,14 +2729,15 @@ namespace LLInitParam // and serialize those params derived_t copy(typed_param); copy.updateBlockFromValue(true); - copy.block_t::serializeBlock(parser, name_stack, NULL); + return copy.block_t::serializeBlock(parser, name_stack, predicate_rule, NULL); } else { - block_t::serializeBlock(parser, name_stack, NULL); + return block_t::serializeBlock(parser, name_stack, predicate_rule, NULL); } } } + return false; } bool validateBlock(bool emit_errors = true) const @@ -2705,8 +2829,6 @@ namespace LLInitParam return block_t::mergeBlock(block_data, source, overwrite); } - mutable bool mValidated; // lazy validation flag - private: mutable T mValue; mutable EValueAge mValueAge; diff --git a/indra/llcommon/llpredicate.cpp b/indra/llcommon/llpredicate.cpp new file mode 100644 index 000000000..1278948e2 --- /dev/null +++ b/indra/llcommon/llpredicate.cpp @@ -0,0 +1,41 @@ +/** + * @file llpredicate.cpp + * @brief abstraction for filtering objects by predicates, with arbitrary boolean expressions + * + * $LicenseInfo:firstyear=2008&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ +#include "linden_common.h" + +#include "llpredicate.h" + +namespace LLPredicate +{ + const U32 cPredicateFlagsFromEnum[5] = + { + 0xAAAAaaaa, // 10101010101010101010101010101010 + 0xCCCCcccc, // 11001100110011001100110011001100 + 0xF0F0F0F0, // 11110000111100001111000011110000 + 0xFF00FF00, // 11111111000000001111111100000000 + 0xFFFF0000 // 11111111111111110000000000000000 + }; +} + diff --git a/indra/llcommon/llpredicate.h b/indra/llcommon/llpredicate.h new file mode 100644 index 000000000..a8300fc9b --- /dev/null +++ b/indra/llcommon/llpredicate.h @@ -0,0 +1,210 @@ +/** + * @file llpredicate.h + * @brief abstraction for filtering objects by predicates, with arbitrary boolean expressions + * + * $LicenseInfo:firstyear=2008&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ + +#ifndef LL_LLPREDICATE_H +#define LL_LLPREDICATE_H + +#include "llerror.h" + +namespace LLPredicate +{ + template class Rule; + + extern LL_COMMON_API const U32 cPredicateFlagsFromEnum[5]; + + template + class Value + { + public: + typedef U32 predicate_flag_t; + static const S32 cMaxEnum = 5; + + Value(ENUM e, bool predicate_value = true) + : mPredicateFlags(predicate_value ? cPredicateFlagsFromEnum[e] : ~cPredicateFlagsFromEnum[e]) + { + llassert(0 <= e && e < cMaxEnum); + } + + Value() + : mPredicateFlags(0xFFFFffff) + {} + + Value operator!() const + { + Value new_value; + new_value.mPredicateFlags = ~mPredicateFlags; + return new_value; + } + + Value operator &&(const Value other) const + { + Value new_value; + new_value.mPredicateFlags = mPredicateFlags & other.mPredicateFlags; + return new_value; + } + + Value operator ||(const Value other) const + { + Value new_value; + new_value.mPredicateFlags = mPredicateFlags | other.mPredicateFlags; + return new_value; + } + + void set(ENUM e, bool value = true) + { + llassert(0 <= e && e < cMaxEnum); + predicate_flag_t flags_to_modify; + predicate_flag_t mask = cPredicateFlagsFromEnum[e]; + if (value) + { // add predicate "e" to flags that don't contain it already + flags_to_modify = (mPredicateFlags & ~mask); + // clear flags not containing e + mPredicateFlags &= mask; + // add back flags shifted to contain e + mPredicateFlags |= flags_to_modify << (0x1 << e); + } + else + { // remove predicate "e" from flags that contain it + flags_to_modify = (mPredicateFlags & mask); + // clear flags containing e + mPredicateFlags &= ~mask; + // add back flags shifted to not contain e + mPredicateFlags |= flags_to_modify >> (0x1 << e); + } + } + + void forget(ENUM e) + { + set(e, true); + U32 flags_with_predicate = mPredicateFlags; + set(e, false); + // ambiguous value is result of adding and removing predicate at the same time! + mPredicateFlags |= flags_with_predicate; + } + + bool allSet() const + { + return mPredicateFlags == ~0; + } + + bool noneSet() const + { + return mPredicateFlags == 0; + } + + bool someSet() const + { + return mPredicateFlags != 0; + } + + private: + predicate_flag_t mPredicateFlags; + }; + + template + class Rule + { + public: + Rule(ENUM value) + : mRule(value) + {} + + Rule(const Value other) + : mRule(other) + {} + + Rule() + {} + + void require(ENUM e, bool match) + { + mRule.set(e, match); + } + + void allow(ENUM e) + { + mRule.forget(e); + } + + bool check(const Value value) const + { + return (mRule && value).someSet(); + } + + bool requires(const Value value) const + { + return (mRule && value).someSet() && (!mRule && value).noneSet(); + } + + bool isAmbivalent(const Value value) const + { + return (mRule && value).someSet() && (!mRule && value).someSet(); + } + + bool acceptsAll() const + { + return mRule.allSet(); + } + + bool acceptsNone() const + { + return mRule.noneSet(); + } + + Rule operator!() const + { + Rule new_rule; + new_rule.mRule = !mRule; + return new_rule; + } + + Rule operator &&(const Rule other) const + { + Rule new_rule; + new_rule.mRule = mRule && other.mRule; + return new_rule; + } + + Rule operator ||(const Rule other) const + { + Rule new_rule; + new_rule.mRule = mRule || other.mRule; + return new_rule; + } + + private: + Value mRule; + }; +} + +template +LLPredicate::Value ll_make_predicate(ENUM e, bool predicate_value = true) +{ + return LLPredicate::Value(e, predicate_value); +} + + +#endif // LL_LLPREDICATE_H diff --git a/indra/llcommon/llpreprocessor.h b/indra/llcommon/llpreprocessor.h index a6f5f9fa9..84087cee3 100644 --- a/indra/llcommon/llpreprocessor.h +++ b/indra/llcommon/llpreprocessor.h @@ -80,8 +80,8 @@ #define LL_CLANG 1 #endif #elif defined (__ICC) - #ifndef LL_ICC - #define LL_ICC 1 + #ifndef LL_INTELC + #define LL_INTELC 1 #endif #elif defined(__GNUC__) #define GCC_VERSION (__GNUC__ * 10000 \ @@ -94,9 +94,6 @@ #ifndef LL_MSVC #define LL_MSVC 1 #endif - #if _MSC_VER < 1400 - #define LL_MSVC7 //Visual C++ 2003 or earlier - #endif #endif // Deal with minor differences on Unixy OSes. @@ -112,6 +109,16 @@ #endif +// Check for C++11 support +#if __cplusplus >= 201100L || _MSC_VER >= 1800 +# define LL_CPP11 +#endif + +#if LL_WINDOWS +# define LL_THREAD_LOCAL __declspec(thread) +#else +# define LL_THREAD_LOCAL __thread +#endif // Static linking with apr on windows needs to be declared. #if LL_WINDOWS && !LL_COMMON_LINK_SHARED @@ -142,7 +149,7 @@ #pragma warning( 3 : 4265 ) // "class has virtual functions, but destructor is not virtual" #pragma warning( 3 : 4266 ) // 'function' : no override available for virtual member function from base 'type'; function is hidden #pragma warning (disable : 4180) // qualifier applied to function type has no meaning; ignored -#pragma warning( disable : 4284 ) // silly MS warning deep inside their include file +//#pragma warning( disable : 4284 ) // silly MS warning deep inside their include file #pragma warning( disable : 4503 ) // 'decorated name length exceeded, name was truncated'. Does not seem to affect compilation. #pragma warning( disable : 4800 ) // 'BOOL' : forcing value to bool 'true' or 'false' (performance warning) #pragma warning( disable : 4996 ) // warning: deprecated @@ -161,6 +168,12 @@ #pragma warning (disable : 4251) // member needs to have dll-interface to be used by clients of class #pragma warning (disable : 4275) // non dll-interface class used as base for dll-interface class +//#pragma warning (disable : 4018) // '<' : signed/unsigned mismatch + +#if _WIN64 +#pragma warning (disable : 4267) // member needs to have dll-interface to be used by clients of class +#endif + #endif // LL_MSVC #if LL_WINDOWS @@ -198,4 +211,23 @@ #endif #endif +#if defined(LL_WINDOWS) || __cplusplus >= 201103L +# define LL_TYPEOF(exp) decltype(exp) +#else +# define LL_TYPEOF(exp) typeof(exp) +#endif + +#define LL_TO_STRING_HELPER(x) #x +#define LL_TO_STRING(x) LL_TO_STRING_HELPER(x) +#define LL_FILE_LINENO_MSG(msg) __FILE__ "(" LL_TO_STRING(__LINE__) ") : " msg +#define LL_GLUE_IMPL(x, y) x##y +#define LL_GLUE_TOKENS(x, y) LL_GLUE_IMPL(x, y) + +#if LL_WINDOWS +#define LL_COMPILE_TIME_MESSAGE(msg) __pragma(message(LL_FILE_LINENO_MSG(msg))) +#else +// no way to get gcc 4.2 to print a user-defined diagnostic message only when a macro is used +#define LL_COMPILE_TIME_MESSAGE(msg) +#endif + #endif // not LL_LINDEN_PREPROCESSOR_H diff --git a/indra/llcommon/llprocessor.cpp b/indra/llcommon/llprocessor.cpp index e39fa373d..d5ec7b075 100644 --- a/indra/llcommon/llprocessor.cpp +++ b/indra/llcommon/llprocessor.cpp @@ -49,10 +49,10 @@ # define LL_X86 1 #elif LL_MSVC && _M_IX86 # define LL_X86 1 -#elif LL_GNUC || LL_ICC || LL_CLANG && ( defined(__amd64__) || defined(__x86_64__) ) +#elif LL_GNUC || LL_CLANG || LL_INTELC && ( defined(__amd64__) || defined(__x86_64__) ) # define LL_X86_64 1 # define LL_X86 1 -#elif LL_GNUC || LL_ICC || LL_CLANG && ( defined(__i386__) ) +#elif LL_GNUC || LL_CLANG || LL_INTELC && ( defined(__i386__) ) # define LL_X86 1 #elif LL_GNUC && ( defined(__powerpc__) || defined(__ppc__) ) # define LL_PPC 1 @@ -202,6 +202,7 @@ namespace case 6: return "AMD K7"; case 0xF: return "AMD K8"; case 0x10: return "AMD K8L"; + case 0x15: return "AMD Bulldozer"; } return "Unknown"; } @@ -418,8 +419,8 @@ static F64 calculate_cpu_frequency(U32 measure_msecs) HANDLE hThread = GetCurrentThread(); unsigned long dwCurPriorityClass = GetPriorityClass(hProcess); int iCurThreadPriority = GetThreadPriority(hThread); - unsigned long dwProcessMask, dwSystemMask, dwNewMask = 1; - GetProcessAffinityMask(hProcess, (PDWORD_PTR)&dwProcessMask, (PDWORD_PTR)&dwSystemMask); + DWORD_PTR dwProcessMask, dwSystemMask, dwNewMask = 1; // + GetProcessAffinityMask(hProcess, &dwProcessMask, &dwSystemMask); SetPriorityClass(hProcess, REALTIME_PRIORITY_CLASS); SetThreadPriority(hThread, THREAD_PRIORITY_TIME_CRITICAL); diff --git a/indra/llcommon/llsd.cpp b/indra/llcommon/llsd.cpp index 61c4ca08d..d8bbb3a74 100644 --- a/indra/llcommon/llsd.cpp +++ b/indra/llcommon/llsd.cpp @@ -24,6 +24,9 @@ * $/LicenseInfo$ */ +// Must turn on conditional declarations in header file so definitions end up +// with proper linkage. +#define LLSD_DEBUG_INFO #include "linden_common.h" #include "llsd.h" @@ -31,6 +34,7 @@ #include "../llmath/llmath.h" #include "llformat.h" #include "llsdserialize.h" +#include "stringize.h" #ifndef LL_RELEASE_FOR_DOWNLOAD #define NAME_UNNAMED_NAMESPACE @@ -50,6 +54,18 @@ namespace using namespace LLSDUnnamedNamespace; #endif +namespace llsd +{ + +// statics +S32 sLLSDAllocationCount = 0; +S32 sLLSDNetObjects = 0; + +} // namespace llsd + +#define ALLOC_LLSD_OBJECT { llsd::sLLSDNetObjects++; llsd::sLLSDAllocationCount++; } +#define FREE_LLSD_OBJECT { llsd::sLLSDNetObjects--; } + class LLSD::Impl /**< This class is the abstract base class of the implementation of LLSD It provides the reference counting implementation, and the default @@ -58,13 +74,10 @@ class LLSD::Impl */ { -private: - U32 mUseCount; - protected: Impl(); - enum StaticAllocationMarker { STATIC }; + enum StaticAllocationMarker { STATIC_USAGE_COUNT = 0xFFFFFFFF }; Impl(StaticAllocationMarker); ///< This constructor is used for static objects and causes the // suppresses adjusting the debugging counters when they are @@ -72,8 +85,10 @@ protected: virtual ~Impl(); - bool shared() const { return mUseCount > 1; } + bool shared() const { return (mUseCount > 1) && (mUseCount != STATIC_USAGE_COUNT); } + U32 mUseCount; + public: static void reset(Impl*& var, Impl* impl); ///< safely set var to refer to the new impl (possibly shared) @@ -111,7 +126,9 @@ public: virtual UUID asUUID() const { return LLUUID(); } virtual Date asDate() const { return LLDate(); } virtual URI asURI() const { return LLURI(); } - virtual Binary asBinary() const { return std::vector(); } + virtual const Binary& asBinary() const { static const std::vector empty; return empty; } + + virtual const String& asStringRef() const { static const std::string empty; return empty; } virtual bool has(const String&) const { return false; } virtual LLSD get(const String&) const { return LLSD(); } @@ -128,6 +145,18 @@ public: virtual LLSD::array_const_iterator beginArray() const { return endArray(); } virtual LLSD::array_const_iterator endArray() const { static const std::vector empty; return empty.end(); } + virtual void dumpStats() const; + virtual void calcStats(S32 type_counts[], S32 share_counts[]) const; + // Container subclasses contain LLSD objects, rather than directly + // containing Impl objects. This helper forwards through LLSD. + void calcStats(const LLSD& llsd, S32 type_counts[], S32 share_counts[]) const + { + safe(llsd.impl).calcStats(type_counts, share_counts); + } + + static const Impl& getImpl(const LLSD& llsd) { return safe(llsd.impl); } + static Impl& getImpl(LLSD& llsd) { return safe(llsd.impl); } + static const LLSD& undef(); static U32 sAllocationCount; @@ -242,6 +271,8 @@ namespace virtual LLSD::UUID asUUID() const { return LLUUID(mValue); } virtual LLSD::Date asDate() const { return LLDate(mValue); } virtual LLSD::URI asURI() const { return LLURI(mValue); } + virtual int size() const { return mValue.size(); } + virtual const LLSD::String& asStringRef() const { return mValue; } }; LLSD::Integer ImplString::asInteger() const @@ -320,7 +351,7 @@ namespace public: ImplBinary(const LLSD::Binary& v) : Base(v) { } - virtual LLSD::Binary asBinary() const{ return mValue; } + virtual const LLSD::Binary& asBinary() const{ return mValue; } }; @@ -360,6 +391,9 @@ namespace LLSD::map_iterator endMap() { return mData.end(); } virtual LLSD::map_const_iterator beginMap() const { return mData.begin(); } virtual LLSD::map_const_iterator endMap() const { return mData.end(); } + + virtual void dumpStats() const; + virtual void calcStats(S32 type_counts[], S32 share_counts[]) const; }; ImplMap& ImplMap::makeMap(LLSD::Impl*& var) @@ -414,6 +448,34 @@ namespace return i->second; } + void ImplMap::dumpStats() const + { + std::cout << "Map size: " << mData.size() << std::endl; + + std::cout << "LLSD Net Objects: " << llsd::sLLSDNetObjects << std::endl; + std::cout << "LLSD allocations: " << llsd::sLLSDAllocationCount << std::endl; + + std::cout << "LLSD::Impl Net Objects: " << sOutstandingCount << std::endl; + std::cout << "LLSD::Impl allocations: " << sAllocationCount << std::endl; + + Impl::dumpStats(); + } + + void ImplMap::calcStats(S32 type_counts[], S32 share_counts[]) const + { + LLSD::map_const_iterator iter = beginMap(); + while (iter != endMap()) + { + //std::cout << " " << (*iter).first << ": " << (*iter).second << std::endl; + Impl::calcStats((*iter).second, type_counts, share_counts); + iter++; + } + + // Add in the values for this map + Impl::calcStats(type_counts, share_counts); + } + + class ImplArray : public LLSD::Impl { private: @@ -447,8 +509,12 @@ namespace LLSD::array_iterator beginArray() { return mData.begin(); } LLSD::array_iterator endArray() { return mData.end(); } + LLSD::reverse_array_iterator rbeginArray() { return mData.rbegin(); } + LLSD::reverse_array_iterator rendArray() { return mData.rend(); } virtual LLSD::array_const_iterator beginArray() const { return mData.begin(); } virtual LLSD::array_const_iterator endArray() const { return mData.end(); } + + virtual void calcStats(S32 type_counts[], S32 share_counts[]) const; }; ImplArray& ImplArray::makeArray(Impl*& var) @@ -544,6 +610,19 @@ namespace return mData[index]; } + + void ImplArray::calcStats(S32 type_counts[], S32 share_counts[]) const + { + LLSD::array_const_iterator iter = beginArray(); + while (iter != endArray()) + { // Add values for all items held in the array + Impl::calcStats((*iter), type_counts, share_counts); + iter++; + } + + // Add in the values for this array + Impl::calcStats(type_counts, share_counts); + } } LLSD::Impl::Impl() @@ -565,8 +644,11 @@ LLSD::Impl::~Impl() void LLSD::Impl::reset(Impl*& var, Impl* impl) { - if (impl) ++impl->mUseCount; - if (var && --var->mUseCount == 0) + if (impl && impl->mUseCount != STATIC_USAGE_COUNT) + { + ++impl->mUseCount; + } + if (var && var->mUseCount != STATIC_USAGE_COUNT && --var->mUseCount == 0) { delete var; } @@ -575,13 +657,13 @@ void LLSD::Impl::reset(Impl*& var, Impl* impl) LLSD::Impl& LLSD::Impl::safe(Impl* impl) { - static Impl theUndefined(STATIC); + static Impl theUndefined(STATIC_USAGE_COUNT); return impl ? *impl : theUndefined; } const LLSD::Impl& LLSD::Impl::safe(const Impl* impl) { - static Impl theUndefined(STATIC); + static Impl theUndefined(STATIC_USAGE_COUNT); return impl ? *impl : theUndefined; } @@ -657,6 +739,43 @@ const LLSD& LLSD::Impl::undef() return immutableUndefined; } +void LLSD::Impl::dumpStats() const +{ + S32 type_counts[LLSD::TypeLLSDNumTypes + 1]; + memset(&type_counts, 0, sizeof(type_counts)); + + S32 share_counts[LLSD::TypeLLSDNumTypes + 1]; + memset(&share_counts, 0, sizeof(share_counts)); + + // Add info from all the values this object has + calcStats(type_counts, share_counts); + + S32 type_index = LLSD::TypeLLSDTypeBegin; + while (type_index != LLSD::TypeLLSDTypeEnd) + { + std::cout << LLSD::typeString((LLSD::Type)type_index) << " type " + << type_counts[type_index] << " objects, " + << share_counts[type_index] << " shared" + << std::endl; + type_index++; + } +} + + +void LLSD::Impl::calcStats(S32 type_counts[], S32 share_counts[]) const +{ + S32 tp = S32(type()); + if (0 <= tp && tp < LLSD::TypeLLSDNumTypes) + { + type_counts[tp]++; + if (shared()) + { + share_counts[tp]++; + } + } +} + + U32 LLSD::Impl::sAllocationCount = 0; U32 LLSD::Impl::sOutstandingCount = 0; @@ -682,10 +801,10 @@ namespace } -LLSD::LLSD() : impl(0) { } -LLSD::~LLSD() { Impl::reset(impl, 0); } +LLSD::LLSD() : impl(0) { ALLOC_LLSD_OBJECT; } +LLSD::~LLSD() { FREE_LLSD_OBJECT; Impl::reset(impl, 0); } -LLSD::LLSD(const LLSD& other) : impl(0) { assign(other); } +LLSD::LLSD(const LLSD& other) : impl(0) { ALLOC_LLSD_OBJECT; assign(other); } void LLSD::assign(const LLSD& other) { Impl::assign(impl, other.impl); } @@ -693,18 +812,18 @@ void LLSD::clear() { Impl::assignUndefined(impl); } LLSD::Type LLSD::type() const { return safe(impl).type(); } -// Scaler Constructors -LLSD::LLSD(Boolean v) : impl(0) { assign(v); } -LLSD::LLSD(Integer v) : impl(0) { assign(v); } -LLSD::LLSD(Real v) : impl(0) { assign(v); } -LLSD::LLSD(const UUID& v) : impl(0) { assign(v); } -LLSD::LLSD(const String& v) : impl(0) { assign(v); } -LLSD::LLSD(const Date& v) : impl(0) { assign(v); } -LLSD::LLSD(const URI& v) : impl(0) { assign(v); } -LLSD::LLSD(const Binary& v) : impl(0) { assign(v); } +// Scalar Constructors +LLSD::LLSD(Boolean v) : impl(0) { ALLOC_LLSD_OBJECT; assign(v); } +LLSD::LLSD(Integer v) : impl(0) { ALLOC_LLSD_OBJECT; assign(v); } +LLSD::LLSD(Real v) : impl(0) { ALLOC_LLSD_OBJECT; assign(v); } +LLSD::LLSD(const UUID& v) : impl(0) { ALLOC_LLSD_OBJECT; assign(v); } +LLSD::LLSD(const String& v) : impl(0) { ALLOC_LLSD_OBJECT; assign(v); } +LLSD::LLSD(const Date& v) : impl(0) { ALLOC_LLSD_OBJECT; assign(v); } +LLSD::LLSD(const URI& v) : impl(0) { ALLOC_LLSD_OBJECT; assign(v); } +LLSD::LLSD(const Binary& v) : impl(0) { ALLOC_LLSD_OBJECT; assign(v); } // Convenience Constructors -LLSD::LLSD(F32 v) : impl(0) { assign((Real)v); } +LLSD::LLSD(F32 v) : impl(0) { ALLOC_LLSD_OBJECT; assign((Real)v); } // Scalar Assignment void LLSD::assign(Boolean v) { safe(impl).assign(impl, v); } @@ -724,10 +843,12 @@ LLSD::String LLSD::asString() const { return safe(impl).asString(); } LLSD::UUID LLSD::asUUID() const { return safe(impl).asUUID(); } LLSD::Date LLSD::asDate() const { return safe(impl).asDate(); } LLSD::URI LLSD::asURI() const { return safe(impl).asURI(); } -LLSD::Binary LLSD::asBinary() const { return safe(impl).asBinary(); } +const LLSD::Binary& LLSD::asBinary() const { return safe(impl).asBinary(); } + +const LLSD::String& LLSD::asStringRef() const { return safe(impl).asStringRef(); } // const char * helpers -LLSD::LLSD(const char* v) : impl(0) { assign(v); } +LLSD::LLSD(const char* v) : impl(0) { ALLOC_LLSD_OBJECT; assign(v); } void LLSD::assign(const char* v) { if(v) assign(std::string(v)); @@ -785,9 +906,6 @@ LLSD& LLSD::operator[](Integer i) const LLSD& LLSD::operator[](Integer i) const { return safe(impl).ref(i); } -U32 LLSD::allocationCount() { return Impl::sAllocationCount; } -U32 LLSD::outstandingCount() { return Impl::sOutstandingCount; } - static const char *llsd_dump(const LLSD &llsd, bool useXMLFormat) { // sStorage is used to hold the string representation of the llsd last @@ -802,15 +920,9 @@ static const char *llsd_dump(const LLSD &llsd, bool useXMLFormat) { std::ostringstream out; if (useXMLFormat) - { - LLSDXMLStreamer xml_streamer(llsd); - out << xml_streamer; - } + out << LLSDXMLStreamer(llsd); else - { - LLSDNotationStreamer notation_streamer(llsd); - out << notation_streamer; - } + out << LLSDNotationStreamer(llsd); out_string = out.str(); } int len = out_string.length(); @@ -841,3 +953,41 @@ LLSD::array_iterator LLSD::beginArray() { return makeArray(impl).beginArray(); LLSD::array_iterator LLSD::endArray() { return makeArray(impl).endArray(); } LLSD::array_const_iterator LLSD::beginArray() const{ return safe(impl).beginArray(); } LLSD::array_const_iterator LLSD::endArray() const { return safe(impl).endArray(); } + +LLSD::reverse_array_iterator LLSD::rbeginArray() { return makeArray(impl).rbeginArray(); } +LLSD::reverse_array_iterator LLSD::rendArray() { return makeArray(impl).rendArray(); } + +namespace llsd +{ + +U32 allocationCount() { return LLSD::Impl::sAllocationCount; } +U32 outstandingCount() { return LLSD::Impl::sOutstandingCount; } + +// Diagnostic dump of contents in an LLSD object +void dumpStats(const LLSD& llsd) { LLSD::Impl::getImpl(llsd).dumpStats(); } + +} // namespace llsd + +// static +std::string LLSD::typeString(Type type) +{ + static const char * sTypeNameArray[] = { + "Undefined", + "Boolean", + "Integer", + "Real", + "String", + "UUID", + "Date", + "URI", + "Binary", + "Map", + "Array" + }; + + if (0 <= type && type < LL_ARRAY_SIZE(sTypeNameArray)) + { + return sTypeNameArray[type]; + } + return STRINGIZE("** invalid type value " << type); +} diff --git a/indra/llcommon/llsd.h b/indra/llcommon/llsd.h index 6e242a163..6e71a717e 100644 --- a/indra/llcommon/llsd.h +++ b/indra/llcommon/llsd.h @@ -251,7 +251,10 @@ public: UUID asUUID() const; Date asDate() const; URI asURI() const; - Binary asBinary() const; + const Binary& asBinary() const; + + // asStringRef on any non-string type will return a ref to an empty string. + const String& asStringRef() const; operator Boolean() const { return asBoolean(); } operator Integer() const { return asInteger(); } @@ -323,11 +326,15 @@ public: typedef std::vector::iterator array_iterator; typedef std::vector::const_iterator array_const_iterator; + typedef std::vector::reverse_iterator reverse_array_iterator; array_iterator beginArray(); array_iterator endArray(); array_const_iterator beginArray() const; array_const_iterator endArray() const; + + reverse_array_iterator rbeginArray(); + reverse_array_iterator rendArray(); //@} /** @name Type Testing */ @@ -390,13 +397,7 @@ public: class Impl; private: Impl* impl; - //@} - - /** @name Unit Testing Interface */ - //@{ -public: - static U32 allocationCount(); ///< how many Impls have been made - static U32 outstandingCount(); ///< how many Impls are still alive + friend class LLSD::Impl; //@} private: @@ -408,6 +409,10 @@ private: /// Returns Notation version of llsd -- only to be called from debugger static const char *dump(const LLSD &llsd); //@} + +public: + + static std::string typeString(Type type); // Return human-readable type as a string }; struct llsd_select_bool : public std::unary_function @@ -455,6 +460,29 @@ struct llsd_select_string : public std::unary_function LL_COMMON_API std::ostream& operator<<(std::ostream& s, const LLSD& llsd); +namespace llsd +{ + +#ifdef LLSD_DEBUG_INFO +/** @name Unit Testing Interface */ +//@{ + LL_COMMON_API void dumpStats(const LLSD&); ///< Output information on object and usage + + /// @warn THE FOLLOWING COUNTS WILL NOT BE ACCURATE IN A MULTI-THREADED + /// ENVIRONMENT. + /// + /// These counts track LLSD::Impl (hidden) objects. + LL_COMMON_API U32 allocationCount(); ///< how many Impls have been made + LL_COMMON_API U32 outstandingCount(); ///< how many Impls are still alive + + /// These counts track LLSD (public) objects. + LL_COMMON_API extern S32 sLLSDAllocationCount; ///< Number of LLSD objects ever created + LL_COMMON_API extern S32 sLLSDNetObjects; ///< Number of LLSD objects that exist +#endif +//@} + +} // namespace llsd + /** QUESTIONS & TO DOS - Would Binary be more convenient as unsigned char* buffer semantics? - Should Binary be convertible to/from String, and if so how? diff --git a/indra/llcommon/llsdparam.cpp b/indra/llcommon/llsdparam.cpp index 9f4460a98..0051bd8e3 100644 --- a/indra/llcommon/llsdparam.cpp +++ b/indra/llcommon/llsdparam.cpp @@ -30,6 +30,7 @@ // Project includes #include "llsdparam.h" #include "llsdutil.h" +#include "boost/bind.hpp" static LLInitParam::Parser::parser_read_func_map_t sReadFuncs; static LLInitParam::Parser::parser_write_func_map_t sWriteFuncs; @@ -42,7 +43,8 @@ LLFastTimer::DeclareTimer FTM_SD_PARAM_ADAPTOR("LLSD to LLInitParam conversion") // LLParamSDParser // LLParamSDParser::LLParamSDParser() -: Parser(sReadFuncs, sWriteFuncs, sInspectFuncs) +: Parser(sReadFuncs, sWriteFuncs, sInspectFuncs), + mCurReadSD(NULL), mCurWriteSD(NULL), mWriteRootSD(NULL) { using boost::bind; @@ -102,13 +104,13 @@ void LLParamSDParser::readSD(const LLSD& sd, LLInitParam::BaseBlock& block, bool //readSDValues(sd, block); } -void LLParamSDParser::writeSD(LLSD& sd, const LLInitParam::BaseBlock& block) +void LLParamSDParser::writeSDImpl(LLSD& sd, const LLInitParam::BaseBlock& block, const LLInitParam::predicate_rule_t rules, const LLInitParam::BaseBlock* diff_block) { mNameStack.clear(); mWriteRootSD = &sd; name_stack_t name_stack; - block.serializeBlock(*this, name_stack); + block.serializeBlock(*this, name_stack, rules, diff_block); } /*virtual*/ std::string LLParamSDParser::getCurrentElementName() @@ -329,13 +331,14 @@ namespace LLInitParam p.writeValue(sd.asString(), name_stack); } - void ParamValue::serializeBlock(Parser& p, Parser::name_stack_t& name_stack, const BaseBlock* diff_block) const + bool ParamValue::serializeBlock(Parser& p, Parser::name_stack_t& name_stack_range, const predicate_rule_t predicate_rule, const BaseBlock* diff_block) const { // attempt to write LLSD out directly - if (!p.writeValue(mValue, name_stack)) + if (!p.writeValue(mValue, name_stack_range)) { // otherwise read from LLSD value and serialize out to parser (which could be LLSD, XUI, etc) - LLParamSDParserUtilities::readSDValues(boost::bind(&serializeElement, boost::ref(p), _1, _2), mValue, name_stack); + LLParamSDParserUtilities::readSDValues(boost::bind(&serializeElement, boost::ref(p), _1, _2), mValue, name_stack_range); } + return true; } } diff --git a/indra/llcommon/llsdparam.h b/indra/llcommon/llsdparam.h index 6ef5debd7..7cfc265c6 100644 --- a/indra/llcommon/llsdparam.h +++ b/indra/llcommon/llsdparam.h @@ -30,6 +30,7 @@ #include "llinitparam.h" #include "boost/function.hpp" +#include "llfasttimer.h" struct LL_COMMON_API LLParamSDParserUtilities { @@ -50,11 +51,28 @@ typedef LLInitParam::Parser parser_t; public: LLParamSDParser(); void readSD(const LLSD& sd, LLInitParam::BaseBlock& block, bool silent = false); - void writeSD(LLSD& sd, const LLInitParam::BaseBlock& block); + template + void writeSD(LLSD& sd, + const BLOCK& block, + const LLInitParam::predicate_rule_t rules = LLInitParam::default_parse_rules(), + const LLInitParam::BaseBlock* diff_block = NULL) + { + if (!diff_block + && !rules.isAmbivalent(LLInitParam::HAS_DEFAULT_VALUE)) + { + diff_block = &LLInitParam::defaultValue(); + } + writeSDImpl(sd, block, rules, diff_block); + } /*virtual*/ std::string getCurrentElementName(); private: + void writeSDImpl(LLSD& sd, + const LLInitParam::BaseBlock& block, + const LLInitParam::predicate_rule_t, + const LLInitParam::BaseBlock* diff_block); + void submit(LLInitParam::BaseBlock& block, const LLSD& sd, LLInitParam::Parser::name_stack_t& name_stack); template diff --git a/indra/llcommon/llsdserialize.cpp b/indra/llcommon/llsdserialize.cpp index ad4fce6f3..38dff60e6 100644 --- a/indra/llcommon/llsdserialize.cpp +++ b/indra/llcommon/llsdserialize.cpp @@ -30,9 +30,9 @@ #include "llsdserialize.h" #include "llpointer.h" #include "llstreamtools.h" // for fullread +#include "llbase64.h" #include -#include "apr_base64.h" #ifdef LL_STANDALONE # include @@ -43,6 +43,7 @@ #if !LL_WINDOWS #include // htonl & ntohl #endif +#include "apr_general.h" // for strncasecmp #include "lldate.h" #include "llsd.h" @@ -648,7 +649,7 @@ S32 LLSDNotationParser::doParse(std::istream& istr, LLSD& data) const default: parse_count = PARSE_FAILURE; llinfos << "Unrecognized character while parsing: int(" << (int)c - << ")" << llendl; + << ")" << LL_ENDL; break; } if(PARSE_FAILURE == parse_count) @@ -807,12 +808,12 @@ bool LLSDNotationParser::parseBinary(std::istream& istr, LLSD& data) const get(istr, *(coded_stream.rdbuf()), '\"'); c = get(istr); std::string encoded(coded_stream.str()); - S32 len = apr_base64_decode_len(encoded.c_str()); + size_t len = LLBase64::requiredDecryptionSpace(encoded); std::vector value; if(len) { value.resize(len); - len = apr_base64_decode_binary(&value[0], encoded.c_str()); + len = LLBase64::decode(encoded, &value[0], len); value.resize(len); } data = value; @@ -873,7 +874,7 @@ S32 LLSDBinaryParser::doParse(std::istream& istr, LLSD& data) const { /** * Undefined: '!'
- * Boolean: 't' for true 'f' for false
+ * Boolean: '1' for true '0' for false
* Integer: 'i' + 4 bytes network byte order
* Real: 'r' + 8 bytes IEEE double
* UUID: 'u' + 16 byte unsigned integer
@@ -999,7 +1000,7 @@ S32 LLSDBinaryParser::doParse(std::istream& istr, LLSD& data) const if(istr.fail()) { llinfos << "STREAM FAILURE reading binary (notation-style) string." - << llendl; + << LL_ENDL; parse_count = PARSE_FAILURE; } break; @@ -1088,7 +1089,7 @@ S32 LLSDBinaryParser::doParse(std::istream& istr, LLSD& data) const default: parse_count = PARSE_FAILURE; llinfos << "Unrecognized character while parsing: int(" << (int)c - << ")" << llendl; + << ")" << LL_ENDL; break; } if(PARSE_FAILURE == parse_count) @@ -1260,13 +1261,38 @@ std::string LLSDNotationFormatter::escapeString(const std::string& in) // virtual S32 LLSDNotationFormatter::format(const LLSD& data, std::ostream& ostr, U32 options) const +{ + S32 rv = format_impl(data, ostr, options, 0); + return rv; +} + +S32 LLSDNotationFormatter::format_impl(const LLSD& data, std::ostream& ostr, U32 options, U32 level) const { S32 format_count = 1; + std::string pre; + std::string post; + + if (options & LLSDFormatter::OPTIONS_PRETTY) + { + for (U32 i = 0; i < level; i++) + { + pre += " "; + } + post = "\n"; + } + switch(data.type()) { case LLSD::TypeMap: { + if (0 != level) ostr << post << pre; ostr << "{"; + std::string inner_pre; + if (options & LLSDFormatter::OPTIONS_PRETTY) + { + inner_pre = pre + " "; + } + bool need_comma = false; LLSD::map_const_iterator iter = data.beginMap(); LLSD::map_const_iterator end = data.endMap(); @@ -1274,18 +1300,18 @@ S32 LLSDNotationFormatter::format(const LLSD& data, std::ostream& ostr, U32 opti { if(need_comma) ostr << ","; need_comma = true; - ostr << '\''; + ostr << post << inner_pre << '\''; serialize_string((*iter).first, ostr); ostr << "':"; - format_count += format((*iter).second, ostr); + format_count += format_impl((*iter).second, ostr, options, level + 2); } - ostr << "}"; + ostr << post << pre << "}"; break; } case LLSD::TypeArray: { - ostr << "["; + ostr << post << pre << "["; bool need_comma = false; LLSD::array_const_iterator iter = data.beginArray(); LLSD::array_const_iterator end = data.endArray(); @@ -1293,7 +1319,7 @@ S32 LLSDNotationFormatter::format(const LLSD& data, std::ostream& ostr, U32 opti { if(need_comma) ostr << ","; need_comma = true; - format_count += format(*iter, ostr); + format_count += format_impl(*iter, ostr, options, level + 1); } ostr << "]"; break; @@ -1343,7 +1369,7 @@ S32 LLSDNotationFormatter::format(const LLSD& data, std::ostream& ostr, U32 opti case LLSD::TypeString: ostr << '\''; - serialize_string(data.asString(), ostr); + serialize_string(data.asStringRef(), ostr); ostr << '\''; break; @@ -1360,9 +1386,26 @@ S32 LLSDNotationFormatter::format(const LLSD& data, std::ostream& ostr, U32 opti case LLSD::TypeBinary: { // *FIX: memory inefficient. - std::vector buffer = data.asBinary(); + const std::vector& buffer = data.asBinary(); ostr << "b(" << buffer.size() << ")\""; - if(buffer.size()) ostr.write((const char*)&buffer[0], buffer.size()); + if(buffer.size()) + { + if (options & LLSDFormatter::OPTIONS_PRETTY_BINARY) + { + std::ios_base::fmtflags old_flags = ostr.flags(); + ostr.setf( std::ios::hex, std::ios::basefield ); + ostr << "0x"; + for (size_t i = 0; i < buffer.size(); i++) + { + ostr << (int) buffer[i]; + } + ostr.flags(old_flags); + } + else + { + ostr.write((const char*)&buffer[0], buffer.size()); + } + } ostr << "\""; break; } @@ -1460,7 +1503,7 @@ S32 LLSDBinaryFormatter::format(const LLSD& data, std::ostream& ostr, U32 option case LLSD::TypeString: ostr.put('s'); - formatString(data.asString(), ostr); + formatString(data.asStringRef(), ostr); break; case LLSD::TypeDate: @@ -1478,9 +1521,8 @@ S32 LLSDBinaryFormatter::format(const LLSD& data, std::ostream& ostr, U32 option case LLSD::TypeBinary: { - // *FIX: memory inefficient. ostr.put('b'); - std::vector buffer = data.asBinary(); + const std::vector& buffer = data.asBinary(); U32 size_nbo = htonl(buffer.size()); ostr.write((const char*)(&size_nbo), sizeof(U32)); if(buffer.size()) ostr.write((const char*)&buffer[0], buffer.size()); @@ -2080,6 +2122,7 @@ std::string zip_llsd(LLSD& data) return result; } +// //decompress a block of LLSD from provided istream // not very efficient -- creats a copy of decompressed LLSD block in memory // and deserializes from that copy using LLSDSerialize @@ -2109,13 +2152,6 @@ bool unzip_llsd(LLSD& data, std::istream& is, S32 size) strm.avail_out = CHUNK; strm.next_out = out; ret = inflate(&strm, Z_NO_FLUSH); - if (ret == Z_STREAM_ERROR) - { - inflateEnd(&strm); - free(result); - delete [] in; - return false; - } switch (ret) { @@ -2123,6 +2159,7 @@ bool unzip_llsd(LLSD& data, std::istream& is, S32 size) ret = Z_DATA_ERROR; case Z_DATA_ERROR: case Z_MEM_ERROR: + case Z_STREAM_ERROR: inflateEnd(&strm); free(result); delete [] in; @@ -2172,6 +2209,7 @@ bool unzip_llsd(LLSD& data, std::istream& is, S32 size) free(result); return true; } + //This unzip function will only work with a gzip header and trailer - while the contents //of the actual compressed data is the same for either format (gzip vs zlib ), the headers //and trailers are different for the formats. @@ -2201,27 +2239,19 @@ U8* unzip_llsdNavMesh( bool& valid, unsigned int& outsize, std::istream& is, S32 strm.avail_out = CHUNK; strm.next_out = out; ret = inflate(&strm, Z_NO_FLUSH); - if (ret == Z_STREAM_ERROR) - { - inflateEnd(&strm); - free(result); - delete [] in; - valid = false; - } - switch (ret) { case Z_NEED_DICT: ret = Z_DATA_ERROR; case Z_DATA_ERROR: case Z_MEM_ERROR: + case Z_STREAM_ERROR: inflateEnd(&strm); free(result); delete [] in; valid = false; - break; + return NULL; } - U32 have = CHUNK-strm.avail_out; result = (U8*) realloc(result, cur_size + have); @@ -2248,5 +2278,5 @@ U8* unzip_llsdNavMesh( bool& valid, unsigned int& outsize, std::istream& is, S32 return result; } - +// diff --git a/indra/llcommon/llsdserialize.h b/indra/llcommon/llsdserialize.h index 09150615c..c47cb6885 100644 --- a/indra/llcommon/llsdserialize.h +++ b/indra/llcommon/llsdserialize.h @@ -4,31 +4,25 @@ * @date 2006-02-26 * @brief Declaration of parsers and formatters for LLSD * - * $LicenseInfo:firstyear=2006&license=viewergpl$ - * - * Copyright (c) 2006-2009, Linden Research, Inc. - * + * $LicenseInfo:firstyear=2006&license=viewerlgpl$ * Second Life Viewer Source Code - * The source code in this file ("Source Code") is provided by Linden Lab - * to you under the terms of the GNU General Public License, version 2.0 - * ("GPL"), unless you have obtained a separate licensing agreement - * ("Other License"), formally executed by you and Linden Lab. Terms of - * the GPL can be found in doc/GPL-license.txt in this distribution, or - * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2 + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. * - * There are special exceptions to the terms and conditions of the GPL as - * it is applied to this Source Code. View the full text of the exception - * in the file doc/FLOSS-exception.txt in this software distribution, or - * online at - * http://secondlifegrid.net/programs/open_source/licensing/flossexception + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * By copying, modifying or distributing this software, you acknowledge - * that you have read and understood your obligations described above, - * and agree to abide by those obligations. + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO - * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, - * COMPLETENESS OR PERFORMANCE. + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * $/LicenseInfo$ */ @@ -306,7 +300,7 @@ public: /** * @brief Constructor */ - LLSDXMLParser(); + LLSDXMLParser(bool emit_errors=true); protected: /** @@ -422,7 +416,8 @@ public: typedef enum e_formatter_options_type { OPTIONS_NONE = 0, - OPTIONS_PRETTY = 1 + OPTIONS_PRETTY = 1, + OPTIONS_PRETTY_BINARY = 2 } EFormatterOptions; /** @@ -513,6 +508,17 @@ public: * @return Returns The number of LLSD objects fomatted out */ virtual S32 format(const LLSD& data, std::ostream& ostr, U32 options = LLSDFormatter::OPTIONS_NONE) const; + +protected: + + /** + * @brief Implementation to format the data. This is called recursively. + * + * @param data The data to write. + * @param ostr The destination stream for the data. + * @return Returns The number of LLSD objects fomatted out + */ + S32 format_impl(const LLSD& data, std::ostream& ostr, U32 options, U32 level) const; }; @@ -638,6 +644,11 @@ protected: * params << "[{'version':i1}," << LLSDOStreamer(sd) * << "]"; * + * + * *NOTE - formerly this class inherited from its template parameter Formatter, + * but all instantiations passed in LLRefCount subclasses. This conflicted with + * the auto allocation intended for this class template (demonstrated in the + * example above). -brad */ template class LLSDOStreamer @@ -721,6 +732,18 @@ public: LLPointer f = new LLSDNotationFormatter; return f->format(sd, str, LLSDFormatter::OPTIONS_NONE); } + static S32 toPrettyNotation(const LLSD& sd, std::ostream& str) + { + LLPointer f = new LLSDNotationFormatter; + return f->format(sd, str, LLSDFormatter::OPTIONS_PRETTY); + } + static S32 toPrettyBinaryNotation(const LLSD& sd, std::ostream& str) + { + LLPointer f = new LLSDNotationFormatter; + return f->format(sd, str, + LLSDFormatter::OPTIONS_PRETTY | + LLSDFormatter::OPTIONS_PRETTY_BINARY); + } static S32 fromNotation(LLSD& sd, std::istream& str, S32 max_bytes) { LLPointer p = new LLSDNotationParser; @@ -748,25 +771,25 @@ public: return f->format(sd, str, LLSDFormatter::OPTIONS_PRETTY); } - static S32 fromXMLEmbedded(LLSD& sd, std::istream& str) + static S32 fromXMLEmbedded(LLSD& sd, std::istream& str, bool emit_errors=true) { // no need for max_bytes since xml formatting is not // subvertable by bad sizes. - LLPointer p = new LLSDXMLParser; + LLPointer p = new LLSDXMLParser(emit_errors); return p->parse(str, sd, LLSDSerialize::SIZE_UNLIMITED); } // Line oriented parser, 30% faster than fromXML(), but can // only be used when you know you have the complete XML // document available in the stream. - static S32 fromXMLDocument(LLSD& sd, std::istream& str) + static S32 fromXMLDocument(LLSD& sd, std::istream& str, bool emit_errors=true) { - LLPointer p = new LLSDXMLParser(); + LLPointer p = new LLSDXMLParser(emit_errors); return p->parseLines(str, sd); } - static S32 fromXML(LLSD& sd, std::istream& str) + static S32 fromXML(LLSD& sd, std::istream& str, bool emit_errors=true) { - return fromXMLEmbedded(sd, str); -// return fromXMLDocument(sd, str); + return fromXMLEmbedded(sd, str, emit_errors); +// return fromXMLDocument(sd, str, emit_errors); } /* diff --git a/indra/llcommon/llsdserialize_xml.cpp b/indra/llcommon/llsdserialize_xml.cpp index f0b4716ce..6c828d42f 100644 --- a/indra/llcommon/llsdserialize_xml.cpp +++ b/indra/llcommon/llsdserialize_xml.cpp @@ -26,11 +26,11 @@ #include "linden_common.h" #include "llsdserialize_xml.h" +#include "llbase64.h" #include #include -#include "apr_base64.h" #include extern "C" @@ -133,11 +133,7 @@ S32 LLSDXMLFormatter::format_impl(const LLSD& data, std::ostream& ostr, U32 opti case LLSD::TypeBoolean: ostr << pre << ""; if(mBoolAlpha || -#if( LL_WINDOWS || __GNUC__ > 2) (ostr.flags() & std::ios::boolalpha) -#else - (ostr.flags() & 0x0100) -#endif ) { ostr << (data.asBoolean() ? "true" : "false"); @@ -172,8 +168,8 @@ S32 LLSDXMLFormatter::format_impl(const LLSD& data, std::ostream& ostr, U32 opti break; case LLSD::TypeString: - if(data.asString().empty()) ostr << pre << "" << post; - else ostr << pre << "" << escapeString(data.asString()) <<"" << post; + if(data.asStringRef().empty()) ostr << pre << "" << post; + else ostr << pre << "" << escapeString(data.asStringRef()) <<"" << post; break; case LLSD::TypeDate: @@ -186,24 +182,15 @@ S32 LLSDXMLFormatter::format_impl(const LLSD& data, std::ostream& ostr, U32 opti case LLSD::TypeBinary: { - LLSD::Binary buffer = data.asBinary(); + const LLSD::Binary& buffer = data.asBinary(); if(buffer.empty()) { ostr << pre << "" << post; } else { - // *FIX: memory inefficient. - // *TODO: convert to use LLBase64 ostr << pre << ""; - int b64_buffer_length = apr_base64_encode_len(buffer.size()); - char* b64_buffer = new char[b64_buffer_length]; - b64_buffer_length = apr_base64_encode_binary( - b64_buffer, - &buffer[0], - buffer.size()); - ostr.write(b64_buffer, b64_buffer_length - 1); - delete[] b64_buffer; + ostr << LLBase64::encode(&buffer[0], buffer.size()); ostr << "" << post; } break; @@ -254,7 +241,7 @@ std::string LLSDXMLFormatter::escapeString(const std::string& in) class LLSDXMLParser::Impl { public: - Impl(); + Impl(bool emit_errors); ~Impl(); S32 parse(std::istream& input, LLSD& data); @@ -298,6 +285,7 @@ private: static const XML_Char* findAttribute(const XML_Char* name, const XML_Char** pairs); + bool mEmitErrors; XML_Parser mParser; @@ -319,7 +307,8 @@ private: }; -LLSDXMLParser::Impl::Impl() +LLSDXMLParser::Impl::Impl(bool emit_errors) + : mEmitErrors(emit_errors) { mParser = XML_ParserCreate(NULL); reset(); @@ -348,9 +337,10 @@ void clear_eol(std::istream& input) static unsigned get_till_eol(std::istream& input, char *buf, unsigned bufsize) { unsigned count = 0; + char c; while (count < bufsize && input.good()) { - char c = input.get(); + input.get(c); buf[count++] = c; if (is_eol(c)) break; @@ -377,13 +367,10 @@ S32 LLSDXMLParser::Impl::parse(std::istream& input, LLSD& data) { break; } + count = get_till_eol(input, (char *)buffer, BUFFER_SIZE); + if (!count) { - - count = get_till_eol(input, (char *)buffer, BUFFER_SIZE); - if (!count) - { - break; - } + break; } status = XML_ParseBuffer(mParser, count, false); @@ -406,7 +393,10 @@ S32 LLSDXMLParser::Impl::parse(std::istream& input, LLSD& data) { ((char*) buffer)[count ? count - 1 : 0] = '\0'; } - llinfos << "LLSDXMLParser::Impl::parse: XML_STATUS_ERROR parsing:" << (char*) buffer << llendl; + if (mEmitErrors) + { + llinfos << "LLSDXMLParser::Impl::parse: XML_STATUS_ERROR parsing:" << (char*) buffer << llendl; + } data = LLSD(); return LLSDParser::PARSE_FAILURE; } @@ -484,7 +474,10 @@ S32 LLSDXMLParser::Impl::parseLines(std::istream& input, LLSD& data) if (status == XML_STATUS_ERROR && !mGracefullStop) { - llinfos << "LLSDXMLParser::Impl::parseLines: XML_STATUS_ERROR" << llendl; + if (mEmitErrors) + { + llinfos << "LLSDXMLParser::Impl::parseLines: XML_STATUS_ERROR" << llendl; + } return LLSDParser::PARSE_FAILURE; } @@ -508,12 +501,7 @@ void LLSDXMLParser::Impl::reset() mSkipping = false; -#if( LL_WINDOWS || __GNUC__ > 2) mCurrentKey.clear(); -#else - mCurrentKey = std::string(); -#endif - XML_ParserReset(mParser, "utf-8"); XML_SetUserData(mParser, this); @@ -641,11 +629,7 @@ void LLSDXMLParser::Impl::startElementHandler(const XML_Char* name, const XML_Ch LLSD& newElement = map[mCurrentKey]; mStack.push_back(&newElement); -#if( LL_WINDOWS || __GNUC__ > 2) mCurrentKey.clear(); -#else - mCurrentKey = std::string(); -#endif } else if (mStack.back()->isArray()) { @@ -787,10 +771,10 @@ void LLSDXMLParser::Impl::endElementHandler(const XML_Char* name) boost::regex r; r.assign("\\s"); std::string stripped = boost::regex_replace(mCurrentContent, r, ""); - S32 len = apr_base64_decode_len(stripped.c_str()); + size_t len = LLBase64::requiredDecryptionSpace(stripped); std::vector data; data.resize(len); - len = apr_base64_decode_binary(&data[0], stripped.c_str()); + len = LLBase64::decode(stripped, &data[0], len); data.resize(len); value = data; break; @@ -910,7 +894,7 @@ LLSDXMLParser::Impl::Element LLSDXMLParser::Impl::readElement(const XML_Char* na /** * LLSDXMLParser */ -LLSDXMLParser::LLSDXMLParser() : impl(* new Impl) +LLSDXMLParser::LLSDXMLParser(bool emit_errors /* = true */) : impl(* new Impl(emit_errors)) { } diff --git a/indra/llcommon/llsdutil.cpp b/indra/llcommon/llsdutil.cpp index 120bfa2c9..da697fe91 100644 --- a/indra/llcommon/llsdutil.cpp +++ b/indra/llcommon/llsdutil.cpp @@ -4,31 +4,25 @@ * @date 2006-05-24 * @brief Implementation of classes, functions, etc, for using structured data. * - * $LicenseInfo:firstyear=2006&license=viewergpl$ - * - * Copyright (c) 2006-2009, Linden Research, Inc. - * + * $LicenseInfo:firstyear=2006&license=viewerlgpl$ * Second Life Viewer Source Code - * The source code in this file ("Source Code") is provided by Linden Lab - * to you under the terms of the GNU General Public License, version 2.0 - * ("GPL"), unless you have obtained a separate licensing agreement - * ("Other License"), formally executed by you and Linden Lab. Terms of - * the GPL can be found in doc/GPL-license.txt in this distribution, or - * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2 + * Copyright (C) 2010, Linden Research, Inc. * - * There are special exceptions to the terms and conditions of the GPL as - * it is applied to this Source Code. View the full text of the exception - * in the file doc/FLOSS-exception.txt in this software distribution, or - * online at - * http://secondlifegrid.net/programs/open_source/licensing/flossexception + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. * - * By copying, modifying or distributing this software, you acknowledge - * that you have read and understood your obligations described above, - * and agree to abide by those obligations. + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO - * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, - * COMPLETENESS OR PERFORMANCE. + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * $/LicenseInfo$ */ @@ -188,7 +182,7 @@ char* ll_pretty_print_sd_ptr(const LLSD* sd) char* ll_pretty_print_sd(const LLSD& sd) { - const U32 bufferSize = 10 * 1024; + const U32 bufferSize = 100 * 1024; static char buffer[bufferSize]; std::ostringstream stream; //stream.rdbuf()->pubsetbuf(buffer, bufferSize); @@ -578,7 +572,7 @@ std::string llsd_matches(const LLSD& prototype, const LLSD& data, const std::str return match_types(prototype.type(), TypeVector(), data.type(), pfx); } -bool llsd_equals(const LLSD& lhs, const LLSD& rhs, unsigned bits) +bool llsd_equals(const LLSD& lhs, const LLSD& rhs, int bits) { // We're comparing strict equality of LLSD representation rather than // performing any conversions. So if the types aren't equal, the LLSD @@ -598,7 +592,7 @@ bool llsd_equals(const LLSD& lhs, const LLSD& rhs, unsigned bits) case LLSD::TypeReal: // This is where the 'bits' argument comes in handy. If passed // explicitly, it means to use is_approx_equal_fraction() to compare. - if (bits != -1) + if (bits >= 0) { return is_approx_equal_fraction(lhs.asReal(), rhs.asReal(), bits); } diff --git a/indra/llcommon/llsdutil.h b/indra/llcommon/llsdutil.h index 532d3f934..99cb79aa5 100644 --- a/indra/llcommon/llsdutil.h +++ b/indra/llcommon/llsdutil.h @@ -29,7 +29,7 @@ #ifndef LL_LLSDUTIL_H #define LL_LLSDUTIL_H -class LLSD; +#include "llsd.h" // U32 LL_COMMON_API LLSD ll_sd_from_U32(const U32); @@ -126,7 +126,7 @@ LL_COMMON_API std::string llsd_matches(const LLSD& prototype, const LLSD& data, /// Deep equality. If you want to compare LLSD::Real values for approximate /// equality rather than bitwise equality, pass @a bits as for /// is_approx_equal_fraction(). -LL_COMMON_API bool llsd_equals(const LLSD& lhs, const LLSD& rhs, unsigned bits=-1); +LL_COMMON_API bool llsd_equals(const LLSD& lhs, const LLSD& rhs, int bits=-1); // Simple function to copy data out of input & output iterators if // there is no need for casting. diff --git a/indra/llcommon/llsingleton.h b/indra/llcommon/llsingleton.h index b1e17fc13..a73c9d06f 100644 --- a/indra/llcommon/llsingleton.h +++ b/indra/llcommon/llsingleton.h @@ -102,10 +102,10 @@ private: // stores pointer to singleton instance struct SingletonLifetimeManager { - SingletonLifetimeManager() + /*SingletonLifetimeManager() { construct(); - } + }*/ static void construct() { @@ -115,14 +115,14 @@ private: sData.mInitState = INITIALIZING; } - ~SingletonLifetimeManager() + /*~SingletonLifetimeManager() { SingletonData& sData(getData()); if (sData.mInitState != DELETED) { deleteSingleton(); } - } + }*/ }; public: @@ -178,33 +178,28 @@ public: static DERIVED_TYPE* getInstance() { - static SingletonLifetimeManager sLifeTimeMgr; + //static SingletonLifetimeManager sLifeTimeMgr; SingletonData& sData(getData()); switch (sData.mInitState) { - case UNINITIALIZED: - // should never be uninitialized at this point - llassert(false); - return NULL; case CONSTRUCTING: llerrs << "Tried to access singleton " << typeid(DERIVED_TYPE).name() << " from singleton constructor!" << LL_ENDL; return NULL; case INITIALIZING: - // go ahead and flag ourselves as initialized so we can be reentrant during initialization - sData.mInitState = INITIALIZED; - // initialize singleton after constructing it so that it can reference other singletons which in turn depend on it, - // thus breaking cyclic dependencies - sData.mInstance->initSingleton(); + llwarns << "Using singleton " << typeid(DERIVED_TYPE).name() << " during its own initialization, before its initialization completed!" << LL_ENDL; return sData.mInstance; case INITIALIZED: return sData.mInstance; case DELETED: llwarns << "Trying to access deleted singleton " << typeid(DERIVED_TYPE).name() << " creating new instance" << LL_ENDL; + case UNINITIALIZED: + // This must be the first time we get here. SingletonLifetimeManager::construct(); // same as first time construction - sData.mInitState = INITIALIZED; + // Singu note: LL sets the state to INITIALIZED here *already* - which avoids the warning below, but is clearly total bullshit. sData.mInstance->initSingleton(); + sData.mInitState = INITIALIZED; return sData.mInstance; } diff --git a/indra/llcommon/llsys.cpp b/indra/llcommon/llsys.cpp index 315b42a71..766d1bbc0 100644 --- a/indra/llcommon/llsys.cpp +++ b/indra/llcommon/llsys.cpp @@ -42,6 +42,7 @@ #include "llprocessor.h" #include "llerrorcontrol.h" #include "llevents.h" +#include "llformat.h" #include "lltimer.h" #include "llsdserialize.h" #include "llsdutil.h" @@ -80,6 +81,7 @@ using namespace llsd; # include # include const char MEMINFO_FILE[] = "/proc/meminfo"; +# include #elif LL_SOLARIS # include # include @@ -107,6 +109,9 @@ static const F32 MEM_INFO_THROTTLE = 20; static const F32 MEM_INFO_WINDOW = 10*60; #if LL_WINDOWS +// We cannot trust GetVersionEx function on Win8.1 , we should check this value when creating OS string +static const U32 WINNT_WINBLUE = 0x0603; + #ifndef DLLVERSIONINFO typedef struct _DllVersionInfo { @@ -175,13 +180,67 @@ bool get_shell32_dll_version(DWORD& major, DWORD& minor, DWORD& build_number) } #endif // LL_WINDOWS +// Wrap boost::regex_match() with a function that doesn't throw. +template +static bool regex_match_no_exc(const S& string, M& match, const R& regex) +{ + try + { + return boost::regex_match(string, match, regex); + } + catch (const std::runtime_error& e) + { + LL_WARNS("LLMemoryInfo") << "error matching with '" << regex.str() << "': " + << e.what() << ":\n'" << string << "'" << LL_ENDL; + return false; + } +} + +// Wrap boost::regex_search() with a function that doesn't throw. +template +static bool regex_search_no_exc(const S& string, M& match, const R& regex) +{ + try + { + return boost::regex_search(string, match, regex); + } + catch (const std::runtime_error& e) + { + LL_WARNS("LLMemoryInfo") << "error searching with '" << regex.str() << "': " + << e.what() << ":\n'" << string << "'" << LL_ENDL; + return false; + } +} + +#if LL_WINDOWS +// GetVersionEx should not works correct with Windows 8.1 and the later version. We need to check this case +static bool check_for_version(WORD wMajorVersion, WORD wMinorVersion, WORD wServicePackMajor) +{ + OSVERSIONINFOEXW osvi = { sizeof(osvi), 0, 0, 0, 0, {0}, 0, 0 }; + DWORDLONG const dwlConditionMask = VerSetConditionMask( + VerSetConditionMask( + VerSetConditionMask( + 0, VER_MAJORVERSION, VER_GREATER_EQUAL), + VER_MINORVERSION, VER_GREATER_EQUAL), + VER_SERVICEPACKMAJOR, VER_GREATER_EQUAL); + + osvi.dwMajorVersion = wMajorVersion; + osvi.dwMinorVersion = wMinorVersion; + osvi.wServicePackMajor = wServicePackMajor; + + return VerifyVersionInfoW(&osvi, VER_MAJORVERSION | VER_MINORVERSION | VER_SERVICEPACKMAJOR, dwlConditionMask) != FALSE; +} +#endif + + LLOSInfo::LLOSInfo() : - mMajorVer(0), mMinorVer(0), mBuild(0) + mMajorVer(0), mMinorVer(0), mBuild(0), mOSVersionString("") { #if LL_WINDOWS OSVERSIONINFOEX osvi; BOOL bOsVersionInfoEx; + BOOL bShouldUseShellVersion = false; // Try calling GetVersionEx using the OSVERSIONINFOEX structure. ZeroMemory(&osvi, sizeof(OSVERSIONINFOEX)); @@ -244,10 +303,18 @@ LLOSInfo::LLOSInfo() : } else if(osvi.dwMinorVersion == 2) { + if (check_for_version(HIBYTE(WINNT_WINBLUE), LOBYTE(WINNT_WINBLUE), 0)) + { + mOSStringSimple = "Microsoft Windows 8.1 "; + bShouldUseShellVersion = true; // GetVersionEx failed, going to use shell version + } + else + { if(osvi.wProductType == VER_NT_WORKSTATION) mOSStringSimple = "Microsoft Windows 8 "; else mOSStringSimple = "Windows Server 2012 "; + } } ///get native system info if available.. @@ -314,9 +381,8 @@ LLOSInfo::LLOSInfo() : } else { - tmpstr = llformat("%s (Build %d)", - csdversion.c_str(), - (osvi.dwBuildNumber & 0xffff)); + tmpstr = !bShouldUseShellVersion ? llformat("%s (Build %d)", csdversion.c_str(), (osvi.dwBuildNumber & 0xffff)): + llformat("%s (Build %d)", csdversion.c_str(), shell32_build); } mOSString = mOSStringSimple + tmpstr; @@ -352,7 +418,7 @@ LLOSInfo::LLOSInfo() : std::string compatibility_mode; if(got_shell32_version) { - if(osvi.dwMajorVersion != shell32_major || osvi.dwMinorVersion != shell32_minor) + if((osvi.dwMajorVersion != shell32_major || osvi.dwMinorVersion != shell32_minor) && !bShouldUseShellVersion) { compatibility_mode = llformat(" compatibility mode. real ver: %d.%d (Build %d)", shell32_major, @@ -412,6 +478,102 @@ LLOSInfo::LLOSInfo() : mOSString = mOSStringSimple; } +#elif LL_LINUX + + struct utsname un; + if(uname(&un) != -1) + { + mOSStringSimple.append(un.sysname); + mOSStringSimple.append(" "); + mOSStringSimple.append(un.release); + + mOSString = mOSStringSimple; + mOSString.append(" "); + mOSString.append(un.version); + mOSString.append(" "); + mOSString.append(un.machine); + + // Simplify 'Simple' + std::string ostype = mOSStringSimple.substr(0, mOSStringSimple.find_first_of(" ", 0)); + if (ostype == "Linux") + { + // Only care about major and minor Linux versions, truncate at second '.' + std::string::size_type idx1 = mOSStringSimple.find_first_of(".", 0); + std::string::size_type idx2 = (idx1 != std::string::npos) ? mOSStringSimple.find_first_of(".", idx1+1) : std::string::npos; + std::string simple = mOSStringSimple.substr(0, idx2); + if (simple.length() > 0) + mOSStringSimple = simple; + } + } + else + { + mOSStringSimple.append("Unable to collect OS info"); + mOSString = mOSStringSimple; + } + + const char OS_VERSION_MATCH_EXPRESSION[] = "([0-9]+)\\.([0-9]+)(\\.([0-9]+))?"; + boost::regex os_version_parse(OS_VERSION_MATCH_EXPRESSION); + boost::smatch matched; + + std::string glibc_version(gnu_get_libc_version()); + if ( regex_match_no_exc(glibc_version, matched, os_version_parse) ) + { + LL_INFOS("AppInit") << "Using glibc version '" << glibc_version << "' as OS version" << LL_ENDL; + + std::string version_value; + + if ( matched[1].matched ) // Major version + { + version_value.assign(matched[1].first, matched[1].second); + if (sscanf(version_value.c_str(), "%d", &mMajorVer) != 1) + { + LL_WARNS("AppInit") << "failed to parse major version '" << version_value << "' as a number" << LL_ENDL; + } + } + else + { + LL_ERRS("AppInit") + << "OS version regex '" << OS_VERSION_MATCH_EXPRESSION + << "' returned true, but major version [1] did not match" + << LL_ENDL; + } + + if ( matched[2].matched ) // Minor version + { + version_value.assign(matched[2].first, matched[2].second); + if (sscanf(version_value.c_str(), "%d", &mMinorVer) != 1) + { + LL_ERRS("AppInit") << "failed to parse minor version '" << version_value << "' as a number" << LL_ENDL; + } + } + else + { + LL_ERRS("AppInit") + << "OS version regex '" << OS_VERSION_MATCH_EXPRESSION + << "' returned true, but minor version [1] did not match" + << LL_ENDL; + } + + if ( matched[4].matched ) // Build version (optional) - note that [3] includes the '.' + { + version_value.assign(matched[4].first, matched[4].second); + if (sscanf(version_value.c_str(), "%d", &mBuild) != 1) + { + LL_ERRS("AppInit") << "failed to parse build version '" << version_value << "' as a number" << LL_ENDL; + } + } + else + { + LL_INFOS("AppInit") + << "OS build version not provided; using zero" + << LL_ENDL; + } + } + else + { + LL_WARNS("AppInit") << "glibc version '" << glibc_version << "' cannot be parsed to three numbers; using all zeros" << LL_ENDL; + } + #else struct utsname un; @@ -444,8 +606,13 @@ LLOSInfo::LLOSInfo() : mOSStringSimple.append("Unable to collect OS info"); mOSString = mOSStringSimple; } + #endif + std::stringstream dotted_version_string; + dotted_version_string << mMajorVer << "." << mMinorVer << "." << mBuild; + mOSVersionString.append(dotted_version_string.str()); + } #ifndef LL_WINDOWS @@ -496,6 +663,11 @@ const std::string& LLOSInfo::getOSStringSimple() const return mOSStringSimple; } +const std::string& LLOSInfo::getOSVersionString() const +{ + return mOSVersionString; +} + const S32 STATUS_SIZE = 8192; //static @@ -687,38 +859,6 @@ private: LLSD mStats; }; -// Wrap boost::regex_match() with a function that doesn't throw. -template -static bool regex_match_no_exc(const S& string, M& match, const R& regex) -{ - try - { - return boost::regex_match(string, match, regex); - } - catch (const std::runtime_error& e) - { - LL_WARNS("LLMemoryInfo") << "error matching with '" << regex.str() << "': " - << e.what() << ":\n'" << string << "'" << LL_ENDL; - return false; - } -} - -// Wrap boost::regex_search() with a function that doesn't throw. -template -static bool regex_search_no_exc(const S& string, M& match, const R& regex) -{ - try - { - return boost::regex_search(string, match, regex); - } - catch (const std::runtime_error& e) - { - LL_WARNS("LLMemoryInfo") << "error searching with '" << regex.str() << "': " - << e.what() << ":\n'" << string << "'" << LL_ENDL; - return false; - } -} - LLMemoryInfo::LLMemoryInfo() { refresh(); @@ -1288,9 +1428,14 @@ public: LL_CONT << "slowest framerate for last " << int(prevSize * MEM_INFO_THROTTLE) << " seconds "; } - LL_CONT << std::fixed << std::setprecision(1) << framerate << std::setprecision(6) << '\n' - << LLMemoryInfo() << LL_ENDL; + std::streamsize precision = LL_CONT.precision(); // + + LL_CONT << std::fixed << std::setprecision(1) << framerate << '\n' + << LLMemoryInfo(); + + LL_CONT.precision(precision); + LL_CONT << LL_ENDL; return false; } diff --git a/indra/llcommon/llsys.h b/indra/llcommon/llsys.h index fb39ef4da..52b884e5a 100644 --- a/indra/llcommon/llsys.h +++ b/indra/llcommon/llsys.h @@ -33,9 +33,10 @@ // use an LLCPUInfo object: // // LLCPUInfo info; -// llinfos << info << llendl; +// LL_INFOS() << info << LL_ENDL; // +#include "llsd.h" #include #include @@ -48,6 +49,8 @@ public: const std::string& getOSString() const; const std::string& getOSStringSimple() const; + const std::string& getOSVersionString() const; + S32 mMajorVer; S32 mMinorVer; S32 mBuild; @@ -61,6 +64,7 @@ public: private: std::string mOSString; std::string mOSStringSimple; + std::string mOSVersionString; }; @@ -101,7 +105,7 @@ class LL_COMMON_API LLMemoryInfo Here's how you use an LLMemoryInfo: LLMemoryInfo info; -
llinfos << info << llendl; +
LL_INFOS() << info << LL_ENDL; */ { public: diff --git a/indra/llcommon/llthread.h b/indra/llcommon/llthread.h index 62e36c2e4..1b83c07ce 100644 --- a/indra/llcommon/llthread.h +++ b/indra/llcommon/llthread.h @@ -201,7 +201,7 @@ protected: #include typedef boost::recursive_mutex LLMutexImpl; typedef boost::condition_variable_any LLConditionVariableImpl; -#elif defined(USE_STD_MUTEX) && (__cplusplus >= 201103L || _MSC_VER >= 1800) +#elif defined(USE_STD_MUTEX) && LL_CPP11 #include typedef std::recursive_mutex LLMutexImpl; typedef std::condition_variable_any LLConditionVariableImpl; @@ -224,6 +224,7 @@ typedef apr_thread_cond_t* impl_cond_handle_type; #define NEEDS_MUTEX_RECURSION //END #endif +#include "llfasttimer.h" #ifdef NEEDS_MUTEX_IMPL diff --git a/indra/llcommon/lltimer.cpp b/indra/llcommon/lltimer.cpp index e77d8b63a..ff9f63b1a 100644 --- a/indra/llcommon/lltimer.cpp +++ b/indra/llcommon/lltimer.cpp @@ -30,8 +30,6 @@ #include "u64.h" -#include "lldate.h" - #if LL_WINDOWS # define WIN32_LEAN_AND_MEAN # include @@ -192,7 +190,7 @@ U64 get_clock_count() return clock_count.QuadPart - offset; } -F64 calc_clock_frequency(void) +F64 calc_clock_frequency() { __int64 freq; QueryPerformanceFrequency((LARGE_INTEGER *) &freq); @@ -203,9 +201,9 @@ F64 calc_clock_frequency(void) #if LL_LINUX || LL_DARWIN || LL_SOLARIS // Both Linux and Mac use gettimeofday for accurate time -F64 calc_clock_frequency(void) +F64 calc_clock_frequency() { - return 1000000.0; // microseconds, so 1 Mhz. + return 1000000.0; // microseconds, so 1 MHz. } U64 get_clock_count() @@ -229,7 +227,7 @@ void update_clock_frequencies() /////////////////////////////////////////////////////////////////////////////// // returns a U64 number that represents the number of -// microseconds since the unix epoch - Jan 1, 1970 +// microseconds since the Unix epoch - Jan 1, 1970 U64 totalTime() { U64 current_clock_count = get_clock_count(); @@ -450,7 +448,7 @@ BOOL LLTimer::knownBadTimer() { if (!wcscmp(pci_id, bad_pci_list[check])) { -// llwarns << "unreliable PCI chipset found!! " << pci_id << endl; +// LL_WARNS() << "unreliable PCI chipset found!! " << pci_id << endl; failed = TRUE; break; } @@ -569,6 +567,3 @@ void timeStructToFormattedString(struct tm * time, std::string format, std::stri } - - - diff --git a/indra/llcommon/lltimer.h b/indra/llcommon/lltimer.h index 167784f3c..0d2e8e86d 100644 --- a/indra/llcommon/lltimer.h +++ b/indra/llcommon/lltimer.h @@ -55,7 +55,7 @@ public: protected: U64 mLastClockCount; U64 mExpirationTicks; - BOOL mStarted; + bool mStarted; public: LLTimer(); @@ -97,7 +97,7 @@ public: F32 getElapsedTimeF32() const; // Returns elapsed time in seconds F64 getElapsedTimeF64() const; // Returns elapsed time in seconds - BOOL getStarted() const { return mStarted; } + bool getStarted() const { return mStarted; } static U64 getCurrentClockCount(); // Returns the raw clockticks diff --git a/indra/llcommon/lluuid.cpp b/indra/llcommon/lluuid.cpp index 0182a370d..7e9460b23 100644 --- a/indra/llcommon/lluuid.cpp +++ b/indra/llcommon/lluuid.cpp @@ -716,7 +716,7 @@ void LLUUID::getCurrentTime(uuid_time_t *timestamp) getSystemTime(&time_last); uuids_this_tick = uuids_per_tick; init = TRUE; - mMutex = new LLMutex; + mMutex = new LLMutex(); } uuid_time_t time_now = {0,0}; diff --git a/indra/llcommon/lluuid.h b/indra/llcommon/lluuid.h index ef99c13e7..85abc411c 100644 --- a/indra/llcommon/lluuid.h +++ b/indra/llcommon/lluuid.h @@ -29,6 +29,8 @@ #include #include #include +#include +#include #include "stdtypes.h" #include "llpreprocessor.h" @@ -116,6 +118,19 @@ public: U16 getCRC16() const; U32 getCRC32() const; + inline size_t hash() const + { + size_t seed = 0; + for (U8 i = 0; i < 4; ++i) + { + seed ^= static_cast(mData[i * 4]) + 0x9e3779b9 + (seed << 6) + (seed >> 2); + seed ^= static_cast(mData[i * 4 + 1]) + 0x9e3779b9 + (seed << 6) + (seed >> 2); + seed ^= static_cast(mData[i * 4 + 2]) + 0x9e3779b9 + (seed << 6) + (seed >> 2); + seed ^= static_cast(mData[i * 4 + 3]) + 0x9e3779b9 + (seed << 6) + (seed >> 2); + } + return seed; + } + static BOOL validate(const std::string& in_string); // Validate that the UUID string is legal. static const LLUUID null; @@ -129,8 +144,6 @@ public: U8 mData[UUID_BYTES]; }; -typedef std::vector uuid_vec_t; - // Construct inline LLUUID::LLUUID() { @@ -141,38 +154,20 @@ inline LLUUID::LLUUID() // Faster than copying from memory inline void LLUUID::setNull() { - U32 *word = (U32 *)mData; - word[0] = 0; - word[1] = 0; - word[2] = 0; - word[3] = 0; + memset(mData, 0, sizeof(mData)); // } // Compare inline bool LLUUID::operator==(const LLUUID& rhs) const { - U32 *tmp = (U32 *)mData; - U32 *rhstmp = (U32 *)rhs.mData; - // Note: binary & to avoid branching - return - (tmp[0] == rhstmp[0]) & - (tmp[1] == rhstmp[1]) & - (tmp[2] == rhstmp[2]) & - (tmp[3] == rhstmp[3]); + return !memcmp(mData, rhs.mData, sizeof(mData)); // } inline bool LLUUID::operator!=(const LLUUID& rhs) const { - U32 *tmp = (U32 *)mData; - U32 *rhstmp = (U32 *)rhs.mData; - // Note: binary | to avoid branching - return - (tmp[0] != rhstmp[0]) | - (tmp[1] != rhstmp[1]) | - (tmp[2] != rhstmp[2]) | - (tmp[3] != rhstmp[3]); + return !!memcmp(mData, rhs.mData, sizeof(mData)); // } /* @@ -187,28 +182,20 @@ inline LLUUID::operator bool() const inline BOOL LLUUID::notNull() const { - U32 *word = (U32 *)mData; - return (word[0] | word[1] | word[2] | word[3]) > 0; + return !!memcmp(mData, null.mData, sizeof(mData)); // } // Faster than == LLUUID::null because doesn't require // as much memory access. inline BOOL LLUUID::isNull() const { - U32 *word = (U32 *)mData; - // If all bits are zero, return !0 == TRUE - return !(word[0] | word[1] | word[2] | word[3]); + return !memcmp(mData, null.mData, sizeof(mData)); // } // Copy constructor inline LLUUID::LLUUID(const LLUUID& rhs) { - U32 *tmp = (U32 *)mData; - U32 *rhstmp = (U32 *)rhs.mData; - tmp[0] = rhstmp[0]; - tmp[1] = rhstmp[1]; - tmp[2] = rhstmp[2]; - tmp[3] = rhstmp[3]; + memcpy(mData, rhs.mData, sizeof(mData)); // } inline LLUUID::~LLUUID() @@ -218,14 +205,7 @@ inline LLUUID::~LLUUID() // Assignment inline LLUUID& LLUUID::operator=(const LLUUID& rhs) { - // No need to check the case where this==&rhs. The branch is slower than the write. - U32 *tmp = (U32 *)mData; - U32 *rhstmp = (U32 *)rhs.mData; - tmp[0] = rhstmp[0]; - tmp[1] = rhstmp[1]; - tmp[2] = rhstmp[2]; - tmp[3] = rhstmp[3]; - + memcpy(mData, rhs.mData, sizeof(mData)); // return *this; } @@ -298,13 +278,25 @@ inline U16 LLUUID::getCRC16() const inline U32 LLUUID::getCRC32() const { - U32 *tmp = (U32*)mData; - return tmp[0] + tmp[1] + tmp[2] + tmp[3]; + // + U32 ret = 0; + for(U32 i = 0;i < 4;++i) + { + ret += (mData[i*4]) | (mData[i*4+1]) << 8 | (mData[i*4+2]) << 16 | (mData[i*4+3]) << 24; + } + return ret; + // } +typedef std::vector uuid_vec_t; +typedef std::set uuid_set_t; -// Helper structure for ordering lluuids in stl containers. -// eg: std::map widget_map; +// Helper structure for ordering lluuids in stl containers. eg: +// std::map widget_map; +// +// (isn't this the default behavior anyway? I think we could +// everywhere replace these with uuid_set_t, but someone should +// verify.) struct lluuid_less { bool operator()(const LLUUID& lhs, const LLUUID& rhs) const @@ -315,6 +307,31 @@ struct lluuid_less typedef std::set uuid_list_t; + +#ifdef LL_CPP11 +namespace std { + template <> struct hash +{ + public: + size_t operator()(const LLUUID & id) const + { + return id.hash(); + } + }; +} +#endif + +namespace boost { + template<> class hash +{ + public: + size_t operator()(const LLUUID& id) const + { + return id.hash(); + } +}; +} + /* * Sub-classes for keeping transaction IDs and asset IDs * straight. @@ -331,3 +348,5 @@ public: }; #endif + + diff --git a/indra/llcommon/sguuidhash.h b/indra/llcommon/sguuidhash.h deleted file mode 100644 index b6b65aa0a..000000000 --- a/indra/llcommon/sguuidhash.h +++ /dev/null @@ -1,36 +0,0 @@ -/* Copyright (C) 2013 Siana Gearz - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General - * Public License along with this library; if not, write to the - * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301 USA */ - -#ifndef SGUUIDHASH_H -#define SGUUIDHASH_H - -#include "lluuid.h" -#include -#include - -namespace boost { - template<> class hash { - public: - size_t operator()(const LLUUID& id ) const - { - return *reinterpret_cast(id.mData); - } - }; -} - - -#endif diff --git a/indra/llimage/llimage.cpp b/indra/llimage/llimage.cpp index 18258ad3a..d9a8696a0 100644 --- a/indra/llimage/llimage.cpp +++ b/indra/llimage/llimage.cpp @@ -1178,13 +1178,13 @@ void LLImageRaw::copyLineScaled( U8* in, U8* out, S32 in_pixel_len, S32 out_pixe a *= norm_factor; // skip conditional S32 t4 = x * out_pixel_step * components; - out[t4 + 0] = U8(llmath::llround(r)); + out[t4 + 0] = U8(ll_round(r)); if (components >= 2) - out[t4 + 1] = U8(llmath::llround(g)); + out[t4 + 1] = U8(ll_round(g)); if (components >= 3) - out[t4 + 2] = U8(llmath::llround(b)); + out[t4 + 2] = U8(ll_round(b)); if( components == 4) - out[t4 + 3] = U8(llmath::llround(a)); + out[t4 + 3] = U8(ll_round(a)); } } } @@ -1259,10 +1259,10 @@ void LLImageRaw::compositeRowScaled4onto3( U8* in, U8* out, S32 in_pixel_len, S3 b *= norm_factor; a *= norm_factor; - in_scaled_r = U8(llmath::llround(r)); - in_scaled_g = U8(llmath::llround(g)); - in_scaled_b = U8(llmath::llround(b)); - in_scaled_a = U8(llmath::llround(a)); + in_scaled_r = U8(ll_round(r)); + in_scaled_g = U8(ll_round(g)); + in_scaled_b = U8(ll_round(b)); + in_scaled_a = U8(ll_round(a)); } if( in_scaled_a ) diff --git a/indra/llmath/llmath.h b/indra/llmath/llmath.h index 5009a1c4f..7b3586cf3 100644 --- a/indra/llmath/llmath.h +++ b/indra/llmath/llmath.h @@ -27,6 +27,8 @@ #ifndef LLMATH_H #define LLMATH_H +#include "llpreprocessor.h" + #include #include #include @@ -39,6 +41,7 @@ // llcommon depend on llmath. #include "is_approx_equal_fraction.h" + // work around for Windows & older gcc non-standard function names. #if LL_WINDOWS #include @@ -153,7 +156,7 @@ inline F64 llabs(const F64 a) inline S32 lltrunc( F32 f ) { -#if LL_WINDOWS && !defined( __INTEL_COMPILER ) && !defined(_WIN64) +#if LL_WINDOWS && !defined( __INTEL_COMPILER ) && !defined(_WIN64) && !(_MSC_VER >= 1800) // Avoids changing the floating point control word. // Add or subtract 0.5 - epsilon and then round const static U32 zpfp[] = { 0xBEFFFFFF, 0x3EFFFFFF }; @@ -167,15 +170,22 @@ inline S32 lltrunc( F32 f ) fistp result } return result; +#else +#ifdef LL_CPP11 + return (S32)trunc(f); #else return (S32)f; #endif +#endif } inline S32 lltrunc( F64 f ) { - +#ifdef LL_CPP11 + return (S32)trunc(f); +#else return (S32)f; +#endif } inline S32 llfloor( F32 f ) @@ -204,36 +214,32 @@ inline S32 llceil( F32 f ) return (S32)ceil(f); } - -namespace llmath +// Use this round. Does an arithmetic round (0.5 always rounds up) +inline S32 ll_round(const F32 val) { - // Use this round. Does an arithmetic round (0.5 always rounds up) - inline S32 llround(const F32 val) - { -#if __cplusplus >= 201103L || _MSC_VER >= 1800 - return S32(std::round(val)); +#ifdef LL_CPP11 + return (S32)round(val); #else - return llfloor(val + 0.5f); + return llfloor(val + 0.5f); #endif - } +} - inline F32 llround(F32 val, F32 nearest) - { -#if __cplusplus >= 201103L || _MSC_VER >= 1800 - return F32(std::round(val * (1.0f / nearest))) * nearest; +inline F32 ll_round(F32 val, F32 nearest) +{ +#ifdef LL_CPP11 + return F32(round(val * (1.0f / nearest))) * nearest; #else - return F32(floor(val * (1.0f / nearest) + 0.5f)) * nearest; + return F32(floor(val * (1.0f / nearest) + 0.5f)) * nearest; #endif - } +} - inline F64 llround(F64 val, F64 nearest) - { -#if __cplusplus >= 201103L || _MSC_VER >= 1800 - return F64(std::round(val * (1.0 / nearest))) * nearest; +inline F64 ll_round(F64 val, F64 nearest) +{ +#ifdef LL_CPP11 + return F64(round(val * (1.0 / nearest))) * nearest; #else - return F64(floor(val * (1.0 / nearest) + 0.5)) * nearest; + return F64(floor(val * (1.0 / nearest) + 0.5)) * nearest; #endif - } } // these provide minimum peak error @@ -281,7 +287,7 @@ const S32 LL_SHIFT_AMOUNT = 16; //16.16 fixed point represe #define LL_MAN_INDEX 1 #endif -/* Deprecated: use llmath::llround(), lltrunc(), or llfloor() instead +/* Deprecated: use ll_round(), lltrunc(), or llfloor() instead // ================================================================================================ // Real2Int // ================================================================================================ @@ -323,7 +329,7 @@ static union #define LL_EXP_A (1048576 * OO_LN2) // use 1512775 for integer #define LL_EXP_C (60801) // this value of C good for -4 < y < 4 -#define LL_FAST_EXP(y) (LLECO.n.i = llmath::llround(F32(LL_EXP_A*(y))) + (1072693248 - LL_EXP_C), LLECO.d) +#define LL_FAST_EXP(y) (LLECO.n.i = ll_round(F32(LL_EXP_A*(y))) + (1072693248 - LL_EXP_C), LLECO.d) @@ -342,8 +348,8 @@ inline F32 snap_to_sig_figs(F32 foo, S32 sig_figs) bar *= 10.f; } - //F32 new_foo = (F32)llmath::llround(foo * bar); - // the llmath::llround() implementation sucks. Don't us it. + //F32 new_foo = (F32)ll_round(foo * bar); + // the ll_round() implementation sucks. Don't us it. F32 sign = (foo > 0.f) ? 1.f : -1.f; F32 new_foo = F32( S64(foo * bar + sign * 0.5f)); diff --git a/indra/llmath/llquantize.h b/indra/llmath/llquantize.h index 6df9c1fb4..9bcd2607d 100644 --- a/indra/llmath/llquantize.h +++ b/indra/llmath/llquantize.h @@ -52,7 +52,7 @@ inline U16 F32_to_U16_ROUND(F32 val, F32 lower, F32 upper) val /= (upper - lower); // round the value. Sreturn the U16 - return (U16)(llmath::llround(val*U16MAX)); + return (U16)(ll_round(val*U16MAX)); } @@ -92,7 +92,7 @@ inline U8 F32_to_U8_ROUND(F32 val, F32 lower, F32 upper) val /= (upper - lower); // return the rounded U8 - return (U8)(llmath::llround(val*U8MAX)); + return (U8)(ll_round(val*U8MAX)); } diff --git a/indra/llmath/llvolume.cpp b/indra/llmath/llvolume.cpp index 25697eef6..e415961f0 100644 --- a/indra/llmath/llvolume.cpp +++ b/indra/llmath/llvolume.cpp @@ -560,7 +560,7 @@ void LLProfile::genNGon(const LLProfileParams& params, S32 sides, F32 offset, F3 // Scale to have size "match" scale. Compensates to get object to generally fill bounding box. - S32 total_sides = llmath::llround(sides / ang_scale); // Total number of sides all around + S32 total_sides = ll_round(sides / ang_scale); // Total number of sides all around if (total_sides < 8) { diff --git a/indra/llmath/v4color.cpp b/indra/llmath/v4color.cpp index 6b771c3ad..8e63b4357 100644 --- a/indra/llmath/v4color.cpp +++ b/indra/llmath/v4color.cpp @@ -125,10 +125,10 @@ LLColor4 LLColor4::cyan6(0.2f, 0.6f, 0.6f, 1.0f); LLColor4::operator const LLColor4U() const { return LLColor4U( - (U8)llclampb(llmath::llround(mV[VRED]*255.f)), - (U8)llclampb(llmath::llround(mV[VGREEN]*255.f)), - (U8)llclampb(llmath::llround(mV[VBLUE]*255.f)), - (U8)llclampb(llmath::llround(mV[VALPHA]*255.f))); + (U8)llclampb(ll_round(mV[VRED]*255.f)), + (U8)llclampb(ll_round(mV[VGREEN]*255.f)), + (U8)llclampb(ll_round(mV[VBLUE]*255.f)), + (U8)llclampb(ll_round(mV[VALPHA]*255.f))); } LLColor4::LLColor4(const LLColor3 &vec, F32 a) diff --git a/indra/llmath/v4coloru.h b/indra/llmath/v4coloru.h index 5040f0710..2018a95f5 100644 --- a/indra/llmath/v4coloru.h +++ b/indra/llmath/v4coloru.h @@ -353,10 +353,10 @@ inline LLColor4U LLColor4U::multAll(const F32 k) { // Round to nearest return LLColor4U( - (U8)llmath::llround(mV[VX] * k), - (U8)llmath::llround(mV[VY] * k), - (U8)llmath::llround(mV[VZ] * k), - (U8)llmath::llround(mV[VW] * k)); + (U8)ll_round(mV[VX] * k), + (U8)ll_round(mV[VY] * k), + (U8)ll_round(mV[VZ] * k), + (U8)ll_round(mV[VW] * k)); } /* inline LLColor4U operator*(const LLColor4U &a, U8 k) @@ -471,7 +471,7 @@ void LLColor4U::setVecScaleClamp(const LLColor4& color) color_scale_factor /= max_color; } const S32 MAX_COLOR = 255; - S32 r = llmath::llround(color.mV[0] * color_scale_factor); + S32 r = ll_round(color.mV[0] * color_scale_factor); if (r > MAX_COLOR) { r = MAX_COLOR; @@ -482,7 +482,7 @@ void LLColor4U::setVecScaleClamp(const LLColor4& color) } mV[0] = r; - S32 g = llmath::llround(color.mV[1] * color_scale_factor); + S32 g = ll_round(color.mV[1] * color_scale_factor); if (g > MAX_COLOR) { g = MAX_COLOR; @@ -493,7 +493,7 @@ void LLColor4U::setVecScaleClamp(const LLColor4& color) } mV[1] = g; - S32 b = llmath::llround(color.mV[2] * color_scale_factor); + S32 b = ll_round(color.mV[2] * color_scale_factor); if (b > MAX_COLOR) { b = MAX_COLOR; @@ -505,7 +505,7 @@ void LLColor4U::setVecScaleClamp(const LLColor4& color) mV[2] = b; // Alpha shouldn't be scaled, just clamped... - S32 a = llmath::llround(color.mV[3] * MAX_COLOR); + S32 a = ll_round(color.mV[3] * MAX_COLOR); if (a > MAX_COLOR) { a = MAX_COLOR; @@ -527,7 +527,7 @@ void LLColor4U::setVecScaleClamp(const LLColor3& color) } const S32 MAX_COLOR = 255; - S32 r = llmath::llround(color.mV[0] * color_scale_factor); + S32 r = ll_round(color.mV[0] * color_scale_factor); if (r > MAX_COLOR) { r = MAX_COLOR; @@ -539,7 +539,7 @@ void LLColor4U::setVecScaleClamp(const LLColor3& color) } mV[0] = r; - S32 g = llmath::llround(color.mV[1] * color_scale_factor); + S32 g = ll_round(color.mV[1] * color_scale_factor); if (g > MAX_COLOR) { g = MAX_COLOR; @@ -551,7 +551,7 @@ void LLColor4U::setVecScaleClamp(const LLColor3& color) } mV[1] = g; - S32 b = llmath::llround(color.mV[2] * color_scale_factor); + S32 b = ll_round(color.mV[2] * color_scale_factor); if (b > MAX_COLOR) { b = MAX_COLOR; diff --git a/indra/llmessage/llmail.cpp b/indra/llmessage/llmail.cpp index 08b31e9c7..a06261bc8 100644 --- a/indra/llmessage/llmail.cpp +++ b/indra/llmessage/llmail.cpp @@ -200,7 +200,7 @@ std::string LLMail::buildSMTPTransaction( if(!from_address || !to_address) { llinfos << "send_mail build_smtp_transaction reject: missing to and/or" - << " from address." << llendl; + << " from address." << LL_ENDL; return std::string(); } if(!valid_subject_chars(subject)) @@ -208,7 +208,7 @@ std::string LLMail::buildSMTPTransaction( llinfos << "send_mail build_smtp_transaction reject: bad subject header: " << "to=<" << to_address << ">, from=<" << from_address << ">" - << llendl; + << LL_ENDL; return std::string(); } std::ostringstream from_fmt; @@ -266,7 +266,7 @@ bool LLMail::send( if(!from_address || !to_address) { llinfos << "send_mail reject: missing to and/or from address." - << llendl; + << LL_ENDL; return false; } @@ -278,7 +278,7 @@ bool LLMail::send( std::string good_string = "\n..\n"; while (1) { - int index = message.find(bad_string); + size_t index = message.find(bad_string); if (index == std::string::npos) break; message.replace(index, bad_string.size(), good_string); } @@ -305,7 +305,7 @@ bool LLMail::send( { llinfos << "send_mail reject: mail system is disabled: to=<" << to_address << ">, from=<" << from_address - << ">" << llendl; + << ">" << LL_ENDL; // Any future interface to SMTP should return this as an // error. --mark return true; @@ -314,7 +314,7 @@ bool LLMail::send( { llwarns << "send_mail reject: mail system not initialized: to=<" << to_address << ">, from=<" << from_address - << ">" << llendl; + << ">" << LL_ENDL; return false; } @@ -322,7 +322,7 @@ bool LLMail::send( { llwarns << "send_mail reject: SMTP connect failure: to=<" << to_address << ">, from=<" << from_address - << ">" << llendl; + << ">" << LL_ENDL; return false; } @@ -342,20 +342,20 @@ bool LLMail::send( << "to=<" << to_address << ">, from=<" << from_address << ">" << ", bytes=" << original_size - << ", sent=" << send_size << llendl; + << ", sent=" << send_size << LL_ENDL; return false; } if(send_size >= LL_MAX_KNOWN_GOOD_MAIL_SIZE) { llwarns << "send_mail message has been shown to fail in testing " << "when sending messages larger than " << LL_MAX_KNOWN_GOOD_MAIL_SIZE - << " bytes. The next log about success is potentially a lie." << llendl; + << " bytes. The next log about success is potentially a lie." << LL_ENDL; } lldebugs << "send_mail success: " << "to=<" << to_address << ">, from=<" << from_address << ">" << ", bytes=" << original_size - << ", sent=" << send_size << llendl; + << ", sent=" << send_size << LL_ENDL; #if LL_LOG_ENTIRE_MAIL_MESSAGE_ON_SEND llinfos << rfc2822_msg.str() << llendl; diff --git a/indra/llmessage/llmessagethrottle.cpp b/indra/llmessage/llmessagethrottle.cpp index 6d6e9a924..20d828f95 100644 --- a/indra/llmessage/llmessagethrottle.cpp +++ b/indra/llmessage/llmessagethrottle.cpp @@ -26,25 +26,13 @@ #include "linden_common.h" -#include "llhash.h" - #include "llmessagethrottle.h" #include "llframetimer.h" -#include "fix_macros.h" -// This is used for the stl search_n function. -#if _MSC_VER >= 1500 // VC9 has a bug in search_n -struct eq_message_throttle_entry : public std::binary_function< LLMessageThrottleEntry, LLMessageThrottleEntry, bool > -{ - bool operator()(const LLMessageThrottleEntry& a, const LLMessageThrottleEntry& b) const - { - return a.getHash() == b.getHash(); - } -}; -#else +#include + bool eq_message_throttle_entry(LLMessageThrottleEntry a, LLMessageThrottleEntry b) { return a.getHash() == b.getHash(); } -#endif const U64 SEC_TO_USEC = 1000000; @@ -114,19 +102,14 @@ BOOL LLMessageThrottle::addViewerAlert(const LLUUID& to, const std::string& mesg std::ostringstream full_mesg; full_mesg << to << mesg; - // Create an entry for this message. - size_t hash = llhash(full_mesg.str().c_str()); + // Create an entry for this message.o.o + size_t hash = boost::hash()(full_mesg.str()); LLMessageThrottleEntry entry(hash, LLFrameTimer::getTotalTime()); // Check if this message is already in the list. -#if _MSC_VER >= 1500 // VC9 has a bug in search_n - // SJB: This *should* work but has not been tested yet *TODO: Test! - message_list_iterator_t found = std::find_if(message_list->begin(), message_list->end(), - std::bind2nd(eq_message_throttle_entry(), entry)); -#else message_list_iterator_t found = std::search_n(message_list->begin(), message_list->end(), 1, entry, eq_message_throttle_entry); -#endif + if (found == message_list->end()) { // This message was not found. Add it to the list. @@ -149,18 +132,12 @@ BOOL LLMessageThrottle::addAgentAlert(const LLUUID& agent, const LLUUID& task, c full_mesg << agent << task << mesg; // Create an entry for this message. - size_t hash = llhash(full_mesg.str().c_str()); + size_t hash = boost::hash()(full_mesg.str()); LLMessageThrottleEntry entry(hash, LLFrameTimer::getTotalTime()); // Check if this message is already in the list. -#if _MSC_VER >= 1500 // VC9 has a bug in search_n - // SJB: This *should* work but has not been tested yet *TODO: Test! - message_list_iterator_t found = std::find_if(message_list->begin(), message_list->end(), - std::bind2nd(eq_message_throttle_entry(), entry)); -#else message_list_iterator_t found = std::search_n(message_list->begin(), message_list->end(), 1, entry, eq_message_throttle_entry); -#endif if (found == message_list->end()) { diff --git a/indra/llmessage/llregionhandle.h b/indra/llmessage/llregionhandle.h index d0c29c54c..085757dcb 100644 --- a/indra/llmessage/llregionhandle.h +++ b/indra/llmessage/llregionhandle.h @@ -68,21 +68,21 @@ inline BOOL to_region_handle(const F32 x_pos, const F32 y_pos, U64 *region_handl U32 x_int, y_int; if (x_pos < 0.f) { -// llwarns << "to_region_handle:Clamping negative x position " << x_pos << " to zero!" << llendl; +// LL_WARNS() << "to_region_handle:Clamping negative x position " << x_pos << " to zero!" << LL_ENDL; return FALSE; } else { - x_int = (U32)llmath::llround(x_pos); + x_int = (U32)ll_round(x_pos); } if (y_pos < 0.f) { -// llwarns << "to_region_handle:Clamping negative y position " << y_pos << " to zero!" << llendl; +// LL_WARNS() << "to_region_handle:Clamping negative y position " << y_pos << " to zero!" << LL_ENDL; return FALSE; } else { - y_int = (U32)llmath::llround(y_pos); + y_int = (U32)ll_round(y_pos); } *region_handle = to_region_handle(x_int, y_int); return TRUE; diff --git a/indra/llmessage/llthrottle.cpp b/indra/llmessage/llthrottle.cpp index b28b9a944..a46370aed 100644 --- a/indra/llmessage/llthrottle.cpp +++ b/indra/llmessage/llthrottle.cpp @@ -391,7 +391,7 @@ BOOL LLThrottleGroup::dynamicAdjust() } mBitsSentThisPeriod[i] = 0; - total += llmath::llround(mBitsSentHistory[i]); + total += ll_round(mBitsSentHistory[i]); } // Look for busy channels diff --git a/indra/llmessage/message.cpp b/indra/llmessage/message.cpp index 03ad0d9d1..8b2845ef6 100644 --- a/indra/llmessage/message.cpp +++ b/indra/llmessage/message.cpp @@ -2765,7 +2765,7 @@ void LLMessageSystem::dumpReceiveCounts() if (mt->mReceiveCount > 0) { LL_INFOS("Messaging") << "Num: " << std::setw(3) << mt->mReceiveCount << " Bytes: " << std::setw(6) << mt->mReceiveBytes - << " Invalid: " << std::setw(3) << mt->mReceiveInvalid << " " << mt->mName << " " << llmath::llround(100 * mt->mDecodeTimeThisFrame / mReceiveTime) << "%" << llendl; + << " Invalid: " << std::setw(3) << mt->mReceiveInvalid << " " << mt->mName << " " << ll_round(100 * mt->mDecodeTimeThisFrame / mReceiveTime) << "%" << llendl; } } } diff --git a/indra/llmessage/message_prehash.cpp b/indra/llmessage/message_prehash.cpp index 8544b37e1..4d91df196 100644 --- a/indra/llmessage/message_prehash.cpp +++ b/indra/llmessage/message_prehash.cpp @@ -1384,6 +1384,8 @@ char const* const _PREHASH_GroupAVSounds = LLMessageStringTable::getInstance()-> char const* const _PREHASH_AppearanceData = LLMessageStringTable::getInstance()->getString("AppearanceData"); char const* const _PREHASH_AppearanceVersion = LLMessageStringTable::getInstance()->getString("AppearanceVersion"); char const* const _PREHASH_CofVersion = LLMessageStringTable::getInstance()->getString("CofVersion"); +char const* const _PREHASH_AppearanceHover = LLMessageStringTable::getInstance()->getString("AppearanceHover"); +char const* const _PREHASH_HoverHeight = LLMessageStringTable::getInstance()->getString("HoverHeight"); // Aurora Sim char const* const _PREHASH_RegionSizeX = LLMessageStringTable::getInstance()->getString("RegionSizeX"); diff --git a/indra/llmessage/message_prehash.h b/indra/llmessage/message_prehash.h index 9a11ca02b..50f500f78 100644 --- a/indra/llmessage/message_prehash.h +++ b/indra/llmessage/message_prehash.h @@ -1384,6 +1384,8 @@ extern char const* const _PREHASH_GroupAVSounds; extern char const* const _PREHASH_AppearanceData; extern char const* const _PREHASH_AppearanceVersion; extern char const* const _PREHASH_CofVersion; +extern char const* const _PREHASH_AppearanceHover; +extern char const* const _PREHASH_HoverHeight; // Aurora Sim extern char const* const _PREHASH_RegionSizeX; diff --git a/indra/llmessage/net.cpp b/indra/llmessage/net.cpp index 6e232aa24..f2b7a3d8c 100644 --- a/indra/llmessage/net.cpp +++ b/indra/llmessage/net.cpp @@ -26,7 +26,7 @@ #include "linden_common.h" -#include "net.h" +//#include "net.h" // system library includes #include @@ -36,7 +36,6 @@ #include #include #else - #include #include #include #include @@ -370,7 +369,7 @@ BOOL send_packet(int hSocket, const char *sendBuffer, int size, U32 recipient, i return TRUE; } llinfos << "sendto() failed to " << u32_to_ip_string(recipient) << ":" << nPort - << ", Error " << last_error << llendl; + << ", Error " << last_error << LL_ENDL; } } } while ( (nRet == SOCKET_ERROR) @@ -414,7 +413,7 @@ S32 start_net(S32& socket_out, int& nPort) if (nRet < 0) { llwarns << "Failed to bind on an OS assigned port error: " - << nRet << llendl; + << nRet << LL_ENDL; } else { @@ -596,7 +595,7 @@ int receive_packet(int hSocket, char * receiveBuffer) } // Uncomment for testing if/when implementing for Mac or Windows: - // llinfos << "Received datagram to in addr " << u32_to_ip_string(get_receiving_interface_ip()) << llendl; + // LL_INFOS() << "Received datagram to in addr " << u32_to_ip_string(get_receiving_interface_ip()) << LL_ENDL; return nRet; } diff --git a/indra/llmessage/net.h b/indra/llmessage/net.h index 0f2437479..beb67bae4 100644 --- a/indra/llmessage/net.h +++ b/indra/llmessage/net.h @@ -67,5 +67,8 @@ const S32 ETHERNET_MTU_BYTES = 1500; const S32 MTUBITS = MTUBYTES*8; const S32 MTUU32S = MTUBITS/32; +// For automatic port discovery when running multiple viewers on one host +const U32 PORT_DISCOVERY_RANGE_MIN = 13000; +const U32 PORT_DISCOVERY_RANGE_MAX = PORT_DISCOVERY_RANGE_MIN + 50; #endif diff --git a/indra/llprimitive/llmaterial.cpp b/indra/llprimitive/llmaterial.cpp index bfe8301a7..cc6329e17 100644 --- a/indra/llprimitive/llmaterial.cpp +++ b/indra/llprimitive/llmaterial.cpp @@ -119,18 +119,18 @@ LLSD LLMaterial::asLLSD() const LLSD material_data; material_data[MATERIALS_CAP_NORMAL_MAP_FIELD] = mNormalID; - material_data[MATERIALS_CAP_NORMAL_MAP_OFFSET_X_FIELD] = llmath::llround(mNormalOffsetX * MATERIALS_MULTIPLIER); - material_data[MATERIALS_CAP_NORMAL_MAP_OFFSET_Y_FIELD] = llmath::llround(mNormalOffsetY * MATERIALS_MULTIPLIER); - material_data[MATERIALS_CAP_NORMAL_MAP_REPEAT_X_FIELD] = llmath::llround(mNormalRepeatX * MATERIALS_MULTIPLIER); - material_data[MATERIALS_CAP_NORMAL_MAP_REPEAT_Y_FIELD] = llmath::llround(mNormalRepeatY * MATERIALS_MULTIPLIER); - material_data[MATERIALS_CAP_NORMAL_MAP_ROTATION_FIELD] = llmath::llround(mNormalRotation * MATERIALS_MULTIPLIER); + material_data[MATERIALS_CAP_NORMAL_MAP_OFFSET_X_FIELD] = ll_round(mNormalOffsetX * MATERIALS_MULTIPLIER); + material_data[MATERIALS_CAP_NORMAL_MAP_OFFSET_Y_FIELD] = ll_round(mNormalOffsetY * MATERIALS_MULTIPLIER); + material_data[MATERIALS_CAP_NORMAL_MAP_REPEAT_X_FIELD] = ll_round(mNormalRepeatX * MATERIALS_MULTIPLIER); + material_data[MATERIALS_CAP_NORMAL_MAP_REPEAT_Y_FIELD] = ll_round(mNormalRepeatY * MATERIALS_MULTIPLIER); + material_data[MATERIALS_CAP_NORMAL_MAP_ROTATION_FIELD] = ll_round(mNormalRotation * MATERIALS_MULTIPLIER); material_data[MATERIALS_CAP_SPECULAR_MAP_FIELD] = mSpecularID; - material_data[MATERIALS_CAP_SPECULAR_MAP_OFFSET_X_FIELD] = llmath::llround(mSpecularOffsetX * MATERIALS_MULTIPLIER); - material_data[MATERIALS_CAP_SPECULAR_MAP_OFFSET_Y_FIELD] = llmath::llround(mSpecularOffsetY * MATERIALS_MULTIPLIER); - material_data[MATERIALS_CAP_SPECULAR_MAP_REPEAT_X_FIELD] = llmath::llround(mSpecularRepeatX * MATERIALS_MULTIPLIER); - material_data[MATERIALS_CAP_SPECULAR_MAP_REPEAT_Y_FIELD] = llmath::llround(mSpecularRepeatY * MATERIALS_MULTIPLIER); - material_data[MATERIALS_CAP_SPECULAR_MAP_ROTATION_FIELD] = llmath::llround(mSpecularRotation * MATERIALS_MULTIPLIER); + material_data[MATERIALS_CAP_SPECULAR_MAP_OFFSET_X_FIELD] = ll_round(mSpecularOffsetX * MATERIALS_MULTIPLIER); + material_data[MATERIALS_CAP_SPECULAR_MAP_OFFSET_Y_FIELD] = ll_round(mSpecularOffsetY * MATERIALS_MULTIPLIER); + material_data[MATERIALS_CAP_SPECULAR_MAP_REPEAT_X_FIELD] = ll_round(mSpecularRepeatX * MATERIALS_MULTIPLIER); + material_data[MATERIALS_CAP_SPECULAR_MAP_REPEAT_Y_FIELD] = ll_round(mSpecularRepeatY * MATERIALS_MULTIPLIER); + material_data[MATERIALS_CAP_SPECULAR_MAP_ROTATION_FIELD] = ll_round(mSpecularRotation * MATERIALS_MULTIPLIER); material_data[MATERIALS_CAP_SPECULAR_COLOR_FIELD] = mSpecularLightColor.getValue(); material_data[MATERIALS_CAP_SPECULAR_EXP_FIELD] = mSpecularLightExponent; diff --git a/indra/llprimitive/llprimitive.cpp b/indra/llprimitive/llprimitive.cpp index e9b7b2f42..44a517af3 100644 --- a/indra/llprimitive/llprimitive.cpp +++ b/indra/llprimitive/llprimitive.cpp @@ -1142,12 +1142,12 @@ BOOL LLPrimitive::packTEMessage(LLMessageSystem *mesgsys) const const LLTextureEntry* te = getTE(face_index); scale_s[face_index] = (F32) te->mScaleS; scale_t[face_index] = (F32) te->mScaleT; - offset_s[face_index] = (S16) llmath::llround((llclamp(te->mOffsetS,-1.0f,1.0f) * (F32)0x7FFF)) ; - offset_t[face_index] = (S16) llmath::llround((llclamp(te->mOffsetT,-1.0f,1.0f) * (F32)0x7FFF)) ; - image_rot[face_index] = (S16) llmath::llround(((fmod(te->mRotation, F_TWO_PI)/F_TWO_PI) * TEXTURE_ROTATION_PACK_FACTOR)); + offset_s[face_index] = (S16) ll_round((llclamp(te->mOffsetS,-1.0f,1.0f) * (F32)0x7FFF)) ; + offset_t[face_index] = (S16) ll_round((llclamp(te->mOffsetT,-1.0f,1.0f) * (F32)0x7FFF)) ; + image_rot[face_index] = (S16) ll_round(((fmod(te->mRotation, F_TWO_PI)/F_TWO_PI) * TEXTURE_ROTATION_PACK_FACTOR)); bump[face_index] = te->getBumpShinyFullbright(); media_flags[face_index] = te->getMediaTexGen(); - glow[face_index] = (U8) llmath::llround((llclamp(te->getGlow(), 0.0f, 1.0f) * (F32)0xFF)); + glow[face_index] = (U8) ll_round((llclamp(te->getGlow(), 0.0f, 1.0f) * (F32)0xFF)); // Directly sending material_ids is not safe! memcpy(&material_data[face_index*16],getTE(face_index)->getMaterialID().get(),16); /* Flawfinder: ignore */ @@ -1227,12 +1227,12 @@ BOOL LLPrimitive::packTEMessage(LLDataPacker &dp) const const LLTextureEntry* te = getTE(face_index); scale_s[face_index] = (F32) te->mScaleS; scale_t[face_index] = (F32) te->mScaleT; - offset_s[face_index] = (S16) llmath::llround((llclamp(te->mOffsetS,-1.0f,1.0f) * (F32)0x7FFF)) ; - offset_t[face_index] = (S16) llmath::llround((llclamp(te->mOffsetT,-1.0f,1.0f) * (F32)0x7FFF)) ; - image_rot[face_index] = (S16) llmath::llround(((fmod(te->mRotation, F_TWO_PI)/F_TWO_PI) * TEXTURE_ROTATION_PACK_FACTOR)); + offset_s[face_index] = (S16) ll_round((llclamp(te->mOffsetS,-1.0f,1.0f) * (F32)0x7FFF)) ; + offset_t[face_index] = (S16) ll_round((llclamp(te->mOffsetT,-1.0f,1.0f) * (F32)0x7FFF)) ; + image_rot[face_index] = (S16) ll_round(((fmod(te->mRotation, F_TWO_PI)/F_TWO_PI) * TEXTURE_ROTATION_PACK_FACTOR)); bump[face_index] = te->getBumpShinyFullbright(); media_flags[face_index] = te->getMediaTexGen(); - glow[face_index] = (U8) llmath::llround((llclamp(te->getGlow(), 0.0f, 1.0f) * (F32)0xFF)); + glow[face_index] = (U8) ll_round((llclamp(te->getGlow(), 0.0f, 1.0f) * (F32)0xFF)); // Directly sending material_ids is not safe! memcpy(&material_data[face_index*16],getTE(face_index)->getMaterialID().get(),16); /* Flawfinder: ignore */ diff --git a/indra/llprimitive/llvolumemessage.cpp b/indra/llprimitive/llvolumemessage.cpp index 53f035fc3..d66e8c234 100644 --- a/indra/llprimitive/llvolumemessage.cpp +++ b/indra/llprimitive/llvolumemessage.cpp @@ -58,13 +58,13 @@ bool LLVolumeMessage::packProfileParams( tempU8 = params->getCurveType(); mesgsys->addU8Fast(_PREHASH_ProfileCurve, tempU8); - tempU16 = (U16) llmath::llround( params->getBegin() / CUT_QUANTA); + tempU16 = (U16) ll_round( params->getBegin() / CUT_QUANTA); mesgsys->addU16Fast(_PREHASH_ProfileBegin, tempU16); - tempU16 = 50000 - (U16) llmath::llround(params->getEnd() / CUT_QUANTA); + tempU16 = 50000 - (U16) ll_round(params->getEnd() / CUT_QUANTA); mesgsys->addU16Fast(_PREHASH_ProfileEnd, tempU16); - tempU16 = (U16) llmath::llround(params->getHollow() / HOLLOW_QUANTA); + tempU16 = (U16) ll_round(params->getHollow() / HOLLOW_QUANTA); mesgsys->addU16Fast(_PREHASH_ProfileHollow, tempU16); return true; @@ -86,13 +86,13 @@ bool LLVolumeMessage::packProfileParams( tempU8 = params->getCurveType(); dp.packU8(tempU8, "Curve"); - tempU16 = (U16) llmath::llround( params->getBegin() / CUT_QUANTA); + tempU16 = (U16) ll_round( params->getBegin() / CUT_QUANTA); dp.packU16(tempU16, "Begin"); - tempU16 = 50000 - (U16) llmath::llround(params->getEnd() / CUT_QUANTA); + tempU16 = 50000 - (U16) ll_round(params->getEnd() / CUT_QUANTA); dp.packU16(tempU16, "End"); - tempU16 = (U16) llmath::llround(params->getHollow() / HOLLOW_QUANTA); + tempU16 = (U16) ll_round(params->getHollow() / HOLLOW_QUANTA); dp.packU16(tempU16, "Hollow"); return true; } @@ -223,46 +223,46 @@ bool LLVolumeMessage::packPathParams( U8 curve = params->getCurveType(); mesgsys->addU8Fast(_PREHASH_PathCurve, curve); - U16 begin = (U16) llmath::llround(params->getBegin() / CUT_QUANTA); + U16 begin = (U16) ll_round(params->getBegin() / CUT_QUANTA); mesgsys->addU16Fast(_PREHASH_PathBegin, begin); - U16 end = 50000 - (U16) llmath::llround(params->getEnd() / CUT_QUANTA); + U16 end = 50000 - (U16) ll_round(params->getEnd() / CUT_QUANTA); mesgsys->addU16Fast(_PREHASH_PathEnd, end); // Avoid truncation problem with direct F32->U8 cast. // (e.g., (U8) (0.50 / 0.01) = (U8) 49.9999999 = 49 not 50. - U8 pack_scale_x = 200 - (U8) llmath::llround(params->getScaleX() / SCALE_QUANTA); + U8 pack_scale_x = 200 - (U8) ll_round(params->getScaleX() / SCALE_QUANTA); mesgsys->addU8Fast(_PREHASH_PathScaleX, pack_scale_x ); - U8 pack_scale_y = 200 - (U8) llmath::llround(params->getScaleY() / SCALE_QUANTA); + U8 pack_scale_y = 200 - (U8) ll_round(params->getScaleY() / SCALE_QUANTA); mesgsys->addU8Fast(_PREHASH_PathScaleY, pack_scale_y ); - U8 pack_shear_x = (U8) llmath::llround(params->getShearX() / SHEAR_QUANTA); + U8 pack_shear_x = (U8) ll_round(params->getShearX() / SHEAR_QUANTA); mesgsys->addU8Fast(_PREHASH_PathShearX, pack_shear_x ); - U8 pack_shear_y = (U8) llmath::llround(params->getShearY() / SHEAR_QUANTA); + U8 pack_shear_y = (U8) ll_round(params->getShearY() / SHEAR_QUANTA); mesgsys->addU8Fast(_PREHASH_PathShearY, pack_shear_y ); - S8 twist = (S8) llmath::llround(params->getTwist() / SCALE_QUANTA); + S8 twist = (S8) ll_round(params->getTwist() / SCALE_QUANTA); mesgsys->addS8Fast(_PREHASH_PathTwist, twist); - S8 twist_begin = (S8) llmath::llround(params->getTwistBegin() / SCALE_QUANTA); + S8 twist_begin = (S8) ll_round(params->getTwistBegin() / SCALE_QUANTA); mesgsys->addS8Fast(_PREHASH_PathTwistBegin, twist_begin); - S8 radius_offset = (S8) llmath::llround(params->getRadiusOffset() / SCALE_QUANTA); + S8 radius_offset = (S8) ll_round(params->getRadiusOffset() / SCALE_QUANTA); mesgsys->addS8Fast(_PREHASH_PathRadiusOffset, radius_offset); - S8 taper_x = (S8) llmath::llround(params->getTaperX() / TAPER_QUANTA); + S8 taper_x = (S8) ll_round(params->getTaperX() / TAPER_QUANTA); mesgsys->addS8Fast(_PREHASH_PathTaperX, taper_x); - S8 taper_y = (S8) llmath::llround(params->getTaperY() / TAPER_QUANTA); + S8 taper_y = (S8) ll_round(params->getTaperY() / TAPER_QUANTA); mesgsys->addS8Fast(_PREHASH_PathTaperY, taper_y); - U8 revolutions = (U8) llmath::llround( (params->getRevolutions() - 1.0f) / REV_QUANTA); + U8 revolutions = (U8) ll_round( (params->getRevolutions() - 1.0f) / REV_QUANTA); mesgsys->addU8Fast(_PREHASH_PathRevolutions, revolutions); - S8 skew = (S8) llmath::llround(params->getSkew() / SCALE_QUANTA); + S8 skew = (S8) ll_round(params->getSkew() / SCALE_QUANTA); mesgsys->addS8Fast(_PREHASH_PathSkew, skew); return true; @@ -280,46 +280,46 @@ bool LLVolumeMessage::packPathParams( U8 curve = params->getCurveType(); dp.packU8(curve, "Curve"); - U16 begin = (U16) llmath::llround(params->getBegin() / CUT_QUANTA); + U16 begin = (U16) ll_round(params->getBegin() / CUT_QUANTA); dp.packU16(begin, "Begin"); - U16 end = 50000 - (U16) llmath::llround(params->getEnd() / CUT_QUANTA); + U16 end = 50000 - (U16) ll_round(params->getEnd() / CUT_QUANTA); dp.packU16(end, "End"); // Avoid truncation problem with direct F32->U8 cast. // (e.g., (U8) (0.50 / 0.01) = (U8) 49.9999999 = 49 not 50. - U8 pack_scale_x = 200 - (U8) llmath::llround(params->getScaleX() / SCALE_QUANTA); + U8 pack_scale_x = 200 - (U8) ll_round(params->getScaleX() / SCALE_QUANTA); dp.packU8(pack_scale_x, "ScaleX"); - U8 pack_scale_y = 200 - (U8) llmath::llround(params->getScaleY() / SCALE_QUANTA); + U8 pack_scale_y = 200 - (U8) ll_round(params->getScaleY() / SCALE_QUANTA); dp.packU8(pack_scale_y, "ScaleY"); - S8 pack_shear_x = (S8) llmath::llround(params->getShearX() / SHEAR_QUANTA); + S8 pack_shear_x = (S8) ll_round(params->getShearX() / SHEAR_QUANTA); dp.packU8(*(U8 *)&pack_shear_x, "ShearX"); - S8 pack_shear_y = (S8) llmath::llround(params->getShearY() / SHEAR_QUANTA); + S8 pack_shear_y = (S8) ll_round(params->getShearY() / SHEAR_QUANTA); dp.packU8(*(U8 *)&pack_shear_y, "ShearY"); - S8 twist = (S8) llmath::llround(params->getTwist() / SCALE_QUANTA); + S8 twist = (S8) ll_round(params->getTwist() / SCALE_QUANTA); dp.packU8(*(U8 *)&twist, "Twist"); - S8 twist_begin = (S8) llmath::llround(params->getTwistBegin() / SCALE_QUANTA); + S8 twist_begin = (S8) ll_round(params->getTwistBegin() / SCALE_QUANTA); dp.packU8(*(U8 *)&twist_begin, "TwistBegin"); - S8 radius_offset = (S8) llmath::llround(params->getRadiusOffset() / SCALE_QUANTA); + S8 radius_offset = (S8) ll_round(params->getRadiusOffset() / SCALE_QUANTA); dp.packU8(*(U8 *)&radius_offset, "RadiusOffset"); - S8 taper_x = (S8) llmath::llround(params->getTaperX() / TAPER_QUANTA); + S8 taper_x = (S8) ll_round(params->getTaperX() / TAPER_QUANTA); dp.packU8(*(U8 *)&taper_x, "TaperX"); - S8 taper_y = (S8) llmath::llround(params->getTaperY() / TAPER_QUANTA); + S8 taper_y = (S8) ll_round(params->getTaperY() / TAPER_QUANTA); dp.packU8(*(U8 *)&taper_y, "TaperY"); - U8 revolutions = (U8) llmath::llround( (params->getRevolutions() - 1.0f) / REV_QUANTA); + U8 revolutions = (U8) ll_round( (params->getRevolutions() - 1.0f) / REV_QUANTA); dp.packU8(*(U8 *)&revolutions, "Revolutions"); - S8 skew = (S8) llmath::llround(params->getSkew() / SCALE_QUANTA); + S8 skew = (S8) ll_round(params->getSkew() / SCALE_QUANTA); dp.packU8(*(U8 *)&skew, "Skew"); return true; diff --git a/indra/llrender/llfontfreetype.cpp b/indra/llrender/llfontfreetype.cpp index f2839bb67..e622899cd 100644 --- a/indra/llrender/llfontfreetype.cpp +++ b/indra/llrender/llfontfreetype.cpp @@ -184,8 +184,8 @@ BOOL LLFontFreetype::loadFace(const std::string& filename, const F32 point_size, mDescender = -mFTFace->descender * pixels_per_unit; mLineHeight = mFTFace->height * pixels_per_unit; - S32 max_char_width = llmath::llround(0.5f + (x_max - x_min)); - S32 max_char_height = llmath::llround(0.5f + (y_max - y_min)); + S32 max_char_width = ll_round(0.5f + (x_max - x_min)); + S32 max_char_height = ll_round(0.5f + (y_max - y_min)); mFontBitmapCachep->init(components, max_char_width, max_char_height); diff --git a/indra/llrender/llfontgl.cpp b/indra/llrender/llfontgl.cpp index 6fd4bc7d1..2a2ea73fe 100644 --- a/indra/llrender/llfontgl.cpp +++ b/indra/llrender/llfontgl.cpp @@ -228,10 +228,10 @@ S32 LLFontGL::render(const LLWString &wstr, S32 begin_offset, F32 x, F32 y, cons case LEFT: break; case RIGHT: - cur_x -= llmin(scaled_max_pixels, llmath::llround(getWidthF32(wstr.c_str(), begin_offset, length) * sScaleX)); + cur_x -= llmin(scaled_max_pixels, ll_round(getWidthF32(wstr.c_str(), begin_offset, length) * sScaleX)); break; case HCENTER: - cur_x -= llmin(scaled_max_pixels, llmath::llround(getWidthF32(wstr.c_str(), begin_offset, length) * sScaleX)) / 2; + cur_x -= llmin(scaled_max_pixels, ll_round(getWidthF32(wstr.c_str(), begin_offset, length) * sScaleX)) / 2; break; default: break; @@ -240,7 +240,7 @@ S32 LLFontGL::render(const LLWString &wstr, S32 begin_offset, F32 x, F32 y, cons cur_render_y = cur_y; cur_render_x = cur_x; - F32 start_x = (F32)llmath::llround(cur_x); + F32 start_x = (F32)ll_round(cur_x); const LLFontBitmapCache* font_bitmap_cache = mFontFreetype->getFontBitmapCache(); @@ -254,12 +254,12 @@ S32 LLFontGL::render(const LLWString &wstr, S32 begin_offset, F32 x, F32 y, cons if (use_ellipses && halign == LEFT) { // check for too long of a string - S32 string_width = llmath::llround(getWidthF32(wstr, begin_offset, max_chars) * sScaleX); + S32 string_width = ll_round(getWidthF32(wstr, begin_offset, max_chars) * sScaleX); if (string_width > scaled_max_pixels) { // use four dots for ellipsis width to generate padding const LLWString dots(utf8str_to_wstring(std::string("...."))); - scaled_max_pixels = llmax(0, scaled_max_pixels - llmath::llround(getWidthF32(dots.c_str()))); + scaled_max_pixels = llmax(0, scaled_max_pixels - ll_round(getWidthF32(dots.c_str()))); draw_ellipses = TRUE; } } @@ -306,8 +306,8 @@ S32 LLFontGL::render(const LLWString &wstr, S32 begin_offset, F32 x, F32 y, cons gGL.getTexUnit(0)->bind(ext_image); // snap origin to whole screen pixel - const F32 ext_x = (F32)llmath::llround(cur_render_x + (EXT_X_BEARING * sScaleX)); - const F32 ext_y = (F32)llmath::llround(cur_render_y + (EXT_Y_BEARING * sScaleY + mFontFreetype->getAscenderHeight() - mFontFreetype->getLineHeight())); + const F32 ext_x = (F32)ll_round(cur_render_x + (EXT_X_BEARING * sScaleX)); + const F32 ext_y = (F32)ll_round(cur_render_y + (EXT_Y_BEARING * sScaleY + mFontFreetype->getAscenderHeight() - mFontFreetype->getLineHeight())); LLRectf uv_rect(0.f, 1.f, 1.f, 0.f); LLRectf screen_rect(ext_x, ext_y + ext_height, ext_x + ext_width, ext_y); @@ -396,10 +396,10 @@ S32 LLFontGL::render(const LLWString &wstr, S32 begin_offset, F32 x, F32 y, cons (fgi->mXBitmapOffset + fgi->mWidth) * inv_width, (fgi->mYBitmapOffset - PAD_UVY) * inv_height); // snap glyph origin to whole screen pixel - LLRectf screen_rect((F32)llmath::llround(cur_render_x + (F32)fgi->mXBearing), - (F32)llmath::llround(cur_render_y + (F32)fgi->mYBearing), - (F32)llmath::llround(cur_render_x + (F32)fgi->mXBearing) + (F32)fgi->mWidth, - (F32)llmath::llround(cur_render_y + (F32)fgi->mYBearing) - (F32)fgi->mHeight); + LLRectf screen_rect((F32)ll_round(cur_render_x + (F32)fgi->mXBearing), + (F32)ll_round(cur_render_y + (F32)fgi->mYBearing), + (F32)ll_round(cur_render_x + (F32)fgi->mXBearing) + (F32)fgi->mWidth, + (F32)ll_round(cur_render_y + (F32)fgi->mYBearing) - (F32)fgi->mHeight); if (glyph_count >= GLYPH_BATCH_SIZE) { @@ -430,8 +430,8 @@ S32 LLFontGL::render(const LLWString &wstr, S32 begin_offset, F32 x, F32 y, cons // Must do this to cur_x, not just to cur_render_x, otherwise you // will squish sub-pixel kerned characters too close together. // For example, "CCCCC" looks bad. - cur_x = (F32)llmath::llround(cur_x); - //cur_y = (F32)llmath::llround(cur_y); + cur_x = (F32)ll_round(cur_x); + //cur_y = (F32)ll_round(cur_y); cur_render_x = cur_x; cur_render_y = cur_y; @@ -506,7 +506,7 @@ F32 LLFontGL::getDescenderHeight() const F32 LLFontGL::getLineHeight() const { - return (F32)llmath::llround(mFontFreetype->getLineHeight() / sScaleY); + return (F32)ll_round(mFontFreetype->getLineHeight() / sScaleY); } S32 LLFontGL::getWidth(const std::string& utf8text, const S32 begin_offset, const S32 max_chars, BOOL use_embedded) const @@ -517,7 +517,7 @@ S32 LLFontGL::getWidth(const std::string& utf8text, const S32 begin_offset, cons S32 LLFontGL::getWidth(const LLWString& utf32text, const S32 begin_offset, const S32 max_chars, BOOL use_embedded) const { F32 width = getWidthF32(utf32text, begin_offset, max_chars, use_embedded); - return llmath::llround(width); + return ll_round(width); } F32 LLFontGL::getWidthF32(const std::string& utf8text, const S32 begin_offset, const S32 max_chars, BOOL use_embedded) const @@ -582,7 +582,7 @@ F32 LLFontGL::getWidthF32(const LLWString& utf32text, const S32 begin_offset, co } } // Round after kerning. - cur_x = (F32)llmath::llround(cur_x); + cur_x = (F32)ll_round(cur_x); } } @@ -698,7 +698,7 @@ S32 LLFontGL::maxDrawableChars(const LLWString& utf32text, F32 max_pixels, S32 m } } // Round after kerning. - cur_x = (F32)llmath::llround(cur_x); + cur_x = (F32)ll_round(cur_x); drawn_x = cur_x; } @@ -785,7 +785,7 @@ S32 LLFontGL::firstDrawableChar(const LLWString& utf32text, F32 max_pixels, S32 } // Round after kerning. - total_width = (F32)llmath::llround(total_width); + total_width = (F32)ll_round(total_width); } if (drawable_chars == 0) @@ -872,7 +872,7 @@ S32 LLFontGL::charFromPixelOffset(const LLWString& utf32text, const S32 begin_of // Round after kerning. - cur_x = (F32)llmath::llround(cur_x); + cur_x = (F32)ll_round(cur_x); } diff --git a/indra/llrender/llpostprocess.cpp b/indra/llrender/llpostprocess.cpp index 0d42e3426..ba6277235 100644 --- a/indra/llrender/llpostprocess.cpp +++ b/indra/llrender/llpostprocess.cpp @@ -639,9 +639,8 @@ void LLPostProcess::drawOrthoQuad(QuadType type) mVBO->getTexCoord1Strider(uv2); float offs[2] = { - /*llmath::llround*/(((float) rand() / (float) RAND_MAX) * (float)NOISE_SIZE)/float(NOISE_SIZE), - /*llmath::llround*/(((float) rand() / (float) RAND_MAX) * (float)NOISE_SIZE)/float(NOISE_SIZE) - }; + /*ll_round*/(((float) rand() / (float) RAND_MAX) * (float)NOISE_SIZE)/float(NOISE_SIZE), + /*ll_round*/(((float) rand() / (float) RAND_MAX) * (float)NOISE_SIZE)/float(NOISE_SIZE) }; float scale[2] = { (float)mScreenWidth * mNoiseTextureScale, (float)mScreenHeight * mNoiseTextureScale }; diff --git a/indra/llrender/llrender2dutils.cpp b/indra/llrender/llrender2dutils.cpp index f8b54ee68..19c00156d 100644 --- a/indra/llrender/llrender2dutils.cpp +++ b/indra/llrender/llrender2dutils.cpp @@ -401,8 +401,8 @@ void gl_draw_scaled_image_with_border(S32 x, S32 y, S32 width, S32 height, LLTex F32 image_width = image->getWidth(0); F32 image_height = image->getHeight(0); - S32 image_natural_width = llmath::llround(image_width * uv_width); - S32 image_natural_height = llmath::llround(image_height * uv_height); + S32 image_natural_width = ll_round(image_width * uv_width); + S32 image_natural_height = ll_round(image_height * uv_height); LLRectf draw_center_rect( uv_center_rect.mLeft * image_width, uv_center_rect.mTop * image_height, @@ -421,10 +421,10 @@ void gl_draw_scaled_image_with_border(S32 x, S32 y, S32 width, S32 height, LLTex F32 shrink_scale = 1.f - llmax(shrink_width_ratio, shrink_height_ratio); - draw_center_rect.mLeft = llmath::llround(ui_translation.mV[VX] + (F32)draw_center_rect.mLeft * shrink_scale * ui_scale.mV[VX]); - draw_center_rect.mTop = llmath::llround(ui_translation.mV[VY] + lerp((F32)height, (F32)draw_center_rect.mTop, shrink_scale) * ui_scale.mV[VY]); - draw_center_rect.mRight = llmath::llround(ui_translation.mV[VX] + lerp((F32)width, (F32)draw_center_rect.mRight, shrink_scale) * ui_scale.mV[VX]); - draw_center_rect.mBottom = llmath::llround(ui_translation.mV[VY] + (F32)draw_center_rect.mBottom * shrink_scale * ui_scale.mV[VY]); + draw_center_rect.mLeft = ll_round(ui_translation.mV[VX] + (F32)draw_center_rect.mLeft * shrink_scale * ui_scale.mV[VX]); + draw_center_rect.mTop = ll_round(ui_translation.mV[VY] + lerp((F32)height, (F32)draw_center_rect.mTop, shrink_scale) * ui_scale.mV[VY]); + draw_center_rect.mRight = ll_round(ui_translation.mV[VX] + lerp((F32)width, (F32)draw_center_rect.mRight, shrink_scale) * ui_scale.mV[VX]); + draw_center_rect.mBottom = ll_round(ui_translation.mV[VY] + (F32)draw_center_rect.mBottom * shrink_scale * ui_scale.mV[VY]); } LLRectf draw_outer_rect(ui_translation.mV[VX], @@ -664,8 +664,8 @@ void gl_draw_scaled_rotated_image(S32 x, S32 y, S32 width, S32 height, F32 degre ui_translation.mV[VY] += y; ui_translation.scaleVec(ui_scale); S32 index = 0; - S32 scaled_width = llmath::llround(width * ui_scale.mV[VX]); - S32 scaled_height = llmath::llround(height * ui_scale.mV[VY]); + S32 scaled_width = ll_round(width * ui_scale.mV[VX]); + S32 scaled_height = ll_round(height * ui_scale.mV[VY]); uv[index] = LLVector2(uv_rect.mRight, uv_rect.mTop); pos[index].set(ui_translation.mV[VX] + scaled_width, ui_translation.mV[VY] + scaled_height, 0.f); @@ -1617,4 +1617,4 @@ LLPointer LLRender2D::getUIImage(const std::string& name, S32 priorit return sImageProvider->getUIImage(name, priority); else return NULL; -} \ No newline at end of file +} diff --git a/indra/llrender/lluiimage.cpp b/indra/llrender/lluiimage.cpp index 7aa750756..2be700aad 100644 --- a/indra/llrender/lluiimage.cpp +++ b/indra/llrender/lluiimage.cpp @@ -115,13 +115,13 @@ void LLUIImage::drawBorder(S32 x, S32 y, S32 width, S32 height, const LLColor4& S32 LLUIImage::getWidth() const { // return clipped dimensions of actual image area - return llmath::llround((F32)mImage->getWidth(0) * mClipRegion.getWidth()); + return ll_round((F32)mImage->getWidth(0) * mClipRegion.getWidth()); } S32 LLUIImage::getHeight() const { // return clipped dimensions of actual image area - return llmath::llround((F32)mImage->getHeight(0) * mClipRegion.getHeight()); + return ll_round((F32)mImage->getHeight(0) * mClipRegion.getHeight()); } S32 LLUIImage::getTextureWidth() const diff --git a/indra/llui/llbutton.cpp b/indra/llui/llbutton.cpp index ed318c473..664f66b37 100644 --- a/indra/llui/llbutton.cpp +++ b/indra/llui/llbutton.cpp @@ -536,8 +536,8 @@ void LLButton::getOverlayImageSize(S32& overlay_width, S32& overlay_height) overlay_height = mImageOverlay->getHeight(); F32 scale_factor = llmin((F32)getRect().getWidth() / (F32)overlay_width, (F32)getRect().getHeight() / (F32)overlay_height, 1.f); - overlay_width = llmath::llround((F32)overlay_width * scale_factor); - overlay_height = llmath::llround((F32)overlay_height * scale_factor); + overlay_width = ll_round((F32)overlay_width * scale_factor); + overlay_height = ll_round((F32)overlay_height * scale_factor); } @@ -696,7 +696,7 @@ void LLButton::draw() if (hasFocus()) { F32 lerp_amt = gFocusMgr.getFocusFlashAmt(); - drawBorder(imagep, gFocusMgr.getFocusColor() % alpha, llmath::llround(lerp(1.f, 3.f, lerp_amt))); + drawBorder(imagep, gFocusMgr.getFocusColor() % alpha, ll_round(lerp(1.f, 3.f, lerp_amt))); } if (use_glow_effect) @@ -981,7 +981,7 @@ void LLButton::resize(LLUIString label) { S32 overlay_width = mImageOverlay->getWidth(); F32 scale_factor = (getRect().getHeight() - (mImageOverlayBottomPad + mImageOverlayTopPad)) / (F32)mImageOverlay->getHeight(); - overlay_width = llmath::llround((F32)overlay_width * scale_factor); + overlay_width = ll_round((F32)overlay_width * scale_factor); switch(mImageOverlayAlignment) { diff --git a/indra/llui/llcheckboxctrl.cpp b/indra/llui/llcheckboxctrl.cpp index caf81cd14..e8e34e64d 100644 --- a/indra/llui/llcheckboxctrl.cpp +++ b/indra/llui/llcheckboxctrl.cpp @@ -83,7 +83,7 @@ LLCheckBoxCtrl::LLCheckBoxCtrl(const std::string& name, const LLRect& rect, // Label (add a little space to make sure text actually renders) const S32 FUDGE = 10; S32 text_width = mFont->getWidth( label ) + FUDGE; - S32 text_height = llmath::llround(mFont->getLineHeight()); + S32 text_height = ll_round(mFont->getLineHeight()); LLRect label_rect; label_rect.setOriginAndSize( LLCHECKBOXCTRL_HPAD + LLCHECKBOXCTRL_BTN_SIZE + LLCHECKBOXCTRL_SPACING, @@ -187,7 +187,7 @@ void LLCheckBoxCtrl::reshape(S32 width, S32 height, BOOL called_from_parent) //stretch or shrink bounding rectangle of label when rebuilding UI at new scale const S32 FUDGE = 10; S32 text_width = mFont->getWidth( mLabel->getText() ) + FUDGE; - S32 text_height = llmath::llround(mFont->getLineHeight()); + S32 text_height = ll_round(mFont->getLineHeight()); LLRect label_rect; label_rect.setOriginAndSize( LLCHECKBOXCTRL_HPAD + LLCHECKBOXCTRL_BTN_SIZE + LLCHECKBOXCTRL_SPACING, diff --git a/indra/llui/lldraghandle.cpp b/indra/llui/lldraghandle.cpp index de5cbbe7a..fc29d4f45 100644 --- a/indra/llui/lldraghandle.cpp +++ b/indra/llui/lldraghandle.cpp @@ -247,7 +247,7 @@ void LLDragHandleTop::reshapeTitleBox() S32 title_width = font->getWidth( getTitleBox()->getText() ) + TITLE_PAD; if (getMaxTitleWidth() > 0) title_width = llmin(title_width, getMaxTitleWidth()); - S32 title_height = llmath::llround(font->getLineHeight()); + S32 title_height = ll_round(font->getLineHeight()); LLRect title_rect; title_rect.setLeftTopAndSize( LEFT_PAD, diff --git a/indra/llui/llfloater.cpp b/indra/llui/llfloater.cpp index f226af189..703f664bf 100644 --- a/indra/llui/llfloater.cpp +++ b/indra/llui/llfloater.cpp @@ -1449,7 +1449,7 @@ void LLFloater::draw() } gl_drop_shadow(left, top, right, bottom, shadow_color, - llmath::llround(shadow_offset)); + ll_round(shadow_offset)); // No transparent windows in simple UI if (isBackgroundOpaque()) @@ -1614,16 +1614,16 @@ void LLFloater::updateButtons() btn_rect.setLeftTopAndSize( LLPANEL_BORDER_WIDTH, getRect().getHeight() - CLOSE_BOX_FROM_TOP - (LLFLOATER_CLOSE_BOX_SIZE + 1) * button_count, - llmath::llround((F32)LLFLOATER_CLOSE_BOX_SIZE * mButtonScale), - llmath::llround((F32)LLFLOATER_CLOSE_BOX_SIZE * mButtonScale)); + ll_round((F32)LLFLOATER_CLOSE_BOX_SIZE * mButtonScale), + ll_round((F32)LLFLOATER_CLOSE_BOX_SIZE * mButtonScale)); } else { btn_rect.setLeftTopAndSize( getRect().getWidth() - LLPANEL_BORDER_WIDTH - (LLFLOATER_CLOSE_BOX_SIZE + 1) * button_count, getRect().getHeight() - CLOSE_BOX_FROM_TOP, - llmath::llround((F32)LLFLOATER_CLOSE_BOX_SIZE * mButtonScale), - llmath::llround((F32)LLFLOATER_CLOSE_BOX_SIZE * mButtonScale)); + ll_round((F32)LLFLOATER_CLOSE_BOX_SIZE * mButtonScale), + ll_round((F32)LLFLOATER_CLOSE_BOX_SIZE * mButtonScale)); } mButtons[i]->setRect(btn_rect); @@ -1650,16 +1650,16 @@ void LLFloater::buildButtons() btn_rect.setLeftTopAndSize( LLPANEL_BORDER_WIDTH, getRect().getHeight() - CLOSE_BOX_FROM_TOP - (LLFLOATER_CLOSE_BOX_SIZE + 1) * (i + 1), - llmath::llround(LLFLOATER_CLOSE_BOX_SIZE * mButtonScale), - llmath::llround(LLFLOATER_CLOSE_BOX_SIZE * mButtonScale)); + ll_round(LLFLOATER_CLOSE_BOX_SIZE * mButtonScale), + ll_round(LLFLOATER_CLOSE_BOX_SIZE * mButtonScale)); } else { btn_rect.setLeftTopAndSize( getRect().getWidth() - LLPANEL_BORDER_WIDTH - (LLFLOATER_CLOSE_BOX_SIZE + 1) * (i + 1), getRect().getHeight() - CLOSE_BOX_FROM_TOP, - llmath::llround(LLFLOATER_CLOSE_BOX_SIZE * mButtonScale), - llmath::llround(LLFLOATER_CLOSE_BOX_SIZE * mButtonScale)); + ll_round(LLFLOATER_CLOSE_BOX_SIZE * mButtonScale), + ll_round(LLFLOATER_CLOSE_BOX_SIZE * mButtonScale)); } LLButton* buttonp = new LLButton( diff --git a/indra/llui/llflyoutbutton.cpp b/indra/llui/llflyoutbutton.cpp index 1290f6b62..52f443d91 100644 --- a/indra/llui/llflyoutbutton.cpp +++ b/indra/llui/llflyoutbutton.cpp @@ -173,4 +173,8 @@ void LLFlyoutButton::setToggleState(BOOL state) mToggleState = state; } +void LLFlyoutButton::setLabel(const std::string& label) +{ + mActionButton->setLabel(label); +} diff --git a/indra/llui/llflyoutbutton.h b/indra/llui/llflyoutbutton.h index 0d9ce80bf..d74a7eb3a 100644 --- a/indra/llui/llflyoutbutton.h +++ b/indra/llui/llflyoutbutton.h @@ -45,6 +45,7 @@ public: virtual void setEnabled(BOOL enabled); void setToggleState(BOOL state); + void setLabel(const std::string& label); // Not to be confused with LLComboBox::setLabel virtual LLXMLNodePtr getXML(bool save_children = true) const; static LLView* fromXML(LLXMLNodePtr node, LLView* parent, LLUICtrlFactory* factory); diff --git a/indra/llui/llfocusmgr.h b/indra/llui/llfocusmgr.h index fd09bf55f..483ef8137 100644 --- a/indra/llui/llfocusmgr.h +++ b/indra/llui/llfocusmgr.h @@ -94,7 +94,7 @@ public: F32 getFocusTime() const { return mFocusFlashTimer.getElapsedTimeF32(); } F32 getFocusFlashAmt() const; - S32 getFocusFlashWidth() const { return llmath::llround(lerp(1.f, 3.f, getFocusFlashAmt())); } + S32 getFocusFlashWidth() const { return ll_round(lerp(1.f, 3.f, getFocusFlashAmt())); } LLColor4 getFocusColor() const; void triggerFocusFlash(); BOOL getAppHasFocus() const { return mAppHasFocus; } diff --git a/indra/llui/lllayoutstack.cpp b/indra/llui/lllayoutstack.cpp index b3efdf5d9..fde54de87 100644 --- a/indra/llui/lllayoutstack.cpp +++ b/indra/llui/lllayoutstack.cpp @@ -122,7 +122,7 @@ F32 LLLayoutPanel::getVisibleAmount() const S32 LLLayoutPanel::getLayoutDim() const { - return llmath::llround((F32)((mOrientation == LLLayoutStack::HORIZONTAL) + return ll_round((F32)((mOrientation == LLLayoutStack::HORIZONTAL) ? getRect().getWidth() : getRect().getHeight())); } @@ -149,7 +149,7 @@ void LLLayoutPanel::setTargetDim(S32 value) S32 LLLayoutPanel::getVisibleDim() const { F32 min_dim = getRelevantMinDim(); - return llmath::llround(mVisibleAmt + return ll_round(mVisibleAmt * (min_dim + (((F32)mTargetDim - min_dim) * (1.f - mCollapseAmt)))); } @@ -157,7 +157,7 @@ S32 LLLayoutPanel::getVisibleDim() const void LLLayoutPanel::setOrientation( LLLayoutStack::ELayoutOrientation orientation ) { mOrientation = orientation; - S32 layout_dim = llmath::llround((F32)((mOrientation == LLLayoutStack::HORIZONTAL) + S32 layout_dim = ll_round((F32)((mOrientation == LLLayoutStack::HORIZONTAL) ? getRect().getWidth() : getRect().getHeight())); @@ -374,14 +374,14 @@ void LLLayoutStack::updateLayout() { panelp->mTargetDim = panelp->getRelevantMinDim(); } - space_to_distribute -= panelp->getVisibleDim() + llmath::llround((F32)mPanelSpacing * panelp->getVisibleAmount()); + space_to_distribute -= panelp->getVisibleDim() + ll_round((F32)mPanelSpacing * panelp->getVisibleAmount()); total_visible_fraction += panelp->mFractionalSize * panelp->getAutoResizeFactor(); } llassert(total_visible_fraction < 1.05f); // don't need spacing after last panel - space_to_distribute += panelp ? llmath::llround((F32)mPanelSpacing * panelp->getVisibleAmount()) : 0; + space_to_distribute += panelp ? ll_round((F32)mPanelSpacing * panelp->getVisibleAmount()) : 0; S32 remaining_space = space_to_distribute; F32 fraction_distributed = 0.f; @@ -392,7 +392,7 @@ void LLLayoutStack::updateLayout() if (panelp->mAutoResize) { F32 fraction_to_distribute = (panelp->mFractionalSize * panelp->getAutoResizeFactor()) / (total_visible_fraction); - S32 delta = llmath::llround((F32)space_to_distribute * fraction_to_distribute); + S32 delta = ll_round((F32)space_to_distribute * fraction_to_distribute); fraction_distributed += fraction_to_distribute; panelp->mTargetDim += delta; remaining_space -= delta; @@ -425,17 +425,17 @@ void LLLayoutStack::updateLayout() LLRect panel_rect; if (mOrientation == HORIZONTAL) { - panel_rect.setLeftTopAndSize(llmath::llround(cur_pos), + panel_rect.setLeftTopAndSize(ll_round(cur_pos), getRect().getHeight(), - llmath::llround(panel_dim), + ll_round(panel_dim), getRect().getHeight()); } else { panel_rect.setLeftTopAndSize(0, - llmath::llround(cur_pos), + ll_round(cur_pos), getRect().getWidth(), - llmath::llround(panel_dim)); + ll_round(panel_dim)); } panelp->setIgnoreReshape(true); panelp->setShape(panel_rect); @@ -447,14 +447,14 @@ void LLLayoutStack::updateLayout() if (mOrientation == HORIZONTAL) { resize_bar_rect.mLeft = panel_rect.mRight - mResizeBarOverlap; - resize_bar_rect.mRight = panel_rect.mRight + (S32)(llmath::llround(panel_spacing)) + mResizeBarOverlap; + resize_bar_rect.mRight = panel_rect.mRight + (S32)(ll_round(panel_spacing)) + mResizeBarOverlap; cur_pos += panel_visible_dim + panel_spacing; } else //VERTICAL { resize_bar_rect.mTop = panel_rect.mBottom + mResizeBarOverlap; - resize_bar_rect.mBottom = panel_rect.mBottom - (S32)(llmath::llround(panel_spacing)) - mResizeBarOverlap; + resize_bar_rect.mBottom = panel_rect.mBottom - (S32)(ll_round(panel_spacing)) - mResizeBarOverlap; cur_pos -= panel_visible_dim + panel_spacing; } @@ -1035,4 +1035,4 @@ LLView* LLLayoutPanel::fromXML(LLXMLNodePtr node, LLView* parent, LLUICtrlFactor panelp->setOrigin(0, 0); return panelp; -} \ No newline at end of file +} diff --git a/indra/llui/lllineeditor.cpp b/indra/llui/lllineeditor.cpp index 617f73978..04bd6ee0c 100644 --- a/indra/llui/lllineeditor.cpp +++ b/indra/llui/lllineeditor.cpp @@ -513,7 +513,7 @@ std::vector LLLineEditor::getMisspelledWordsPositions() { //misspelled word here, and you have just right clicked on it! //get the center of this word.. - //S32 center = llmath::llround( (wordEnd-wordStart)/2 ) + wordStart; + //S32 center = ll_round( (wordEnd-wordStart)/2 ) + wordStart; //turn this cursor position into a pixel pos //center = findPixelNearestPos(center-getCursor()); @@ -770,7 +770,7 @@ BOOL LLLineEditor::handleHover(S32 x, S32 y, MASK mask) // Scroll if mouse cursor outside of bounds if (mScrollTimer.hasExpired()) { - S32 increment = llmath::llround(mScrollTimer.getElapsedTimeF32() / AUTO_SCROLL_TIME); + S32 increment = ll_round(mScrollTimer.getElapsedTimeF32() / AUTO_SCROLL_TIME); mScrollTimer.reset(AUTO_SCROLL_TIME); if( (x < mMinHPixels) && (mScrollHPos > 0 ) ) { @@ -1930,7 +1930,7 @@ void LLLineEditor::draw() LLFontGL::NORMAL, LLFontGL::NO_SHADOW, select_left - mScrollHPos, - mMaxHPixels - llmath::llround(rendered_pixels_right), + mMaxHPixels - ll_round(rendered_pixels_right), &rendered_pixels_right); } @@ -1939,8 +1939,8 @@ void LLLineEditor::draw() LLColor4 color(1.f - bg_color.mV[0], 1.f - bg_color.mV[1], 1.f - bg_color.mV[2], alpha ); // selected middle S32 width = mGLFont->getWidth(mText.getWString().c_str(), mScrollHPos + rendered_text, select_right - mScrollHPos - rendered_text); - width = llmin(width, mMaxHPixels - llmath::llround(rendered_pixels_right)); - gl_rect_2d(llmath::llround(rendered_pixels_right), cursor_top, llmath::llround(rendered_pixels_right)+width, cursor_bottom, color); + width = llmin(width, mMaxHPixels - ll_round(rendered_pixels_right)); + gl_rect_2d(ll_round(rendered_pixels_right), cursor_top, ll_round(rendered_pixels_right)+width, cursor_bottom, color); LLColor4 tmp_color( 1.f - text_color.mV[0], 1.f - text_color.mV[1], 1.f - text_color.mV[2], alpha ); rendered_text += mGLFont->render( @@ -1951,7 +1951,7 @@ void LLLineEditor::draw() LLFontGL::NORMAL, LLFontGL::NO_SHADOW, select_right - mScrollHPos - rendered_text, - mMaxHPixels - llmath::llround(rendered_pixels_right), + mMaxHPixels - ll_round(rendered_pixels_right), &rendered_pixels_right); } @@ -1966,7 +1966,7 @@ void LLLineEditor::draw() LLFontGL::NORMAL, LLFontGL::NO_SHADOW, S32_MAX, - mMaxHPixels - llmath::llround(rendered_pixels_right), + mMaxHPixels - ll_round(rendered_pixels_right), &rendered_pixels_right); } } @@ -1980,7 +1980,7 @@ void LLLineEditor::draw() LLFontGL::NORMAL, LLFontGL::NO_SHADOW, S32_MAX, - mMaxHPixels - llmath::llround(rendered_pixels_right), + mMaxHPixels - ll_round(rendered_pixels_right), &rendered_pixels_right); } #if 0 // for when we're ready for image art. @@ -2048,7 +2048,7 @@ void LLLineEditor::draw() LLFontGL::NORMAL, LLFontGL::NO_SHADOW, S32_MAX, - mMaxHPixels - llmath::llround(rendered_pixels_right), + mMaxHPixels - ll_round(rendered_pixels_right), &rendered_pixels_right, FALSE); } @@ -2073,7 +2073,7 @@ void LLLineEditor::draw() LLFontGL::NORMAL, LLFontGL::NO_SHADOW, S32_MAX, - mMaxHPixels - llmath::llround(rendered_pixels_right), + mMaxHPixels - ll_round(rendered_pixels_right), &rendered_pixels_right, FALSE); } // Draw children (border) @@ -3022,7 +3022,7 @@ void LLLineEditor::markAsPreedit(S32 position, S32 length) S32 LLLineEditor::getPreeditFontSize() const { - return llmath::llround(mGLFont->getLineHeight() * LLUI::getScaleFactor().mV[VY]); + return ll_round(mGLFont->getLineHeight() * LLUI::getScaleFactor().mV[VY]); } void LLLineEditor::setReplaceNewlinesWithSpaces(BOOL replace) diff --git a/indra/llui/llmenugl.cpp b/indra/llui/llmenugl.cpp index 13422546c..086574e09 100644 --- a/indra/llui/llmenugl.cpp +++ b/indra/llui/llmenugl.cpp @@ -342,7 +342,7 @@ void LLMenuItemGL::setJumpKey(KEY key) // virtual U32 LLMenuItemGL::getNominalHeight( void ) const { - return llmath::llround(mFont->getLineHeight()) + MENU_ITEM_PADDING; + return ll_round(mFont->getLineHeight()) + MENU_ITEM_PADDING; } //virtual @@ -1828,7 +1828,7 @@ void LLMenuItemBranchDownGL::draw( void ) if (offset != std::string::npos) { const LLWString& utf32text = mLabel.getWString(); - S32 x_offset = llmath::llround((F32)getRect().getWidth() / 2.f - getFont()->getWidthF32(utf32text, 0, S32_MAX) / 2.f); + S32 x_offset = ll_round((F32)getRect().getWidth() / 2.f - getFont()->getWidthF32(utf32text, 0, S32_MAX) / 2.f); S32 x_begin = x_offset + getFont()->getWidth(utf32text, 0, offset); S32 x_end = x_offset + getFont()->getWidth(utf32text, 0, offset + 1); gl_line_2d(x_begin, LABEL_BOTTOM_PAD_PIXELS, x_end, LABEL_BOTTOM_PAD_PIXELS); @@ -2662,7 +2662,7 @@ void LLMenuGL::arrange( void ) // *FIX: create the item first and then ask for its dimensions? S32 spillover_item_width = PLAIN_PAD_PIXELS + LLFontGL::getFontSansSerif()->getWidth( std::string("More") ); // *TODO: Translate - S32 spillover_item_height = llmath::llround(LLFontGL::getFontSansSerif()->getLineHeight()) + MENU_ITEM_PADDING; + S32 spillover_item_height = ll_round(LLFontGL::getFontSansSerif()->getLineHeight()) + MENU_ITEM_PADDING; // Scrolling support item_list_t::iterator first_visible_item_iter; @@ -3590,8 +3590,8 @@ BOOL LLMenuGL::handleHover( S32 x, S32 y, MASK mask ) LLVector2 mouse_avg_dir((F32)mMouseVelX, (F32)mMouseVelY); mouse_avg_dir.normVec(); F32 interp = 0.5f * (llclamp(mouse_dir * mouse_avg_dir, 0.f, 1.f)); - mMouseVelX = llmath::llround(lerp((F32)mouse_delta_x, (F32)mMouseVelX, interp)); - mMouseVelY = llmath::llround(lerp((F32)mouse_delta_y, (F32)mMouseVelY, interp)); + mMouseVelX = ll_round(lerp((F32)mouse_delta_x, (F32)mMouseVelX, interp)); + mMouseVelY = ll_round(lerp((F32)mouse_delta_y, (F32)mMouseVelY, interp)); mLastMouseX = x; mLastMouseY = y; diff --git a/indra/llui/llmodaldialog.cpp b/indra/llui/llmodaldialog.cpp index e210d856e..4185aadb1 100644 --- a/indra/llui/llmodaldialog.cpp +++ b/indra/llui/llmodaldialog.cpp @@ -292,7 +292,7 @@ void LLModalDialog::draw() void LLModalDialog::centerOnScreen() { LLVector2 window_size = LLUI::getWindowSize(); - centerWithin(LLRect(0, 0, llmath::llround(window_size.mV[VX]), llmath::llround(window_size.mV[VY]))); + centerWithin(LLRect(0, 0, ll_round(window_size.mV[VX]), ll_round(window_size.mV[VY]))); } diff --git a/indra/llui/llprogressbar.cpp b/indra/llui/llprogressbar.cpp index 36ff5587e..c1c842d54 100644 --- a/indra/llui/llprogressbar.cpp +++ b/indra/llui/llprogressbar.cpp @@ -84,7 +84,7 @@ void LLProgressBar::draw() bar_bg_imagep->draw(getLocalRect(), background_color % alpha); LLRect progress_rect = getLocalRect(); - progress_rect.mRight = llmath::llround(getRect().getWidth() * (mPercentDone / 100.f)); + progress_rect.mRight = ll_round(getRect().getWidth() * (mPercentDone / 100.f)); bar_fg_imagep->draw(progress_rect, LLColor4::white % alpha); } diff --git a/indra/llui/llscrollcontainer.cpp b/indra/llui/llscrollcontainer.cpp index ad1b4ead0..7fa841b50 100644 --- a/indra/llui/llscrollcontainer.cpp +++ b/indra/llui/llscrollcontainer.cpp @@ -299,7 +299,7 @@ bool LLScrollContainer::autoScroll(S32 x, S32 y) // clip rect against root view inner_rect_local.intersectWith(screen_local_extents); - S32 auto_scroll_speed = llmath::llround(mAutoScrollRate * LLFrameTimer::getFrameDeltaTimeF32()); + S32 auto_scroll_speed = ll_round(mAutoScrollRate * LLFrameTimer::getFrameDeltaTimeF32()); // autoscroll region should take up no more than one third of visible scroller area S32 auto_scroll_region_width = llmin(inner_rect_local.getWidth() / 3, 10); S32 auto_scroll_region_height = llmin(inner_rect_local.getHeight() / 3, 10); diff --git a/indra/llui/llscrolllistcell.cpp b/indra/llui/llscrolllistcell.cpp index cc5453445..82484b0bb 100644 --- a/indra/llui/llscrolllistcell.cpp +++ b/indra/llui/llscrolllistcell.cpp @@ -254,7 +254,7 @@ BOOL LLScrollListText::getVisible() const //virtual S32 LLScrollListText::getHeight() const { - return llmath::llround(mFont->getLineHeight()); + return ll_round(mFont->getLineHeight()); } @@ -326,7 +326,7 @@ void LLScrollListText::draw(const LLColor4& color, const LLColor4& highlight_col break; } LLRect highlight_rect(left - 2, - llmath::llround(mFont->getLineHeight()) + 1, + ll_round(mFont->getLineHeight()) + 1, left + mFont->getWidth(mText.getString(), mHighlightOffset, mHighlightCount) + 1, 1); mRoundedRectImage->draw(highlight_rect, highlight_color); diff --git a/indra/llui/llscrolllistctrl.cpp b/indra/llui/llscrolllistctrl.cpp index 95ce3e561..014bb6956 100644 --- a/indra/llui/llscrolllistctrl.cpp +++ b/indra/llui/llscrolllistctrl.cpp @@ -602,7 +602,7 @@ bool LLScrollListCtrl::updateColumnWidths() S32 new_width = column->getWidth(); if (column->mRelWidth >= 0) { - new_width = (S32)llmath::llround(column->mRelWidth*mItemListRect.getWidth()); + new_width = (S32)ll_round(column->mRelWidth*mItemListRect.getWidth()); } else if (column->mDynamicWidth) { @@ -2604,9 +2604,11 @@ LLView* LLScrollListCtrl::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFac LLSD columns; S32 index = 0; + const std::string nodename(std::string(node->getName()->mString) + '.'); + const std::string kidcolumn(nodename + "columns"); for (LLXMLNodePtr child = node->getFirstChild(); child.notNull(); child = child->getNextSibling()) { - if (child->hasName("column")) + if (child->hasName("column") || child->hasName(kidcolumn)) { std::string labelname(""); if (child->getAttributeString("label", labelname)) @@ -2666,9 +2668,11 @@ LLView* LLScrollListCtrl::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFac scroll_list->sortByColumnIndex(sort_column, sort_ascending); } + const std::string kidrow(nodename + "row"); + const std::string kidrows(nodename + "rows"); for (LLXMLNodePtr child = node->getFirstChild(); child.notNull(); child = child->getNextSibling()) { - if (child->hasName("row") || child->hasName("rows")) + if (child->hasName("row") || child->hasName(kidrow) || child->hasName("rows") || child->hasName(kidrows)) { LLUUID id; LLSD row; @@ -2829,7 +2833,7 @@ void LLScrollListCtrl::addColumn(const LLScrollListColumn::Params& column_params } if (new_column->mRelWidth >= 0) { - new_column->setWidth((S32)llmath::llround(new_column->mRelWidth*mItemListRect.getWidth())); + new_column->setWidth((S32)ll_round(new_column->mRelWidth*mItemListRect.getWidth())); } else if(new_column->mDynamicWidth) { diff --git a/indra/llui/llscrolllistctrl.h b/indra/llui/llscrolllistctrl.h index 9babab009..9753013f1 100644 --- a/indra/llui/llscrolllistctrl.h +++ b/indra/llui/llscrolllistctrl.h @@ -324,6 +324,23 @@ public: BOOL hasSortOrder() const; void clearSortOrder(); + template S32 selectMultiple(const std::vector& vec) + { + size_t count = 0; + for (item_list::iterator iter = mItemList.begin(); iter != mItemList.end(); ++iter) + { + LLScrollListItem* item = *iter; + for (typename std::vector::const_iterator titr = vec.begin(); titr != vec.end(); ++titr) + if (item->getEnabled() && static_cast(item->getValue()) == (*titr)) + { + selectItem(item, false); + ++count; + break; + } + } + if (mCommitOnSelectionChange) commitIfChanged(); + return count; + } S32 selectMultiple( uuid_vec_t ids ); // conceptually const, but mutates mItemList void updateSort() const; diff --git a/indra/llui/llsliderctrl.cpp b/indra/llui/llsliderctrl.cpp index 594a2d890..365f0b3d7 100644 --- a/indra/llui/llsliderctrl.cpp +++ b/indra/llui/llsliderctrl.cpp @@ -75,7 +75,8 @@ LLSliderCtrl::LLSliderCtrl(const std::string& name, const LLRect& rect, mEditor( NULL ), mTextBox( NULL ), mTextEnabledColor( LLUI::sColorsGroup->getColor( "LabelTextColor" ) ), - mTextDisabledColor( LLUI::sColorsGroup->getColor( "LabelDisabledColor" ) ) + mTextDisabledColor(LLUI::sColorsGroup->getColor("LabelDisabledColor")), + mEditorCommitSignal(NULL) { S32 top = getRect().getHeight(); S32 bottom = 0; @@ -141,6 +142,11 @@ LLSliderCtrl::LLSliderCtrl(const std::string& name, const LLRect& rect, updateText(); } +LLSliderCtrl::~LLSliderCtrl() +{ + delete mEditorCommitSignal; +} + void LLSliderCtrl::setValue(F32 v, BOOL from_event) { mSlider->setValue( v, from_event ); @@ -238,6 +244,8 @@ void LLSliderCtrl::onEditorCommit( LLUICtrl* ctrl, const LLSD& userdata ) if( success ) { self->onCommit(); + if (self->mEditorCommitSignal) + (*(self->mEditorCommitSignal))(self, self->getValueF32()); } else { @@ -350,6 +358,12 @@ boost::signals2::connection LLSliderCtrl::setSliderMouseUpCallback( const commit return mSlider->setMouseUpCallback( cb ); } +boost::signals2::connection LLSliderCtrl::setSliderEditorCommitCallback(const commit_signal_t::slot_type& cb) +{ + if (!mEditorCommitSignal) mEditorCommitSignal = new commit_signal_t(); + return mEditorCommitSignal->connect(cb); +} + void LLSliderCtrl::onTabInto() { if( mEditor ) diff --git a/indra/llui/llsliderctrl.h b/indra/llui/llsliderctrl.h index bf1b8366e..a5bc3488c 100644 --- a/indra/llui/llsliderctrl.h +++ b/indra/llui/llsliderctrl.h @@ -62,7 +62,7 @@ public: F32 initial_value, F32 min_value, F32 max_value, F32 increment, const std::string& control_which = LLStringUtil::null ); - virtual ~LLSliderCtrl() {} // Children all cleaned up by default view destructor. + virtual ~LLSliderCtrl(); virtual LLXMLNodePtr getXML(bool save_children = true) const; static LLView* fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *factory); @@ -99,6 +99,7 @@ public: boost::signals2::connection setSliderMouseDownCallback( const commit_signal_t::slot_type& cb ); boost::signals2::connection setSliderMouseUpCallback( const commit_signal_t::slot_type& cb ); + boost::signals2::connection setSliderEditorCommitCallback(const commit_signal_t::slot_type& cb); virtual void onTabInto(); @@ -137,6 +138,8 @@ private: LLColor4 mTextEnabledColor; LLColor4 mTextDisabledColor; + + commit_signal_t* mEditorCommitSignal; }; #endif // LL_LLSLIDERCTRL_H diff --git a/indra/llui/llspinctrl.cpp b/indra/llui/llspinctrl.cpp index 5944d0c11..213354f94 100644 --- a/indra/llui/llspinctrl.cpp +++ b/indra/llui/llspinctrl.cpp @@ -147,7 +147,7 @@ F32 clamp_precision(F32 value, S32 decimal_precision) for (S32 i = 0; i < decimal_precision; i++) clamped_value *= 10.0; - clamped_value = llmath::llround((F32)clamped_value); + clamped_value = ll_round((F32)clamped_value); for (S32 i = 0; i < decimal_precision; i++) clamped_value /= 10.0; @@ -161,13 +161,13 @@ F32 get_increment(F32 inc, S32 decimal_precision) //CF: finetune increments if(gKeyboard->getKeyDown(KEY_ALT)) inc = inc * 10.f; else if(gKeyboard->getKeyDown(KEY_CONTROL)) { - if (llmath::llround(inc * 1000.f) == 25) // 0.025 gets 0.05 here + if (ll_round(inc * 1000.f) == 25) // 0.025 gets 0.05 here inc = inc * 0.2f; else inc = inc * 0.1f; } else if(gKeyboard->getKeyDown(KEY_SHIFT)) { - if (decimal_precision == 2 && llmath::llround(inc) == 1) // for rotations, finest step is 0.05 + if (decimal_precision == 2 && ll_round(inc) == 1) // for rotations, finest step is 0.05 inc = inc * 0.05f; else inc = inc * 0.01f; diff --git a/indra/llui/llstatgraph.cpp b/indra/llui/llstatgraph.cpp index c271e1706..dd74e5882 100644 --- a/indra/llui/llstatgraph.cpp +++ b/indra/llui/llstatgraph.cpp @@ -120,7 +120,7 @@ void LLStatGraph::draw() color = mThresholdColors[i]; gGL.color4fv(color.mV); - gl_rect_2d(1, llmath::llround(frac*getRect().getHeight()), getRect().getWidth() - 1, 0, TRUE); + gl_rect_2d(1, ll_round(frac*getRect().getHeight()), getRect().getWidth() - 1, 0, TRUE); } void LLStatGraph::setValue(const LLSD& value) diff --git a/indra/llui/lltexteditor.cpp b/indra/llui/lltexteditor.cpp index dd679566c..683d52d0d 100644 --- a/indra/llui/lltexteditor.cpp +++ b/indra/llui/lltexteditor.cpp @@ -312,7 +312,7 @@ LLTextEditor::LLTextEditor( updateTextRect(); - S32 line_height = llmath::llround( mGLFont->getLineHeight() ); + S32 line_height = ll_round( mGLFont->getLineHeight() ); S32 page_size = mTextRect.getHeight() / line_height; // Init the scrollbar @@ -970,7 +970,7 @@ S32 LLTextEditor::getCursorPosFromLocalCoord( S32 local_x, S32 local_y, BOOL rou // Figure out which line we're nearest to. S32 total_lines = getLineCount(); - S32 line_height = llmath::llround( mGLFont->getLineHeight() ); + S32 line_height = ll_round( mGLFont->getLineHeight() ); S32 max_visible_lines = mTextRect.getHeight() / line_height; S32 scroll_lines = mScrollbar->getDocPos(); S32 visible_lines = llmin( total_lines - scroll_lines, max_visible_lines ); // Lines currently visible @@ -2927,7 +2927,7 @@ void LLTextEditor::drawSelectionBackground() const S32 text_len = getLength(); std::queue line_endings; - S32 line_height = llmath::llround( mGLFont->getLineHeight() ); + S32 line_height = ll_round( mGLFont->getLineHeight() ); S32 selection_left = llmin( mSelectionStart, mSelectionEnd ); S32 selection_right = llmax( mSelectionStart, mSelectionEnd ); @@ -3122,7 +3122,7 @@ void LLTextEditor::drawMisspelled() S32 line_end = 0; // Determine if the cursor is visible and if so what its coordinates are. - while( (mTextRect.mBottom <= llmath::llround(text_y)) && (search_pos < num_lines)) + while( (mTextRect.mBottom <= ll_round(text_y)) && (search_pos < num_lines)) { line_end = text_len + 1; S32 next_line = -1; @@ -3197,7 +3197,7 @@ void LLTextEditor::drawCursor() S32 line_end = 0; // Determine if the cursor is visible and if so what its coordinates are. - while( (mTextRect.mBottom <= llmath::llround(text_y)) && (cur_pos < num_lines)) + while( (mTextRect.mBottom <= ll_round(text_y)) && (cur_pos < num_lines)) { line_end = text_len + 1; S32 next_line = -1; @@ -3316,7 +3316,7 @@ void LLTextEditor::drawPreeditMarker() return; } - const S32 line_height = llmath::llround( mGLFont->getLineHeight() ); + const S32 line_height = ll_round( mGLFont->getLineHeight() ); S32 line_start = getLineStart(cur_line); S32 line_y = mTextRect.mTop - line_height; @@ -3436,7 +3436,7 @@ void LLTextEditor::drawText() if (seg_iter == mSegments.end() || (*seg_iter)->getStart() > line_start) --seg_iter; LLTextSegment* cur_segment = *seg_iter; - S32 line_height = llmath::llround( mGLFont->getLineHeight() ); + S32 line_height = ll_round( mGLFont->getLineHeight() ); F32 text_y = (F32)(mTextRect.mTop - line_height); while((mTextRect.mBottom <= text_y) && (cur_line < num_lines)) { @@ -3461,7 +3461,7 @@ void LLTextEditor::drawText() if( mShowLineNumbers && !cur_line_is_continuation) { const LLFontGL *num_font = LLFontGL::getFontMonospace(); - F32 y_top = text_y + ((F32)llmath::llround(num_font->getLineHeight()) / 2); + F32 y_top = text_y + ((F32)ll_round(num_font->getLineHeight()) / 2); BOOL is_cur_line = getCurrentLine() == cur_line_num; const U8 style = is_cur_line ? LLFontGL::BOLD : LLFontGL::NORMAL; const LLColor4 fg_color = is_cur_line ? mCursorColor : mReadOnlyFgColor; @@ -3506,7 +3506,7 @@ void LLTextEditor::drawText() S32 style_image_height = style->mImageHeight; S32 style_image_width = style->mImageWidth; LLUIImagePtr image = style->getImage(); - image->draw(llmath::llround(text_x), llmath::llround(text_y)+line_height-style_image_height, + image->draw(ll_round(text_x), ll_round(text_y)+line_height-style_image_height, style_image_width, style_image_height); } @@ -3593,7 +3593,7 @@ void LLTextEditor::drawClippedSegment(const LLWString &text, S32 seg_start, S32 } } - F32 y_top = y + (F32)llmath::llround(font->getLineHeight()); + F32 y_top = y + (F32)ll_round(font->getLineHeight()); if( selection_left > seg_start ) { @@ -3996,7 +3996,7 @@ void LLTextEditor::reshape(S32 width, S32 height, BOOL called_from_parent) // propagate shape information to scrollbar mScrollbar->setDocSize( getLineCount() ); - S32 line_height = llmath::llround( mGLFont->getLineHeight() ); + S32 line_height = ll_round( mGLFont->getLineHeight() ); S32 page_lines = mTextRect.getHeight() / line_height; mScrollbar->setPageSize( page_lines ); } @@ -5163,7 +5163,7 @@ BOOL LLTextEditor::getPreeditLocation(S32 query_offset, LLCoordGL *coord, LLRect } const llwchar * const text = mWText.c_str(); - const S32 line_height = llmath::llround(mGLFont->getLineHeight()); + const S32 line_height = ll_round(mGLFont->getLineHeight()); if (coord) { @@ -5266,7 +5266,7 @@ void LLTextEditor::markAsPreedit(S32 position, S32 length) S32 LLTextEditor::getPreeditFontSize() const { - return llmath::llround(mGLFont->getLineHeight() * LLUI::getScaleFactor().mV[VY]); + return ll_round(mGLFont->getLineHeight() * LLUI::getScaleFactor().mV[VY]); } void LLTextEditor::setKeystrokeCallback(const keystroke_signal_t::slot_type& callback) diff --git a/indra/llui/llui.cpp b/indra/llui/llui.cpp index 39f4598c5..722093628 100644 --- a/indra/llui/llui.cpp +++ b/indra/llui/llui.cpp @@ -158,8 +158,8 @@ void LLUI::cleanupClass() void LLUI::setMousePositionScreen(S32 x, S32 y) { S32 screen_x, screen_y; - screen_x = llmath::llround((F32)x * getScaleFactor().mV[VX]); - screen_y = llmath::llround((F32)y * getScaleFactor().mV[VY]); + screen_x = ll_round((F32)x * getScaleFactor().mV[VX]); + screen_y = ll_round((F32)y * getScaleFactor().mV[VY]); LLView::getWindow()->setCursorPosition(LLCoordGL(screen_x, screen_y).convert()); } @@ -170,8 +170,8 @@ void LLUI::getMousePositionScreen(S32 *x, S32 *y) LLCoordWindow cursor_pos_window; getWindow()->getCursorPosition(&cursor_pos_window); LLCoordGL cursor_pos_gl(cursor_pos_window.convert()); - *x = llmath::llround((F32)cursor_pos_gl.mX / getScaleFactor().mV[VX]); - *y = llmath::llround((F32)cursor_pos_gl.mY / getScaleFactor().mV[VX]); + *x = ll_round((F32)cursor_pos_gl.mX / getScaleFactor().mV[VX]); + *y = ll_round((F32)cursor_pos_gl.mY / getScaleFactor().mV[VX]); } //static @@ -262,15 +262,15 @@ LLVector2 LLUI::getWindowSize() //static void LLUI::screenPointToGL(S32 screen_x, S32 screen_y, S32 *gl_x, S32 *gl_y) { - *gl_x = llmath::llround((F32)screen_x * getScaleFactor().mV[VX]); - *gl_y = llmath::llround((F32)screen_y * getScaleFactor().mV[VY]); + *gl_x = ll_round((F32)screen_x * getScaleFactor().mV[VX]); + *gl_y = ll_round((F32)screen_y * getScaleFactor().mV[VY]); } //static void LLUI::glPointToScreen(S32 gl_x, S32 gl_y, S32 *screen_x, S32 *screen_y) { - *screen_x = llmath::llround((F32)gl_x / getScaleFactor().mV[VX]); - *screen_y = llmath::llround((F32)gl_y / getScaleFactor().mV[VY]); + *screen_x = ll_round((F32)gl_x / getScaleFactor().mV[VX]); + *screen_y = ll_round((F32)gl_y / getScaleFactor().mV[VY]); } //static diff --git a/indra/llui/llurlentry.cpp b/indra/llui/llurlentry.cpp index 741954d11..5cd532d81 100644 --- a/indra/llui/llurlentry.cpp +++ b/indra/llui/llurlentry.cpp @@ -835,9 +835,9 @@ void LLUrlEntryParcel::processParcelInfo(const LLParcelData& parcel_data) // If parcel name is empty use Sim_name (x, y, z) for parcel label. else if (!parcel_data.sim_name.empty()) { - S32 region_x = llmath::llround(parcel_data.global_x) % REGION_WIDTH_UNITS; - S32 region_y = llmath::llround(parcel_data.global_y) % REGION_WIDTH_UNITS; - S32 region_z = llmath::llround(parcel_data.global_z); + S32 region_x = ll_round(parcel_data.global_x) % REGION_WIDTH_UNITS; + S32 region_y = ll_round(parcel_data.global_y) % REGION_WIDTH_UNITS; + S32 region_z = ll_round(parcel_data.global_z); label = llformat("%s (%d, %d, %d)", parcel_data.sim_name.c_str(), region_x, region_y, region_z); diff --git a/indra/llui/llview.cpp b/indra/llui/llview.cpp index 12c6ef34d..460ed38a9 100644 --- a/indra/llui/llview.cpp +++ b/indra/llui/llview.cpp @@ -2416,7 +2416,9 @@ LLControlVariable *LLView::findControl(const std::string& name) { return mParentView->findControl(name); } - return LLUI::sConfigGroup->getControl(name); + if (LLControlVariable* control = LLUI::sConfigGroup->getControl(name)) + return control; + return LLUI::sAccountGroup->getControl(name); } const S32 FLOATER_H_MARGIN = 15; @@ -2916,7 +2918,7 @@ bool LLView::setControlValue(const LLSD& value) std::string ctrlname = getControlName(); if (!ctrlname.empty()) { - LLUI::sConfigGroup->setUntypedValue(ctrlname, value); + LLUI::getControlControlGroup(ctrlname).setUntypedValue(ctrlname, value); return true; } return false; diff --git a/indra/llwindow/llkeyboardwin32.cpp b/indra/llwindow/llkeyboardwin32.cpp index f86222e15..2740fce59 100644 --- a/indra/llwindow/llkeyboardwin32.cpp +++ b/indra/llwindow/llkeyboardwin32.cpp @@ -269,7 +269,7 @@ void LLKeyboardWin32::scanKeyboard() // keydown in highest bit if (!mControllerKeys[key] && !pending_key_events && !(GetAsyncKeyState(virtual_key) & 0x8000)) { - //llinfos << "Key up event missed, resetting" << llendl; + //LL_INFOS() << "Key up event missed, resetting" << LL_ENDL; mKeyLevel[key] = FALSE; } } diff --git a/indra/llwindow/llkeyboardwin32.h b/indra/llwindow/llkeyboardwin32.h index a2138759f..bffccc7f5 100644 --- a/indra/llwindow/llkeyboardwin32.h +++ b/indra/llwindow/llkeyboardwin32.h @@ -2,31 +2,25 @@ * @file llkeyboardwin32.h * @brief Handler for assignable key bindings * - * $LicenseInfo:firstyear=2004&license=viewergpl$ - * - * Copyright (c) 2004-2009, Linden Research, Inc. - * + * $LicenseInfo:firstyear=2004&license=viewerlgpl$ * Second Life Viewer Source Code - * The source code in this file ("Source Code") is provided by Linden Lab - * to you under the terms of the GNU General Public License, version 2.0 - * ("GPL"), unless you have obtained a separate licensing agreement - * ("Other License"), formally executed by you and Linden Lab. Terms of - * the GPL can be found in doc/GPL-license.txt in this distribution, or - * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2 + * Copyright (C) 2010, Linden Research, Inc. * - * There are special exceptions to the terms and conditions of the GPL as - * it is applied to this Source Code. View the full text of the exception - * in the file doc/FLOSS-exception.txt in this software distribution, or - * online at - * http://secondlifegrid.net/programs/open_source/licensing/flossexception + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - * By copying, modifying or distributing this software, you acknowledge - * that you have read and understood your obligations described above, - * and agree to abide by those obligations. - * - * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO - * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, - * COMPLETENESS OR PERFORMANCE. + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * $/LicenseInfo$ */ diff --git a/indra/llwindow/llwindowsdl.cpp b/indra/llwindow/llwindowsdl.cpp index e7832731e..2f87037dc 100644 --- a/indra/llwindow/llwindowsdl.cpp +++ b/indra/llwindow/llwindowsdl.cpp @@ -2561,8 +2561,8 @@ void LLWindowSDL::spawnWebBrowser(const std::string& escaped_url, bool async) std::string cmd, arg; cmd = gDirUtilp->getAppRODataDir(); cmd += gDirUtilp->getDirDelimiter(); - //cmd += "etc"; - //cmd += gDirUtilp->getDirDelimiter(); + cmd += "etc"; + cmd += gDirUtilp->getDirDelimiter(); cmd += "launch_url.sh"; arg = escaped_url; exec_cmd(cmd, arg); diff --git a/indra/llwindow/llwindowwin32.cpp b/indra/llwindow/llwindowwin32.cpp index f2db11f26..a6cfa3625 100644 --- a/indra/llwindow/llwindowwin32.cpp +++ b/indra/llwindow/llwindowwin32.cpp @@ -3820,11 +3820,11 @@ LLWindowCallbacks::DragNDropResult LLWindowWin32::completeDragNDropRequest( cons // When it handled the message, the value to be returned from // the Window Procedure is set to *result. -BOOL LLWindowWin32::handleImeRequests(U32 request, U32 param, LRESULT *result) +BOOL LLWindowWin32::handleImeRequests(WPARAM w_param, LPARAM l_param, LRESULT *result) { if ( mPreeditor ) { - switch (request) + switch (w_param) { case IMR_CANDIDATEWINDOW: // http://msdn2.microsoft.com/en-us/library/ms776080.aspx { @@ -3832,7 +3832,7 @@ BOOL LLWindowWin32::handleImeRequests(U32 request, U32 param, LRESULT *result) LLRect preedit_bounds; mPreeditor->getPreeditLocation(-1, &caret_coord, &preedit_bounds, NULL); - CANDIDATEFORM *const form = (CANDIDATEFORM *)param; + CANDIDATEFORM *const form = (CANDIDATEFORM *)l_param; DWORD const dwIndex = form->dwIndex; fillCandidateForm(caret_coord, preedit_bounds, form); form->dwIndex = dwIndex; @@ -3842,7 +3842,7 @@ BOOL LLWindowWin32::handleImeRequests(U32 request, U32 param, LRESULT *result) } case IMR_QUERYCHARPOSITION: { - IMECHARPOSITION *const char_position = (IMECHARPOSITION *)param; + IMECHARPOSITION *const char_position = (IMECHARPOSITION *)l_param; // char_position->dwCharPos counts in number of // WCHARs, i.e., UTF-16 encoding units, so we can't simply pass the @@ -3867,7 +3867,7 @@ BOOL LLWindowWin32::handleImeRequests(U32 request, U32 param, LRESULT *result) } case IMR_COMPOSITIONFONT: { - fillCompositionLogfont((LOGFONT *)param); + fillCompositionLogfont((LOGFONT *)l_param); *result = 1; return TRUE; @@ -3882,7 +3882,7 @@ BOOL LLWindowWin32::handleImeRequests(U32 request, U32 param, LRESULT *result) S32 context_offset; const LLWString context = find_context(wtext, select, select_length, &context_offset); - RECONVERTSTRING * const reconvert_string = (RECONVERTSTRING *)param; + RECONVERTSTRING * const reconvert_string = (RECONVERTSTRING *)l_param; const U32 size = fillReconvertString(context, select - context_offset, select_length, reconvert_string); if (reconvert_string) { @@ -3932,7 +3932,7 @@ BOOL LLWindowWin32::handleImeRequests(U32 request, U32 param, LRESULT *result) context.erase(preedit, preedit_length); } - RECONVERTSTRING *reconvert_string = (RECONVERTSTRING *)param; + RECONVERTSTRING *reconvert_string = (RECONVERTSTRING *)l_param; *result = fillReconvertString(context, preedit, 0, reconvert_string); return TRUE; } diff --git a/indra/llwindow/llwindowwin32.h b/indra/llwindow/llwindowwin32.h index 07dc67c20..9ef2b206e 100644 --- a/indra/llwindow/llwindowwin32.h +++ b/indra/llwindow/llwindowwin32.h @@ -152,7 +152,7 @@ protected: U32 fillReconvertString(const LLWString &text, S32 focus, S32 focus_length, RECONVERTSTRING *reconvert_string); void handleStartCompositionMessage(); void handleCompositionMessage(U32 indexes); - BOOL handleImeRequests(U32 request, U32 param, LRESULT *result); + BOOL handleImeRequests(WPARAM request, LPARAM param, LRESULT *result); protected: // diff --git a/indra/newview/CMakeLists.txt b/indra/newview/CMakeLists.txt index d43c309c3..b39c82054 100644 --- a/indra/newview/CMakeLists.txt +++ b/indra/newview/CMakeLists.txt @@ -82,6 +82,7 @@ set(viewer_SOURCE_FILES NACLantispam.cpp aihttpview.cpp aixmllindengenepool.cpp + alfloaterregiontracker.cpp aoremotectrl.cpp ascentfloatercontactgroups.cpp ascentkeyword.cpp @@ -610,6 +611,7 @@ set(viewer_HEADER_FILES NACLantispam.h aihttpview.h aixmllindengenepool.h + alfloaterregiontracker.h aoremotectrl.h ascentfloatercontactgroups.h ascentkeyword.h diff --git a/indra/newview/aihttpview.cpp b/indra/newview/aihttpview.cpp index 49f6f726f..1e011e7bd 100644 --- a/indra/newview/aihttpview.cpp +++ b/indra/newview/aihttpview.cpp @@ -190,7 +190,7 @@ class AIGLHTTPHeaderBar : public LLView AIGLHTTPHeaderBar(std::string const& name, AIHTTPView* httpview) : LLView(name, FALSE), mHTTPView(httpview) { - sLineHeight = llmath::llround(LLFontGL::getFontMonospace()->getLineHeight()); + sLineHeight = ll_round(LLFontGL::getFontMonospace()->getLineHeight()); setRect(LLRect(0, 0, 200, sLineHeight * number_of_header_lines)); } diff --git a/indra/newview/alfloaterregiontracker.cpp b/indra/newview/alfloaterregiontracker.cpp new file mode 100644 index 000000000..c19295924 --- /dev/null +++ b/indra/newview/alfloaterregiontracker.cpp @@ -0,0 +1,298 @@ +/** +* @file alfloaterregiontracker.cpp +* @brief Region tracking floater +* +* $LicenseInfo:firstyear=2013&license=viewerlgpl$ +* Alchemy Viewer Source Code +* Copyright (C) 2014, Alchemy Viewer Project. +* +* This library is free software; you can redistribute it and/or +* modify it under the terms of the GNU Lesser General Public +* License as published by the Free Software Foundation; +* version 2.1 of the License only. +* +* This library is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +* Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public +* License along with this library; if not, write to the Free Software +* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +* +* $/LicenseInfo$ +*/ + +#include "llviewerprecompiledheaders.h" + +#include "alfloaterregiontracker.h" + +// library +#include "llbutton.h" +#include "lldir.h" +#include "llfile.h" +#include "llscrolllistctrl.h" +#include "llsd.h" +#include "llsdserialize.h" +#include "llsdserialize_xml.h" +#include "lltextbox.h" +#include "lluictrlfactory.h" + +// newview +#include "hippogridmanager.h" +#include "llagent.h" +#include "llfloaterworldmap.h" +//#include "llfloaterreg.h" +#include "llnotificationsutil.h" +#include "llviewermessage.h" +#include "llworldmap.h" +#include "llworldmapmessage.h" + +#include + +const std::string TRACKER_FILE = "tracked_regions.json"; + +ALFloaterRegionTracker::ALFloaterRegionTracker(const LLSD&) + : LLFloater(), + LLEventTimer(5.f), + mRefreshRegionListBtn(NULL), + mRemoveRegionBtn(NULL), + mOpenMapBtn(NULL), + mRegionScrollList(NULL) +{ + LLUICtrlFactory::instance().buildFloater(this, "floater_region_tracker.xml"); + loadFromJSON(); +} + +ALFloaterRegionTracker::~ALFloaterRegionTracker() +{ + saveToJSON(); +} + +BOOL ALFloaterRegionTracker::postBuild() +{ + mRefreshRegionListBtn = getChild("refresh"); + mRefreshRegionListBtn->setClickedCallback(boost::bind(&ALFloaterRegionTracker::refresh, this)); + + mRemoveRegionBtn = getChild("remove"); + mRemoveRegionBtn->setClickedCallback(boost::bind(&ALFloaterRegionTracker::removeRegions, this)); + + mOpenMapBtn = getChild("open_map"); + mOpenMapBtn->setClickedCallback(boost::bind(&ALFloaterRegionTracker::openMap, this)); + + mRegionScrollList = getChild("region_list"); + mRegionScrollList->setCommitOnSelectionChange(TRUE); + mRegionScrollList->setCommitCallback(boost::bind(&ALFloaterRegionTracker::updateHeader, this)); + mRegionScrollList->setDoubleClickCallback(boost::bind(&ALFloaterRegionTracker::openMap, this)); + + updateHeader(); + + return LLFloater::postBuild(); +} + +void ALFloaterRegionTracker::onOpen(/*const LLSD& key*/) +{ + requestRegionData(); + mEventTimer.start(); +} + +void ALFloaterRegionTracker::onClose(bool app_quitting) +{ + mEventTimer.stop(); + app_quitting ? destroy() : setVisible(false); +} + +void ALFloaterRegionTracker::updateHeader() +{ + S32 num_selected(mRegionScrollList->getNumSelected()); + mRefreshRegionListBtn->setEnabled(mRegionMap.size() != 0); + mRemoveRegionBtn->setEnabled(!!num_selected); + mOpenMapBtn->setEnabled(num_selected == 1); +} + +void ALFloaterRegionTracker::refresh() +{ + if (!mRegionMap.size()) + { + updateHeader(); + return; + } + + std::vector saved_selected_values; + BOOST_FOREACH(const LLScrollListItem* item, mRegionScrollList->getAllSelected()) + { + saved_selected_values.push_back(item->getValue().asString()); + } + mRegionScrollList->deleteAllItems(); + + const std::string& cur_region_name = gAgent.getRegion()->getName(); + + for (LLSD::map_const_iterator it = mRegionMap.beginMap(); it != mRegionMap.endMap(); it++) + { + const std::string& sim_name = it->first; + const LLSD& data = it->second; + if (data.isMap()) // Assume the rest is correct. + { + LLScrollListCell::Params label; + LLScrollListCell::Params maturity; + LLScrollListCell::Params region; + LLScrollListCell::Params count; + label.column("region_label").type("text").value(data["label"].asString()); + maturity.column("region_maturity_icon").type("icon").font_halign(LLFontGL::HCENTER); + region.column("region_name").type("text").value(sim_name); + count.column("region_agent_count").type("text").value("..."); + if (LLSimInfo* info = LLWorldMap::getInstance()->simInfoFromName(sim_name)) + { + maturity.value(info->getAccessIcon()); + maturity.tool_tip(info->getShortAccessString()); + + info->updateAgentCount(LLTimer::getElapsedSeconds()); + S32 agent_count = info->getAgentCount(); + if (info->isDown()) + { + label.color(LLColor4::red); + maturity.color(LLColor4::red); + region.color(LLColor4::red); + count.color(LLColor4::red); + count.value(0); + } + else + count.value((sim_name == cur_region_name) ? agent_count + 1 : agent_count); + } + else + { + label.color(LLColor4::grey); + maturity.color(LLColor4::grey); + region.color(LLColor4::grey); + count.color(LLColor4::grey); + + LLWorldMapMessage::getInstance()->sendNamedRegionRequest(sim_name); + if (!mEventTimer.getStarted()) mEventTimer.start(); + } + LLScrollListItem::Params row; + row.value = sim_name; + row.columns.add(label); + row.columns.add(maturity); + row.columns.add(region); + row.columns.add(count); + mRegionScrollList->addRow(row); + } + } + if (!saved_selected_values.empty()) + mRegionScrollList->selectMultiple(saved_selected_values); +} + +BOOL ALFloaterRegionTracker::tick() +{ + refresh(); + return FALSE; +} + +void ALFloaterRegionTracker::requestRegionData() +{ + if (!mRegionMap.size()) + return; + + for (LLSD::map_const_iterator it = mRegionMap.beginMap(); it != mRegionMap.endMap(); it++) + { + const std::string& name = it->first; + if (LLSimInfo* info = LLWorldMap::getInstance()->simInfoFromName(name)) + { + info->updateAgentCount(LLTimer::getElapsedSeconds()); + } + else + { + LLWorldMapMessage::getInstance()->sendNamedRegionRequest(name); + } + } + mEventTimer.start(); +} + +void ALFloaterRegionTracker::removeRegions() +{ + BOOST_FOREACH(const LLScrollListItem* item, mRegionScrollList->getAllSelected()) + { + mRegionMap.erase(item->getValue().asString()); + } + mRegionScrollList->deleteSelectedItems(); + saveToJSON(); + updateHeader(); +} + +std::string getGridSpecificFile(const std::string& file, const char& sep = '_') +{ + const HippoGridInfo& grid(*gHippoGridManager->getConnectedGrid()); + if (grid.isSecondLife()) return file; + return file + sep + grid.getGridNick(); +} + +bool ALFloaterRegionTracker::saveToJSON() +{ + const std::string& filename = gDirUtilp->getExpandedFilename(LL_PATH_USER_SETTINGS, TRACKER_FILE); + llofstream out_file; + out_file.open(getGridSpecificFile(filename)); + if (out_file.is_open()) + { + LLSDSerialize::toPrettyNotation(mRegionMap, out_file); + out_file.close(); + return true; + } + return false; +} + +bool ALFloaterRegionTracker::loadFromJSON() +{ + const std::string& filename = gDirUtilp->getExpandedFilename(LL_PATH_USER_SETTINGS, TRACKER_FILE); + llifstream in_file; + in_file.open(getGridSpecificFile(filename)); + if (in_file.is_open()) + { + LLSDSerialize::fromNotation(mRegionMap, in_file, LLSDSerialize::SIZE_UNLIMITED); + in_file.close(); + return true; + } + return false; +} + +std::string ALFloaterRegionTracker::getRegionLabelIfExists(const std::string& name) +{ + return mRegionMap.get(name)["label"].asString(); +} + +void ALFloaterRegionTracker::onRegionAddedCallback(const LLSD& notification, const LLSD& response) +{ + const S32 option = LLNotificationsUtil::getSelectedOption(notification, response); + if (option == 0) + { + const std::string& name = notification["payload"]["name"].asString(); + std::string label = response["label"].asString(); + LLStringUtil::trim(label); + if (!name.empty() && !label.empty()) + { + if (mRegionMap.has(name)) + { + for (LLSD::map_iterator it = mRegionMap.beginMap(); it != mRegionMap.endMap(); it++) + if (it->first == name) it->second["label"] = label; + } + else + { + LLSD region; + region["label"] = label; + mRegionMap.insert(name, region); + } + saveToJSON(); + refresh(); + } + } +} + +void ALFloaterRegionTracker::openMap() +{ + const std::string& region = mRegionScrollList->getFirstSelected()->getValue().asString(); + LLFloaterWorldMap* worldmap_floaterp = gFloaterWorldMap; + if (!region.empty() && worldmap_floaterp) + { + worldmap_floaterp->trackURL(region, 128, 128, 0); + worldmap_floaterp->show(true); + } +} diff --git a/indra/newview/alfloaterregiontracker.h b/indra/newview/alfloaterregiontracker.h new file mode 100644 index 000000000..bf7db79a1 --- /dev/null +++ b/indra/newview/alfloaterregiontracker.h @@ -0,0 +1,69 @@ +/** +* @file alfloaterregiontracker.h +* @brief Region tracking floater +* +* $LicenseInfo:firstyear=2013&license=viewerlgpl$ +* Alchemy Viewer Source Code +* Copyright (C) 2014, Alchemy Viewer Project. +* +* This library is free software; you can redistribute it and/or +* modify it under the terms of the GNU Lesser General Public +* License as published by the Free Software Foundation; +* version 2.1 of the License only. +* +* This library is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +* Lesser General Public License for more details. +* +* You should have received a copy of the GNU Lesser General Public +* License along with this library; if not, write to the Free Software +* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +* +* $/LicenseInfo$ +*/ + +#pragma once + +#include "lleventtimer.h" +#include "llfloater.h" + +class LLButton; +class LLSD; +class LLScrollListCtrl; + +class ALFloaterRegionTracker : public LLFloater, public LLEventTimer +, public LLFloaterSingleton +{ + //friend class LLFloaterReg; + friend class LLUISingleton >; +private: + ALFloaterRegionTracker(const LLSD& key); + virtual ~ALFloaterRegionTracker(); +public: + /*virtual*/ BOOL postBuild(); + /*virtual*/ void onOpen(/*const LLSD& key*/); + /*virtual*/ void onClose(bool app_quitting); + /*virtual*/ void refresh(); + /*virtual*/ BOOL tick(); + using LLFloaterSingleton::getInstance; + +private: + void updateHeader(); + void requestRegionData(); + void removeRegions(); + bool saveToJSON(); + bool loadFromJSON(); + void openMap(); + +public: + std::string getRegionLabelIfExists(const std::string& name); + void onRegionAddedCallback(const LLSD& notification, const LLSD& response); + +private: + LLSD mRegionMap; + LLButton* mRefreshRegionListBtn; + LLButton* mRemoveRegionBtn; + LLButton* mOpenMapBtn; + LLScrollListCtrl* mRegionScrollList; +}; diff --git a/indra/newview/app_settings/keys.ini b/indra/newview/app_settings/keys.ini index c21bf9ef8..50594923b 100644 --- a/indra/newview/app_settings/keys.ini +++ b/indra/newview/app_settings/keys.ini @@ -312,11 +312,24 @@ SITTING PAD_DIVIDE NONE start_gesture # these are for passing controls when sitting on vehicles SITTING A SHIFT slide_left SITTING D SHIFT slide_right +SITTING W SHIFT move_forward_sitting +SITTING S SHIFT move_backward_sitting +SITTING E SHIFT spin_over_sitting +SITTING C SHIFT spin_under_sitting + SITTING LEFT SHIFT slide_left SITTING RIGHT SHIFT slide_right +SITTING UP SHIFT move_forward_sitting +SITTING DOWN SHIFT move_backward_sitting +SITTING PGUP SHIFT spin_over_sitting +SITTING PGDN SHIFT spin_under_sitting SITTING PAD_LEFT SHIFT slide_left SITTING PAD_RIGHT SHIFT slide_right +SITTING PAD_UP SHIFT move_forward_sitting +SITTING PAD_DOWN SHIFT move_backward_sitting +SITTING PAD_PGUP SHIFT spin_over_sitting +SITTING PAD_PGDN SHIFT spin_under_sitting SITTING PAD_ENTER SHIFT start_chat SITTING PAD_DIVIDE SHIFT start_gesture diff --git a/indra/newview/app_settings/keysZQSD.ini b/indra/newview/app_settings/keysZQSD.ini index 72704408f..fd3d4805b 100644 --- a/indra/newview/app_settings/keysZQSD.ini +++ b/indra/newview/app_settings/keysZQSD.ini @@ -312,11 +312,24 @@ SITTING PAD_DIVIDE NONE start_gesture # these are for passing controls when sitting on vehicles SITTING Q SHIFT slide_left SITTING D SHIFT slide_right +SITTING Z SHIFT move_forward_sitting +SITTING S SHIFT move_backward_sitting +SITTING E SHIFT spin_over_sitting +SITTING C SHIFT spin_under_sitting + SITTING LEFT SHIFT slide_left SITTING RIGHT SHIFT slide_right +SITTING UP SHIFT move_forward_sitting +SITTING DOWN SHIFT move_backward_sitting +SITTING PGUP SHIFT spin_over_sitting +SITTING PGDN SHIFT spin_under_sitting SITTING PAD_LEFT SHIFT slide_left SITTING PAD_RIGHT SHIFT slide_right +SITTING PAD_UP SHIFT move_forward_sitting +SITTING PAD_DOWN SHIFT move_backward_sitting +SITTING PAD_PGUP SHIFT spin_over_sitting +SITTING PAD_PGDN SHIFT spin_under_sitting SITTING PAD_ENTER SHIFT start_chat SITTING PAD_DIVIDE SHIFT start_gesture diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index 81e21494c..f611cb14c 100644 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -648,11 +648,11 @@ LiruBlockConferences Comment - When true, new incoming conference chats will not be opened. + When not zero, new incoming conference chats will not be opened, if 2 only those from nonfriends will be blocked. Persist 1 Type - Boolean + U32 Value 0 @@ -4219,6 +4219,17 @@ This should be as low as possible, but too low may break functionality
Value 1
+ LetterKeysFocusChatBar + + Comment + When printable characters keys (possibly with Shift held) are pressed, the chatbar takes focus + Persist + 1 + Type + Boolean + Value + 0 + ChatBubbleOpacity Comment @@ -18029,6 +18040,17 @@ This should be as low as possible, but too low may break functionality
0 + LogInventoryDecline + + Comment + Log in system chat whenever an inventory offer is declined + Persist + 1 + Type + Boolean + Value + 1 + UseHTTPInventory Comment @@ -18521,6 +18543,22 @@ This should be as low as possible, but too low may break functionality
0 + FloaterRegionTrackerRect + + Comment + Rectangle for Region Tracker Floater + Persist + 1 + Type + Rect + Value + + 500 + 450 + 850 + 400 + + WindEnabled Comment @@ -18745,7 +18783,7 @@ This should be as low as possible, but too low may break functionality Type U32 Value - 2 + 0 diff --git a/indra/newview/app_settings/settings_ascent.xml b/indra/newview/app_settings/settings_ascent.xml index 41207d047..38e39bb7a 100644 --- a/indra/newview/app_settings/settings_ascent.xml +++ b/indra/newview/app_settings/settings_ascent.xml @@ -113,6 +113,28 @@ Value 1 + AlchemyChatCommandHoverHeight + + Comment + Command to hover your height or something + Persist + 1 + Type + String + Value + /hover + + AlchemyChatCommandResyncAnim + + Comment + Command to stop/start in order to resync animations + Persist + 1 + Type + String + Value + /resync + AlchemyConnectToNeighbors Comment @@ -135,6 +157,39 @@ Value 0 + AlchemyMouselookIFF + + Comment + Display user that is currently focused upon by crosshair in mouselook + Persist + 1 + Type + Boolean + Value + 1 + + AlchemyMouselookIFFRange + + Comment + Range of IFF display + Persist + 1 + Type + F32 + Value + 380.0 + + AlchemyMouselookInstructions + + Comment + Draw Mouselook Instructions + Persist + 1 + Type + Boolean + Value + 1 + AlchemyRainbowEffects Comment @@ -156,6 +211,17 @@ Boolean Value 0 + + AlchemySitOnAway + + Comment + Agent groundsits in away mode + Persist + 1 + Type + Boolean + Value + 0 AscentPowerfulWizard @@ -1714,6 +1780,17 @@ Value 0 + ToolbarVisibleRegionTracker + + Comment + Whether or not the button for the region tracker is on the toolbar + Persist + 1 + Type + Boolean + Value + 0 + ToolbarVisibleScriptErrors Comment diff --git a/indra/newview/app_settings/settings_per_account.xml b/indra/newview/app_settings/settings_per_account.xml index 7e369cf26..2dd4904f4 100644 --- a/indra/newview/app_settings/settings_per_account.xml +++ b/indra/newview/app_settings/settings_per_account.xml @@ -8,6 +8,17 @@ + AvatarHoverOffsetZ + + Comment + After-everything-else fixup for avatar Z position. + Persist + 1 + Type + F32 + Value + 0.0 + AOConfigNotecardID @@ -393,6 +404,17 @@ Value This is an autoresponse! + AutoresponseMutedShow + + Comment + Whether to show that AutoresponseMuted's were sent + Persist + 1 + Type + Boolean + Value + 0 + AutoresponseOnlyIfAway Comment diff --git a/indra/newview/ascentprefschat.cpp b/indra/newview/ascentprefschat.cpp index c604a3260..aacfe6826 100644 --- a/indra/newview/ascentprefschat.cpp +++ b/indra/newview/ascentprefschat.cpp @@ -83,6 +83,7 @@ LLPrefsAscentChat::LLPrefsAscentChat() childSetValue("AutoresponseMuted", gSavedPerAccountSettings.getBOOL("AutoresponseMuted")); childSetValue("AutoresponseMutedItem", gSavedPerAccountSettings.getBOOL("AutoresponseMutedItem")); childSetValue("AutoresponseMutedMessage", gSavedPerAccountSettings.getString("AutoresponseMutedMessage")); + childSetValue("AutoresponseMutedShow", gSavedPerAccountSettings.getBOOL("AutoresponseMutedShow")); childSetValue("BusyModeResponse", gSavedPerAccountSettings.getString("BusyModeResponse")); childSetValue("BusyModeResponseItem", gSavedPerAccountSettings.getBOOL("BusyModeResponseItem")); childSetValue("BusyModeResponseShow", gSavedPerAccountSettings.getBOOL("BusyModeResponseShow")); @@ -291,6 +292,7 @@ void LLPrefsAscentChat::refreshValues() gSavedPerAccountSettings.setBOOL("AutoresponseMuted", childGetValue("AutoresponseMuted")); gSavedPerAccountSettings.setBOOL("AutoresponseMutedItem", childGetValue("AutoresponseMutedItem")); gSavedPerAccountSettings.setString("AutoresponseMutedMessage", childGetValue("AutoresponseMutedMessage")); + gSavedPerAccountSettings.setBOOL("AutoresponseMutedShow", childGetValue("AutoresponseMutedShow")); gSavedPerAccountSettings.setString("BusyModeResponse", childGetValue("BusyModeResponse")); gSavedPerAccountSettings.setBOOL("BusyModeResponseItem", childGetValue("BusyModeResponseItem")); gSavedPerAccountSettings.setBOOL("BusyModeResponseShow", childGetValue("BusyModeResponseShow")); diff --git a/indra/newview/ascentprefssys.cpp b/indra/newview/ascentprefssys.cpp index 2170d0824..b172627fd 100644 --- a/indra/newview/ascentprefssys.cpp +++ b/indra/newview/ascentprefssys.cpp @@ -73,6 +73,8 @@ LLPrefsAscentSys::LLPrefsAscentSys() getChild("SinguCmdLineAway")->setCommitCallback(lineEditorControl); getChild("SinguCmdLineRegionSay")->setCommitCallback(lineEditorControl); getChild("SinguCmdLineURL")->setCommitCallback(lineEditorControl); + getChild("AlchemyChatCommandResyncAnim")->setCommitCallback(lineEditorControl); + getChild("AlchemyChatCommandHoverHeight")->setCommitCallback(lineEditorControl); //Security ---------------------------------------------------------------------------- getChild("UISndRestart")->setCommitCallback(lineEditorControl); @@ -113,10 +115,8 @@ void LLPrefsAscentSys::onCommitCheckBox(LLUICtrl* ctrl, const LLSD& value) LLVector3d lpos_global = gAgent.getPositionGlobal(); if(gAudiop) gAudiop->triggerSound(LLUUID("58a38e89-44c6-c52b-deb8-9f1ddc527319"), gAgent.getID(), 1.0f, LLAudioEngine::AUDIO_TYPE_UI, lpos_global); - LLChat chat; - chat.mSourceType = CHAT_SOURCE_SYSTEM; - chat.mText = LLTrans::getString("PowerUser1") + "\n" + LLTrans::getString("PowerUser2") + "\n" + LLTrans::getString("Unlocked:") + "\n" + LLTrans::getString("PowerUser3") + "\n- " + LLTrans::getString("RightClick") + " > " + LLTrans::getString("PowerUser4") + "\n- " + LLTrans::getString("RightClick") + " > " + LLTrans::getString("PowerUser5"); - LLFloaterChat::addChat(chat); + void cmdline_printchat(const std::string& message); + cmdline_printchat(LLTrans::getString("PowerUser1") + '\n' + LLTrans::getString("PowerUser2") + '\n' + LLTrans::getString("Unlocked:") + '\n' + LLTrans::getString("PowerUser3") + "\n- " + LLTrans::getString("RightClick") + " > " + LLTrans::getString("PowerUser4") + "\n- " + LLTrans::getString("RightClick") + " > " + LLTrans::getString("PowerUser5")); } } else if (name == "next_owner_copy") @@ -186,6 +186,8 @@ void LLPrefsAscentSys::refreshValues() mCmdLineAway = gSavedSettings.getString("SinguCmdLineAway"); mCmdLineRegionSay = gSavedSettings.getString("SinguCmdLineRegionSay"); mCmdLineURL = gSavedSettings.getString("SinguCmdLineURL"); + mCmdLineResync = gSavedSettings.getString("AlchemyChatCommandResyncAnim"); + mCmdLineHover = gSavedSettings.getString("AlchemyChatCommandHoverHeight"); //Security ---------------------------------------------------------------------------- mBroadcastViewerEffects = gSavedSettings.getBOOL("BroadcastViewerEffects"); @@ -196,6 +198,7 @@ void LLPrefsAscentSys::refreshValues() mLookAtLines = gSavedSettings.getBOOL("AlchemyLookAtLines"); mQuietSnapshotsToDisk = gSavedSettings.getBOOL("QuietSnapshotsToDisk"); mAnnounceBumps = gSavedSettings.getBOOL("AnnounceBumps"); + mSitOnAway = gSavedSettings.getBOOL("AlchemySitOnAway"); mDetachBridge = gSavedSettings.getBOOL("SGDetachBridge"); mRevokePermsOnStandUp = gSavedSettings.getBOOL("RevokePermsOnStandUp"); mDisableClickSit = gSavedSettings.getBOOL("DisableClickSit"); @@ -257,6 +260,8 @@ void LLPrefsAscentSys::refresh() childSetValue("SinguCmdLineAway", mCmdLineAway); childSetValue("SinguCmdLineRegionSay", mCmdLineRegionSay); childSetValue("SinguCmdLineURL", mCmdLineURL); + childSetValue("AlchemyChatCommandResyncAnim", mCmdLineResync); + childSetValue("AlchemyChatCommandHoverHeight", mCmdLineHover); //Security ---------------------------------------------------------------------------- getChildView("UISndRestart")->setValue(mRestartSound); @@ -328,6 +333,8 @@ void LLPrefsAscentSys::cancel() gSavedSettings.setString("SinguCmdLineAway", mCmdLineAway); gSavedSettings.setString("SinguCmdLineRegionSay", mCmdLineRegionSay); gSavedSettings.setString("SinguCmdLineURL", mCmdLineURL); + gSavedSettings.setString("AlchemyChatCommandResyncAnim", mCmdLineResync); + gSavedSettings.setString("AlchemyChatCommandHoverHeight", mCmdLineHover); //Security ---------------------------------------------------------------------------- gSavedSettings.setBOOL("BroadcastViewerEffects", mBroadcastViewerEffects); @@ -338,6 +345,7 @@ void LLPrefsAscentSys::cancel() gSavedSettings.setBOOL("AlchemyLookAtLines", mLookAtLines); gSavedSettings.setBOOL("QuietSnapshotsToDisk", mQuietSnapshotsToDisk); gSavedSettings.setBOOL("AnnounceBumps", mAnnounceBumps); + gSavedSettings.setBOOL("AlchemySitOnAway", mSitOnAway); gSavedSettings.setBOOL("SGDetachBridge", mDetachBridge); gSavedSettings.setBOOL("RevokePermsOnStandUp", mRevokePermsOnStandUp); gSavedSettings.setBOOL("DisableClickSit", mDisableClickSit); diff --git a/indra/newview/ascentprefssys.h b/indra/newview/ascentprefssys.h index 50fbdae30..c55c5cceb 100644 --- a/indra/newview/ascentprefssys.h +++ b/indra/newview/ascentprefssys.h @@ -96,6 +96,8 @@ private: std::string mCmdLineAway; std::string mCmdLineRegionSay; std::string mCmdLineURL; + std::string mCmdLineResync; + std::string mCmdLineHover; //Security ---------------------------------------------------------------------------- bool mBroadcastViewerEffects; @@ -106,6 +108,7 @@ private: bool mLookAtLines; bool mQuietSnapshotsToDisk; bool mAnnounceBumps; + bool mSitOnAway; bool mDetachBridge; bool mRevokePermsOnStandUp; bool mDisableClickSit; diff --git a/indra/newview/chatbar_as_cmdline.cpp b/indra/newview/chatbar_as_cmdline.cpp index 3eda4098f..82ae5514e 100644 --- a/indra/newview/chatbar_as_cmdline.cpp +++ b/indra/newview/chatbar_as_cmdline.cpp @@ -66,9 +66,9 @@ #include "llchat.h" #include "llfloaterchat.h" +#include "rlvhandler.h" - -void cmdline_printchat(std::string message); +void cmdline_printchat(const std::string& message); void cmdline_rezplat(bool use_saved_value = true, F32 visual_radius = 30.0); void cmdline_tp2name(std::string target); @@ -241,6 +241,8 @@ bool cmd_line_chat(std::string revised_text, EChatType type) static LLCachedControl sSinguCmdLineAway(gSavedSettings, "SinguCmdLineAway"); static LLCachedControl sSinguCmdLineRegionSay(gSavedSettings, "SinguCmdLineRegionSay"); static LLCachedControl sSinguCmdLineURL(gSavedSettings, "SinguCmdLineURL"); + static LLCachedControl sResyncAnimCommand(gSavedSettings, "AlchemyChatCommandResyncAnim", "/resync"); + static LLCachedControl sHoverHeight(gSavedSettings, "AlchemyChatCommandHoverHeight", "/hover"); if(sAscentCmdLine) { @@ -450,6 +452,12 @@ bool cmd_line_chat(std::string revised_text, EChatType type) { if (revised_text.length() > command.length() + 1) { + const std::string& message = revised_text.substr(command.length()+1); + if (!gAgent.getRegion()->isEstateManager()) + { + gChatBar->sendChatFromViewer(message, CHAT_TYPE_REGION, false); + return false; + } std::vector strings(5, "-1"); // [0] grid_x, unused here // [1] grid_y, unused here @@ -458,11 +466,39 @@ bool cmd_line_chat(std::string revised_text, EChatType type) std::string name; LLAgentUI::buildFullname(name); strings[3] = name; - strings[4] = revised_text.substr(command.length()+1); // [4] message + strings[4] = message; // [4] message LLRegionInfoModel::sendEstateOwnerMessage(gMessageSystem, "simulatormessage", LLFloaterRegionInfo::getLastInvoice(), strings); } return false; } + else if (command == utf8str_tolower(sHoverHeight)) // Hover height + { + F32 height; + if (i >> height) + { + gSavedPerAccountSettings.set("AvatarHoverOffsetZ", + llclamp(height, MIN_HOVER_Z, MAX_HOVER_Z)); + return false; + } + } + else if (command == utf8str_tolower(sResyncAnimCommand)) // Resync Animations + { + for (S32 i = 0; i < gObjectList.getNumObjects(); i++) + { + LLViewerObject* object = gObjectList.getObject(i); + if (object && object->isAvatar()) + { + LLVOAvatar& avatarp = *(LLVOAvatar*)object; + for (LLVOAvatar::AnimIterator it = avatarp.mPlayingAnimations.begin(), end = avatarp.mPlayingAnimations.end(); it != end; ++it) + { + const std::pair& playpair = *it; + avatarp.stopMotion(playpair.first, TRUE); + avatarp.startMotion(playpair.first); + } + } + } + return false; + } else if(command == "typingstop") { std::string text; @@ -623,11 +659,38 @@ void cmdline_rezplat(bool use_saved_value, F32 visual_radius) //cmdline_rezplat( msg->sendReliable(gAgent.getRegionHost()); } -void cmdline_printchat(std::string message) +void cmdline_printchat(const std::string& message) { - LLChat chat; - chat.mText = message; + LLChat chat(message); chat.mSourceType = CHAT_SOURCE_SYSTEM; - LLFloaterChat::addChat(chat, FALSE, FALSE); + if (rlv_handler_t::isEnabled()) chat.mRlvLocFiltered = chat.mRlvNamesFiltered = true; + LLFloaterChat::addChat(chat); } +static void fake_local_chat(LLChat chat, const std::string& name) +{ + chat.mFromName = name; + chat.mText = name + chat.mText; + LLFloaterChat::addChat(chat); +} +void fake_local_chat(std::string msg) +{ + bool action(LLStringUtil::startsWith(msg, "/me") && (msg[3] == ' ' || msg[3] == '\'')); + if (action) msg.erase(0, 4); + LLChat chat((action ? " " : ": ") + msg); + chat.mFromID = gAgentID; + chat.mSourceType = CHAT_SOURCE_SYSTEM; + if (rlv_handler_t::isEnabled()) chat.mRlvLocFiltered = chat.mRlvNamesFiltered = true; + chat.mPosAgent = gAgent.getPositionAgent(); + chat.mURL = "secondlife:///app/agent/" + gAgentID.asString() + "/about"; + if (action) chat.mChatStyle = CHAT_STYLE_IRC; + if (!LLAvatarNameCache::getNSName(gAgentID, chat.mFromName)) + { + LLAvatarNameCache::get(gAgentID, boost::bind(fake_local_chat, chat, boost::bind(&LLAvatarName::getNSName, _2, main_name_system()))); + } + else + { + chat.mText = chat.mFromName + chat.mText; + LLFloaterChat::addChat(chat); + } +} diff --git a/indra/newview/floaterao.cpp b/indra/newview/floaterao.cpp index c9386d95a..ace2fbad9 100644 --- a/indra/newview/floaterao.cpp +++ b/indra/newview/floaterao.cpp @@ -38,7 +38,7 @@ #include // Uncomment and use instead if we ever add the chatbar as a command line - MC -void cmdline_printchat(std::string message); +void cmdline_printchat(const std::string& message); class AONotecardCallback : public LLInventoryCallback { diff --git a/indra/newview/importtracker.cpp b/indra/newview/importtracker.cpp index bddbf790e..568567c50 100644 --- a/indra/newview/importtracker.cpp +++ b/indra/newview/importtracker.cpp @@ -87,7 +87,7 @@ void ImportTracker::expectRez() state = IDLE; finish(); } -void cmdline_printchat(std::string message);*/ +void cmdline_printchat(const std::string& message);*/ LLViewerObject* find(U32 local) { S32 i; diff --git a/indra/newview/jcfloaterareasearch.cpp b/indra/newview/jcfloaterareasearch.cpp index 3beacdf3d..c447f00c6 100644 --- a/indra/newview/jcfloaterareasearch.cpp +++ b/indra/newview/jcfloaterareasearch.cpp @@ -41,6 +41,7 @@ #include "lluictrlfactory.h" #include "llagent.h" +#include "llagentcamera.h" #include "lltracker.h" #include "llviewerobjectlist.h" @@ -84,6 +85,8 @@ BOOL JCFloaterAreaSearch::postBuild() getChild("Refresh")->setClickedCallback(boost::bind(&JCFloaterAreaSearch::onRefresh,this)); getChild("Stop")->setClickedCallback(boost::bind(&JCFloaterAreaSearch::onStop,this)); + getChild("TP")->setClickedCallback(boost::bind(&JCFloaterAreaSearch::teleportToSelected, this)); + getChild("Look")->setClickedCallback(boost::bind(&JCFloaterAreaSearch::lookAtSelected, this)); getChild("Name query chunk")->setCommitCallback(boost::bind(&JCFloaterAreaSearch::onCommitLine,this,_1,_2,LIST_OBJECT_NAME)); getChild("Description query chunk")->setCommitCallback(boost::bind(&JCFloaterAreaSearch::onCommitLine,this,_1,_2,LIST_OBJECT_DESC)); @@ -113,22 +116,32 @@ void JCFloaterAreaSearch::checkRegion(bool force_clear) } } +LLViewerObject* JCFloaterAreaSearch::getSelectedObject() +{ + if (LLScrollListItem* item = mResultList->getFirstSelected()) + return gObjectList.findObject(item->getUUID()); + return NULL; +} + void JCFloaterAreaSearch::onDoubleClick() { - LLScrollListItem *item = mResultList->getFirstSelected(); - if (!item) return; - LLUUID object_id = item->getUUID(); - std::map::iterator it = mCachedObjects.find(object_id); - if(it != mCachedObjects.end()) - { - LLViewerObject* objectp = gObjectList.findObject(object_id); - if (objectp) - { - LLTracker::trackLocation(objectp->getPositionGlobal(), it->second.name, "", LLTracker::LOCATION_ITEM); - } - } + if (LLViewerObject* objectp = getSelectedObject()) + LLTracker::trackLocation(objectp->getPositionGlobal(), mCachedObjects[objectp->getID()].name, "", LLTracker::LOCATION_ITEM); } +void JCFloaterAreaSearch::teleportToSelected() +{ + if (LLViewerObject* objectp = getSelectedObject()) + gAgent.teleportViaLocation(objectp->getPositionGlobal()); +} + +void JCFloaterAreaSearch::lookAtSelected() +{ + if (LLScrollListItem* item = mResultList->getFirstSelected()) + gAgentCamera.lookAtObject(item->getUUID(), false); +} + + void JCFloaterAreaSearch::onStop() { mStopped = true; diff --git a/indra/newview/jcfloaterareasearch.h b/indra/newview/jcfloaterareasearch.h index 71cd1c7af..413dbab99 100644 --- a/indra/newview/jcfloaterareasearch.h +++ b/indra/newview/jcfloaterareasearch.h @@ -72,7 +72,10 @@ private: void onRefresh(); void onCommitLine(LLUICtrl* caller, const LLSD& value, OBJECT_COLUMN_ORDER type); bool requestIfNeeded(LLUUID object_id); + class LLViewerObject* getSelectedObject(); void onDoubleClick(); + void teleportToSelected(); + void lookAtSelected(); LLTextBox* mCounterText; LLScrollListCtrl* mResultList; @@ -94,4 +97,4 @@ private: std::string mFilterStrings[LIST_OBJECT_COUNT]; }; -#endif \ No newline at end of file +#endif diff --git a/indra/newview/lfsimfeaturehandler.cpp b/indra/newview/lfsimfeaturehandler.cpp index 6937e1205..65d1e6e55 100644 --- a/indra/newview/lfsimfeaturehandler.cpp +++ b/indra/newview/lfsimfeaturehandler.cpp @@ -46,13 +46,13 @@ void LFSimFeatureHandler::handleRegionChange() { if (LLViewerRegion* region = gAgent.getRegion()) { - if (region->getFeaturesReceived()) + if (region->simulatorFeaturesReceived()) { setSupportedFeatures(); } else { - region->setFeaturesReceivedCallback(boost::bind(&LFSimFeatureHandler::setSupportedFeatures, this)); + region->setSimulatorFeaturesReceivedCallback(boost::bind(&LFSimFeatureHandler::setSupportedFeatures, this)); } } } diff --git a/indra/newview/linux_tools/install.sh.in b/indra/newview/linux_tools/install.sh.in index 2bfd6d192..2d42c13dd 100755 --- a/indra/newview/linux_tools/install.sh.in +++ b/indra/newview/linux_tools/install.sh.in @@ -59,7 +59,7 @@ function homedir_install() fi install_to_prefix "$HOME/.@VIEWER_BRANDING_ID@-install" - $HOME/.@VIEWER_BRANDING_ID@-install/refresh_desktop_app_entry.sh + $HOME/.@VIEWER_BRANDING_ID@-install/etc/refresh_desktop_app_entry.sh } function root_install() diff --git a/indra/newview/llagent.cpp b/indra/newview/llagent.cpp index a8fa1568b..ab06f2ac9 100644 --- a/indra/newview/llagent.cpp +++ b/indra/newview/llagent.cpp @@ -396,7 +396,8 @@ LLAgent::LLAgent() : mShowAvatar(TRUE), mFrameAgent(), - mIsBusy(FALSE), + mIsAwaySitting(false), + mIsDoNotDisturb(false), mControlFlags(0x00000000), mbFlagsDirty(FALSE), @@ -1427,12 +1428,13 @@ void LLAgent::setAFK() { sendAnimationRequest(ANIM_AGENT_AWAY, ANIM_REQUEST_START); setControlFlags(AGENT_CONTROL_AWAY | AGENT_CONTROL_STOP); - LL_INFOS("AFK") << "Setting Away" << LL_ENDL; gAwayTimer.start(); + + if (isAgentAvatarValid() && !gAgentAvatarp->isSitting() && gSavedSettings.getBOOL("AlchemySitOnAway")) + gAgent.setSitDownAway(true); + if (gAFKMenu) - { gAFKMenu->setLabel(LLTrans::getString("AvatarSetNotAway")); - } } } @@ -1452,14 +1454,27 @@ void LLAgent::clearAFK() { sendAnimationRequest(ANIM_AGENT_AWAY, ANIM_REQUEST_STOP); clearControlFlags(AGENT_CONTROL_AWAY); - LL_INFOS("AFK") << "Clearing Away" << LL_ENDL; + + if (isAgentAvatarValid() && gAgentAvatarp->isSitting() && gAgent.isAwaySitting()) + gAgent.setSitDownAway(false); + if (gAFKMenu) - { gAFKMenu->setLabel(LLTrans::getString("AvatarSetAway")); - } } } +//----------------------------------------------------------------------------- +// setSitDownAway(bool) +//----------------------------------------------------------------------------- +void LLAgent::setSitDownAway(bool go_away) +{ + if (go_away) + gAgent.sitDown(); + else + gAgent.standUp(); + mIsAwaySitting = go_away; +} + //----------------------------------------------------------------------------- // getAFK() //----------------------------------------------------------------------------- @@ -1469,39 +1484,25 @@ BOOL LLAgent::getAFK() const } //----------------------------------------------------------------------------- -// setBusy() +// setDoNotDisturb() //----------------------------------------------------------------------------- -void LLAgent::setBusy() +void LLAgent::setDoNotDisturb(bool pIsDoNotDisturb) { - sendAnimationRequest(ANIM_AGENT_BUSY, ANIM_REQUEST_START); - mIsBusy = TRUE; + sendAnimationRequest(ANIM_AGENT_BUSY, pIsDoNotDisturb ? ANIM_REQUEST_START : ANIM_REQUEST_STOP); + mIsDoNotDisturb = pIsDoNotDisturb; if (gBusyMenu) { - gBusyMenu->setLabel(LLTrans::getString("AvatarSetNotBusy")); + gBusyMenu->setLabel(LLTrans::getString(pIsDoNotDisturb ? "AvatarSetNotBusy" : "AvatarSetBusy")); } LLFloaterMute::getInstance()->updateButtons(); } //----------------------------------------------------------------------------- -// clearBusy() +// isDoNotDisturb() //----------------------------------------------------------------------------- -void LLAgent::clearBusy() +bool LLAgent::isDoNotDisturb() const { - mIsBusy = FALSE; - sendAnimationRequest(ANIM_AGENT_BUSY, ANIM_REQUEST_STOP); - if (gBusyMenu) - { - gBusyMenu->setLabel(LLTrans::getString("AvatarSetBusy")); - } - LLFloaterMute::getInstance()->updateButtons(); -} - -//----------------------------------------------------------------------------- -// getBusy() -//----------------------------------------------------------------------------- -BOOL LLAgent::getBusy() const -{ - return mIsBusy; + return mIsDoNotDisturb; } diff --git a/indra/newview/llagent.h b/indra/newview/llagent.h index 6294d2e0a..cb332a497 100644 --- a/indra/newview/llagent.h +++ b/indra/newview/llagent.h @@ -462,15 +462,20 @@ public: /// @brief ground-sit at agent's current position void sitDown(); + void setSitDownAway(bool away); + bool isAwaySitting() const { return mIsAwaySitting; } + +private: + bool mIsAwaySitting; + //-------------------------------------------------------------------- - // Busy + // Do Not Disturb //-------------------------------------------------------------------- public: - void setBusy(); - void clearBusy(); - BOOL getBusy() const; + void setDoNotDisturb(bool pIsDoNotDisturb); + bool isDoNotDisturb() const; private: - BOOL mIsBusy; + bool mIsDoNotDisturb; //-------------------------------------------------------------------- // Grab diff --git a/indra/newview/llappviewerwin32.cpp b/indra/newview/llappviewerwin32.cpp index 7d16a5340..47a0fb861 100644 --- a/indra/newview/llappviewerwin32.cpp +++ b/indra/newview/llappviewerwin32.cpp @@ -38,9 +38,10 @@ # endif #endif +#include "llwindowwin32.h" // *FIX: for setting gIconResource. + #include "llappviewerwin32.h" -#include "llwindowwin32.h" // *FIX: for setting gIconResource. #include "llgl.h" #include "res/resource.h" // *FIX: for setting gIconResource. @@ -49,6 +50,7 @@ #include // for AddERExcludedApplicationA() #include // _spawnl() #include // For TCHAR support +#include #include "llviewercontrol.h" #include "lldxhardware.h" diff --git a/indra/newview/llavataractions.cpp b/indra/newview/llavataractions.cpp index 963a546a0..a56db3f12 100644 --- a/indra/newview/llavataractions.cpp +++ b/indra/newview/llavataractions.cpp @@ -432,7 +432,7 @@ void LLAvatarActions::pay(const LLUUID& id) LLNotification::Params params("BusyModePay"); params.functor(boost::bind(&LLAvatarActions::handlePay, _1, _2, id)); - if (gAgent.getBusy()) + if (gAgent.isDoNotDisturb()) { // warn users of being in busy mode during a transaction LLNotifications::instance().add(params); @@ -1110,7 +1110,7 @@ bool LLAvatarActions::handlePay(const LLSD& notification, const LLSD& response, S32 option = LLNotificationsUtil::getSelectedOption(notification, response); if (option == 0) { - gAgent.clearBusy(); + gAgent.setDoNotDisturb(false); } LLFloaterPay::payDirectly(&give_money, avatar_id, /*is_group=*/false); diff --git a/indra/newview/llcloud.cpp b/indra/newview/llcloud.cpp index 12c260b87..d826c5fbf 100644 --- a/indra/newview/llcloud.cpp +++ b/indra/newview/llcloud.cpp @@ -189,7 +189,7 @@ void LLCloudGroup::updatePuffCount() return; } S32 i; - S32 target_puff_count = llmath::llround(CLOUD_DENSITY * mDensity); + S32 target_puff_count = ll_round(CLOUD_DENSITY * mDensity); target_puff_count = llmax(0, target_puff_count); target_puff_count = llmin(CLOUD_COUNT_MAX, target_puff_count); S32 current_puff_count = (S32) mCloudPuffs.size(); diff --git a/indra/newview/lldrawable.cpp b/indra/newview/lldrawable.cpp index 449753b47..d23c520c7 100644 --- a/indra/newview/lldrawable.cpp +++ b/indra/newview/lldrawable.cpp @@ -812,7 +812,7 @@ void LLDrawable::updateDistance(LLCamera& camera, bool force_update) } pos -= camera.getOrigin(); - mDistanceWRTCamera = llmath::llround(pos.magVec(), 0.01f); + mDistanceWRTCamera = ll_round(pos.magVec(), 0.01f); mVObjp->updateLOD(); } } diff --git a/indra/newview/lldrawpoolbump.cpp b/indra/newview/lldrawpoolbump.cpp index 280f6e914..1a5cecb47 100644 --- a/indra/newview/lldrawpoolbump.cpp +++ b/indra/newview/lldrawpoolbump.cpp @@ -1309,7 +1309,7 @@ void LLBumpImageList::onSourceLoaded( BOOL success, LLViewerTexture *src_vi, LLI for( i = minimum; i <= maximum; i++ ) { F32 minus_one_to_one = F32(maximum - i) * twice_one_over_range - 1.f; - bias_and_scale_lut[i] = llclampb(llmath::llround(127 * minus_one_to_one * ARTIFICIAL_SCALE + 128)); + bias_and_scale_lut[i] = llclampb(ll_round(127 * minus_one_to_one * ARTIFICIAL_SCALE + 128)); } } else @@ -1318,7 +1318,7 @@ void LLBumpImageList::onSourceLoaded( BOOL success, LLViewerTexture *src_vi, LLI for( i = minimum; i <= maximum; i++ ) { F32 minus_one_to_one = F32(i - minimum) * twice_one_over_range - 1.f; - bias_and_scale_lut[i] = llclampb(llmath::llround(127 * minus_one_to_one * ARTIFICIAL_SCALE + 128)); + bias_and_scale_lut[i] = llclampb(ll_round(127 * minus_one_to_one * ARTIFICIAL_SCALE + 128)); } } diff --git a/indra/newview/lldroptarget.cpp b/indra/newview/lldroptarget.cpp index f41d0681a..6354ae522 100644 --- a/indra/newview/lldroptarget.cpp +++ b/indra/newview/lldroptarget.cpp @@ -253,8 +253,8 @@ void LLDropTarget::doDrop(EDragAndDropType cargo_type, void* cargo_data) BOOL LLDropTarget::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, EDragAndDropType cargo_type, void* cargo_data, EAcceptance* accept, std::string& tooltip_msg) { - if (mEntityID.notNull()) - return getParent() ? LLToolDragAndDrop::handleGiveDragAndDrop(mEntityID, LLUUID::null, drop, cargo_type, cargo_data, accept) : false; + if (mID.notNull()) + return getParent() ? LLToolDragAndDrop::handleGiveDragAndDrop(mID, LLUUID::null, drop, cargo_type, cargo_data, accept) : false; if (LLViewerInventoryItem* inv_item = static_cast(cargo_data)) { diff --git a/indra/newview/lldroptarget.h b/indra/newview/lldroptarget.h index 69d9a6998..8edc4c691 100644 --- a/indra/newview/lldroptarget.h +++ b/indra/newview/lldroptarget.h @@ -76,13 +76,13 @@ public: void setChildRects(LLRect rect); void fillParent(const LLView* parent); - void setEntityID(const LLUUID& id) { mEntityID = id;} + void setEntityID(const LLUUID& id) { mID = id; } protected: virtual void setItem(const class LLInventoryItem* item); void setControlValue(const std::string& val); - LLUUID mEntityID; + LLUUID mID; class LLViewBorder* mBorder; LLControlVariable* mControl; boost::signals2::scoped_connection mConnection; diff --git a/indra/newview/llfasttimerview.cpp b/indra/newview/llfasttimerview.cpp index eb360e120..05cbefacf 100644 --- a/indra/newview/llfasttimerview.cpp +++ b/indra/newview/llfasttimerview.cpp @@ -256,7 +256,7 @@ BOOL LLFastTimerView::handleHover(S32 x, S32 y, MASK mask) if (hasMouseCapture()) { F32 lerp = llclamp(1.f - (F32) (x - mGraphRect.mLeft) / (F32) mGraphRect.getWidth(), 0.f, 1.f); - mScrollIndex = llmath::llround( lerp * (F32)(LLFastTimer::NamedTimer::HISTORY_NUM - MAX_VISIBLE_HISTORY)); + mScrollIndex = ll_round( lerp * (F32)(LLFastTimer::NamedTimer::HISTORY_NUM - MAX_VISIBLE_HISTORY)); mScrollIndex = llclamp( mScrollIndex, 0, LLFastTimer::getLastFrameIndex()); return TRUE; } @@ -298,9 +298,9 @@ BOOL LLFastTimerView::handleHover(S32 x, S32 y, MASK mask) } mToolTipRect.set(mBarStart[mHoverBarIndex][i], - mBarRect.mBottom + llmath::llround(((F32)(MAX_VISIBLE_HISTORY - mHoverBarIndex + 1)) * ((F32)mBarRect.getHeight() / ((F32)MAX_VISIBLE_HISTORY + 2.f))), + mBarRect.mBottom + ll_round(((F32)(MAX_VISIBLE_HISTORY - mHoverBarIndex + 1)) * ((F32)mBarRect.getHeight() / ((F32)MAX_VISIBLE_HISTORY + 2.f))), mBarEnd[mHoverBarIndex][i], - mBarRect.mBottom + llmath::llround((F32)(MAX_VISIBLE_HISTORY - mHoverBarIndex) * ((F32)mBarRect.getHeight() / ((F32)MAX_VISIBLE_HISTORY + 2.f)))); + mBarRect.mBottom + ll_round((F32)(MAX_VISIBLE_HISTORY - mHoverBarIndex) * ((F32)mBarRect.getHeight() / ((F32)MAX_VISIBLE_HISTORY + 2.f)))); } if ((*it)->getCollapsed()) @@ -432,7 +432,7 @@ void LLFastTimerView::draw() mAverageCyclesPerTimer = LLFastTimer::sTimerCalls == 0 ? 0 - : llmath::llround(lerp((F32)mAverageCyclesPerTimer, (F32)(LLFastTimer::sTimerCycles / (U64)LLFastTimer::sTimerCalls), 0.1f)); + : ll_round(lerp((F32)mAverageCyclesPerTimer, (F32)(LLFastTimer::sTimerCycles / (U64)LLFastTimer::sTimerCalls), 0.1f)); LLFastTimer::sTimerCycles = 0; LLFastTimer::sTimerCalls = 0; @@ -800,7 +800,7 @@ void LLFastTimerView::draw() ? (F32)idp->getCountAverage() / (F32)totalticks : (F32)idp->getHistoricalCount(tidx) / (F32)totalticks; - dx = llmath::llround(frac * (F32)barw); + dx = ll_round(frac * (F32)barw); S32 prev_delta_x = deltax.empty() ? 0 : deltax.back(); deltax.push_back(dx); diff --git a/indra/newview/llflexibleobject.cpp b/indra/newview/llflexibleobject.cpp index 1bcf79278..380ea0df1 100644 --- a/indra/newview/llflexibleobject.cpp +++ b/indra/newview/llflexibleobject.cpp @@ -302,7 +302,7 @@ void LLVolumeImplFlexible::updateRenderRes() mRenderRes = (S32) (12.f*app_angle); #else //legacy behavior //number of segments only cares about z axis - F32 app_angle = llmath::llround((F32) atan2( mVO->getScale().mV[2]*2.f, drawablep->mDistanceWRTCamera) * RAD_TO_DEG, 0.01f); + F32 app_angle = ll_round((F32) atan2( mVO->getScale().mV[2]*2.f, drawablep->mDistanceWRTCamera) * RAD_TO_DEG, 0.01f); // Rendering sections increases with visible angle on the screen mRenderRes = (S32)(FLEXIBLE_OBJECT_MAX_SECTIONS*4*app_angle*DEG_TO_RAD/LLViewerCamera::getInstance()->getView()); diff --git a/indra/newview/llfloaterabout.cpp b/indra/newview/llfloaterabout.cpp index b2b7e71aa..4f4ac87fc 100644 --- a/indra/newview/llfloaterabout.cpp +++ b/indra/newview/llfloaterabout.cpp @@ -70,11 +70,6 @@ #include "lldxhardware.h" #endif - - - - - extern LLMemoryInfo gSysMemory; extern U32 gPacketsIn; @@ -158,7 +153,7 @@ LLFloaterAbout::LLFloaterAbout() support.append(llformat("Built with Clang version %d\n\n", CLANG_VERSION)); #endif -#if LL_ICC +#if LL_INTELC support.append(llformat("Built with ICC version %d\n\n", __ICC)); #endif diff --git a/indra/newview/llfloateravatarlist.cpp b/indra/newview/llfloateravatarlist.cpp index 51f7728a7..5085aac4d 100644 --- a/indra/newview/llfloateravatarlist.cpp +++ b/indra/newview/llfloateravatarlist.cpp @@ -530,25 +530,22 @@ void LLFloaterAvatarList::updateAvatarList() } { - std::vector avatar_ids; - std::vector sorted_avatar_ids; - std::vector positions; - + LLWorld::pos_map_t avs; LLVector3d mypos = gAgent.getPositionGlobal(); static const LLCachedControl radar_range_radius("RadarRangeRadius", 0); - LLWorld::instance().getAvatars(&avatar_ids, &positions, mypos, radar_range_radius ? radar_range_radius : F32_MAX); + LLWorld::instance().getAvatars(&avs, mypos, radar_range_radius ? radar_range_radius : F32_MAX); static LLCachedControl announce(gSavedSettings, "RadarChatKeys"); std::queue announce_keys; - for (size_t i = 0, count = avatar_ids.size(); i < count; ++i) + for (LLWorld::pos_map_t::const_iterator i = avs.cbegin(), end = avs.cend(); i != end; ++i) { - const LLUUID& avid = avatar_ids[i]; + const LLUUID& avid = i->first; std::string name; static const LLCachedControl namesystem("RadarNameSystem"); if (!LLAvatarNameCache::getNSName(avid, name, namesystem)) continue; //prevent (Loading...) - LLVector3d position = positions[i]; + LLVector3d position = i->second; LLVOAvatar* avatarp = gObjectList.findAvatar(avid); if (avatarp) position = gAgent.getPosGlobalFromAgent(avatarp->getCharacterPosition()); @@ -653,7 +650,7 @@ void LLFloaterAvatarList::updateAvatarSorting() } } -bool mm_getMarkerColor(const LLUUID&, LLColor4&); +bool getCustomColor(const LLUUID& id, LLColor4& color, LLViewerRegion* parent_estate); /** * Redraws the avatar list @@ -740,37 +737,7 @@ void LLFloaterAvatarList::refreshAvatarList() } // custom colors for certain types of avatars! - //Changed a bit so people can modify them in settings. And since they're colors, again it's possibly account-based. Starting to think I need a function just to determine that. - HgB - //name.color = gColors.getColor( "MapAvatar" ); - LLUUID estate_owner = LLUUID::null; - if (LLViewerRegion* parent_estate = LLWorld::getInstance()->getRegionFromPosGlobal(entry->getPosition())) - if (parent_estate->isAlive()) - estate_owner = parent_estate->getOwner(); - - //Lindens are always more Linden than your friend, make that take precedence - if (mm_getMarkerColor(av_id, color)) {} - else if (LLMuteList::getInstance()->isLinden(av_id)) - { - static const LLCachedControl ascent_linden_color("AscentLindenColor", LLColor4(0.f,0.f,1.f,1.f)); - color = ascent_linden_color; - } - //check if they are an estate owner at their current position - else if (estate_owner.notNull() && av_id == estate_owner) - { - static const LLCachedControl ascent_estate_owner_color("AscentEstateOwnerColor", LLColor4(1.f,0.6f,1.f,1.f)); - color = ascent_estate_owner_color; - } - //without these dots, SL would suck. - else if (LLAvatarActions::isFriend(av_id)) - { - static const LLCachedControl ascent_friend_color("AscentFriendColor", LLColor4(1.f,1.f,0.f,1.f)); - color = ascent_friend_color; - } - //big fat jerkface who is probably a jerk, display them as such. - else if (LLMuteList::getInstance()->isMuted(av_id)) - { - color = ascent_muted_color; - } + getCustomColor(av_id, color, LLWorld::getInstance()->getRegionFromPosGlobal(entry->getPosition())); name.color = color*0.5f + unselected_color*0.5f; element.columns.add(name); } diff --git a/indra/newview/llfloaterbuyland.cpp b/indra/newview/llfloaterbuyland.cpp index 86ed6505f..875925e26 100644 --- a/indra/newview/llfloaterbuyland.cpp +++ b/indra/newview/llfloaterbuyland.cpp @@ -386,9 +386,9 @@ void LLFloaterBuyLandUI::updateParcelInfo() } mParcelBillableArea = - llmath::llround(mRegion->getBillableFactor() * mParcelActualArea); + ll_round(mRegion->getBillableFactor() * mParcelActualArea); - mParcelSupportedObjects = llmath::llround( + mParcelSupportedObjects = ll_round( parcel->getMaxPrimCapacity() * parcel->getParcelPrimBonus()); // Can't have more than region max tasks, regardless of parcel // object bonus factor. diff --git a/indra/newview/llfloaterdirectory.cpp b/indra/newview/llfloaterdirectory.cpp index e6606de36..25ee21f7d 100644 --- a/indra/newview/llfloaterdirectory.cpp +++ b/indra/newview/llfloaterdirectory.cpp @@ -106,13 +106,13 @@ public: { if (LLViewerRegion* region = gAgent.getRegion()) { - if (region->getFeaturesReceived()) + if (region->simulatorFeaturesReceived()) { setMarketplaceURL(container); } else { - region->setFeaturesReceivedCallback(boost::bind(&LLPanelDirMarket::setMarketplaceURL, this, container)); + region->setSimulatorFeaturesReceivedCallback(boost::bind(&LLPanelDirMarket::setMarketplaceURL, this, container)); } } } diff --git a/indra/newview/llfloatereditui.cpp b/indra/newview/llfloatereditui.cpp index 0bc8fcc15..2d7b42438 100644 --- a/indra/newview/llfloatereditui.cpp +++ b/indra/newview/llfloatereditui.cpp @@ -164,7 +164,7 @@ LLFloaterEditUI::LLFloaterEditUI() spin = new LLSpinCtrl(std::string("width_spin"), LLRect(x, y+20, x+100, y), std::string("Width:"), LLFontGL::getFontSansSerifSmall(), - boost::bind(&LLFloaterEditUI::onCommitHeight,_1), + boost::bind(&LLFloaterEditUI::onCommitWidth,_1), 0.f, 2.f, 1000.f, diff --git a/indra/newview/llfloaterenvsettings.cpp b/indra/newview/llfloaterenvsettings.cpp index d6b053f97..3461b2461 100644 --- a/indra/newview/llfloaterenvsettings.cpp +++ b/indra/newview/llfloaterenvsettings.cpp @@ -316,7 +316,7 @@ std::string LLFloaterEnvSettings::timeToString(F32 curTime) // get hours and minutes hours = (S32) (24.0 * curTime); curTime -= ((F32) hours / 24.0f); - min = llmath::llround(24.0f * 60.0f * curTime); + min = ll_round(24.0f * 60.0f * curTime); // handle case where it's 60 if(min == 60) diff --git a/indra/newview/llfloaterfriends.cpp b/indra/newview/llfloaterfriends.cpp index bd5517c4e..b170a858e 100644 --- a/indra/newview/llfloaterfriends.cpp +++ b/indra/newview/llfloaterfriends.cpp @@ -459,11 +459,6 @@ void LLPanelFriends::updateFriendItem(const LLUUID& agent_id, const LLRelationsh itemp->getColumn(LIST_VISIBLE_MAP_THEIRS)->setValue(info->isRightGrantedFrom(LLRelationship::GRANT_MAP_LOCATION)); itemp->getColumn(LIST_EDIT_THEIRS)->setValue(info->isRightGrantedFrom(LLRelationship::GRANT_MODIFY_OBJECTS)); - // enable this item, in case it was disabled after user input - itemp->getColumn(LIST_VISIBLE_ONLINE)->setEnabled(true); - itemp->getColumn(LIST_VISIBLE_MAP)->setEnabled(true); - itemp->getColumn(LIST_EDIT_MINE)->setEnabled(true); - mFriendsList->setNeedsSort(); // Do not resort, this function can be called frequently. @@ -471,30 +466,7 @@ void LLPanelFriends::updateFriendItem(const LLUUID& agent_id, const LLRelationsh void LLPanelFriends::refreshRightsChangeList() { - const uuid_vec_t friends = mFriendsList->getSelectedIDs(); - - size_t num_selected = friends.size(); - bool can_offer_teleport = num_selected; - - /* if (LLTextBox* processing_label = getChild("process_rights_label")) - { - processing_label->setVisible(true); - // ignore selection for now - friends.clear(); - num_selected = 0; - } Making Dummy View -HgB */ - for(uuid_vec_t::const_iterator itr = friends.begin(); itr != friends.end(); ++itr) - { - if (const LLRelationship* friend_status = LLAvatarTracker::instance().getBuddyInfo(*itr)) - { - if (!friend_status->isOnline()) - can_offer_teleport = false; - } - else // missing buddy info, don't allow any operations - { - can_offer_teleport = false; - } - } + S32 num_selected = mFriendsList->getNumSelected(); //Stuff for the online/total/select counts. getChild("s_num")->setValue(llformat("%d", num_selected)); @@ -510,7 +482,7 @@ void LLPanelFriends::refreshRightsChangeList() { getChildView("im_btn")->setEnabled(true); //getChildView("assign_btn")->setEnabled(num_selected == 1); - getChildView("offer_teleport_btn")->setEnabled(can_offer_teleport); + getChildView("offer_teleport_btn")->setEnabled(true); } } @@ -958,15 +930,7 @@ void LLPanelFriends::applyRightsToFriends() } if (rights_changed) - { rights_updates.insert(std::make_pair(id, rights)); - // disable these ui elements until response from server - // to avoid race conditions - LLScrollListItem& item = *(*itr); - item.getColumn(LIST_VISIBLE_ONLINE)->setEnabled(false); - item.getColumn(LIST_VISIBLE_MAP)->setEnabled(false); - item.getColumn(LIST_EDIT_MINE)->setEnabled(false); - } } // separately confirm grant and revoke of modify rights diff --git a/indra/newview/llfloaterland.cpp b/indra/newview/llfloaterland.cpp index 57e4c0f20..85aae36b4 100644 --- a/indra/newview/llfloaterland.cpp +++ b/indra/newview/llfloaterland.cpp @@ -1228,7 +1228,7 @@ void LLPanelLandObjects::refresh() { S32 sw_max = parcel->getSimWideMaxPrimCapacity(); S32 sw_total = parcel->getSimWidePrimCount(); - S32 max = llmath::llround(parcel->getMaxPrimCapacity() * parcel->getParcelPrimBonus()); + S32 max = ll_round(parcel->getMaxPrimCapacity() * parcel->getParcelPrimBonus()); S32 total = parcel->getPrimCount(); S32 owned = parcel->getOwnerPrimCount(); S32 group = parcel->getGroupPrimCount(); @@ -1574,8 +1574,7 @@ void LLPanelLandObjects::processParcelObjectOwnersReply(LLMessageSystem *msg, vo LLVector3d mypos = gAgent.getPositionGlobal(); std::vector avatar_ids; - std::vector positions; - LLWorld::instance().getAvatars(&avatar_ids, &positions, mypos, F32_MAX); + LLWorld::instance().getAvatars(&avatar_ids, NULL, mypos, F32_MAX); for(S32 i = 0; i < rows; ++i) { @@ -2106,9 +2105,9 @@ void LLPanelLandOptions::refresh() else { mLocationText->setTextArg("[LANDING]",llformat("%d, %d, %d", - llmath::llround(pos.mV[VX]), - llmath::llround(pos.mV[VY]), - llmath::llround(pos.mV[VZ]))); + ll_round(pos.mV[VX]), + ll_round(pos.mV[VY]), + ll_round(pos.mV[VZ]))); } mSetBtn->setEnabled( can_change_landing_point ); diff --git a/indra/newview/llfloaterlandholdings.cpp b/indra/newview/llfloaterlandholdings.cpp index b672cbe91..12a0cc797 100644 --- a/indra/newview/llfloaterlandholdings.cpp +++ b/indra/newview/llfloaterlandholdings.cpp @@ -227,8 +227,8 @@ void LLFloaterLandHoldings::processPlacesReply(LLMessageSystem* msg, void**) self->mActualArea += actual_area; self->mBillableArea += billable_area; - S32 region_x = llmath::llround(global_x) % REGION_WIDTH_UNITS; - S32 region_y = llmath::llround(global_y) % REGION_WIDTH_UNITS; + S32 region_x = ll_round(global_x) % REGION_WIDTH_UNITS; + S32 region_y = ll_round(global_y) % REGION_WIDTH_UNITS; std::string location; location = llformat("%s (%d, %d)", sim_name.c_str(), region_x, region_y); diff --git a/indra/newview/llfloaterpathfindingcharacters.cpp b/indra/newview/llfloaterpathfindingcharacters.cpp index d335b9566..0cccc80f7 100644 --- a/indra/newview/llfloaterpathfindingcharacters.cpp +++ b/indra/newview/llfloaterpathfindingcharacters.cpp @@ -219,7 +219,7 @@ LLSD LLFloaterPathfindingCharacters::buildCharacterScrollListItemData(const LLPa columns[2]["column"] = "owner"; columns[2]["value"] = getOwnerName(pCharacterPtr); - S32 cpuTime = llmath::llround(pCharacterPtr->getCPUTime()); + S32 cpuTime = ll_round(pCharacterPtr->getCPUTime()); std::string cpuTimeString = llformat("%d", cpuTime); LLStringUtil::format_map_t string_args; string_args["[CPU_TIME]"] = cpuTimeString; diff --git a/indra/newview/llfloatersnapshot.cpp b/indra/newview/llfloatersnapshot.cpp index f8c1b504b..73626b21b 100644 --- a/indra/newview/llfloatersnapshot.cpp +++ b/indra/newview/llfloatersnapshot.cpp @@ -493,16 +493,16 @@ void LLSnapshotLivePreview::updateSnapshot(BOOL new_snapshot, BOOL new_thumbnail if (mAspectRatio > window_aspect_ratio) { // trim off top and bottom - S32 height_diff = llmath::llround(getRect().getHeight() - (F32)getRect().getWidth() / mAspectRatio); - S32 half_height_diff = llmath::llround((getRect().getHeight() - (F32)getRect().getWidth() / mAspectRatio) * 0.5); + S32 height_diff = ll_round(getRect().getHeight() - (F32)getRect().getWidth() / mAspectRatio); + S32 half_height_diff = ll_round((getRect().getHeight() - (F32)getRect().getWidth() / mAspectRatio) * 0.5); rect.mBottom += half_height_diff; rect.mTop -= height_diff - half_height_diff; } else if (mAspectRatio < window_aspect_ratio) { // trim off left and right - S32 width_diff = llmath::llround(getRect().getWidth() - (F32)getRect().getHeight() * mAspectRatio); - S32 half_width_diff = llmath::llround((getRect().getWidth() - (F32)getRect().getHeight() * mAspectRatio) * 0.5f); + S32 width_diff = ll_round(getRect().getWidth() - (F32)getRect().getHeight() * mAspectRatio); + S32 half_width_diff = ll_round((getRect().getWidth() - (F32)getRect().getHeight() * mAspectRatio) * 0.5f); rect.mLeft += half_width_diff; rect.mRight -= width_diff - half_width_diff; } @@ -639,9 +639,9 @@ void LLSnapshotLivePreview::draw() LLLocalClipRect clip(getLocalRect()); { // draw diagonal stripe with gradient that passes over screen - S32 x1 = gViewerWindow->getWindowWidthScaled() * llmath::llround((clamp_rescale(shine_interp, 0.f, 1.f, -1.f - SHINE_WIDTH, 1.f))); - S32 x2 = x1 + llmath::llround(gViewerWindow->getWindowWidthScaled() * SHINE_WIDTH); - S32 x3 = x2 + llmath::llround(gViewerWindow->getWindowWidthScaled() * SHINE_WIDTH); + S32 x1 = gViewerWindow->getWindowWidthScaled() * ll_round((clamp_rescale(shine_interp, 0.f, 1.f, -1.f - SHINE_WIDTH, 1.f))); + S32 x2 = x1 + ll_round(gViewerWindow->getWindowWidthScaled() * SHINE_WIDTH); + S32 x3 = x2 + ll_round(gViewerWindow->getWindowWidthScaled() * SHINE_WIDTH); S32 y1 = 0; S32 y2 = gViewerWindow->getWindowHeightScaled(); @@ -719,7 +719,7 @@ void LLSnapshotLivePreview::draw() gGL.pushMatrix(); { LLRect const& rect = mFallFullScreenImageRect; - gGL.translatef((F32)rect.mLeft, (F32)rect.mBottom - llmath::llround(getRect().getHeight() * 2.f * (fall_interp * fall_interp)), 0.f); + gGL.translatef((F32)rect.mLeft, (F32)rect.mBottom - ll_round(getRect().getHeight() * 2.f * (fall_interp * fall_interp)), 0.f); gGL.rotatef(-45.f * fall_interp, 0.f, 0.f, 1.f); gGL.begin(LLRender::QUADS); { @@ -772,13 +772,13 @@ BOOL LLSnapshotLivePreview::setThumbnailImageSize() { // image too wide, shrink to width mThumbnailWidth = max_width; - mThumbnailHeight = llmath::llround((F32)max_width / window_aspect_ratio); + mThumbnailHeight = ll_round((F32)max_width / window_aspect_ratio); } else { // image too tall, shrink to height mThumbnailHeight = max_height; - mThumbnailWidth = llmath::llround((F32)max_height * window_aspect_ratio); + mThumbnailWidth = ll_round((F32)max_height * window_aspect_ratio); } if(mThumbnailWidth > window_width || mThumbnailHeight > window_height) @@ -790,11 +790,11 @@ BOOL LLSnapshotLivePreview::setThumbnailImageSize() F32 ratio = mAspectRatio * window_height / window_width; if(ratio > 1.f) { - top = llmath::llround(top / ratio); + top = ll_round(top / ratio); } else { - right = llmath::llround(right * ratio); + right = ll_round(right * ratio); } left = (mThumbnailWidth - right + 1) / 2; bottom = (mThumbnailHeight - top + 1) / 2; @@ -991,8 +991,8 @@ LLSnapshotLivePreview::EAspectSizeProblem LLSnapshotLivePreview::getAspectSizePr // We need an image with the aspect mAspectRatio (from which mWidth and mHeight were derived). // The current aspect ratio of mRawSnapshot. This should be (almost) equal to window_width / window_height, - // since these values are calculated in rawRawSnapshot with llmath::llround(window_width * scale_factor) and - // llmath::llround(window_height * scale_factor) respectively (since we set uncrop = true). + // since these values are calculated in rawRawSnapshot with ll_round(window_width * scale_factor) and + // ll_round(window_height * scale_factor) respectively (since we set uncrop = true). F32 raw_aspect = (F32)mRawSnapshotWidth / mRawSnapshotHeight; // The smaller dimension might have been rounded up to 0.5 up or down. Calculate upper and lower limits. F32 lower_raw_aspect = (mRawSnapshotWidth - 0.5) / (mRawSnapshotHeight + 0.5); @@ -1017,7 +1017,7 @@ LLSnapshotLivePreview::EAspectSizeProblem LLSnapshotLivePreview::getAspectSizePr height_out = mRawSnapshotHeight; if (mAspectRatio < lower_raw_aspect) { - width_out = llmath::llround(width_out * mAspectRatio / raw_aspect); + width_out = ll_round(width_out * mAspectRatio / raw_aspect); if (width_out < mRawSnapshotWidth) { // Only set this to false when there is actually something to crop. @@ -1033,7 +1033,7 @@ LLSnapshotLivePreview::EAspectSizeProblem LLSnapshotLivePreview::getAspectSizePr } else if (mAspectRatio > upper_raw_aspect) { - height_out = llmath::llround(height_out * raw_aspect / mAspectRatio); + height_out = ll_round(height_out * raw_aspect / mAspectRatio); if (height_out < mRawSnapshotHeight) { if (!allow_vertical_crop) @@ -2407,8 +2407,8 @@ void LLFloaterSnapshot::Impl::keepAspect(LLFloaterSnapshot* view, bool on, bool LLSnapshotLivePreview* previewp = getPreviewView(); if (previewp) { - S32 w = llmath::llround(view->childGetValue("snapshot_width").asReal(), 1.0); - S32 h = llmath::llround(view->childGetValue("snapshot_height").asReal(), 1.0); + S32 w = ll_round(view->childGetValue("snapshot_width").asReal(), 1.0); + S32 h = ll_round(view->childGetValue("snapshot_height").asReal(), 1.0); gSavedSettings.setS32(lastSnapshotWidthName(), w); gSavedSettings.setS32(lastSnapshotHeightName(), h); comboSetCustom(view, previewp->resolutionComboName()); @@ -2468,8 +2468,8 @@ void LLFloaterSnapshot::Impl::updateResolution(LLUICtrl* ctrl, void* data, bool // The size is actually the source aspect now, encoded in the width. F32 source_aspect = width / 630.f; // Use the size of the current window, cropped to the required aspect. - width = llmin(gViewerWindow->getWindowDisplayWidth(), llmath::llround(gViewerWindow->getWindowDisplayHeight() * source_aspect)); - height = llmin(gViewerWindow->getWindowDisplayHeight(), llmath::llround(gViewerWindow->getWindowDisplayWidth() / source_aspect)); + width = llmin(gViewerWindow->getWindowDisplayWidth(), ll_round(gViewerWindow->getWindowDisplayHeight() * source_aspect)); + height = llmin(gViewerWindow->getWindowDisplayHeight(), ll_round(gViewerWindow->getWindowDisplayWidth() / source_aspect)); previewp->setSize(width, height); } else @@ -2656,8 +2656,8 @@ void LLFloaterSnapshot::Impl::enforceResolution(LLFloaterSnapshot* floater, F32 nw = llmin(nw, nh * new_aspect); nh = llmin(nh, nw / new_aspect); // Round off to nearest integer. - S32 new_width = llmath::llround(nw); - S32 new_height = llmath::llround(nh); + S32 new_width = ll_round(nw); + S32 new_height = ll_round(nh); gSavedSettings.setS32(lastSnapshotWidthName(), new_width); gSavedSettings.setS32(lastSnapshotHeightName(), new_height); @@ -2758,8 +2758,8 @@ void LLFloaterSnapshot::Impl::onCommitCustomResolution(LLUICtrl *ctrl, void* dat LLSpinCtrl* width_spinner = view->getChild("snapshot_width"); LLSpinCtrl* height_spinner = view->getChild("snapshot_height"); - S32 w = llmath::llround((F32)width_spinner->getValue().asReal(), 1.0f); - S32 h = llmath::llround((F32)height_spinner->getValue().asReal(), 1.0f); + S32 w = ll_round((F32)width_spinner->getValue().asReal(), 1.0f); + S32 h = ll_round((F32)height_spinner->getValue().asReal(), 1.0f); LLSnapshotLivePreview* previewp = getPreviewView(); if (previewp) @@ -2786,12 +2786,12 @@ void LLFloaterSnapshot::Impl::onCommitCustomResolution(LLUICtrl *ctrl, void* dat if (h == curh) { // Width was changed. Change height to keep aspect constant. - h = llmath::llround(w / aspect); + h = ll_round(w / aspect); } else { // Height was changed. Change width to keep aspect constant. - w = llmath::llround(h * aspect); + w = ll_round(h * aspect); } } width_spinner->forceSetValue(LLSD::Real(w)); diff --git a/indra/newview/llfloaterurldisplay.cpp b/indra/newview/llfloaterurldisplay.cpp index c265c6169..514f1f758 100644 --- a/indra/newview/llfloaterurldisplay.cpp +++ b/indra/newview/llfloaterurldisplay.cpp @@ -48,7 +48,7 @@ LLFloaterURLDisplay::LLFloaterURLDisplay(const LLSD& sd) { mFactoryMap["place_details_panel"] = LLCallbackMap(LLFloaterURLDisplay::createPlaceDetail, this); LLUICtrlFactory::getInstance()->buildFloater(this, "floater_preview_url.xml", &getFactoryMap()); - this->setVisible(false); + setVisible(false); // If positioned at 0,0 the teleport button is behind the toolbar. LLRect r = getRect(); diff --git a/indra/newview/llfloaterworldmap.cpp b/indra/newview/llfloaterworldmap.cpp index 3fdb07d81..83135dc9f 100644 --- a/indra/newview/llfloaterworldmap.cpp +++ b/indra/newview/llfloaterworldmap.cpp @@ -39,6 +39,7 @@ #include "llfloaterworldmap.h" +#include "alfloaterregiontracker.h" #include "llagent.h" #include "llagentcamera.h" #include "llbutton.h" @@ -268,6 +269,7 @@ LLFloaterWorldMap::LLFloaterWorldMap() mCommitCallbackRegistrar.add("WMap.ShowAgent", boost::bind(&LLFloaterWorldMap::onShowAgentBtn, this)); mCommitCallbackRegistrar.add("WMap.Clear", boost::bind(&LLFloaterWorldMap::onClearBtn, this)); mCommitCallbackRegistrar.add("WMap.CopySLURL", boost::bind(&LLFloaterWorldMap::onCopySLURL, this)); + mCommitCallbackRegistrar.add("WMap.TrackRegion", boost::bind(&LLFloaterWorldMap::onTrackRegion, this)); LLUICtrlFactory::getInstance()->buildFloater(this, "floater_world_map.xml", &getFactoryMap()); gSavedSettings.getControl("PreferredMaturity")->getSignal()->connect(boost::bind(&LLFloaterWorldMap::onChangeMaturity, this)); @@ -535,8 +537,10 @@ void LLFloaterWorldMap::draw() getChildView("Teleport")->setEnabled((BOOL)tracking_status); // getChildView("Clear")->setEnabled((BOOL)tracking_status); - getChildView("Show Destination")->setEnabled((BOOL)tracking_status || LLWorldMap::getInstance()->isTracking()); + bool is_tracking((BOOL)tracking_status || LLWorldMap::instance().isTracking()); + getChildView("Show Destination")->setEnabled(is_tracking); getChildView("copy_slurl")->setEnabled((mSLURL.isValid()) ); + getChild("track_region")->setEnabled(is_tracking); setMouseOpaque(TRUE); getDragHandle()->setMouseOpaque(TRUE); @@ -709,9 +713,9 @@ void LLFloaterWorldMap::trackLocation(const LLVector3d& pos_global) // std::string full_name = llformat("%s (%d, %d, %d)", sim_name.c_str(), - llmath::llround(region_x), - llmath::llround(region_y), - llmath::llround((F32)pos_global.mdV[VZ])); + ll_round(region_x), + ll_round(region_y), + ll_round((F32)pos_global.mdV[VZ])); std::string tooltip(""); mTrackedStatus = LLTracker::TRACKING_LOCATION; @@ -1427,6 +1431,28 @@ void LLFloaterWorldMap::onCopySLURL() LLNotificationsUtil::add("CopySLURL", args); } +void LLFloaterWorldMap::onTrackRegion() +{ + ALFloaterRegionTracker* floaterp = ALFloaterRegionTracker::getInstance(); + if (floaterp) + { + if (LLTracker::getTrackingStatus() != LLTracker::TRACKING_NOTHING) + { + std::string sim_name; + LLWorldMap::getInstance()->simNameFromPosGlobal(LLTracker::getTrackedPositionGlobal(), sim_name); + if (!sim_name.empty()) + { + const std::string& temp_label = floaterp->getRegionLabelIfExists(sim_name); + LLSD args, payload; + args["REGION"] = sim_name; + args["LABEL"] = !temp_label.empty() ? temp_label : sim_name; + payload["name"] = sim_name; + LLNotificationsUtil::add("RegionTrackerAdd", args, payload, boost::bind(&ALFloaterRegionTracker::onRegionAddedCallback, floaterp, _1, _2)); + } + } + } +} + // protected void LLFloaterWorldMap::centerOnTarget(BOOL animate) { @@ -1741,10 +1767,10 @@ void LLFloaterWorldMap::onChangeMaturity() bool can_access_adult = gAgent.canAccessAdult(); getChildView("events_mature_icon")->setVisible( can_access_mature); - getChildView("event_mature_chk")->setVisible( can_access_mature); + getChildView("events_mature_chk")->setVisible( can_access_mature); getChildView("events_adult_icon")->setVisible( can_access_adult); - getChildView("event_adult_chk")->setVisible( can_access_adult); + getChildView("events_adult_chk")->setVisible( can_access_adult); // disable mature / adult events. if (!can_access_mature) diff --git a/indra/newview/llfloaterworldmap.h b/indra/newview/llfloaterworldmap.h index 652c23e1f..952570287 100644 --- a/indra/newview/llfloaterworldmap.h +++ b/indra/newview/llfloaterworldmap.h @@ -132,6 +132,7 @@ protected: void onShowTargetBtn(); void onShowAgentBtn(); void onCopySLURL(); + void onTrackRegion(); void centerOnTarget(BOOL animate); void updateLocation(); diff --git a/indra/newview/llfolderview.cpp b/indra/newview/llfolderview.cpp index 14259fe99..291a1efe1 100644 --- a/indra/newview/llfolderview.cpp +++ b/indra/newview/llfolderview.cpp @@ -535,7 +535,7 @@ S32 LLFolderView::arrange( S32* unused_width, S32* unused_height, S32 filter_gen updateRenamerPosition(); mTargetHeight = (F32)target_height; - return llmath::llround(mTargetHeight); + return ll_round(mTargetHeight); } const std::string LLFolderView::getFilterSubString(BOOL trim) @@ -2041,7 +2041,7 @@ void LLFolderView::scrollToShowItem(LLFolderViewItem* item, const LLRect& constr LLRect item_scrolled_rect; // item position relative to display area of scroller S32 icon_height = mIcon.isNull() ? 0 : mIcon->getHeight(); - S32 label_height = llmath::llround(getLabelFontForStyle(mLabelStyle)->getLineHeight()); + S32 label_height = ll_round(getLabelFontForStyle(mLabelStyle)->getLineHeight()); // when navigating with keyboard, only move top of opened folder on screen, otherwise show whole folder S32 max_height_to_show = item->isOpen() && mScrollContainer->hasFocus() ? (llmax( icon_height, label_height ) + ICON_PAD) : local_rect.getHeight(); diff --git a/indra/newview/llfolderviewitem.cpp b/indra/newview/llfolderviewitem.cpp index 3014bf180..f71eb1cf6 100644 --- a/indra/newview/llfolderviewitem.cpp +++ b/indra/newview/llfolderviewitem.cpp @@ -454,6 +454,9 @@ void LLFolderViewItem::filter( LLInventoryFilter& filter) setFiltered(passed_filter, filter.getCurrentGeneration()); mStringMatchOffset = filter.getStringMatchOffset(); + // If Creator is part of the filter, don't let it get highlighted if it matches + if (mSearchType & 4 && mStringMatchOffset >= mSearchable.length()-mSearchableLabelCreator.length()) + mStringMatchOffset = std::string::npos; filter.decrementFilterCount(); if (getRoot()->getDebugFilters()) @@ -1088,7 +1091,7 @@ void LLFolderViewItem::draw() if (filter_string_length > 0 && (mRoot->getSearchType() & 1)) { std::string combined_string = mLabel + mLabelSuffix; - S32 left = llmath::llround(text_left) + font->getWidth(combined_string, 0, mStringMatchOffset) - 1; + S32 left = ll_round(text_left) + font->getWidth(combined_string, 0, mStringMatchOffset) - 1; S32 right = left + font->getWidth(combined_string, mStringMatchOffset, filter_string_length) + 2; S32 bottom = llfloor(getRect().getHeight() - font->getLineHeight() - 3 - TOP_PAD); S32 top = getRect().getHeight() - TOP_PAD; @@ -1225,7 +1228,7 @@ S32 LLFolderViewFolder::arrange( S32* width, S32* height, S32 filter_generation) { S32 child_width = *width; S32 child_height = 0; - S32 child_top = parent_item_height - llmath::llround(running_height); + S32 child_top = parent_item_height - ll_round(running_height); target_height += folderp->arrange( &child_width, &child_height, filter_generation ); @@ -1251,7 +1254,7 @@ S32 LLFolderViewFolder::arrange( S32* width, S32* height, S32 filter_generation) { S32 child_width = *width; S32 child_height = 0; - S32 child_top = parent_item_height - llmath::llround(running_height); + S32 child_top = parent_item_height - ll_round(running_height); target_height += itemp->arrange( &child_width, &child_height, filter_generation ); // don't change width, as this item is as wide as its parent folder by construction @@ -1288,7 +1291,7 @@ S32 LLFolderViewFolder::arrange( S32* width, S32* height, S32 filter_generation) folders_t::iterator fit = iter++; // number of pixels that bottom of folder label is from top of parent folder if (getRect().getHeight() - (*fit)->getRect().mTop + (*fit)->getItemHeight() - > llmath::llround(mCurHeight) + MAX_FOLDER_ITEM_OVERLAP) + > ll_round(mCurHeight) + MAX_FOLDER_ITEM_OVERLAP) { // hide if beyond current folder height (*fit)->setVisible(FALSE); @@ -1301,7 +1304,7 @@ S32 LLFolderViewFolder::arrange( S32* width, S32* height, S32 filter_generation) items_t::iterator iit = iter++; // number of pixels that bottom of item label is from top of parent folder if (getRect().getHeight() - (*iit)->getRect().mBottom - > llmath::llround(mCurHeight) + MAX_FOLDER_ITEM_OVERLAP) + > ll_round(mCurHeight) + MAX_FOLDER_ITEM_OVERLAP) { (*iit)->setVisible(FALSE); } @@ -1313,12 +1316,12 @@ S32 LLFolderViewFolder::arrange( S32* width, S32* height, S32 filter_generation) } // don't change width as this item is already as wide as its parent folder - reshape(getRect().getWidth(),llmath::llround(mCurHeight)); + reshape(getRect().getWidth(),ll_round(mCurHeight)); // pass current height value back to parent - *height = llmath::llround(mCurHeight); + *height = ll_round(mCurHeight); - return llmath::llround(mTargetHeight); + return ll_round(mTargetHeight); } BOOL LLFolderViewFolder::needsArrange() diff --git a/indra/newview/llgesturemgr.cpp b/indra/newview/llgesturemgr.cpp index 517266097..3a1a076e5 100644 --- a/indra/newview/llgesturemgr.cpp +++ b/indra/newview/llgesturemgr.cpp @@ -61,6 +61,8 @@ #include "shcommandhandler.h" #endif //shy_mod +void fake_local_chat(std::string msg); + // Longest time, in seconds, to wait for all animations to stop playing const F32 MAX_WAIT_ANIM_SECS = 30.f; @@ -522,7 +524,7 @@ void LLGestureMgr::replaceGesture(const LLUUID& item_id, const LLUUID& new_asset LLGestureMgr::instance().replaceGesture(base_item_id, gesture, new_asset_id); } -void LLGestureMgr::playGesture(LLMultiGesture* gesture) +void LLGestureMgr::playGesture(LLMultiGesture* gesture, bool local) { if (!gesture) return; @@ -531,6 +533,7 @@ void LLGestureMgr::playGesture(LLMultiGesture* gesture) // Add to list of playing gesture->mPlaying = TRUE; + gesture->mLocal = local; mPlaying.push_back(gesture); // Load all needed assets to minimize the delays @@ -608,7 +611,7 @@ void LLGestureMgr::playGesture(LLMultiGesture* gesture) // Convenience function that looks up the item_id for you. -void LLGestureMgr::playGesture(const LLUUID& item_id) +void LLGestureMgr::playGesture(const LLUUID& item_id, bool local) { const LLUUID& base_item_id = get_linked_uuid(item_id); @@ -826,8 +829,7 @@ void LLGestureMgr::stepGesture(LLMultiGesture* gesture) { // look in signaled animations (simulator's view of what is // currently playing. - LLVOAvatar::AnimIterator play_it = gAgentAvatarp->mSignaledAnimations.find(*gest_it); - if (play_it != gAgentAvatarp->mSignaledAnimations.end()) + if (gesture->mLocal ? !!gAgentAvatarp->findMotion(*gest_it) : (gAgentAvatarp->mSignaledAnimations.find(*gest_it) != gAgentAvatarp->mSignaledAnimations.end())) { ++gest_it; } @@ -970,21 +972,37 @@ void LLGestureMgr::runStep(LLMultiGesture* gesture, LLGestureStep* step) if (anim_step->mFlags & ANIM_FLAG_STOP) { - gAgent.sendAnimationRequest(anim_step->mAnimAssetID, ANIM_REQUEST_STOP); - // remove it from our request set in case we just requested it - std::set::iterator set_it = gesture->mRequestedAnimIDs.find(anim_step->mAnimAssetID); - if (set_it != gesture->mRequestedAnimIDs.end()) + if (gesture->mLocal) { - gesture->mRequestedAnimIDs.erase(set_it); + gAgentAvatarp->stopMotion(anim_step->mAnimAssetID); + } + else + { + gAgent.sendAnimationRequest(anim_step->mAnimAssetID, ANIM_REQUEST_STOP); + // remove it from our request set in case we just requested it + std::set::iterator set_it = gesture->mRequestedAnimIDs.find(anim_step->mAnimAssetID); + if (set_it != gesture->mRequestedAnimIDs.end()) + { + gesture->mRequestedAnimIDs.erase(set_it); + } } } else { - gAgent.sendAnimationRequest(anim_step->mAnimAssetID, ANIM_REQUEST_START); - // Indicate that we've requested this animation to play as - // part of this gesture (but it won't start playing for at - // least one round-trip to simulator). - gesture->mRequestedAnimIDs.insert(anim_step->mAnimAssetID); + if (gesture->mLocal) + { + gAgentAvatarp->startMotion(anim_step->mAnimAssetID); + // Indicate we're playing this animation now. + gesture->mPlayingAnimIDs.insert(anim_step->mAnimAssetID); + } + else + { + gAgent.sendAnimationRequest(anim_step->mAnimAssetID, ANIM_REQUEST_START); + // Indicate that we've requested this animation to play as + // part of this gesture (but it won't start playing for at + // least one round-trip to simulator). + gesture->mRequestedAnimIDs.insert(anim_step->mAnimAssetID); + } } gesture->mCurrentStep++; break; @@ -994,7 +1012,10 @@ void LLGestureMgr::runStep(LLMultiGesture* gesture, LLGestureStep* step) LLGestureStepSound* sound_step = (LLGestureStepSound*)step; const LLUUID& sound_id = sound_step->mSoundAssetID; const F32 volume = 1.f; - send_sound_trigger(sound_id, volume); + if (gesture->mLocal) + gAudiop->triggerSound(sound_id, gAgentID, volume, LLAudioEngine::AUDIO_TYPE_UI, gAgent.getPositionGlobal()); + else + send_sound_trigger(sound_id, volume); gesture->mCurrentStep++; break; } @@ -1011,7 +1032,7 @@ void LLGestureMgr::runStep(LLMultiGesture* gesture, LLGestureStep* step) #if SHY_MOD //Command handler if(!SHCommandHandler::handleCommand(true, chat_text, gAgentID, gAgentAvatarp))//returns true if handled #endif //shy_mod - gChatBar->sendChatFromViewer(chat_text, CHAT_TYPE_NORMAL, animate); + gesture->mLocal ? fake_local_chat(chat_text) : gChatBar->sendChatFromViewer(chat_text, CHAT_TYPE_NORMAL, animate); } gesture->mCurrentStep++; break; @@ -1284,7 +1305,10 @@ void LLGestureMgr::stopGesture(LLMultiGesture* gesture) for (set_it = gesture->mPlayingAnimIDs.begin(); set_it != gesture->mPlayingAnimIDs.end(); ++set_it) { const LLUUID& anim_id = *set_it; - gAgent.sendAnimationRequest(anim_id, ANIM_REQUEST_STOP); + if (gesture->mLocal) + gAgentAvatarp->stopMotion(anim_id, TRUE); + else + gAgent.sendAnimationRequest(anim_id, ANIM_REQUEST_STOP); } std::vector::iterator it; diff --git a/indra/newview/llgesturemgr.h b/indra/newview/llgesturemgr.h index 9f112261b..419ae77e7 100644 --- a/indra/newview/llgesturemgr.h +++ b/indra/newview/llgesturemgr.h @@ -103,8 +103,8 @@ public: const item_map_t& getActiveGestures() const { return mActive; } // Force a gesture to be played, for example, if it is being // previewed. - void playGesture(LLMultiGesture* gesture); - void playGesture(const LLUUID& item_id); + void playGesture(LLMultiGesture* gesture, bool local = false); + void playGesture(const LLUUID& item_id, bool local = false); // Stop all requested or playing anims for this gesture // Also remove from playing list diff --git a/indra/newview/llglsandbox.cpp b/indra/newview/llglsandbox.cpp index c951fe953..4e6846686 100644 --- a/indra/newview/llglsandbox.cpp +++ b/indra/newview/llglsandbox.cpp @@ -100,10 +100,10 @@ void LLToolSelectRect::handleRectangleSelection(S32 x, S32 y, MASK mask) S32 top = llmax(y, mDragStartY); S32 bottom =llmin(y, mDragStartY); - left = llmath::llround((F32) left * LLUI::getScaleFactor().mV[VX]); - right = llmath::llround((F32) right * LLUI::getScaleFactor().mV[VX]); - top = llmath::llround((F32) top * LLUI::getScaleFactor().mV[VY]); - bottom = llmath::llround((F32) bottom * LLUI::getScaleFactor().mV[VY]); + left = ll_round((F32) left * LLUI::getScaleFactor().mV[VX]); + right = ll_round((F32) right * LLUI::getScaleFactor().mV[VX]); + top = ll_round((F32) top * LLUI::getScaleFactor().mV[VY]); + bottom = ll_round((F32) bottom * LLUI::getScaleFactor().mV[VY]); F32 old_far_plane = LLViewerCamera::getInstance()->getFar(); F32 old_near_plane = LLViewerCamera::getInstance()->getNear(); diff --git a/indra/newview/llgroupmgr.cpp b/indra/newview/llgroupmgr.cpp index 524763f98..d6a85512a 100644 --- a/indra/newview/llgroupmgr.cpp +++ b/indra/newview/llgroupmgr.cpp @@ -964,6 +964,17 @@ static void formatDateString(std::string &date_string) } } +const std::string& localized_online() +{ + static const std::string online(LLTrans::getString("group_member_status_online")); + return online; +} +const std::string& localized_unknown() +{ + static const std::string unknown(LLTrans::getString("group_member_status_unknown")); + return unknown; +} + // static void LLGroupMgr::processGroupMembersReply(LLMessageSystem* msg, void** data) { @@ -1015,13 +1026,11 @@ void LLGroupMgr::processGroupMembersReply(LLMessageSystem* msg, void** data) { if (online_status == "Online") { - static std::string localized_online(LLTrans::getString("group_member_status_online")); - online_status = localized_online; + online_status = localized_online(); } else if (online_status == "unknown") { - static std::string localized_unknown(LLTrans::getString("group_member_status_unknown")); - online_status = localized_unknown; + online_status = localized_unknown(); } else { @@ -2214,7 +2223,7 @@ void LLGroupMgr::processCapGroupMembersRequest(const LLSD& content) for ( ; member_iter_start != member_iter_end; ++member_iter_start) { // Reset defaults - online_status = LLTrans::getString("group_member_status_unknown"); + online_status = localized_unknown(); title = titles[0].asString(); contribution = 0; member_powers = default_powers; @@ -2227,9 +2236,9 @@ void LLGroupMgr::processCapGroupMembersRequest(const LLSD& content) { online_status = member_info["last_login"].asString(); if (online_status == "Online") - online_status = LLTrans::getString("group_member_status_online"); + online_status = localized_online(); else if (online_status == "unknown") - online_status = LLTrans::getString("group_member_status_unknown"); + online_status = localized_unknown(); else formatDateString(online_status); } diff --git a/indra/newview/llhudeffectlookat.cpp b/indra/newview/llhudeffectlookat.cpp index 3efb9299a..f2eac7a91 100644 --- a/indra/newview/llhudeffectlookat.cpp +++ b/indra/newview/llhudeffectlookat.cpp @@ -55,6 +55,7 @@ #include "llviewerwindow.h" #include "llviewercontrol.h" // +#include "rlvhandler.h" // packet layout @@ -553,6 +554,8 @@ void LLHUDEffectLookAt::render() if (!LLAvatarNameCache::getNSName(static_cast(mSourceObject.get())->getID(), text, lookAtNames)) return; if (text.length() > 9 && 0 == text.compare(text.length() - 9, 9, " Resident")) text.erase(text.length() - 9); + if (gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMES)) + text = RlvStrings::getAnonym(text); LLVector3 offset = gAgentCamera.getCameraPositionAgent() - target; offset.normalize(); LLVector3 shadow_offset = offset * 0.49f; diff --git a/indra/newview/llimview.cpp b/indra/newview/llimview.cpp index 31b562e31..9c8c6222e 100644 --- a/indra/newview/llimview.cpp +++ b/indra/newview/llimview.cpp @@ -53,6 +53,7 @@ #include "llmutelist.h" #include "llspeakers.h" #include "llvoavatar.h" // For mIdleTimer reset +#include "llviewerobjectlist.h" #include "llviewerregion.h" // [RLVa:KB] - Checked: 2013-05-10 (RLVa-1.4.9) @@ -97,14 +98,22 @@ LLColor4 agent_chat_color(const LLUUID& id, const std::string& name, bool local_ static const LLCachedControl color_eo_chat("ColorEstateOwnerChat"); if (color_eo_chat) { - const LLViewerRegion* parent_estate = gAgent.getRegion(); - if (parent_estate && id == parent_estate->getOwner()) - return gSavedSettings.getColor4("AscentEstateOwnerColor"); + const LLViewerObject* obj = gObjectList.findObject(id); // Nearby? + if (const LLViewerRegion* parent_estate = obj ? obj->getRegion() : gAgent.getRegion()) + if (id == parent_estate->getOwner()) + return gSavedSettings.getColor4("AscentEstateOwnerColor"); } return local_chat ? gSavedSettings.getColor4("AgentChatColor") : gSavedSettings.getColor("IMChatColor"); } +bool block_conference(const LLUUID& id) +{ + const U32 block(gSavedSettings.getU32("LiruBlockConferences")); + if (block == 2) return !LLAvatarActions::isFriend(id); + return block; +} + class LLViewerChatterBoxInvitationAcceptResponder : public LLHTTPClient::ResponderWithResult { @@ -449,7 +458,7 @@ void LLIMMgr::addMessage( if(!floater) { // Return now if we're blocking this group's chat or conferences - if (gAgent.isInGroup(session_id) ? getIgnoreGroup(session_id) : dialog != IM_NOTHING_SPECIAL && dialog != IM_SESSION_P2P_INVITE && gSavedSettings.getBOOL("LiruBlockConferences")) + if (gAgent.isInGroup(session_id) ? getIgnoreGroup(session_id) : dialog != IM_NOTHING_SPECIAL && dialog != IM_SESSION_P2P_INVITE && block_conference(other_participant_id)) return; std::string name = (session_name.size() > 1) ? session_name : from; @@ -1476,7 +1485,7 @@ public: time_t timestamp = (time_t) message_params["timestamp"].asInteger(); - BOOL is_busy = gAgent.getBusy(); + bool is_do_not_disturb = gAgent.isDoNotDisturb(); BOOL is_muted = LLMuteList::getInstance()->isMuted( from_id, name, @@ -1499,7 +1508,7 @@ public: chat.mFromID = from_id; chat.mFromName = name; - if (!is_linden && (is_busy || is_muted)) + if (!is_linden && (is_do_not_disturb || is_muted)) { return; } @@ -1566,7 +1575,7 @@ public: } else { - if (from_id != session_id && gSavedSettings.getBOOL("LiruBlockConferences")) // from and session are equal for IMs only. + if (from_id != session_id && block_conference(from_id)) // from and session are equal for IMs only. { leave_group_chat(from_id, session_id); return; diff --git a/indra/newview/llinventorybridge.cpp b/indra/newview/llinventorybridge.cpp index a5ababe30..2358bec4c 100644 --- a/indra/newview/llinventorybridge.cpp +++ b/indra/newview/llinventorybridge.cpp @@ -1520,46 +1520,42 @@ void LLItemBridge::restoreItem() } } -void LLItemBridge::restoreToWorld() +void restore_to_world(LLViewerInventoryItem* itemp, bool no_copy, bool response = true) { - //Similar functionality to the drag and drop rez logic - bool remove_from_inventory = false; + if (!response) return; + LLMessageSystem* msg = gMessageSystem; + msg->newMessage("RezRestoreToWorld"); + msg->nextBlockFast(_PREHASH_AgentData); + msg->addUUIDFast(_PREHASH_AgentID, gAgentID); + msg->addUUIDFast(_PREHASH_SessionID, gAgentSessionID); - LLViewerInventoryItem* itemp = static_cast(getItem()); - if (itemp) - { - LLMessageSystem* msg = gMessageSystem; - msg->newMessage("RezRestoreToWorld"); - msg->nextBlockFast(_PREHASH_AgentData); - msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID()); - msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID()); + msg->nextBlockFast(_PREHASH_InventoryData); + itemp->packMessage(msg); + msg->sendReliable(gAgent.getRegion()->getHost()); - msg->nextBlockFast(_PREHASH_InventoryData); - itemp->packMessage(msg); - msg->sendReliable(gAgent.getRegion()->getHost()); - - //remove local inventory copy, sim will deal with permissions and removing the item - //from the actual inventory if its a no-copy etc - if(!itemp->getPermissions().allowCopyBy(gAgent.getID())) - { - remove_from_inventory = true; - } - - // Check if it's in the trash. (again similar to the normal rez logic) - const LLUUID trash_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_TRASH); - if(gInventory.isObjectDescendentOf(itemp->getUUID(), trash_id)) - { - remove_from_inventory = true; - } - } - - if(remove_from_inventory) + //remove local inventory copy, sim will deal with permissions and removing the item + //from the actual inventory if it's a no-copy etc + // Check if it's in the trash. (again similar to the normal rez logic) + if (no_copy || gInventory.isObjectDescendentOf(itemp->getUUID(), gInventory.findCategoryUUIDForType(LLFolderType::FT_TRASH))) { gInventory.deleteObject(itemp->getUUID()); gInventory.notifyObservers(); } } +void LLItemBridge::restoreToWorld() +{ + if (LLViewerInventoryItem* itemp = static_cast(getItem())) + { + //Similar functionality to the drag and drop rez logic + bool no_copy = !itemp->getPermissions().allowCopyBy(gAgentID); + if (no_copy && gHippoGridManager->getCurrentGrid()->isSecondLife()) + LLNotificationsUtil::add("RestoreToWorldConfirm", LLSD(), LLSD(), boost::bind(restore_to_world, itemp, true, !boost::bind(LLNotification::getSelectedOption, _1, _2))); + else + restore_to_world(itemp, no_copy); + } +} + void LLItemBridge::gotoItem() { LLInventoryObject *obj = getInventoryObject(); diff --git a/indra/newview/llinventorymodelbackgroundfetch.cpp b/indra/newview/llinventorymodelbackgroundfetch.cpp index e6b2a72cb..a511c2c7c 100644 --- a/indra/newview/llinventorymodelbackgroundfetch.cpp +++ b/indra/newview/llinventorymodelbackgroundfetch.cpp @@ -193,12 +193,17 @@ void LLInventoryModelBackgroundFetch::backgroundFetchCB(void *) LLInventoryModelBackgroundFetch::instance().backgroundFetch(); } +bool use_http_inventory() +{ + return gHippoGridManager->getConnectedGrid()->isSecondLife() || gSavedSettings.getBOOL("UseHTTPInventory"); +} + void LLInventoryModelBackgroundFetch::backgroundFetch() { LLViewerRegion* region = gAgent.getRegion(); if (mBackgroundFetchActive && region && region->capabilitiesReceived()) { - if (gSavedSettings.getBOOL("UseHTTPInventory")) + if (use_http_inventory()) { // If we'll be using the capability, we'll be sending batches and the background thing isn't as important. std::string url = region->getCapability("FetchInventory2"); diff --git a/indra/newview/llmanip.cpp b/indra/newview/llmanip.cpp index c0f606414..d9ad92aab 100644 --- a/indra/newview/llmanip.cpp +++ b/indra/newview/llmanip.cpp @@ -538,8 +538,8 @@ void LLManip::renderTickValue(const LLVector3& pos, F32 value, const std::string std::string val_string; std::string fraction_string; - F32 val_to_print = llmath::llround(value, 0.001f); - S32 fractional_portion = llmath::llround(fmodf(llabs(val_to_print), 1.f) * 100.f); + F32 val_to_print = ll_round(value, 0.001f); + S32 fractional_portion = ll_round(fmodf(llabs(val_to_print), 1.f) * 100.f); if (val_to_print < 0.f) { if (fractional_portion == 0) diff --git a/indra/newview/llmaniprotate.cpp b/indra/newview/llmaniprotate.cpp index 5c160e5b6..19b95bcfe 100644 --- a/indra/newview/llmaniprotate.cpp +++ b/indra/newview/llmaniprotate.cpp @@ -373,9 +373,9 @@ void LLManipRotate::render() LLQuaternion object_rot = first_object->getRotationEdit(); object_rot.getEulerAngles(&(euler_angles.mV[VX]), &(euler_angles.mV[VY]), &(euler_angles.mV[VZ])); euler_angles *= RAD_TO_DEG; - euler_angles.mV[VX] = llmath::llround(fmodf(euler_angles.mV[VX] + 360.f, 360.f), 0.05f); - euler_angles.mV[VY] = llmath::llround(fmodf(euler_angles.mV[VY] + 360.f, 360.f), 0.05f); - euler_angles.mV[VZ] = llmath::llround(fmodf(euler_angles.mV[VZ] + 360.f, 360.f), 0.05f); + euler_angles.mV[VX] = ll_round(fmodf(euler_angles.mV[VX] + 360.f, 360.f), 0.05f); + euler_angles.mV[VY] = ll_round(fmodf(euler_angles.mV[VY] + 360.f, 360.f), 0.05f); + euler_angles.mV[VZ] = ll_round(fmodf(euler_angles.mV[VZ] + 360.f, 360.f), 0.05f); renderXYZ(euler_angles); } @@ -1500,7 +1500,7 @@ LLQuaternion LLManipRotate::dragConstrained( S32 x, S32 y ) F32 mouse_angle = fmodf(atan2(projected_mouse * axis1, projected_mouse * axis2) * RAD_TO_DEG + 360.f, 360.f); F32 relative_mouse_angle = fmodf(mouse_angle + (SNAP_ANGLE_DETENTE / 2), SNAP_ANGLE_INCREMENT); - //fmodf(llmath::llround(mouse_angle * RAD_TO_DEG, 7.5f) + 360.f, 360.f); + //fmodf(ll_round(mouse_angle * RAD_TO_DEG, 7.5f) + 360.f, 360.f); LLVector3 object_axis; getObjectAxisClosestToMouse(object_axis); @@ -1584,7 +1584,7 @@ LLQuaternion LLManipRotate::dragConstrained( S32 x, S32 y ) F32 mouse_angle = fmodf(atan2(projected_mouse * axis1, projected_mouse * axis2) * RAD_TO_DEG + 360.f, 360.f); F32 relative_mouse_angle = fmodf(mouse_angle + (SNAP_ANGLE_DETENTE / 2), SNAP_ANGLE_INCREMENT); - //fmodf(llmath::llround(mouse_angle * RAD_TO_DEG, 7.5f) + 360.f, 360.f); + //fmodf(ll_round(mouse_angle * RAD_TO_DEG, 7.5f) + 360.f, 360.f); LLVector3 object_axis; getObjectAxisClosestToMouse(object_axis); diff --git a/indra/newview/llmanipscale.cpp b/indra/newview/llmanipscale.cpp index 1a40a9e12..4b6a3d6cc 100644 --- a/indra/newview/llmanipscale.cpp +++ b/indra/newview/llmanipscale.cpp @@ -1559,8 +1559,8 @@ void LLManipScale::updateSnapGuides(const LLBBox& bbox) mScaleSnapUnit1 = mScaleSnapUnit1 / (mSnapDir1 * mScaleDir); mScaleSnapUnit2 = mScaleSnapUnit2 / (mSnapDir2 * mScaleDir); - mTickPixelSpacing1 = llmath::llround((F32)MIN_DIVISION_PIXEL_WIDTH / (mScaleDir % mSnapGuideDir1).length()); - mTickPixelSpacing2 = llmath::llround((F32)MIN_DIVISION_PIXEL_WIDTH / (mScaleDir % mSnapGuideDir2).length()); + mTickPixelSpacing1 = ll_round((F32)MIN_DIVISION_PIXEL_WIDTH / (mScaleDir % mSnapGuideDir1).length()); + mTickPixelSpacing2 = ll_round((F32)MIN_DIVISION_PIXEL_WIDTH / (mScaleDir % mSnapGuideDir2).length()); if (uniform) { @@ -1632,8 +1632,8 @@ void LLManipScale::renderSnapGuides(const LLBBox& bbox) F32 grid_offset2 = fmodf(dist_grid_axis, smallest_subdivision2); // how many smallest grid units are we away from largest grid scale? - S32 sub_div_offset_1 = llmath::llround(fmod(dist_grid_axis - grid_offset1, mScaleSnapUnit1 / sGridMinSubdivisionLevel) / smallest_subdivision1); - S32 sub_div_offset_2 = llmath::llround(fmod(dist_grid_axis - grid_offset2, mScaleSnapUnit2 / sGridMinSubdivisionLevel) / smallest_subdivision2); + S32 sub_div_offset_1 = ll_round(fmod(dist_grid_axis - grid_offset1, mScaleSnapUnit1 / sGridMinSubdivisionLevel) / smallest_subdivision1); + S32 sub_div_offset_2 = ll_round(fmod(dist_grid_axis - grid_offset2, mScaleSnapUnit2 / sGridMinSubdivisionLevel) / smallest_subdivision2); S32 num_ticks_per_side1 = llmax(1, lltrunc(0.5f * mSnapGuideLength / smallest_subdivision1)); S32 num_ticks_per_side2 = llmax(1, lltrunc(0.5f * mSnapGuideLength / smallest_subdivision2)); @@ -1687,7 +1687,7 @@ void LLManipScale::renderSnapGuides(const LLBBox& bbox) LLVector2 screen_translate_axis(llabs(mScaleDir * LLViewerCamera::getInstance()->getLeftAxis()), llabs(mScaleDir * LLViewerCamera::getInstance()->getUpAxis())); screen_translate_axis.normalize(); - S32 tick_label_spacing = llmath::llround(screen_translate_axis * sTickLabelSpacing); + S32 tick_label_spacing = ll_round(screen_translate_axis * sTickLabelSpacing); for (pass = 0; pass < 3; pass++) { @@ -1767,8 +1767,8 @@ void LLManipScale::renderSnapGuides(const LLBBox& bbox) stop_tick = llmin(max_ticks1, num_ticks_per_side1); F32 grid_resolution = mObjectSelection->getSelectType() == SELECT_TYPE_HUD ? 0.25f : llmax(gSavedSettings.getF32("GridResolution"), 0.001f); - S32 label_sub_div_offset_1 = llmath::llround(fmod(dist_grid_axis - grid_offset1, mScaleSnapUnit1 * 32.f) / smallest_subdivision1); - S32 label_sub_div_offset_2 = llmath::llround(fmod(dist_grid_axis - grid_offset2, mScaleSnapUnit2 * 32.f) / smallest_subdivision2); + S32 label_sub_div_offset_1 = ll_round(fmod(dist_grid_axis - grid_offset1, mScaleSnapUnit1 * 32.f) / smallest_subdivision1); + S32 label_sub_div_offset_2 = ll_round(fmod(dist_grid_axis - grid_offset2, mScaleSnapUnit2 * 32.f) / smallest_subdivision2); for (S32 i = start_tick; i <= stop_tick; i++) { diff --git a/indra/newview/llmaniptranslate.cpp b/indra/newview/llmaniptranslate.cpp index 3be734b62..cb3ce30c2 100644 --- a/indra/newview/llmaniptranslate.cpp +++ b/indra/newview/llmaniptranslate.cpp @@ -1263,7 +1263,7 @@ void LLManipTranslate::renderSnapGuides() // find distance to nearest smallest grid unit F32 offset_nearest_grid_unit = fmodf(dist_grid_axis, smallest_grid_unit_scale); // how many smallest grid units are we away from largest grid scale? - S32 sub_div_offset = llmath::llround(fmodf(dist_grid_axis - offset_nearest_grid_unit, getMinGridScale() / sGridMinSubdivisionLevel) / smallest_grid_unit_scale); + S32 sub_div_offset = ll_round(fmodf(dist_grid_axis - offset_nearest_grid_unit, getMinGridScale() / sGridMinSubdivisionLevel) / smallest_grid_unit_scale); S32 num_ticks_per_side = llmax(1, llfloor(0.5f * guide_size_meters / smallest_grid_unit_scale)); LLGLDepthTest gls_depth(GL_FALSE); @@ -1377,12 +1377,12 @@ void LLManipTranslate::renderSnapGuides() } } - sub_div_offset = llmath::llround(fmod(dist_grid_axis - offset_nearest_grid_unit, getMinGridScale() * 32.f) / smallest_grid_unit_scale); + sub_div_offset = ll_round(fmod(dist_grid_axis - offset_nearest_grid_unit, getMinGridScale() * 32.f) / smallest_grid_unit_scale); LLVector2 screen_translate_axis(llabs(translate_axis * LLViewerCamera::getInstance()->getLeftAxis()), llabs(translate_axis * LLViewerCamera::getInstance()->getUpAxis())); screen_translate_axis.normVec(); - S32 tick_label_spacing = llmath::llround(screen_translate_axis * sTickLabelSpacing); + S32 tick_label_spacing = ll_round(screen_translate_axis * sTickLabelSpacing); // render tickmark values for (S32 i = -num_ticks_per_side; i <= num_ticks_per_side; i++) @@ -1420,7 +1420,7 @@ void LLManipTranslate::renderSnapGuides() F32 offset_val = 0.5f * tick_offset.mV[ARROW_TO_AXIS[mManipPart]] / getMinGridScale(); EGridMode grid_mode = LLSelectMgr::getInstance()->getGridMode(); F32 text_highlight = 0.8f; - if(i - llmath::llround(offset_nearest_grid_unit / smallest_grid_unit_scale) == 0 && mInSnapRegime) + if(i - ll_round(offset_nearest_grid_unit / smallest_grid_unit_scale) == 0 && mInSnapRegime) { text_highlight = 1.f; } diff --git a/indra/newview/llmediactrl.cpp b/indra/newview/llmediactrl.cpp index b4239080a..aec5eda8f 100644 --- a/indra/newview/llmediactrl.cpp +++ b/indra/newview/llmediactrl.cpp @@ -120,8 +120,8 @@ LLMediaCtrl::LLMediaCtrl( const Params& p) : if(!getDecoupleTextureSize()) { - S32 screen_width = llmath::llround((F32)getRect().getWidth() * LLUI::getScaleFactor().mV[VX]); - S32 screen_height = llmath::llround((F32)getRect().getHeight() * LLUI::getScaleFactor().mV[VY]); + S32 screen_width = ll_round((F32)getRect().getWidth() * LLUI::getScaleFactor().mV[VX]); + S32 screen_height = ll_round((F32)getRect().getHeight() * LLUI::getScaleFactor().mV[VY]); setTextureSize(screen_width, screen_height); } @@ -464,8 +464,8 @@ void LLMediaCtrl::reshape( S32 width, S32 height, BOOL called_from_parent ) { if(!getDecoupleTextureSize()) { - S32 screen_width = llmath::llround((F32)width * LLUI::getScaleFactor().mV[VX]); - S32 screen_height = llmath::llround((F32)height * LLUI::getScaleFactor().mV[VY]); + S32 screen_width = ll_round((F32)width * LLUI::getScaleFactor().mV[VX]); + S32 screen_height = ll_round((F32)height * LLUI::getScaleFactor().mV[VY]); // when floater is minimized, these sizes are negative if ( screen_height > 0 && screen_width > 0 ) @@ -797,13 +797,13 @@ void LLMediaCtrl::draw() { // max width, adjusted height width = r.getWidth(); - height = llmin(llmax(llmath::llround(width / media_aspect), 0), r.getHeight()); + height = llmin(llmax(ll_round(width / media_aspect), 0), r.getHeight()); } else { // max height, adjusted width height = r.getHeight(); - width = llmin(llmax(llmath::llround(height * media_aspect), 0), r.getWidth()); + width = llmin(llmax(ll_round(height * media_aspect), 0), r.getWidth()); } } else @@ -823,10 +823,10 @@ void LLMediaCtrl::draw() /*if (mIgnoreUIScale) { - x_offset = llmath::llround((F32)x_offset * LLUI::getScaleFactor().mV[VX]); - y_offset = llmath::llround((F32)y_offset * LLUI::getScaleFactor().mV[VY]); - width = llmath::llround((F32)width * LLUI::getScaleFactor().mV[VX]); - height = llmath::llround((F32)height * LLUI::getScaleFactor().mV[VY]); + x_offset = ll_round((F32)x_offset * LLUI::getScaleFactor().mV[VX]); + y_offset = ll_round((F32)y_offset * LLUI::getScaleFactor().mV[VY]); + width = ll_round((F32)width * LLUI::getScaleFactor().mV[VX]); + height = ll_round((F32)height * LLUI::getScaleFactor().mV[VY]); }*/ // draw the browser @@ -897,14 +897,14 @@ void LLMediaCtrl::convertInputCoords(S32& x, S32& y) coords_opengl = mMediaSource->getMediaPlugin()->getTextureCoordsOpenGL(); } - x = llmath::llround((F32)x * LLUI::getScaleFactor().mV[VX]); + x = ll_round((F32)x * LLUI::getScaleFactor().mV[VX]); if ( ! coords_opengl ) { - y = llmath::llround((F32)(y) * LLUI::getScaleFactor().mV[VY]); + y = ll_round((F32)(y) * LLUI::getScaleFactor().mV[VY]); } else { - y = llmath::llround((F32)(getRect().getHeight() - y) * LLUI::getScaleFactor().mV[VY]); + y = ll_round((F32)(getRect().getHeight() - y) * LLUI::getScaleFactor().mV[VY]); }; } diff --git a/indra/newview/llmenucommands.cpp b/indra/newview/llmenucommands.cpp index fdd533257..e7684b034 100644 --- a/indra/newview/llmenucommands.cpp +++ b/indra/newview/llmenucommands.cpp @@ -35,6 +35,7 @@ #include "llmenucommands.h" #include "aihttpview.h" +#include "alfloaterregiontracker.h" #include "floaterao.h" #include "floaterlocalassetbrowse.h" #include "hbfloatergrouptitles.h" @@ -239,6 +240,7 @@ struct MenuFloaterDict : public LLSingleton registerFloater ("pathfinding_linksets"); registerFloater ("perm prefs"); registerFloater ("radar"); + registerFloater ("region_tracker"); registerFloater ("script info"); registerFloater ("stat bar"); registerFloater ("teleport history"); diff --git a/indra/newview/llmeshrepository.h b/indra/newview/llmeshrepository.h index de26a1ba0..71442b009 100644 --- a/indra/newview/llmeshrepository.h +++ b/indra/newview/llmeshrepository.h @@ -32,7 +32,6 @@ #include "lluuid.h" #include "llviewertexture.h" #include "llvolume.h" -#include "sguuidhash.h" #define LLCONVEXDECOMPINTER_STATIC 1 diff --git a/indra/newview/llmutelist.cpp b/indra/newview/llmutelist.cpp index 4fb306317..2551b3216 100644 --- a/indra/newview/llmutelist.cpp +++ b/indra/newview/llmutelist.cpp @@ -500,7 +500,7 @@ BOOL LLMuteList::autoRemove(const LLUUID& agent_id, const EAutoReason reason) { BOOL removed = FALSE; - if (isMuted(agent_id) && !(reason == AR_INVENTORY && gSavedSettings.getBOOL("AutoresponseMutedItem"))) + if (isMuted(agent_id) && !(reason == AR_INVENTORY && gSavedPerAccountSettings.getBOOL("AutoresponseMutedItem"))) { LLMute automute(agent_id, LLStringUtil::null, LLMute::AGENT); removed = TRUE; diff --git a/indra/newview/llnetmap.cpp b/indra/newview/llnetmap.cpp index adacb2a79..cff819560 100644 --- a/indra/newview/llnetmap.cpp +++ b/indra/newview/llnetmap.cpp @@ -76,7 +76,6 @@ // #include "lfsimfeaturehandler.h" #include "llfloateravatarlist.h" -#include "llmutelist.h" #include "llvoavatar.h" // @@ -314,7 +313,7 @@ void LLNetMap::draw() static const LLCachedControl live_region_color(gColors, "NetMapLiveRegion"); static const LLCachedControl dead_region_color(gColors, "NetMapDeadRegion"); // Aurora Sim - //S32 region_width = llmath::llround(LLWorld::getInstance()->getRegionWidthInMeters()); + //S32 region_width = ll_round(LLWorld::getInstance()->getRegionWidthInMeters()); S32 region_width = REGION_WIDTH_UNITS; // Aurora Sim @@ -558,10 +557,9 @@ void LLNetMap::draw() // [RLVa:KB] - Version: 1.23.4 | Alternate: Snowglobe-1.2.4 | Checked: 2009-07-08 (RLVa-1.0.0e) | Modified: RLVa-0.2.0b bool show_friends = !gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMES); // [/RLVa:KB] - uuid_vec_t avatar_ids; - std::vector positions; + LLWorld::pos_map_t positions; - LLWorld::getInstance()->getAvatars(&avatar_ids, &positions, gAgentCamera.getCameraPositionGlobal()); + LLWorld::getInstance()->getAvatars(&positions, gAgentCamera.getCameraPositionGlobal()); // Get the selected ids from radar now, as they are loop invariant uuid_vec_t gmSelected; @@ -570,57 +568,30 @@ void LLNetMap::draw() gmSelected = LLFloaterAvatarList::instance().getSelectedIDs(); // Draw avatars - for(U32 i=0; ifirst; static const LLCachedControl standard_color("MapAvatar",LLColor4(0.f,1.f,0.f,1.f)); LLColor4 color = standard_color; // TODO: it'd be very cool to draw these in sorted order from lowest Z to highest. // just be careful to sort the avatar IDs along with the positions. -MG - pos_map = globalPosToView(positions[i]); - if (positions[i].mdV[VZ] == 0.f || positions[i].mdV[VZ] == COARSEUPDATE_MAX_Z) + const LLVector3d& position = iter->second; + pos_map = globalPosToView(position); + if (position.mdV[VZ] == 0.f || position.mdV[VZ] == COARSEUPDATE_MAX_Z) { pos_map.mV[VZ] = 16000.f; } if (dist_vec(LLVector2(pos_map.mV[VX], pos_map.mV[VY]), LLVector2(local_mouse_x, local_mouse_y)) < min_pick_dist) { - mClosestAgentsToCursor[uuid] = positions[i]; + mClosestAgentsToCursor[uuid] = position; static const LLCachedControl map_avatar_rollover_color(gSavedSettings, "ExodusMapRolloverColor", LLColor4::cyan); color = map_avatar_rollover_color; } else { - - if(LLMuteList::getInstance()->isMuted(uuid)) - { - static const LLCachedControl muted_color("AscentMutedColor",LLColor4(0.7f,0.7f,0.7f,1.f)); - color = muted_color; - } - - LLViewerRegion* avatar_region = LLWorld::getInstance()->getRegionFromPosGlobal(positions[i]); - const LLUUID estate_owner = avatar_region ? avatar_region->getOwner() : LLUUID::null; - - // MOYMOD Minimap custom av colors. - if (mm_getMarkerColor(uuid, color)) {} - //Lindens are always more Linden than your friend, make that take precedence - else if (LLMuteList::getInstance()->isLinden(uuid)) - { - static const LLCachedControl linden_color("AscentLindenColor",LLColor4(0.f,0.f,1.f,1.f)); - color = linden_color; - } - //check if they are an estate owner at their current position - else if (estate_owner.notNull() && uuid == estate_owner) - { - static const LLCachedControl em_color("AscentEstateOwnerColor",LLColor4(1.f,0.6f,1.f,1.f)); - color = em_color; - } - //without these dots, SL would suck. - else if (show_friends && LLAvatarActions::isFriend(uuid)) - { - static const LLCachedControl friend_color("AscentFriendColor",LLColor4(1.f,1.f,0.f,1.f)); - color = friend_color; - } + bool getCustomColorRLV(const LLUUID&, LLColor4&, LLViewerRegion*, bool name_restricted); + getCustomColorRLV(uuid, color, LLWorld::getInstance()->getRegionFromPosGlobal(position), !show_friends); } LLWorldMapView::drawAvatar( @@ -650,8 +621,8 @@ void LLNetMap::draw() (pos_map.mV[VX] >= getRect().getWidth()) || (pos_map.mV[VY] >= getRect().getHeight()) ) { - S32 x = llmath::llround( pos_map.mV[VX] ); - S32 y = llmath::llround( pos_map.mV[VY] ); + S32 x = ll_round( pos_map.mV[VX] ); + S32 y = ll_round( pos_map.mV[VY] ); LLWorldMapView::drawTrackingCircle( getRect(), x, y, color, 1, 10); } @@ -687,13 +658,13 @@ void LLNetMap::draw() } pos_map = globalPosToView(gAgent.getPositionGlobal()); - S32 dot_width = llmath::llround(mDotRadius * 2.f); + S32 dot_width = ll_round(mDotRadius * 2.f); LLUIImagePtr you = LLWorldMapView::sAvatarYouLargeImage; if (you) { - you->draw(llmath::llround(pos_map.mV[VX] - mDotRadius), - llmath::llround(pos_map.mV[VY] - mDotRadius), + you->draw(ll_round(pos_map.mV[VX] - mDotRadius), + ll_round(pos_map.mV[VY] - mDotRadius), dot_width, dot_width); @@ -856,8 +827,8 @@ void LLNetMap::drawTracking(const LLVector3d& pos_global, const LLColor4& color, { if (draw_arrow) { - S32 x = llmath::llround( pos_local.mV[VX] ); - S32 y = llmath::llround( pos_local.mV[VY] ); + S32 x = ll_round( pos_local.mV[VX] ); + S32 y = ll_round( pos_local.mV[VY] ); LLWorldMapView::drawTrackingCircle( getRect(), x, y, color, 1, 10 ); LLWorldMapView::drawTrackingArrow( getRect(), x, y, color ); } @@ -873,8 +844,8 @@ void LLNetMap::drawTracking(const LLVector3d& pos_global, const LLColor4& color, LLVector3d LLNetMap::viewPosToGlobal( S32 x, S32 y ) { - x -= llmath::llround(getRect().getWidth() / 2 + mCurPan.mV[VX]); - y -= llmath::llround(getRect().getHeight() / 2 + mCurPan.mV[VY]); + x -= ll_round(getRect().getWidth() / 2 + mCurPan.mV[VX]); + y -= ll_round(getRect().getHeight() / 2 + mCurPan.mV[VY]); LLVector3 pos_local( (F32)x, (F32)y, 0 ); @@ -1020,8 +991,8 @@ void LLNetMap::setDirectionPos( LLTextBox* text_box, F32 rotation ) // Inset by a little to account for position display. radius -= 8.f; - text_box->setOrigin(llmath::llround(half_width + radius * cos( rotation )), - llmath::llround(half_height + radius * sin( rotation ))); + text_box->setOrigin(ll_round(half_width + radius * cos( rotation )), + ll_round(half_height + radius * sin( rotation ))); } void LLNetMap::updateMinorDirections() @@ -1050,7 +1021,7 @@ void LLNetMap::renderScaledPointGlobal( const LLVector3d& pos, const LLColor4U & const F32 MAX_RADIUS = 256.0f; F32 radius_clamped = llmin(radius_meters, MAX_RADIUS); - S32 diameter_pixels = llmath::llround(2 * radius_clamped * mObjectMapTPM); + S32 diameter_pixels = ll_round(2 * radius_clamped * mObjectMapTPM); renderPoint( local_pos, color, diameter_pixels ); } @@ -1066,8 +1037,8 @@ void LLNetMap::renderPoint(const LLVector3 &pos_local, const LLColor4U &color, const S32 image_width = (S32)mObjectImagep->getWidth(); const S32 image_height = (S32)mObjectImagep->getHeight(); - S32 x_offset = llmath::llround(pos_local.mV[VX] * mObjectMapTPM + image_width / 2); - S32 y_offset = llmath::llround(pos_local.mV[VY] * mObjectMapTPM + image_height / 2); + S32 x_offset = ll_round(pos_local.mV[VX] * mObjectMapTPM + image_width / 2); + S32 y_offset = ll_round(pos_local.mV[VY] * mObjectMapTPM + image_height / 2); if ((x_offset < 0) || (x_offset >= image_width)) { @@ -1147,8 +1118,8 @@ void LLNetMap::renderPropertyLinesForRegion(const LLViewerRegion* pRegion, const const S32 imgHeight = (S32)mParcelImagep->getHeight(); const LLVector3 originLocal(pRegion->getOriginGlobal() - mParcelImageCenterGlobal); - const S32 originX = llmath::llround(originLocal.mV[VX] * mObjectMapTPM + imgWidth / 2); - const S32 originY = llmath::llround(originLocal.mV[VY] * mObjectMapTPM + imgHeight / 2); + const S32 originX = ll_round(originLocal.mV[VX] * mObjectMapTPM + imgWidth / 2); + const S32 originY = ll_round(originLocal.mV[VY] * mObjectMapTPM + imgHeight / 2); U32* pTextureData = (U32*)mParcelRawImagep->getData(); @@ -1156,17 +1127,17 @@ void LLNetMap::renderPropertyLinesForRegion(const LLViewerRegion* pRegion, const // Draw the north and east region borders // const F32 real_width(pRegion->getWidth()); -const S32 borderY = originY + llmath::llround(real_width * mObjectMapTPM); +const S32 borderY = originY + ll_round(real_width * mObjectMapTPM); if ( (borderY >= 0) && (borderY < imgHeight) ) { - S32 curX = llclamp(originX, 0, imgWidth), endX = llclamp(originX + llmath::llround(real_width * mObjectMapTPM), 0, imgWidth - 1); + S32 curX = llclamp(originX, 0, imgWidth), endX = llclamp(originX + ll_round(real_width * mObjectMapTPM), 0, imgWidth - 1); for (; curX <= endX; curX++) pTextureData[borderY * imgWidth + curX] = clrOverlay.mAll; } - const S32 borderX = originX + llmath::llround(real_width * mObjectMapTPM); + const S32 borderX = originX + ll_round(real_width * mObjectMapTPM); if ( (borderX >= 0) && (borderX < imgWidth) ) { - S32 curY = llclamp(originY, 0, imgHeight), endY = llclamp(originY + llmath::llround(real_width * mObjectMapTPM), 0, imgHeight - 1); + S32 curY = llclamp(originY, 0, imgHeight), endY = llclamp(originY + ll_round(real_width * mObjectMapTPM), 0, imgHeight - 1); for (; curY <= endY; curY++) pTextureData[curY * imgWidth + borderX] = clrOverlay.mAll; } @@ -1190,17 +1161,17 @@ const S32 borderY = originY + llmath::llround(real_width * mObjectMapTPM); if ( (!fForSale) && (!fCollision) && (0 == (overlay & (PARCEL_SOUTH_LINE | PARCEL_WEST_LINE))) ) continue; - const S32 posX = originX + llmath::llround(idxCol * GRID_STEP * mObjectMapTPM); - const S32 posY = originY + llmath::llround(idxRow * GRID_STEP * mObjectMapTPM); + const S32 posX = originX + ll_round(idxCol * GRID_STEP * mObjectMapTPM); + const S32 posY = originY + ll_round(idxRow * GRID_STEP * mObjectMapTPM); static LLCachedControl s_fForSaleParcels(gSavedSettings, "MiniMapForSaleParcels"); static LLCachedControl s_fShowCollisionParcels(gSavedSettings, "MiniMapCollisionParcels"); if ( ((s_fForSaleParcels) && (fForSale)) || ((s_fShowCollisionParcels) && (fCollision)) ) { - S32 curY = llclamp(posY, 0, imgHeight), endY = llclamp(posY + llmath::llround(GRID_STEP * mObjectMapTPM), 0, imgHeight - 1); + S32 curY = llclamp(posY, 0, imgHeight), endY = llclamp(posY + ll_round(GRID_STEP * mObjectMapTPM), 0, imgHeight - 1); for (; curY <= endY; curY++) { - S32 curX = llclamp(posX, 0, imgWidth) , endX = llclamp(posX + llmath::llround(GRID_STEP * mObjectMapTPM), 0, imgWidth - 1); + S32 curX = llclamp(posX, 0, imgWidth) , endX = llclamp(posX + ll_round(GRID_STEP * mObjectMapTPM), 0, imgWidth - 1); for (; curX <= endX; curX++) { pTextureData[curY * imgWidth + curX] = (fForSale) ? LLColor4U(255, 255, 128, 192).mAll @@ -1212,7 +1183,7 @@ const S32 borderY = originY + llmath::llround(real_width * mObjectMapTPM); { if ( (posY >= 0) && (posY < imgHeight) ) { - S32 curX = llclamp(posX, 0, imgWidth), endX = llclamp(posX + llmath::llround(GRID_STEP * mObjectMapTPM), 0, imgWidth - 1); + S32 curX = llclamp(posX, 0, imgWidth), endX = llclamp(posX + ll_round(GRID_STEP * mObjectMapTPM), 0, imgWidth - 1); for (; curX <= endX; curX++) pTextureData[posY * imgWidth + curX] = clrOverlay.mAll; } @@ -1221,7 +1192,7 @@ const S32 borderY = originY + llmath::llround(real_width * mObjectMapTPM); { if ( (posX >= 0) && (posX < imgWidth) ) { - S32 curY = llclamp(posY, 0, imgHeight), endY = llclamp(posY + llmath::llround(GRID_STEP * mObjectMapTPM), 0, imgHeight - 1); + S32 curY = llclamp(posY, 0, imgHeight), endY = llclamp(posY + ll_round(GRID_STEP * mObjectMapTPM), 0, imgHeight - 1); for (; curY <= endY; curY++) pTextureData[curY * imgWidth + posX] = clrOverlay.mAll; } @@ -1240,7 +1211,7 @@ bool LLNetMap::createImage(LLPointer& rawimagep) const // ... which is, the diagonal of the rect. F32 width = (F32)getRect().getWidth(); F32 height = (F32)getRect().getHeight(); - S32 square_size = llmath::llround( sqrt(width*width + height*height) ); + S32 square_size = ll_round( sqrt(width*width + height*height) ); // Find the least power of two >= the minimum size. const S32 MIN_SIZE = 64; diff --git a/indra/newview/llnotify.cpp b/indra/newview/llnotify.cpp index 9cbafafd2..81ac127cf 100644 --- a/indra/newview/llnotify.cpp +++ b/indra/newview/llnotify.cpp @@ -533,6 +533,7 @@ void LLNotifyBox::close() die(); if (not_tip) { + --sNotifyBoxCount; if (LLNotifyBox* front = gNotifyBoxView->getFirstNontipBox()) { gNotifyBoxView->showOnly(front); @@ -541,7 +542,6 @@ void LLNotifyBox::close() view->setFocus(true); gFocusMgr.triggerFocusFlash(); // TODO it's ugly to call this here } - --sNotifyBoxCount; } } diff --git a/indra/newview/lloverlaybar.cpp b/indra/newview/lloverlaybar.cpp index e20ead18d..fac6a04d6 100644 --- a/indra/newview/lloverlaybar.cpp +++ b/indra/newview/lloverlaybar.cpp @@ -322,7 +322,7 @@ void LLOverlayBar::refresh() } buttons_changed = true; } - buttons_changed |= updateButtonVisiblity(mNotBusy,gAgent.getBusy()) != NULL; + buttons_changed |= updateButtonVisiblity(mNotBusy, gAgent.isDoNotDisturb()) != NULL; buttons_changed |= updateButtonVisiblity(mFlyCam,LLViewerJoystick::getInstance()->getOverrideCamera()) != NULL; buttons_changed |= updateButtonVisiblity(mMouseLook,gAgent.isControlGrabbed(CONTROL_ML_LBUTTON_DOWN_INDEX)||gAgent.isControlGrabbed(CONTROL_ML_LBUTTON_UP_INDEX)) != NULL; // [RLVa:KB] - Checked: 2009-07-10 (RLVa-1.0.0g) @@ -374,7 +374,7 @@ void LLOverlayBar::onClickIMReceived(void*) // static void LLOverlayBar::onClickSetNotBusy(void*) { - gAgent.clearBusy(); + gAgent.setDoNotDisturb(false); } diff --git a/indra/newview/llpanelclassified.cpp b/indra/newview/llpanelclassified.cpp index b08150b57..de3223942 100644 --- a/indra/newview/llpanelclassified.cpp +++ b/indra/newview/llpanelclassified.cpp @@ -332,9 +332,9 @@ void LLPanelClassifiedInfo::processProperties(void* data, EAvatarProcessorType t if (!location_text.empty()) location_text.append(", "); - S32 region_x = llmath::llround((F32)c_info->pos_global.mdV[VX]) % REGION_WIDTH_UNITS; - S32 region_y = llmath::llround((F32)c_info->pos_global.mdV[VY]) % REGION_WIDTH_UNITS; - S32 region_z = llmath::llround((F32)c_info->pos_global.mdV[VZ]); + S32 region_x = ll_round((F32)c_info->pos_global.mdV[VX]) % REGION_WIDTH_UNITS; + S32 region_y = ll_round((F32)c_info->pos_global.mdV[VY]) % REGION_WIDTH_UNITS; + S32 region_z = ll_round((F32)c_info->pos_global.mdV[VZ]); std::string buffer = llformat("%s (%d, %d, %d)", c_info->sim_name.c_str(), region_x, region_y, region_z); location_text.append(buffer); @@ -893,9 +893,9 @@ void LLPanelClassifiedInfo::onClickSet() location_text.assign(regionName); location_text.append(", "); - S32 region_x = llmath::llround((F32)mPosGlobal.mdV[VX]) % REGION_WIDTH_UNITS; - S32 region_y = llmath::llround((F32)mPosGlobal.mdV[VY]) % REGION_WIDTH_UNITS; - S32 region_z = llmath::llround((F32)mPosGlobal.mdV[VZ]); + S32 region_x = ll_round((F32)mPosGlobal.mdV[VX]) % REGION_WIDTH_UNITS; + S32 region_y = ll_round((F32)mPosGlobal.mdV[VY]) % REGION_WIDTH_UNITS; + S32 region_z = ll_round((F32)mPosGlobal.mdV[VZ]); location_text.append(mSimName); location_text.append(llformat(" (%d, %d, %d)", region_x, region_y, region_z)); diff --git a/indra/newview/llpaneldisplay.cpp b/indra/newview/llpaneldisplay.cpp index 9ba12e570..688c03f6c 100644 --- a/indra/newview/llpaneldisplay.cpp +++ b/indra/newview/llpaneldisplay.cpp @@ -904,8 +904,8 @@ void LLPanelDisplay::fractionFromDecimal(F32 decimal_val, S32& numerator, S32& d { if (fmodf((decimal_val * test_denominator) + 0.01f, 1.f) < 0.02f) { - numerator = llmath::llround(decimal_val * test_denominator); - denominator = llmath::llround(test_denominator); + numerator = ll_round(decimal_val * test_denominator); + denominator = ll_round(test_denominator); break; } } diff --git a/indra/newview/llpanelevent.cpp b/indra/newview/llpanelevent.cpp index 6b57f1cf9..96ab2d426 100644 --- a/indra/newview/llpanelevent.cpp +++ b/indra/newview/llpanelevent.cpp @@ -154,9 +154,9 @@ void LLPanelEvent::processEventInfoReply(LLMessageSystem *msg, void **) F32 global_x = (F32)self->mEventInfo.mPosGlobal.mdV[VX]; F32 global_y = (F32)self->mEventInfo.mPosGlobal.mdV[VY]; - S32 region_x = llmath::llround(global_x) % REGION_WIDTH_UNITS; - S32 region_y = llmath::llround(global_y) % REGION_WIDTH_UNITS; - S32 region_z = llmath::llround((F32)self->mEventInfo.mPosGlobal.mdV[VZ]); + S32 region_x = ll_round(global_x) % REGION_WIDTH_UNITS; + S32 region_y = ll_round(global_y) % REGION_WIDTH_UNITS; + S32 region_z = ll_round((F32)self->mEventInfo.mPosGlobal.mdV[VZ]); std::string desc = self->mEventInfo.mSimName + llformat(" (%d, %d, %d)", region_x, region_y, region_z); self->mTBLocation->setText(desc); diff --git a/indra/newview/llpanelgrouplandmoney.cpp b/indra/newview/llpanelgrouplandmoney.cpp index 18000914c..bae454434 100644 --- a/indra/newview/llpanelgrouplandmoney.cpp +++ b/indra/newview/llpanelgrouplandmoney.cpp @@ -462,8 +462,8 @@ void LLPanelGroupLandMoney::impl::processGroupLand(LLMessageSystem* msg) land_type = LLTrans::getString("land_type_unknown"); } - S32 region_x = llmath::llround(global_x) % REGION_WIDTH_UNITS; - S32 region_y = llmath::llround(global_y) % REGION_WIDTH_UNITS; + S32 region_x = ll_round(global_x) % REGION_WIDTH_UNITS; + S32 region_y = ll_round(global_y) % REGION_WIDTH_UNITS; std::string location = sim_name + llformat(" (%d, %d)", region_x, region_y); std::string area; committed+=billable_area; diff --git a/indra/newview/llpanelgroupnotices.cpp b/indra/newview/llpanelgroupnotices.cpp index e6bfd0251..31d9ea516 100644 --- a/indra/newview/llpanelgroupnotices.cpp +++ b/indra/newview/llpanelgroupnotices.cpp @@ -124,7 +124,7 @@ BOOL LLGroupDropTarget::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, { BOOL handled = FALSE; - if (!gAgent.hasPowerInGroup(mEntityID,GP_NOTICES_SEND)) + if (!gAgent.hasPowerInGroup(mID,GP_NOTICES_SEND)) { *accept = ACCEPT_NO; return TRUE; diff --git a/indra/newview/llpanelgrouproles.cpp b/indra/newview/llpanelgrouproles.cpp index 2575b53d2..b180c7b70 100644 --- a/indra/newview/llpanelgrouproles.cpp +++ b/indra/newview/llpanelgrouproles.cpp @@ -51,7 +51,6 @@ #include "lltabcontainer.h" #include "lltextbox.h" #include "lltexteditor.h" -#include "lltrans.h" #include "llviewertexturelist.h" #include "llviewerwindow.h" #include "llfocusmgr.h" @@ -1670,10 +1669,9 @@ void LLPanelGroupMembersSubTab::update(LLGroupChange gc) bool is_online_status_string(const std::string& status) { - static const std::string online(LLTrans::getString("group_member_status_online")); - if (status == online) return true; - static const std::string unknown(LLTrans::getString("group_member_status_unknown")); - return status == unknown; + const std::string& localized_online(); + const std::string& localized_unknown(); + return status == localized_online() || status == localized_unknown(); } void LLPanelGroupMembersSubTab::addMemberToList(LLGroupMemberData* data) diff --git a/indra/newview/llpanellogin.cpp b/indra/newview/llpanellogin.cpp index 572a35145..614fa7392 100644 --- a/indra/newview/llpanellogin.cpp +++ b/indra/newview/llpanellogin.cpp @@ -381,12 +381,6 @@ void LLPanelLogin::draw() // virtual BOOL LLPanelLogin::handleKeyHere(KEY key, MASK mask) { - if (( KEY_RETURN == key ) && (MASK_ALT == mask)) - { - gViewerWindow->toggleFullscreen(FALSE); - return TRUE; - } - if (('T' == key) && (MASK_CONTROL == mask)) { new LLFloaterSimple("floater_test.xml"); @@ -503,14 +497,14 @@ void LLPanelLogin::setFields(const std::string& firstname, // fill it with MAX_PASSWORD characters so we get a // nice row of asterixes. const std::string filler("123456789!123456"); - sInstance->childSetText("password_edit", filler); + sInstance->getChild("password_edit")->setValue(filler); sInstance->mIncomingPassword = filler; sInstance->mMungedPassword = password; } else { // this is a normal text password - sInstance->childSetText("password_edit", password); + sInstance->getChild("password_edit")->setValue(password); sInstance->mIncomingPassword = password; LLMD5 pass((unsigned char *)password.c_str()); char munged_password[MD5HEX_STR_SIZE]; @@ -533,7 +527,7 @@ void LLPanelLogin::setFields(const LLSavedLoginEntry& entry, bool takeFocus) LLComboBox* login_combo = sInstance->getChild("username_combo"); login_combo->setTextEntry(fullname); login_combo->resetTextDirty(); - //sInstance->childSetText("username_combo", fullname); + //sInstance->getChild("username_combo")->setValue(fullname); std::string grid = entry.getGrid(); //grid comes via LLSavedLoginEntry, which uses full grid names, not nicks @@ -544,13 +538,13 @@ void LLPanelLogin::setFields(const LLSavedLoginEntry& entry, bool takeFocus) if (entry.getPassword().empty()) { - sInstance->childSetText("password_edit", std::string("")); + sInstance->getChild("password_edit")->setValue(LLStringUtil::null); remember_pass_check->setValue(LLSD(false)); } else { const std::string filler("123456789!123456"); - sInstance->childSetText("password_edit", filler); + sInstance->getChild("password_edit")->setValue(filler); sInstance->mIncomingPassword = filler; sInstance->mMungedPassword = entry.getPassword(); remember_pass_check->setValue(LLSD(true)); @@ -902,10 +896,8 @@ void LLPanelLogin::refreshLoginPage() sInstance->updateGridCombo(); - sInstance->childSetVisible("create_new_account_text", - !gHippoGridManager->getCurrentGrid()->getRegisterUrl().empty()); - sInstance->childSetVisible("forgot_password_text", - !gHippoGridManager->getCurrentGrid()->getPasswordUrl().empty()); + sInstance->getChildView("create_new_account_text")->setVisible(!gHippoGridManager->getCurrentGrid()->getRegisterUrl().empty()); + sInstance->getChildView("forgot_password_text")->setVisible(!gHippoGridManager->getCurrentGrid()->getPasswordUrl().empty()); std::string login_page = gHippoGridManager->getCurrentGrid()->getLoginPage(); if (!login_page.empty()) @@ -996,7 +988,7 @@ void LLPanelLogin::onLoginComboLostFocus(LLComboBox* combo_box) { if (combo_box->isTextDirty()) { - childSetText("password_edit", mIncomingPassword = mMungedPassword = LLStringUtil::null); + getChild("password_edit")->setValue(mIncomingPassword = mMungedPassword = LLStringUtil::null); combo_box->resetTextDirty(); } } diff --git a/indra/newview/llpanelnetwork.cpp b/indra/newview/llpanelnetwork.cpp index 05821a8a8..414c9275f 100644 --- a/indra/newview/llpanelnetwork.cpp +++ b/indra/newview/llpanelnetwork.cpp @@ -67,7 +67,11 @@ BOOL LLPanelNetwork::postBuild() childSetEnabled("connection_port", gSavedSettings.getBOOL("ConnectionPortEnabled")); childSetCommitCallback("connection_port_enabled", onCommitPort, this); - childSetValue("cache_size", (F32)gSavedSettings.getU32("CacheSize")); + if (LLUICtrl* ctrl = getChild("cache_size")) + { + ctrl->setValue((F32)gSavedSettings.getU32("CacheSize")); + ctrl->setCommitCallback(boost::bind(LLPanelNetwork::onClickClearCache, (void*)NULL)); + } childSetValue("max_bandwidth", gSavedSettings.getF32("ThrottleBandwidthKBPS")); childSetValue("tex_bandwidth", gSavedSettings.getF32("HTTPThrottleBandwidth")); childSetValue("http_textures", gSavedSettings.getBOOL("ImagePipelineUseHTTP")); diff --git a/indra/newview/llpanelobject.cpp b/indra/newview/llpanelobject.cpp index c93f41aa6..e7123d523 100644 --- a/indra/newview/llpanelobject.cpp +++ b/indra/newview/llpanelobject.cpp @@ -465,10 +465,10 @@ void LLPanelObject::getState( ) return; } - // can move or rotate only linked group with move permissions, or sub-object with move and modify perms - BOOL enable_move = objectp->permMove() && !objectp->isPermanentEnforced() && ((root_objectp == NULL) || !root_objectp->isPermanentEnforced()) && ( (objectp->permModify() && !objectp->isAttachment()) || !gSavedSettings.getBOOL("EditLinkedParts")); - BOOL enable_scale = objectp->permMove() && !objectp->isPermanentEnforced() && ((root_objectp == NULL) || !root_objectp->isPermanentEnforced()) && objectp->permModify(); - BOOL enable_rotate = objectp->permMove() && !objectp->isPermanentEnforced() && ((root_objectp == NULL) || !root_objectp->isPermanentEnforced()) && ( (objectp->permModify() && !objectp->isAttachment()) || !gSavedSettings.getBOOL("EditLinkedParts")); + // can move or rotate only linked group with move permissions + BOOL enable_move = objectp->permMove() && !objectp->isPermanentEnforced() && ((root_objectp == NULL) || !root_objectp->isPermanentEnforced()); + BOOL enable_scale = enable_move && objectp->permModify(); + BOOL enable_rotate = enable_move; S32 selected_count = LLSelectMgr::getInstance()->getSelection()->getObjectCount(); BOOL single_volume = (LLSelectMgr::getInstance()->selectionAllPCode( LL_PCODE_VOLUME )) @@ -565,9 +565,9 @@ void LLPanelObject::getState( ) LLQuaternion object_rot = objectp->getRotationEdit(); object_rot.getEulerAngles(&(mCurEulerDegrees.mV[VX]), &(mCurEulerDegrees.mV[VY]), &(mCurEulerDegrees.mV[VZ])); mCurEulerDegrees *= RAD_TO_DEG; - mCurEulerDegrees.mV[VX] = fmod(llmath::llround(mCurEulerDegrees.mV[VX], OBJECT_ROTATION_PRECISION) + 360.f, 360.f); - mCurEulerDegrees.mV[VY] = fmod(llmath::llround(mCurEulerDegrees.mV[VY], OBJECT_ROTATION_PRECISION) + 360.f, 360.f); - mCurEulerDegrees.mV[VZ] = fmod(llmath::llround(mCurEulerDegrees.mV[VZ], OBJECT_ROTATION_PRECISION) + 360.f, 360.f); + mCurEulerDegrees.mV[VX] = fmod(ll_round(mCurEulerDegrees.mV[VX], OBJECT_ROTATION_PRECISION) + 360.f, 360.f); + mCurEulerDegrees.mV[VY] = fmod(ll_round(mCurEulerDegrees.mV[VY], OBJECT_ROTATION_PRECISION) + 360.f, 360.f); + mCurEulerDegrees.mV[VZ] = fmod(ll_round(mCurEulerDegrees.mV[VZ], OBJECT_ROTATION_PRECISION) + 360.f, 360.f); if (enable_rotate) { @@ -1965,9 +1965,9 @@ void LLPanelObject::sendRotation(BOOL btn_down) if (mObject.isNull()) return; LLVector3 new_rot(mCtrlRotX->get(), mCtrlRotY->get(), mCtrlRotZ->get()); - new_rot.mV[VX] = llmath::llround(new_rot.mV[VX], OBJECT_ROTATION_PRECISION); - new_rot.mV[VY] = llmath::llround(new_rot.mV[VY], OBJECT_ROTATION_PRECISION); - new_rot.mV[VZ] = llmath::llround(new_rot.mV[VZ], OBJECT_ROTATION_PRECISION); + new_rot.mV[VX] = ll_round(new_rot.mV[VX], OBJECT_ROTATION_PRECISION); + new_rot.mV[VY] = ll_round(new_rot.mV[VY], OBJECT_ROTATION_PRECISION); + new_rot.mV[VZ] = ll_round(new_rot.mV[VZ], OBJECT_ROTATION_PRECISION); // Note: must compare before conversion to radians LLVector3 delta = new_rot - mCurEulerDegrees; diff --git a/indra/newview/llpanelpick.cpp b/indra/newview/llpanelpick.cpp index f949d482d..55e58a4c9 100644 --- a/indra/newview/llpanelpick.cpp +++ b/indra/newview/llpanelpick.cpp @@ -180,9 +180,9 @@ void LLPanelPick::processProperties(void* data, EAvatarProcessorType type) self->mImporting = false; } - S32 region_x = llmath::llround((F32)pick_info->pos_global.mdV[VX]) % REGION_WIDTH_UNITS; - S32 region_y = llmath::llround((F32)pick_info->pos_global.mdV[VY]) % REGION_WIDTH_UNITS; - S32 region_z = llmath::llround((F32)pick_info->pos_global.mdV[VZ]); + S32 region_x = ll_round((F32)pick_info->pos_global.mdV[VX]) % REGION_WIDTH_UNITS; + S32 region_y = ll_round((F32)pick_info->pos_global.mdV[VY]) % REGION_WIDTH_UNITS; + S32 region_z = ll_round((F32)pick_info->pos_global.mdV[VZ]); location_text.append(llformat("(%d, %d, %d)", region_x, region_y, region_z)); mDataReceived = true; @@ -403,9 +403,9 @@ void LLPanelPick::onClickSet() std::string location_text("(will update after save), " + mSimName); - S32 region_x = llmath::llround((F32)mPosGlobal.mdV[VX]) % REGION_WIDTH_UNITS; - S32 region_y = llmath::llround((F32)mPosGlobal.mdV[VY]) % REGION_WIDTH_UNITS; - S32 region_z = llmath::llround((F32)mPosGlobal.mdV[VZ]); + S32 region_x = ll_round((F32)mPosGlobal.mdV[VX]) % REGION_WIDTH_UNITS; + S32 region_y = ll_round((F32)mPosGlobal.mdV[VY]) % REGION_WIDTH_UNITS; + S32 region_z = ll_round((F32)mPosGlobal.mdV[VZ]); location_text.append(llformat(" (%d, %d, %d)", region_x, region_y, region_z)); // if sim name in pick is different from current sim name diff --git a/indra/newview/llpanelplace.cpp b/indra/newview/llpanelplace.cpp index dfa5d88ef..50901bb58 100644 --- a/indra/newview/llpanelplace.cpp +++ b/indra/newview/llpanelplace.cpp @@ -289,16 +289,16 @@ void LLPanelPlace::processParcelInfo(const LLParcelData& parcel_data) } // Just use given region position for display - S32 region_x = llmath::llround(mPosRegion.mV[0]); - S32 region_y = llmath::llround(mPosRegion.mV[1]); - S32 region_z = llmath::llround(mPosRegion.mV[2]); + S32 region_x = ll_round(mPosRegion.mV[0]); + S32 region_y = ll_round(mPosRegion.mV[1]); + S32 region_z = ll_round(mPosRegion.mV[2]); // If the region position is zero, grab position from the global if(mPosRegion.isExactlyZero()) { - region_x = llmath::llround(parcel_data.global_x) % REGION_WIDTH_UNITS; - region_y = llmath::llround(parcel_data.global_y) % REGION_WIDTH_UNITS; - region_z = llmath::llround(parcel_data.global_z); + region_x = ll_round(parcel_data.global_x) % REGION_WIDTH_UNITS; + region_y = ll_round(parcel_data.global_y) % REGION_WIDTH_UNITS; + region_z = ll_round(parcel_data.global_z); } if(mPosGlobal.isExactlyZero()) diff --git a/indra/newview/llpanelprimmediacontrols.cpp b/indra/newview/llpanelprimmediacontrols.cpp index 91372b23c..3a05ba1ef 100644 --- a/indra/newview/llpanelprimmediacontrols.cpp +++ b/indra/newview/llpanelprimmediacontrols.cpp @@ -642,12 +642,12 @@ void LLPanelPrimMediaControls::updateShape() // convert screenspace bbox to pixels (in screen coords) LLRect window_rect = gViewerWindow->getWorldViewRectScaled(); LLCoordGL screen_min; - screen_min.mX = llmath::llround((F32)window_rect.mLeft + (F32)window_rect.getWidth() * (min.getF32ptr()[VX] + 1.f) * 0.5f); - screen_min.mY = llmath::llround((F32)window_rect.mBottom + (F32)window_rect.getHeight() * (min.getF32ptr()[VY] + 1.f) * 0.5f); + screen_min.mX = ll_round((F32)window_rect.mLeft + (F32)window_rect.getWidth() * (min.getF32ptr()[VX] + 1.f) * 0.5f); + screen_min.mY = ll_round((F32)window_rect.mBottom + (F32)window_rect.getHeight() * (min.getF32ptr()[VY] + 1.f) * 0.5f); LLCoordGL screen_max; - screen_max.mX = llmath::llround((F32)window_rect.mLeft + (F32)window_rect.getWidth() * (max.getF32ptr()[VX] + 1.f) * 0.5f); - screen_max.mY = llmath::llround((F32)window_rect.mBottom + (F32)window_rect.getHeight() * (max.getF32ptr()[VY] + 1.f) * 0.5f); + screen_max.mX = ll_round((F32)window_rect.mLeft + (F32)window_rect.getWidth() * (max.getF32ptr()[VX] + 1.f) * 0.5f); + screen_max.mY = ll_round((F32)window_rect.mBottom + (F32)window_rect.getHeight() * (max.getF32ptr()[VY] + 1.f) * 0.5f); // grow panel so that screenspace bounding box fits inside "media_region" element of panel LLRect media_panel_rect; diff --git a/indra/newview/llpreviewgesture.cpp b/indra/newview/llpreviewgesture.cpp index eb5a75972..b6e31b52e 100644 --- a/indra/newview/llpreviewgesture.cpp +++ b/indra/newview/llpreviewgesture.cpp @@ -44,6 +44,7 @@ #include "lldatapacker.h" #include "lldelayedgestureerror.h" #include "llfloatergesture.h" // for some label constants +#include "llflyoutbutton.h" #include "llgesturemgr.h" #include "llinventorydefines.h" #include "llinventoryfunctions.h" @@ -493,17 +494,17 @@ BOOL LLPreviewGesture::postBuild() mWaitTimeEditor = edit; // Buttons at the bottom - check = getChild( "active_check"); + check = getChild("active_check"); check->setCommitCallback(boost::bind(&LLPreviewGesture::onCommitActive,this)); mActiveCheck = check; - btn = getChild( "save_btn"); + btn = getChild("save_btn"); btn->setClickedCallback(boost::bind(&LLPreviewGesture::onClickSave,this)); mSaveBtn = btn; - btn = getChild( "preview_btn"); - btn->setClickedCallback(boost::bind(&LLPreviewGesture::onClickPreview,this)); - mPreviewBtn = btn; + LLFlyoutButton* flyout = getChild("preview_btn"); + flyout->setCommitCallback(boost::bind(&LLPreviewGesture::onClickPreview, this, _2)); + mPreviewBtn = flyout; // Populate the comboboxes @@ -1740,7 +1741,7 @@ void LLPreviewGesture::onClickSave() saveIfNeeded(); } -void LLPreviewGesture::onClickPreview() +void LLPreviewGesture::onClickPreview(bool local) { if (!mPreviewGesture) { @@ -1754,17 +1755,15 @@ void LLPreviewGesture::onClickPreview() mPreviewBtn->setLabel(getString("stop_txt")); // play it, and delete when done - LLGestureMgr::instance().playGesture(mPreviewGesture); - - refresh(); + LLGestureMgr::instance().playGesture(mPreviewGesture, local); } else { // Will call onDonePreview() below LLGestureMgr::instance().stopGesture(mPreviewGesture); - - refresh(); } + + refresh(); } diff --git a/indra/newview/llpreviewgesture.h b/indra/newview/llpreviewgesture.h index d4d7228f4..7bb27063f 100644 --- a/indra/newview/llpreviewgesture.h +++ b/indra/newview/llpreviewgesture.h @@ -137,7 +137,7 @@ protected: void onCommitActive(); void onClickSave(); - void onClickPreview(); + void onClickPreview(bool local); void onDonePreview(LLMultiGesture* gesture); @@ -170,7 +170,7 @@ protected: LLCheckBoxCtrl* mActiveCheck; LLButton* mSaveBtn; - LLButton* mPreviewBtn; + class LLFlyoutButton* mPreviewBtn; LLMultiGesture* mPreviewGesture; BOOL mDirty; diff --git a/indra/newview/llpreviewtexture.cpp b/indra/newview/llpreviewtexture.cpp index 4127cfadc..1427f0d13 100644 --- a/indra/newview/llpreviewtexture.cpp +++ b/indra/newview/llpreviewtexture.cpp @@ -590,7 +590,7 @@ void LLPreviewTexture::updateDimensions() client_width = getRect().getWidth() - horiz_pad; if (mAspectRatio > 0.f) { - client_height = llmath::llround(client_width / mAspectRatio); + client_height = ll_round(client_width / mAspectRatio); } else { @@ -608,7 +608,7 @@ void LLPreviewTexture::updateDimensions() if (client_height > max_height) { client_height = max_height; - client_width = llmath::llround(client_height * mAspectRatio); + client_width = ll_round(client_height * mAspectRatio); } } else diff --git a/indra/newview/llslurl.cpp b/indra/newview/llslurl.cpp index 5862dd958..d22178377 100644 --- a/indra/newview/llslurl.cpp +++ b/indra/newview/llslurl.cpp @@ -356,9 +356,9 @@ LLSLURL::LLSLURL(const std::string& grid, { mGrid = grid; mRegion = region; - S32 x = llmath::llround( (F32)position[VX] ); - S32 y = llmath::llround( (F32)position[VY] ); - S32 z = llmath::llround( (F32)position[VZ] ); + S32 x = ll_round( (F32)position[VX] ); + S32 y = ll_round( (F32)position[VY] ); + S32 z = ll_round( (F32)position[VZ] ); mType = LOCATION; mPosition = LLVector3(x, y, z); } @@ -417,9 +417,9 @@ std::string LLSLURL::getSLURLString() const case LOCATION: { // lookup the grid - S32 x = llmath::llround( (F32)mPosition[VX] ); - S32 y = llmath::llround( (F32)mPosition[VY] ); - S32 z = llmath::llround( (F32)mPosition[VZ] ); + S32 x = ll_round( (F32)mPosition[VX] ); + S32 y = ll_round( (F32)mPosition[VY] ); + S32 z = ll_round( (F32)mPosition[VZ] ); //return LLGridManager::getInstance()->getSLURLBase(mGrid) + //Singu TODO: Implement LLHippoGridMgr::getSLURLBase some day. For now it's hardcoded. std::string fixed_slurl; @@ -471,9 +471,9 @@ std::string LLSLURL::getLoginString() const case LOCATION: unescaped_start << "uri:" << mRegion << "&" - << llmath::llround(mPosition[0]) << "&" - << llmath::llround(mPosition[1]) << "&" - << llmath::llround(mPosition[2]); + << ll_round(mPosition[0]) << "&" + << ll_round(mPosition[1]) << "&" + << ll_round(mPosition[2]); break; case HOME_LOCATION: unescaped_start << "home"; @@ -517,9 +517,9 @@ std::string LLSLURL::getLocationString() const { return llformat("%s/%d/%d/%d", mRegion.c_str(), - (int)llmath::llround(mPosition[0]), - (int)llmath::llround(mPosition[1]), - (int)llmath::llround(mPosition[2])); + (int)ll_round(mPosition[0]), + (int)ll_round(mPosition[1]), + (int)ll_round(mPosition[2])); } // static diff --git a/indra/newview/llspeakers.cpp b/indra/newview/llspeakers.cpp index c1a497e39..c1b794500 100644 --- a/indra/newview/llspeakers.cpp +++ b/indra/newview/llspeakers.cpp @@ -42,6 +42,8 @@ #include "rlvhandler.h" +#include + extern AIHTTPTimeoutPolicy moderationResponder_timeout; const LLColor4 INACTIVE_COLOR(0.3f, 0.3f, 0.3f, 0.5f); @@ -580,7 +582,8 @@ void LLSpeakerMgr::updateSpeakerList() LLGroupMemberData* member = member_it->second; LLUUID id = member_it->first; // Add only members who are online and not already in the list - if ((member->getOnlineStatus() == "Online") && (mSpeakers.find(id) == mSpeakers.end())) + const std::string& localized_online(); + if ((member->getOnlineStatus() == localized_online()) && (mSpeakers.find(id) == mSpeakers.end())) { LLPointer speakerp = setSpeaker(id, "", LLSpeaker::STATUS_VOICE_ACTIVE, LLSpeaker::SPEAKER_AGENT); speakerp->mIsModerator = ((member->getAgentPowers() & GP_SESSION_MODERATOR) == GP_SESSION_MODERATOR); @@ -1040,11 +1043,10 @@ void LLLocalSpeakerMgr::updateSpeakerList() // pick up non-voice speakers in chat range uuid_vec_t avatar_ids; - std::vector positions; - LLWorld::getInstance()->getAvatars(&avatar_ids, &positions, gAgent.getPositionGlobal(), CHAT_NORMAL_RADIUS); - for(U32 i=0; igetAvatars(&avatar_ids, NULL, gAgent.getPositionGlobal(), CHAT_NORMAL_RADIUS); + BOOST_FOREACH(const LLUUID& id, avatar_ids) { - setSpeaker(avatar_ids[i]); + setSpeaker(id); } // check if text only speakers have moved out of chat range diff --git a/indra/newview/llsurface.cpp b/indra/newview/llsurface.cpp index 00aed4b19..cc587197e 100644 --- a/indra/newview/llsurface.cpp +++ b/indra/newview/llsurface.cpp @@ -1424,10 +1424,10 @@ BOOL LLSurface::generateWaterTexture(const F32 x, const F32 y, S32 x_begin, y_begin, x_end, y_end; - x_begin = llmath::llround(x * scale_inv); - y_begin = llmath::llround(y * scale_inv); - x_end = llmath::llround((x + width) * scale_inv); - y_end = llmath::llround((y + width) * scale_inv); + x_begin = ll_round(x * scale_inv); + y_begin = ll_round(y * scale_inv); + x_end = ll_round((x + width) * scale_inv); + y_end = ll_round((y + width) * scale_inv); if (x_end > tex_width) { @@ -1475,9 +1475,9 @@ BOOL LLSurface::generateWaterTexture(const F32 x, const F32 y, // Want non-linear curve for transparency gradient coloru = MAX_WATER_COLOR; const F32 frac = 1.f - 2.f/(2.f - (height - WATER_HEIGHT)); - S32 alpha = 64 + llmath::llround((255-64)*frac); + S32 alpha = 64 + ll_round((255-64)*frac); - alpha = llmin(llmath::llround((F32)MAX_WATER_COLOR.mV[3]), alpha); + alpha = llmin(ll_round((F32)MAX_WATER_COLOR.mV[3]), alpha); alpha = llmax(64, alpha); coloru.mV[3] = alpha; diff --git a/indra/newview/lltexturectrl.cpp b/indra/newview/lltexturectrl.cpp index d0b2bfa13..3513811df 100644 --- a/indra/newview/lltexturectrl.cpp +++ b/indra/newview/lltexturectrl.cpp @@ -1167,7 +1167,7 @@ LLTextureCtrl::LLTextureCtrl( S32 image_top = getRect().getHeight(); S32 image_bottom = BTN_HEIGHT_SMALL; S32 image_middle = (image_top + image_bottom) / 2; - S32 line_height = llmath::llround(LLFontGL::getFontSansSerifSmall()->getLineHeight()); + S32 line_height = ll_round(LLFontGL::getFontSansSerifSmall()->getLineHeight()); mTentativeLabel = new LLTextBox( std::string("Multiple"), LLRect( diff --git a/indra/newview/lltoolgun.cpp b/indra/newview/lltoolgun.cpp index 07629eefc..001fd42af 100644 --- a/indra/newview/lltoolgun.cpp +++ b/indra/newview/lltoolgun.cpp @@ -48,14 +48,20 @@ #include "llhudmanager.h" #include "lltoolmgr.h" #include "lltoolgrab.h" - +#include "lluiimage.h" // Linden library includes #include "llwindow.h" // setMouseClipping() +bool getCustomColorRLV(const LLUUID& id, LLColor4& color, LLViewerRegion* parent_estate, bool name_restricted); +#include "llavatarnamecache.h" +#include "llworld.h" +#include "rlvhandler.h" + LLToolGun::LLToolGun( LLToolComposite* composite ) : LLTool( std::string("gun"), composite ), mIsSelected(FALSE) { + mCrosshairp = LLUI::getUIImage("UIImgCrosshairsUUID"); // - UI Caching } void LLToolGun::handleSelect() @@ -95,8 +101,8 @@ BOOL LLToolGun::handleHover(S32 x, S32 y, MASK mask) { const F32 NOMINAL_MOUSE_SENSITIVITY = 0.0025f; - F32 mouse_sensitivity = gSavedSettings.getF32("MouseSensitivity"); - mouse_sensitivity = clamp_rescale(mouse_sensitivity, 0.f, 15.f, 0.5f, 2.75f) * NOMINAL_MOUSE_SENSITIVITY; + static LLCachedControl mouse_sensitivity_setting(gSavedSettings, "MouseSensitivity"); + F32 mouse_sensitivity = clamp_rescale(mouse_sensitivity_setting, 0.f, 15.f, 0.5f, 2.75f) * NOMINAL_MOUSE_SENSITIVITY; // ...move the view with the mouse @@ -107,18 +113,21 @@ BOOL LLToolGun::handleHover(S32 x, S32 y, MASK mask) if (dx != 0 || dy != 0) { // ...actually moved off center - if (gSavedSettings.getBOOL("InvertMouse")) + const F32 fov = LLViewerCamera::getInstance()->getView() / DEFAULT_FIELD_OF_VIEW; + static LLCachedControl invert_mouse(gSavedSettings, "InvertMouse"); + if (invert_mouse) { - gAgent.pitch(mouse_sensitivity * -dy); + gAgent.pitch(mouse_sensitivity * fov * -dy); } else { - gAgent.pitch(mouse_sensitivity * dy); + gAgent.pitch(mouse_sensitivity * fov * dy); } LLVector3 skyward = gAgent.getReferenceUpVector(); - gAgent.rotate(mouse_sensitivity * dx, skyward.mV[VX], skyward.mV[VY], skyward.mV[VZ]); + gAgent.rotate(mouse_sensitivity * fov * dx, skyward.mV[VX], skyward.mV[VY], skyward.mV[VZ]); - if (gSavedSettings.getBOOL("MouseSun")) + static LLCachedControl mouse_sun(gSavedSettings, "MouseSun"); + if (mouse_sun) { gSky.setSunDirection(LLViewerCamera::getInstance()->getAtAxis(), LLVector3(0.f, 0.f, 0.f)); gSky.setOverrideSun(TRUE); @@ -129,11 +138,11 @@ BOOL LLToolGun::handleHover(S32 x, S32 y, MASK mask) gViewerWindow->hideCursor(); } - lldebugst(LLERR_USER_INPUT) << "hover handled by LLToolGun (mouselook)" << llendl; + LL_DEBUGS("UserInput") << "hover handled by LLToolGun (mouselook)" << LL_ENDL; } else { - lldebugst(LLERR_USER_INPUT) << "hover handled by LLToolGun (not mouselook)" << llendl; + LL_DEBUGS("UserInput") << "hover handled by LLToolGun (not mouselook)" << LL_ENDL; } // HACK to avoid assert: error checking system makes sure that the cursor is set during every handleHover. This is actually a no-op since the cursor is hidden. @@ -144,14 +153,57 @@ BOOL LLToolGun::handleHover(S32 x, S32 y, MASK mask) void LLToolGun::draw() { - static const LLCachedControl show("ShowCrosshairs"); - if (show) + static LLCachedControl show_crosshairs(gSavedSettings, "ShowCrosshairs"); + static LLCachedControl show_iff(gSavedSettings, "AlchemyMouselookIFF", true); + static LLCachedControl iff_range(gSavedSettings, "AlchemyMouselookIFFRange", 380.f); + if (show_crosshairs) { - LLUIImagePtr crosshair = LLUI::getUIImage("UIImgCrosshairsUUID"); + const S32 windowWidth = gViewerWindow->getWorldViewRectScaled().getWidth(); + const S32 windowHeight = gViewerWindow->getWorldViewRectScaled().getHeight(); static const LLCachedControl color("LiruCrosshairColor"); - crosshair->draw( - ( gViewerWindow->getWorldViewRectScaled().getWidth() - crosshair->getWidth() ) / 2, - ( gViewerWindow->getWorldViewRectScaled().getHeight() - crosshair->getHeight() ) / 2, - color); + LLColor4 targetColor = color; + targetColor.mV[VALPHA] = 0.5f; + if (show_iff) + { + LLVector3d myPosition = gAgentCamera.getCameraPositionGlobal(); + LLQuaternion myRotation = LLViewerCamera::getInstance()->getQuaternion(); + myRotation.set(-myRotation.mQ[VX], -myRotation.mQ[VY], -myRotation.mQ[VZ], myRotation.mQ[VW]); + + LLWorld::pos_map_t positions; + LLWorld& world(LLWorld::instance()); + world.getAvatars(&positions, gAgent.getPositionGlobal(), iff_range); + for (LLWorld::pos_map_t::const_iterator iter = positions.cbegin(), iter_end = positions.cend(); iter != iter_end; ++iter) + { + const LLUUID& id = iter->first; + const LLVector3d& targetPosition = iter->second; + if (id == gAgentID || targetPosition.isNull()) + { + continue; + } + + LLVector3d magicVector = (targetPosition - myPosition) * myRotation; + magicVector.setVec(-magicVector.mdV[VY], magicVector.mdV[VZ], magicVector.mdV[VX]); + if (magicVector.mdV[VX] > -0.75 && magicVector.mdV[VX] < 0.75 && magicVector.mdV[VZ] > 0.0 && magicVector.mdV[VY] > -1.5 && magicVector.mdV[VY] < 1.5) // Do not fuck with these, cheater. :( + { + LLAvatarName avatarName; + LLAvatarNameCache::get(id, &avatarName); + bool name_restricted = gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMES); + getCustomColorRLV(id, targetColor, world.getRegionFromPosGlobal(targetPosition), name_restricted); + const std::string name(name_restricted ? RlvStrings::getAnonym(avatarName.getNSName()) : avatarName.getNSName()); + targetColor.mV[VALPHA] = 0.5f; + LLFontGL::getFontSansSerifBold()->renderUTF8( + gRlvHandler.hasBehaviour(RLV_BHVR_SHOWLOC) ? name : llformat("%s : %.2fm", name.c_str(), (targetPosition - myPosition).magVec()), + 0, (windowWidth / 2.f), (windowHeight / 2.f) - 25.f, targetColor, + LLFontGL::HCENTER, LLFontGL::TOP, LLFontGL::BOLD, LLFontGL::NO_SHADOW + ); + + break; + } + } + } + + mCrosshairp->draw( + (windowWidth - mCrosshairp->getWidth() ) / 2, + (windowHeight - mCrosshairp->getHeight() ) / 2, targetColor); } } diff --git a/indra/newview/lltoolgun.h b/indra/newview/lltoolgun.h index 4644e686b..e15a88f47 100644 --- a/indra/newview/lltoolgun.h +++ b/indra/newview/lltoolgun.h @@ -54,6 +54,9 @@ public: virtual BOOL clipMouseWhenDown() { return FALSE; } private: BOOL mIsSelected; + + // - UI Caching + LLUIImagePtr mCrosshairp; }; #endif diff --git a/indra/newview/lltoolselectland.cpp b/indra/newview/lltoolselectland.cpp index 9a09c3ed3..f0de5e785 100644 --- a/indra/newview/lltoolselectland.cpp +++ b/indra/newview/lltoolselectland.cpp @@ -226,8 +226,8 @@ void LLToolSelectLand::handleDeselect() void LLToolSelectLand::roundXY(LLVector3d &vec) { - vec.mdV[VX] = llmath::llround( vec.mdV[VX], (F64)PARCEL_GRID_STEP_METERS ); - vec.mdV[VY] = llmath::llround( vec.mdV[VY], (F64)PARCEL_GRID_STEP_METERS ); + vec.mdV[VX] = ll_round( vec.mdV[VX], (F64)PARCEL_GRID_STEP_METERS ); + vec.mdV[VY] = ll_round( vec.mdV[VY], (F64)PARCEL_GRID_STEP_METERS ); } diff --git a/indra/newview/llviewerdisplay.cpp b/indra/newview/llviewerdisplay.cpp index 681838d21..c1f92a378 100644 --- a/indra/newview/llviewerdisplay.cpp +++ b/indra/newview/llviewerdisplay.cpp @@ -1254,8 +1254,8 @@ LLRect get_whole_screen_region() if (zoom_factor > 1.f) { S32 num_horizontal_tiles = llceil(zoom_factor); - S32 tile_width = llmath::llround((F32)gViewerWindow->getWorldViewWidthScaled() / zoom_factor); - S32 tile_height = llmath::llround((F32)gViewerWindow->getWorldViewHeightScaled() / zoom_factor); + S32 tile_width = ll_round((F32)gViewerWindow->getWorldViewWidthScaled() / zoom_factor); + S32 tile_height = ll_round((F32)gViewerWindow->getWorldViewHeightScaled() / zoom_factor); int tile_y = sub_region / num_horizontal_tiles; int tile_x = sub_region - (tile_y * num_horizontal_tiles); @@ -1539,8 +1539,8 @@ void render_ui_2d() int pos_y = sub_region / llceil(zoom_factor); int pos_x = sub_region - (pos_y*llceil(zoom_factor)); // offset for this tile - LLFontGL::sCurOrigin.mX -= llmath::llround((F32)gViewerWindow->getWindowWidthScaled() * (F32)pos_x / zoom_factor); - LLFontGL::sCurOrigin.mY -= llmath::llround((F32)gViewerWindow->getWindowHeightScaled() * (F32)pos_y / zoom_factor); + LLFontGL::sCurOrigin.mX -= ll_round((F32)gViewerWindow->getWindowWidthScaled() * (F32)pos_x / zoom_factor); + LLFontGL::sCurOrigin.mY -= ll_round((F32)gViewerWindow->getWindowHeightScaled() * (F32)pos_y / zoom_factor); } stop_glerror(); diff --git a/indra/newview/llviewerinventory.cpp b/indra/newview/llviewerinventory.cpp index 4455b4d11..2ee341638 100644 --- a/indra/newview/llviewerinventory.cpp +++ b/indra/newview/llviewerinventory.cpp @@ -64,6 +64,7 @@ #include "llfloatercustomize.h" // #include "llappviewer.h" // System Folders +bool use_http_inventory(); // UseHTTPInventory replacement // // Two do-nothing ops for use in callbacks. @@ -354,7 +355,7 @@ void LLViewerInventoryItem::fetchFromServer(void) const { std::string url; - if (gSavedSettings.getBOOL("UseHTTPInventory")) + if (use_http_inventory()) { LLViewerRegion* region = gAgent.getRegion(); // we have to check region. It can be null after region was destroyed. See EXT-245 @@ -656,13 +657,13 @@ bool LLViewerInventoryCategory::fetch() { llwarns << "agent region is null" << llendl; } - if (!url.empty() && gSavedSettings.getBOOL("UseHTTPInventory")) //Capability found and HTTP inventory enabled. Build up LLSD and use it. + if (!url.empty() && use_http_inventory()) //Capability found and HTTP inventory enabled. Build up LLSD and use it. { LLInventoryModelBackgroundFetch::instance().start(mUUID, false); } else { //We don't have a capability or the use of HTTP inventory is disabled, use the old system. - if (gSavedSettings.getBOOL("UseHTTPInventory")) + if (use_http_inventory()) { llinfos << "FetchInventoryDescendents2 capability not found. Using UDP message." << llendl; } diff --git a/indra/newview/llviewerkeyboard.cpp b/indra/newview/llviewerkeyboard.cpp index 535b66001..ef23a05cd 100644 --- a/indra/newview/llviewerkeyboard.cpp +++ b/indra/newview/llviewerkeyboard.cpp @@ -71,7 +71,7 @@ void agent_jump( EKeystate s ) { if( KEYSTATE_UP == s ) return; F32 time = gKeyboard->getCurKeyElapsedTime(); - S32 frame_count = llmath::llround(gKeyboard->getCurKeyElapsedFrameCount()); + S32 frame_count = ll_round(gKeyboard->getCurKeyElapsedFrameCount()); if( time < FLY_TIME || frame_count <= FLY_FRAMES @@ -148,7 +148,7 @@ static void agent_push_forwardbackward( EKeystate s, S32 direction, LLAgent::EDo if (KEYSTATE_UP == s) return; F32 time = gKeyboard->getCurKeyElapsedTime(); - S32 frame_count = llmath::llround(gKeyboard->getCurKeyElapsedFrameCount()); + S32 frame_count = ll_round(gKeyboard->getCurKeyElapsedFrameCount()); if( time < NUDGE_TIME || frame_count <= NUDGE_FRAMES) { @@ -176,7 +176,7 @@ static void agent_slide_leftright( EKeystate s, S32 direction, LLAgent::EDoubleT agent_handle_doubletap_run(s, mode); if( KEYSTATE_UP == s ) return; F32 time = gKeyboard->getCurKeyElapsedTime(); - S32 frame_count = llmath::llround(gKeyboard->getCurKeyElapsedFrameCount()); + S32 frame_count = ll_round(gKeyboard->getCurKeyElapsedFrameCount()); if( time < NUDGE_TIME || frame_count <= NUDGE_FRAMES) { diff --git a/indra/newview/llviewermedia.cpp b/indra/newview/llviewermedia.cpp index 52ccb9c7c..daeedf75c 100644 --- a/indra/newview/llviewermedia.cpp +++ b/indra/newview/llviewermedia.cpp @@ -941,7 +941,7 @@ void LLViewerMedia::updateMedia(void *dummy_arg) { F32 approximate_interest_dimension = (F32) sqrt(pimpl->getInterest()); - pimpl->setLowPrioritySizeLimit(llmath::llround(approximate_interest_dimension)); + pimpl->setLowPrioritySizeLimit(ll_round(approximate_interest_dimension)); } } else @@ -2367,8 +2367,8 @@ void LLViewerMediaImpl::scaleTextureCoords(const LLVector2& texture_coords, S32 texture_y = 1.0 + texture_y; // scale x and y to texel units. - *x = llmath::llround(texture_x * plugin->getTextureWidth()); - *y = llmath::llround((1.0f - texture_y) * plugin->getTextureHeight()); + *x = ll_round(texture_x * plugin->getTextureWidth()); + *y = ll_round((1.0f - texture_y) * plugin->getTextureHeight()); // Adjust for the difference between the actual texture height and the amount of the texture in use. *y -= (plugin->getTextureHeight() - plugin->getHeight()); diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp index bb581801b..100e03441 100644 --- a/indra/newview/llviewermenu.cpp +++ b/indra/newview/llviewermenu.cpp @@ -5891,15 +5891,10 @@ class LLWorldSetBusy : public view_listener_t { bool handleEvent(LLPointer event, const LLSD& userdata) { - if (gAgent.getBusy()) - { - gAgent.clearBusy(); - } - else - { - gAgent.setBusy(); + bool busy = !gAgent.isDoNotDisturb(); + gAgent.setDoNotDisturb(busy); + if (busy) LLNotificationsUtil::add("BusyModeSet"); - } return true; } }; @@ -6032,7 +6027,7 @@ bool complete_give_money(const LLSD& notification, const LLSD& response, LLObjec S32 option = LLNotification::getSelectedOption(notification, response); if (option == 0) { - gAgent.clearBusy(); + gAgent.setDoNotDisturb(false); } LLViewerObject* objectp = selection->getPrimaryObject(); @@ -6068,7 +6063,7 @@ void handle_give_money_dialog() LLNotification::Params params("BusyModePay"); params.functor(boost::bind(complete_give_money, _1, _2, LLSelectMgr::getInstance()->getSelection())); - if (gAgent.getBusy()) + if (gAgent.isDoNotDisturb()) { // warn users of being in busy mode during a transaction LLNotifications::instance().add(params); @@ -7329,6 +7324,16 @@ class LLToggleControl : public view_listener_t } }; +class LLTogglePerAccountControl : public view_listener_t +{ + bool handleEvent(LLPointer event, const LLSD& userdata) + { + LLControlVariable* control(gSavedPerAccountSettings.getControl(userdata.asString())); + control->set(!control->get()); + return true; + } +}; + BOOL menu_check_control( void* user_data) { return gSavedSettings.getBOOL((char*)user_data); @@ -9452,6 +9457,7 @@ void initialize_menus() addMenu(new LLPromptShowURL(), "PromptShowURL"); addMenu(new LLShowAgentProfile(), "ShowAgentProfile"); addMenu(new LLToggleControl(), "ToggleControl"); + addMenu(new LLTogglePerAccountControl(), "TogglePerAccountControl"); addMenu(new LLGoToObject(), "GoToObject"); addMenu(new LLPayObject(), "PayObject"); @@ -9558,13 +9564,13 @@ void region_change() LLViewerRegion* regionp = gAgent.getRegion(); if (!regionp) return; - if (regionp->getFeaturesReceived()) + if (regionp->simulatorFeaturesReceived()) { parse_simulator_features(); } else { - regionp->setFeaturesReceivedCallback(boost::bind(&parse_simulator_features)); + regionp->setSimulatorFeaturesReceivedCallback(boost::bind(&parse_simulator_features)); } } diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp index 2779f1404..a506437e4 100644 --- a/indra/newview/llviewermessage.cpp +++ b/indra/newview/llviewermessage.cpp @@ -1176,7 +1176,7 @@ bool check_asset_previewable(const LLAssetType::EType asset_type) void open_inventory_offer(const uuid_vec_t& objects, const std::string& from_name) { - if (gAgent.getBusy()) return; + if (gAgent.isDoNotDisturb()) return; for (uuid_vec_t::const_iterator obj_iter = objects.begin(); obj_iter != objects.end(); ++obj_iter) @@ -1496,7 +1496,7 @@ bool LLOfferInfo::inventory_offer_callback(const LLSD& notification, const LLSD& from_string = chatHistory_string = mFromName; } - bool busy = gAgent.getBusy(); + bool busy = gAgent.isDoNotDisturb(); // [RLVa:KB] - Checked: 2010-09-23 (RLVa-1.2.1) bool fRlvNotifyAccepted = false; @@ -1651,26 +1651,29 @@ bool LLOfferInfo::inventory_offer_callback(const LLSD& notification, const LLSD& // send the message msg->sendReliable(mHost); -// [RLVa:KB] - Checked: 2010-09-23 (RLVa-1.2.1e) | Added: RLVa-1.2.1e - if ( (rlv_handler_t::isEnabled()) && - (IM_TASK_INVENTORY_OFFERED == mIM) && (LLAssetType::AT_CATEGORY == mType) && (mDesc.find(RLV_PUTINV_PREFIX) == 1) ) + if (gSavedSettings.getBOOL("LogInventoryDecline")) { - std::string::size_type idxToken = mDesc.find("' ( http://"); - if (std::string::npos != idxToken) - RlvBehaviourNotifyHandler::instance().sendNotification("declined inv_offer " + mDesc.substr(1, idxToken - 1)); - } +// [RLVa:KB] - Checked: 2010-09-23 (RLVa-1.2.1e) | Added: RLVa-1.2.1e + if ( (rlv_handler_t::isEnabled()) && + (IM_TASK_INVENTORY_OFFERED == mIM) && (LLAssetType::AT_CATEGORY == mType) && (mDesc.find(RLV_PUTINV_PREFIX) == 1) ) + { + std::string::size_type idxToken = mDesc.find("' ( http://"); + if (std::string::npos != idxToken) + RlvBehaviourNotifyHandler::instance().sendNotification("declined inv_offer " + mDesc.substr(1, idxToken - 1)); + } // [/RLVa:KB] - LLStringUtil::format_map_t log_message_args; - log_message_args["[DESC]"] = mDesc; - log_message_args["[NAME]"] = mFromName; - log_message = LLTrans::getString("InvOfferDecline", log_message_args); - chat.mText = log_message; - if( LLMuteList::getInstance()->isMuted(mFromID ) && ! LLMuteList::getInstance()->isLinden(mFromName) ) // muting for SL-42269 - { - chat.mMuted = TRUE; + LLStringUtil::format_map_t log_message_args; + log_message_args["[DESC]"] = mDesc; + log_message_args["[NAME]"] = mFromName; + log_message = LLTrans::getString("InvOfferDecline", log_message_args); + chat.mText = log_message; + if( LLMuteList::getInstance()->isMuted(mFromID ) && ! LLMuteList::getInstance()->isLinden(mFromName) ) // muting for SL-42269 + { + chat.mMuted = TRUE; + } + LLFloaterChat::addChatHistory(chat); } - LLFloaterChat::addChatHistory(chat); // If it's from an agent, we have to fetch the item to throw // it away. If it's from a task or group, just denying the @@ -1800,7 +1803,7 @@ void inventory_offer_handler(LLOfferInfo* info) return; } - if (gAgent.getBusy() && info->mIM != IM_TASK_INVENTORY_OFFERED) // busy mode must not affect interaction with objects (STORM-565) + if (gAgent.isDoNotDisturb() && info->mIM != IM_TASK_INVENTORY_OFFERED) // busy mode must not affect interaction with objects (STORM-565) { // Until throttling is implemented, busy mode should reject inventory instead of silently // accepting it. SEE SL-39554 @@ -2164,6 +2167,27 @@ std::string replace_wildcards(std::string autoresponse, const LLUUID& id, const return autoresponse; } +void autoresponder_finish(bool show_autoresponded, const LLUUID& computed_session_id, const LLUUID& from_id, const std::string& name, const LLUUID& itemid, bool is_muted) +{ + LLAvatarName av_name; + const std::string ns_name(LLAvatarNameCache::get(from_id, &av_name) ? av_name.getNSName() : name); + void cmdline_printchat(const std::string& message); + if (show_autoresponded) + { + const std::string notice(LLTrans::getString("IM_autoresponded_to") + ' ' + ns_name); + is_muted ? cmdline_printchat(notice) : gIMMgr->addMessage(computed_session_id, from_id, name, notice); + } + if (LLViewerInventoryItem* item = gInventory.getItem(itemid)) + { + LLGiveInventory::doGiveInventoryItem(from_id, item, computed_session_id); + if (show_autoresponded) + { + const std::string notice(llformat("%s %s \"%s\"", ns_name.c_str(), LLTrans::getString("IM_autoresponse_sent_item").c_str(), item->getName().c_str())); + is_muted ? cmdline_printchat(notice) : gIMMgr->addMessage(computed_session_id, from_id, name, notice); + } + } +} + void process_improved_im(LLMessageSystem *msg, void **user_data) { if (gNoRender) @@ -2250,7 +2274,7 @@ void process_improved_im(LLMessageSystem *msg, void **user_data) llinfos << "RegionID: " << region_id.asString() << llendl; // - BOOL is_do_not_disturb = gAgent.getBusy(); + bool is_do_not_disturb = gAgent.isDoNotDisturb(); BOOL is_muted = LLMuteList::getInstance()->isMuted(from_id, name, LLMute::flagTextChat) // object IMs contain sender object id in session_id (STORM-1209) || dialog == IM_FROM_TASK && LLMuteList::getInstance()->isMuted(session_id); @@ -2422,7 +2446,7 @@ void process_improved_im(LLMessageSystem *msg, void **user_data) response = gSavedPerAccountSettings.getString("AutoresponseMutedMessage"); if (gSavedPerAccountSettings.getBOOL("AutoresponseMutedItem")) itemid = static_cast(gSavedPerAccountSettings.getString("AutoresponseMutedItemID")); - // We don't show that we've responded to mutes + show_autoresponded = gSavedPerAccountSettings.getBOOL("AutoresponseMutedShow"); } else if (is_autorespond_nonfriends) { @@ -2442,7 +2466,7 @@ void process_improved_im(LLMessageSystem *msg, void **user_data) gMessageSystem, gAgentID, FALSE, - gAgent.getSessionID(), + gAgentSessionID, from_id, my_name, replace_wildcards(response, from_id, name), @@ -2451,21 +2475,7 @@ void process_improved_im(LLMessageSystem *msg, void **user_data) session_id); gAgent.sendReliableMessage(); - LLAvatarName av_name; - std::string ns_name = LLAvatarNameCache::get(from_id, &av_name) ? av_name.getNSName() : name; - if (show_autoresponded) - { - gIMMgr->addMessage(session_id, from_id, name, LLTrans::getString("IM_autoresponded_to") + " " + ns_name); - } - if (LLViewerInventoryItem* item = gInventory.getItem(itemid)) - { - LLGiveInventory::doGiveInventoryItem(from_id, item, computed_session_id); - if (show_autoresponded) - { - gIMMgr->addMessage(computed_session_id, from_id, name, - llformat("%s %s \"%s\"", ns_name.c_str(), LLTrans::getString("IM_autoresponse_sent_item").c_str(), item->getName().c_str())); - } - } + autoresponder_finish(show_autoresponded, computed_session_id, from_id, name, itemid, is_muted); } // We stored the incoming IM in history before autoresponding, logically. } @@ -2561,7 +2571,7 @@ void process_improved_im(LLMessageSystem *msg, void **user_data) gMessageSystem, gAgentID, FALSE, - gAgent.getSessionID(), + gAgentSessionID, from_id, my_name, replace_wildcards(gSavedPerAccountSettings.getString("AutoresponseMutedMessage"), from_id, name), @@ -2569,9 +2579,8 @@ void process_improved_im(LLMessageSystem *msg, void **user_data) IM_BUSY_AUTO_RESPONSE, session_id); gAgent.sendReliableMessage(); - if (gSavedPerAccountSettings.getBOOL("AutoresponseMutedItem")) - if (LLViewerInventoryItem* item = gInventory.getItem(static_cast(gSavedPerAccountSettings.getString("AutoresponseMutedItemID")))) - LLGiveInventory::doGiveInventoryItem(from_id, item, computed_session_id); + LLAvatarName av_name; + autoresponder_finish(gSavedPerAccountSettings.getBOOL("AutoresponseMutedShow"), computed_session_id, from_id, LLAvatarNameCache::get(from_id, &av_name) ? av_name.getNSName() : name, gSavedPerAccountSettings.getBOOL("AutoresponseMutedItem") ? static_cast(gSavedPerAccountSettings.getString("AutoresponseMutedItemID")) : LLUUID::null, true); } } } @@ -2624,19 +2633,7 @@ void process_improved_im(LLMessageSystem *msg, void **user_data) pack_instant_message(gMessageSystem, gAgentID, false, gAgentSessionID, from_id, my_name, replace_wildcards(response, from_id, name), IM_ONLINE, IM_BUSY_AUTO_RESPONSE, session_id); gAgent.sendReliableMessage(); - if (show_autoresponded) - { - gIMMgr->addMessage(session_id, from_id, name, LLTrans::getString("IM_autoresponded_to") + " " + ns_name); - } - if (LLViewerInventoryItem* item = gInventory.getItem(itemid)) - { - LLGiveInventory::doGiveInventoryItem(from_id, item, computed_session_id); - if (show_autoresponded) - { - gIMMgr->addMessage(computed_session_id, from_id, name, - llformat("%s %s \"%s\"", ns_name.c_str(), LLTrans::getString("IM_autoresponse_sent_item").c_str(), item->getName().c_str())); - } - } + autoresponder_finish(show_autoresponded, computed_session_id, from_id, name, itemid, is_muted); } } LLPointer im_info = new LLIMInfo(gMessageSystem); @@ -3465,7 +3462,7 @@ void process_improved_im(LLMessageSystem *msg, void **user_data) void send_do_not_disturb_message (LLMessageSystem* msg, const LLUUID& from_id, const LLUUID& session_id) { - if (gAgent.getBusy()) + if (gAgent.isDoNotDisturb()) { std::string my_name; LLAgentUI::buildFullname(my_name); @@ -3488,7 +3485,7 @@ void send_do_not_disturb_message (LLMessageSystem* msg, const LLUUID& from_id, c std::string ns_name = LLAvatarNameCache::get(from_id, &av_name) ? av_name.getNSName() : from_name; LLUUID session_id; msg->getUUIDFast(_PREHASH_MessageBlock, _PREHASH_ID, session_id); - if (gSavedPerAccountSettings.getBOOL("BusyModeResponseShow")) gIMMgr->addMessage(session_id, from_id, from_name, LLTrans::getString("IM_autoresponded_to") + " " + ns_name); + if (gSavedPerAccountSettings.getBOOL("BusyModeResponseShow")) gIMMgr->addMessage(session_id, from_id, from_name, LLTrans::getString("IM_autoresponded_to") + ' ' + ns_name); if (!gSavedPerAccountSettings.getBOOL("BusyModeResponseItem")) return; // Not sending an item, finished if (LLViewerInventoryItem* item = gInventory.getItem(static_cast(gSavedPerAccountSettings.getString("BusyModeResponseItemID")))) { @@ -3584,7 +3581,7 @@ void process_offer_callingcard(LLMessageSystem* msg, void**) if(!source_name.empty()) { - if (gAgent.getBusy() + if (gAgent.isDoNotDisturb() || LLMuteList::getInstance()->isMuted(source_id, source_name, LLMute::flagTextChat)) { // automatically decline offer @@ -3810,7 +3807,7 @@ void process_chat_from_simulator(LLMessageSystem *msg, void **user_data) chat.mFromName = from_name; } - BOOL is_do_not_disturb = gAgent.getBusy(); + bool is_do_not_disturb = gAgent.isDoNotDisturb(); BOOL is_muted = FALSE; BOOL is_linden = FALSE; @@ -3961,9 +3958,9 @@ void process_chat_from_simulator(LLMessageSystem *msg, void **user_data) const LLViewerObject* obj(chatter ? chatter : gObjectList.findObject(owner_id)); // Compute the object SLURL. LLVector3 pos = obj ? obj->getPositionRegion() : LLVector3::zero; - S32 x = llmath::llround((F32)fmod((F64)pos.mV[VX], (F64)REGION_WIDTH_METERS)); - S32 y = llmath::llround((F32)fmod((F64)pos.mV[VY], (F64)REGION_WIDTH_METERS)); - S32 z = llmath::llround((F32)pos.mV[VZ]); + S32 x = ll_round((F32)fmod((F64)pos.mV[VX], (F64)REGION_WIDTH_METERS)); + S32 y = ll_round((F32)fmod((F64)pos.mV[VY], (F64)REGION_WIDTH_METERS)); + S32 z = ll_round((F32)pos.mV[VZ]); std::ostringstream location; location << (obj ? obj->getRegion() : gAgent.getRegion())->getName() << "/" << x << "/" << y << "/" << z; if (chatter != obj) location << "?owner_not_object"; @@ -4789,14 +4786,7 @@ void process_agent_movement_complete(LLMessageSystem* msg, void**) } // force simulator to recognize busy state - if (gAgent.getBusy()) - { - gAgent.setBusy(); - } - else - { - gAgent.clearBusy(); - } + gAgent.setDoNotDisturb(gAgent.isDoNotDisturb()); if (isAgentAvatarValid()) { diff --git a/indra/newview/llviewerobjectlist.h b/indra/newview/llviewerobjectlist.h index 516c3d1e1..052cdacf9 100644 --- a/indra/newview/llviewerobjectlist.h +++ b/indra/newview/llviewerobjectlist.h @@ -39,7 +39,6 @@ // common includes #include "llstat.h" #include "llstring.h" -#include "sguuidhash.h" // project includes #include "llviewerobject.h" diff --git a/indra/newview/llviewerparcelmgr.cpp b/indra/newview/llviewerparcelmgr.cpp index 63ba67994..f6ad4ca32 100644 --- a/indra/newview/llviewerparcelmgr.cpp +++ b/indra/newview/llviewerparcelmgr.cpp @@ -315,7 +315,7 @@ S32 LLViewerParcelMgr::getSelectedArea() const F64 width = mEastNorth.mdV[VX] - mWestSouth.mdV[VX]; F64 height = mEastNorth.mdV[VY] - mWestSouth.mdV[VY]; F32 area = (F32)(width * height); - rv = llmath::llround(area); + rv = ll_round(area); } return rv; } @@ -335,10 +335,10 @@ void LLViewerParcelMgr::writeHighlightSegments(F32 west, F32 south, F32 east, F32 north) { S32 x, y; - S32 min_x = llmath::llround( west / PARCEL_GRID_STEP_METERS ); - S32 max_x = llmath::llround( east / PARCEL_GRID_STEP_METERS ); - S32 min_y = llmath::llround( south / PARCEL_GRID_STEP_METERS ); - S32 max_y = llmath::llround( north / PARCEL_GRID_STEP_METERS ); + S32 min_x = ll_round( west / PARCEL_GRID_STEP_METERS ); + S32 max_x = ll_round( east / PARCEL_GRID_STEP_METERS ); + S32 min_y = ll_round( south / PARCEL_GRID_STEP_METERS ); + S32 max_y = ll_round( north / PARCEL_GRID_STEP_METERS ); const S32 STRIDE = mParcelsPerEdge+1; @@ -450,12 +450,12 @@ LLParcelSelectionHandle LLViewerParcelMgr::selectParcelAt(const LLVector3d& pos_ LLVector3d northeast = pos_global; southwest -= LLVector3d( PARCEL_GRID_STEP_METERS/2, PARCEL_GRID_STEP_METERS/2, 0 ); - southwest.mdV[VX] = llmath::llround( southwest.mdV[VX], (F64)PARCEL_GRID_STEP_METERS ); - southwest.mdV[VY] = llmath::llround( southwest.mdV[VY], (F64)PARCEL_GRID_STEP_METERS ); + southwest.mdV[VX] = ll_round( southwest.mdV[VX], (F64)PARCEL_GRID_STEP_METERS ); + southwest.mdV[VY] = ll_round( southwest.mdV[VY], (F64)PARCEL_GRID_STEP_METERS ); northeast += LLVector3d( PARCEL_GRID_STEP_METERS/2, PARCEL_GRID_STEP_METERS/2, 0 ); - northeast.mdV[VX] = llmath::llround( northeast.mdV[VX], (F64)PARCEL_GRID_STEP_METERS ); - northeast.mdV[VY] = llmath::llround( northeast.mdV[VY], (F64)PARCEL_GRID_STEP_METERS ); + northeast.mdV[VX] = ll_round( northeast.mdV[VX], (F64)PARCEL_GRID_STEP_METERS ); + northeast.mdV[VY] = ll_round( northeast.mdV[VY], (F64)PARCEL_GRID_STEP_METERS ); // Snap to parcel return selectLand( southwest, northeast, TRUE ); diff --git a/indra/newview/llviewerpartsim.cpp b/indra/newview/llviewerpartsim.cpp index 5e334e634..c9ed0b4dc 100644 --- a/indra/newview/llviewerpartsim.cpp +++ b/indra/newview/llviewerpartsim.cpp @@ -397,7 +397,7 @@ void LLViewerPartGroup::updateParticles(const F32 lastdt) } // Do glow interpolation - part->mGlow.mV[3] = (U8) llmath::llround(lerp(part->mStartGlow, part->mEndGlow, frac)*255.f); + part->mGlow.mV[3] = (U8) ll_round(lerp(part->mStartGlow, part->mEndGlow, frac)*255.f); // Set the last update time to now. part->mLastUpdateTime = cur_time; diff --git a/indra/newview/llviewerpartsource.cpp b/indra/newview/llviewerpartsource.cpp index 10b70f398..8569f2663 100644 --- a/indra/newview/llviewerpartsource.cpp +++ b/indra/newview/llviewerpartsource.cpp @@ -322,7 +322,7 @@ void LLViewerPartSourceScript::update(const F32 dt) part->mStartGlow = mPartSysData.mPartData.mStartGlow; part->mEndGlow = mPartSysData.mPartData.mEndGlow; - part->mGlow = LLColor4U(0, 0, 0, (U8) llmath::llround(part->mStartGlow*255.f)); + part->mGlow = LLColor4U(0, 0, 0, (U8) ll_round(part->mStartGlow*255.f)); if (mPartSysData.mPattern & LLPartSysData::LL_PART_SRC_PATTERN_DROP) { diff --git a/indra/newview/llviewerprecompiledheaders.h b/indra/newview/llviewerprecompiledheaders.h index cce678081..3e41172b1 100644 --- a/indra/newview/llviewerprecompiledheaders.h +++ b/indra/newview/llviewerprecompiledheaders.h @@ -73,9 +73,6 @@ #include "imageids.h" #include "indra_constants.h" #include "llinitparam.h" - -//#include "linden_common.h" -//#include "llpreprocessor.h" #include "llapp.h" #include "llapr.h" #include "llcriticaldamp.h" @@ -88,14 +85,12 @@ #include "llerror.h" #include "llfasttimer.h" #include "llframetimer.h" -#include "llhash.h" #include "lllocalidhashmap.h" #include "llmap.h" #include "llmemory.h" #include "llnametable.h" #include "llpriqueuemap.h" #include "llprocessor.h" -//#include "llsecondlifeurls.h" #include "llstack.h" #include "llstat.h" #include "llstl.h" @@ -104,11 +99,8 @@ #include "llsys.h" #include "llthread.h" #include "lltimer.h" -//#include "processor.h" #include "stdenums.h" #include "stdtypes.h" -//#include "string_table.h" -//#include "timer.h" #include "timing.h" #include "u64.h" @@ -150,7 +142,6 @@ #include "llnamevalue.h" #include "llpacketack.h" #include "llpacketbuffer.h" -//#include "llpacketring.h" #include "llpartdata.h" #include "llregionhandle.h" #include "lltaskname.h" @@ -173,7 +164,6 @@ #include "message.h" #include "message_prehash.h" #include "net.h" -//#include "network.h" #include "patch_code.h" #include "patch_dct.h" #include "sound_ids.h" @@ -182,12 +172,8 @@ #include "imageids.h" #include "legacy_object_types.h" #include "llmaterialtable.h" -//#include "llprimitive.h" #include "lltextureanim.h" -//#include "lltextureentry.h" #include "lltreeparams.h" -//#include "llvolume.h" -//#include "llvolumemgr.h" #include "material_codes.h" // Library includes from llxml @@ -196,9 +182,6 @@ // Library includes from llvfs #include "llassettype.h" #include "lldir.h" -//#include "lldir_linux.h" -//#include "lldir_mac.h" -//#include "lldir_win32.h" #include "llvfile.h" #include "llvfs.h" diff --git a/indra/newview/llviewerregion.cpp b/indra/newview/llviewerregion.cpp index 4a75bc8fc..c502eab4f 100644 --- a/indra/newview/llviewerregion.cpp +++ b/indra/newview/llviewerregion.cpp @@ -314,7 +314,7 @@ LLViewerRegion::LLViewerRegion(const U64 &handle, mCacheDirty(FALSE), mReleaseNotesRequested(FALSE), mCapabilitiesReceived(false), - mFeaturesReceived(false), + mSimulatorFeaturesReceived(false), mGamingFlags(0), // Aurora Sim mWidth(region_width_meters) @@ -1318,6 +1318,26 @@ void LLViewerRegion::getInfo(LLSD& info) info["Region"]["Handle"]["y"] = (LLSD::Integer)y; } +boost::signals2::connection LLViewerRegion::setSimulatorFeaturesReceivedCallback(const caps_received_signal_t::slot_type& cb) +{ + return mSimulatorFeaturesReceivedSignal.connect(cb); +} + +void LLViewerRegion::setSimulatorFeaturesReceived(bool received) +{ + mSimulatorFeaturesReceived = received; + if (received) + { + mSimulatorFeaturesReceivedSignal(getRegionID()); + mSimulatorFeaturesReceivedSignal.disconnect_all_slots(); + } +} + +bool LLViewerRegion::simulatorFeaturesReceived() const +{ + return mSimulatorFeaturesReceived; +} + void LLViewerRegion::getSimulatorFeatures(LLSD& sim_features) { sim_features = mSimulatorFeatures; @@ -1331,9 +1351,7 @@ void LLViewerRegion::setSimulatorFeatures(const LLSD& sim_features) LL_DEBUGS("SimFeatures") << "\n" << str.str() << LL_ENDL; mSimulatorFeatures = sim_features; - mFeaturesReceived = true; - mFeaturesReceivedSignal(getRegionID()); - mFeaturesReceivedSignal.disconnect_all_slots(); + setSimulatorFeaturesReceived(true); } void LLViewerRegion::setGamingData(const LLSD& gaming_data) @@ -2026,9 +2044,9 @@ void LLViewerRegion::setCapabilitiesReceived(bool received) // in consumers by allowing them to expect this signal, regardless. if (getCapability("SimulatorFeatures").empty()) { - mFeaturesReceived = true; - mFeaturesReceivedSignal(getRegionID()); - mFeaturesReceivedSignal.disconnect_all_slots(); + mSimulatorFeaturesReceived = true; + mSimulatorFeaturesReceivedSignal(getRegionID()); + mSimulatorFeaturesReceivedSignal.disconnect_all_slots(); } } } @@ -2148,9 +2166,10 @@ bool LLViewerRegion::dynamicPathfindingEnabled() const mSimulatorFeatures["DynamicPathfindingEnabled"].asBoolean()); } -boost::signals2::connection LLViewerRegion::setFeaturesReceivedCallback(const features_received_signal_t::slot_type& cb) +bool LLViewerRegion::avatarHoverHeightEnabled() const { - return mFeaturesReceivedSignal.connect(cb); + return ( mSimulatorFeatures.has("AvatarHoverHeightEnabled") && + mSimulatorFeatures["AvatarHoverHeightEnabled"].asBoolean()); } void LLViewerRegion::resetMaterialsCapThrottle() diff --git a/indra/newview/llviewerregion.h b/indra/newview/llviewerregion.h index cfaef5ebc..07d4fcca4 100644 --- a/indra/newview/llviewerregion.h +++ b/indra/newview/llviewerregion.h @@ -105,7 +105,6 @@ public: } eObjectPartitions; typedef boost::signals2::signal caps_received_signal_t; - typedef boost::signals2::signal features_received_signal_t; LLViewerRegion(const U64 &handle, const LLHost &host, @@ -284,9 +283,6 @@ public: static bool isSpecialCapabilityName(const std::string &name); void logActiveCapabilities() const; - boost::signals2::connection setFeaturesReceivedCallback(const features_received_signal_t::slot_type& cb); - bool getFeaturesReceived() const { return mFeaturesReceived; } - /// Get LLEventPump on which we listen for capability requests /// (https://wiki.lindenlab.com/wiki/Viewer:Messaging/Messaging_Notes#Capabilities) LLEventPump& getCapAPI() const; @@ -327,12 +323,19 @@ public: bool meshRezEnabled() const; bool meshUploadEnabled() const; + // has region received its simulator features list? Requires an additional query after caps received. + void setSimulatorFeaturesReceived(bool); + bool simulatorFeaturesReceived() const; + boost::signals2::connection setSimulatorFeaturesReceivedCallback(const caps_received_signal_t::slot_type& cb); + void getSimulatorFeatures(LLSD& info); void setSimulatorFeatures(const LLSD& info); bool dynamicPathfindingEnabled() const; + bool avatarHoverHeightEnabled() const; + typedef enum { CACHE_MISS_TYPE_FULL = 0, @@ -480,9 +483,9 @@ private: bool mAlive; // can become false if circuit disconnects bool mCapabilitiesReceived; - bool mFeaturesReceived; + bool mSimulatorFeaturesReceived; caps_received_signal_t mCapabilitiesReceivedSignal; - features_received_signal_t mFeaturesReceivedSignal; + caps_received_signal_t mSimulatorFeaturesReceivedSignal; BOOL mReleaseNotesRequested; diff --git a/indra/newview/llviewertextureanim.cpp b/indra/newview/llviewertextureanim.cpp index fc5d30890..c91e997e0 100644 --- a/indra/newview/llviewertextureanim.cpp +++ b/indra/newview/llviewertextureanim.cpp @@ -174,7 +174,7 @@ S32 LLViewerTextureAnim::animateTextures(F32 &off_s, F32 &off_t, if (!(mMode & SMOOTH)) { - frame_counter = (F32)llmath::llround(frame_counter); + frame_counter = (F32)ll_round(frame_counter); } // diff --git a/indra/newview/llviewerwindow.cpp b/indra/newview/llviewerwindow.cpp index 4a0e79b97..77530b9f8 100644 --- a/indra/newview/llviewerwindow.cpp +++ b/indra/newview/llviewerwindow.cpp @@ -846,8 +846,8 @@ BOOL LLViewerWindow::handleAnyMouseClick(LLWindow *window, LLCoordGL pos, MASK BOOL handled = FALSE; S32 x = pos.mX; S32 y = pos.mY; - x = llmath::llround((F32)x / mDisplayScale.mV[VX]); - y = llmath::llround((F32)y / mDisplayScale.mV[VY]); + x = ll_round((F32)x / mDisplayScale.mV[VX]); + y = ll_round((F32)y / mDisplayScale.mV[VY]); if (down) { @@ -1021,8 +1021,8 @@ BOOL LLViewerWindow::handleRightMouseDown(LLWindow *window, LLCoordGL pos, MASK { S32 x = pos.mX; S32 y = pos.mY; - x = llmath::llround((F32)x / mDisplayScale.mV[VX]); - y = llmath::llround((F32)y / mDisplayScale.mV[VY]); + x = ll_round((F32)x / mDisplayScale.mV[VX]); + y = ll_round((F32)y / mDisplayScale.mV[VY]); LLView::sMouseHandlerMessage.clear(); @@ -1220,8 +1220,8 @@ void LLViewerWindow::handleMouseMove(LLWindow *window, LLCoordGL pos, MASK mask S32 x = pos.mX; S32 y = pos.mY; - x = llmath::llround((F32)x / mDisplayScale.mV[VX]); - y = llmath::llround((F32)y / mDisplayScale.mV[VY]); + x = ll_round((F32)x / mDisplayScale.mV[VX]); + y = ll_round((F32)y / mDisplayScale.mV[VY]); mMouseInWindow = TRUE; @@ -1716,7 +1716,7 @@ LLViewerWindow::LLViewerWindow( LLCoordWindow size; mWindow->getSize(&size); mWindowRectRaw.set(0, size.mY, size.mX, 0); - mWindowRectScaled.set(0, llmath::llround((F32)size.mY / mDisplayScale.mV[VY]), llmath::llround((F32)size.mX / mDisplayScale.mV[VX]), 0); + mWindowRectScaled.set(0, ll_round((F32)size.mY / mDisplayScale.mV[VY]), ll_round((F32)size.mX / mDisplayScale.mV[VX]), 0); } LLFontManager::initClass(); @@ -2398,8 +2398,8 @@ void LLViewerWindow::reshape(S32 width, S32 height) LLUI::setScaleFactor(mDisplayScale); // update our window rectangle - mWindowRectScaled.mRight = mWindowRectScaled.mLeft + llmath::llround((F32)width / mDisplayScale.mV[VX]); - mWindowRectScaled.mTop = mWindowRectScaled.mBottom + llmath::llround((F32)height / mDisplayScale.mV[VY]); + mWindowRectScaled.mRight = mWindowRectScaled.mLeft + ll_round((F32)width / mDisplayScale.mV[VX]); + mWindowRectScaled.mTop = mWindowRectScaled.mBottom + ll_round((F32)height / mDisplayScale.mV[VY]); setup2DViewport(); @@ -2560,8 +2560,8 @@ void LLViewerWindow::draw() microsecondsToTimecodeString(gFrameTime,text); const LLFontGL* font = LLFontGL::getFontSansSerif(); font->renderUTF8(text, 0, - llmath::llround((getWindowWidthScaled()/2)-100.f), - llmath::llround((getWindowHeightScaled()-60.f)), + ll_round((getWindowWidthScaled()/2)-100.f), + ll_round((getWindowHeightScaled()-60.f)), LLColor4( 1.f, 1.f, 1.f, 1.f ), LLFontGL::LEFT, LLFontGL::TOP); } @@ -2601,7 +2601,8 @@ void LLViewerWindow::draw() // Draw tool specific overlay on world LLToolMgr::getInstance()->getCurrentTool()->draw(); - if( gAgentCamera.cameraMouselook() ) + static LLCachedControl drawMouselookInst(gSavedSettings, "AlchemyMouselookInstructions", true); + if (drawMouselookInst && (gAgentCamera.cameraMouselook())) { drawMouselookInstructions(); stop_glerror(); @@ -2661,7 +2662,7 @@ void LLViewerWindow::draw() const S32 DIST_FROM_TOP = 20; LLFontGL::getFontSansSerifBig()->renderUTF8( mOverlayTitle, 0, - llmath::llround( getWindowWidthScaled() * 0.5f), + ll_round( getWindowWidthScaled() * 0.5f), getWindowHeightScaled() - DIST_FROM_TOP, LLColor4(1, 1, 1, 0.4f), LLFontGL::HCENTER, LLFontGL::TOP); @@ -2852,6 +2853,19 @@ BOOL LLViewerWindow::handleKey(KEY key, MASK mask) return TRUE; } + // If "Pressing letter keys starts local chat" option is selected, we are not in mouselook, + // no view has keyboard focus, this is a printable character key (and no modifier key is + // pressed except shift), then give focus to nearby chat (STORM-560) + if (gSavedSettings.getBOOL("LetterKeysFocusChatBar") && !gAgentCamera.cameraMouselook() && + !keyboard_focus && key < 0x80 && (mask == MASK_NONE || mask == MASK_SHIFT)) + { + { + // passing NULL here, character will be added later when it is handled by character handler. + gChatBar->startChat(NULL); + return TRUE; + } + } + // give menus a chance to handle unmodified accelerator keys if ((gMenuBarView && gMenuBarView->handleAcceleratorKey(key, mask)) ||(gLoginMenuBarView && gLoginMenuBarView->handleAcceleratorKey(key, mask))) @@ -3514,7 +3528,7 @@ void LLViewerWindow::updateMouseDelta() fdx = fdx + ((F32) dx - fdx) * llmin(gFrameIntervalSeconds*amount,1.f); fdy = fdy + ((F32) dy - fdy) * llmin(gFrameIntervalSeconds*amount,1.f); - mCurrentMouseDelta.set(llmath::llround(fdx), llmath::llround(fdy)); + mCurrentMouseDelta.set(ll_round(fdx), ll_round(fdy)); mouse_vel.setVec(fdx,fdy); } else @@ -4804,10 +4818,10 @@ bool LLViewerWindow::rawRawSnapshot(LLImageRaw *raw, // However, if the buffer turns out to be too large, then clamp it to max_size. scale_factor = llmin(max_size / snapshot_width, max_size / snapshot_height)) // Clamp { - image_buffer_x = llmath::llround(unscaled_image_buffer_x * scale_factor); - image_buffer_y = llmath::llround(unscaled_image_buffer_y * scale_factor); - S32 image_size_x = llmath::llround(snapshot_width * scale_factor); - S32 image_size_y = llmath::llround(snapshot_width * scale_factor); + image_buffer_x = ll_round(unscaled_image_buffer_x * scale_factor); + image_buffer_y = ll_round(unscaled_image_buffer_y * scale_factor); + S32 image_size_x = ll_round(snapshot_width * scale_factor); + S32 image_size_y = ll_round(snapshot_width * scale_factor); if (llmax(image_size_x, image_size_y) > max_size && // Boundary check to avoid memory overflow. internal_scale <= 1.f && !reset_deferred) // SHY_MOD: If supersampling... Don't care about max_size. { @@ -5051,44 +5065,52 @@ void LLViewerWindow::destroyWindow() void LLViewerWindow::drawMouselookInstructions() { - static const F32 INSTRUCTIONS_OPAQUE_TIME = 10.f; - static const F32 INSTRUCTIONS_FADE_TIME = 5.f; - - F32 mouselook_duration = gAgentCamera.getMouseLookDuration(); - if( mouselook_duration >= (INSTRUCTIONS_OPAQUE_TIME+INSTRUCTIONS_OPAQUE_TIME) ) - return; - - F32 alpha = 1.f; - - if( mouselook_duration > INSTRUCTIONS_OPAQUE_TIME) //instructions are fading - { - alpha = (F32) sqrt(1.f-pow(((mouselook_duration-INSTRUCTIONS_OPAQUE_TIME)/INSTRUCTIONS_FADE_TIME),2.f)); - } - + // // Draw instructions for mouselook ("Press ESC to leave Mouselook" in a box at the top of the screen.) - const std::string instructions = LLTrans::getString("LeaveMouselook"); - const LLFontGL* font = LLResMgr::getInstance()->getRes( LLFONT_SANSSERIF ); - - const S32 INSTRUCTIONS_PAD = 5; - LLRect instructions_rect; - instructions_rect.setLeftTopAndSize( - INSTRUCTIONS_PAD, - getWindowHeight() - INSTRUCTIONS_PAD, - font->getWidth( instructions ) + 2 * INSTRUCTIONS_PAD, - llmath::llround(font->getLineHeight() + 2 * INSTRUCTIONS_PAD)); + const LLFontGL* font = LLFontGL::getFontSansSerifBig(); + //to be on top of Bottom bar when it is opened + const S32 INSTRUCTIONS_PAD = getWorldViewRectScaled().mTop - 15; + const S32 text_pos_start = getWorldViewRectScaled().getCenterX() - 150; + if (!gRlvHandler.hasBehaviour(RLV_BHVR_SHOWLOC)) { - gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); - gGL.color4f( 0.9f, 0.9f, 0.9f, alpha ); - gl_rect_2d( instructions_rect ); + const LLVector3& vec = gAgent.getPositionAgent(); + font->renderUTF8( + llformat("X: %.2f", vec.mV[VX]), 0, + text_pos_start, + INSTRUCTIONS_PAD, + LLColor4(1.0f, 0.5f, 0.5f, 0.5), + LLFontGL::HCENTER, LLFontGL::TOP, + LLFontGL::BOLD, LLFontGL::DROP_SHADOW_SOFT); + font->renderUTF8( + llformat("Y: %.2f", vec.mV[VX]), 0, + text_pos_start + 100, + INSTRUCTIONS_PAD, + LLColor4(0.5f, 1.0f, 0.5f, 0.5), + LLFontGL::HCENTER, LLFontGL::TOP, + LLFontGL::BOLD, LLFontGL::DROP_SHADOW_SOFT); + font->renderUTF8( + llformat("Z: %.2f", vec.mV[VX]), 0, + text_pos_start + 200, + INSTRUCTIONS_PAD, + LLColor4(0.5f, 0.5f, 1.0f, 0.5), + LLFontGL::HCENTER, LLFontGL::TOP, + LLFontGL::BOLD, LLFontGL::DROP_SHADOW_SOFT); } - - font->renderUTF8( - instructions, 0, - instructions_rect.mLeft + INSTRUCTIONS_PAD, - instructions_rect.mTop - INSTRUCTIONS_PAD, - LLColor4( 0.0f, 0.0f, 0.0f, alpha ), - LLFontGL::LEFT, LLFontGL::TOP); + const LLViewerParcelMgr& vpm = LLViewerParcelMgr::instance(); + const bool allow_damage = vpm.allowAgentDamage(gAgent.getRegion(), vpm.getAgentParcel()); + if (allow_damage) + { + const S32 health = gStatusBar ? gStatusBar->getHealth() : -1; + font->renderUTF8( + llformat("HP: %d%%", health), 0, + text_pos_start + 300, + INSTRUCTIONS_PAD, + LLColor4(1.0f, 1.0f, 1.0f, 0.5), + LLFontGL::HCENTER, LLFontGL::TOP, + LLFontGL::BOLD, LLFontGL::DROP_SHADOW_SOFT); + } + // } void* LLViewerWindow::getPlatformWindow() const @@ -5685,8 +5707,8 @@ void LLViewerWindow::calcDisplayScale() if (mWindow->getFullscreen()) { - display_scale.mV[0] = llmath::llround(display_scale.mV[0], 2.0f/(F32) mWindowRectRaw.getWidth()); - display_scale.mV[1] = llmath::llround(display_scale.mV[1], 2.0f/(F32) mWindowRectRaw.getHeight()); + display_scale.mV[0] = ll_round(display_scale.mV[0], 2.0f/(F32) mWindowRectRaw.getWidth()); + display_scale.mV[1] = ll_round(display_scale.mV[1], 2.0f/(F32) mWindowRectRaw.getHeight()); } if (display_scale != mDisplayScale) @@ -5970,8 +5992,8 @@ void LLPickInfo::updateXYCoords() LLPointer imagep = LLViewerTextureManager::getFetchedTexture(tep->getID()); if(mUVCoords.mV[VX] >= 0.f && mUVCoords.mV[VY] >= 0.f && imagep.notNull()) { - mXYCoords.mX = llmath::llround(mUVCoords.mV[VX] * (F32)imagep->getWidth()); - mXYCoords.mY = llmath::llround((1.f - mUVCoords.mV[VY]) * (F32)imagep->getHeight()); + mXYCoords.mX = ll_round(mUVCoords.mV[VX] * (F32)imagep->getWidth()); + mXYCoords.mY = ll_round((1.f - mUVCoords.mV[VY]) * (F32)imagep->getHeight()); } } } @@ -6000,7 +6022,7 @@ void LLPickInfo::getSurfaceInfo() if (objectp) { - if (gViewerWindow->cursorIntersect(llmath::llround((F32)mMousePt.mX), llmath::llround((F32)mMousePt.mY), 1024.f, + if (gViewerWindow->cursorIntersect(ll_round((F32)mMousePt.mX), ll_round((F32)mMousePt.mY), 1024.f, objectp, -1, mPickTransparent, &mObjectFace, &intersection, @@ -6058,8 +6080,8 @@ LLVector2 LLPickInfo::pickUV() objectp->mDrawable.notNull() && objectp->getPCode() == LL_PCODE_VOLUME && mObjectFace < objectp->mDrawable->getNumFaces()) { - S32 scaled_x = llmath::llround((F32)mPickPt.mX * gViewerWindow->getDisplayScale().mV[VX]); - S32 scaled_y = llmath::llround((F32)mPickPt.mY * gViewerWindow->getDisplayScale().mV[VY]); + S32 scaled_x = ll_round((F32)mPickPt.mX * gViewerWindow->getDisplayScale().mV[VX]); + S32 scaled_y = ll_round((F32)mPickPt.mY * gViewerWindow->getDisplayScale().mV[VY]); const S32 UV_PICK_WIDTH = 5; const S32 UV_PICK_HALF_WIDTH = (UV_PICK_WIDTH - 1) / 2; U8 uv_pick_buffer[UV_PICK_WIDTH * UV_PICK_WIDTH * 4]; diff --git a/indra/newview/llvlcomposition.cpp b/indra/newview/llvlcomposition.cpp index cf26bd695..1d6ef8de3 100644 --- a/indra/newview/llvlcomposition.cpp +++ b/indra/newview/llvlcomposition.cpp @@ -133,10 +133,10 @@ BOOL LLVLComposition::generateHeights(const F32 x, const F32 y, S32 x_begin, y_begin, x_end, y_end; - x_begin = llmath::llround( x * mScaleInv ); - y_begin = llmath::llround( y * mScaleInv ); - x_end = llmath::llround( (x + width) * mScaleInv ); - y_end = llmath::llround( (y + width) * mScaleInv ); + x_begin = ll_round( x * mScaleInv ); + y_begin = ll_round( y * mScaleInv ); + x_end = ll_round( (x + width) * mScaleInv ); + y_end = ll_round( (y + width) * mScaleInv ); if (x_end > mWidth) { @@ -328,8 +328,8 @@ BOOL LLVLComposition::generateTexture(const F32 x, const F32 y, S32 x_begin, y_begin, x_end, y_end; x_begin = (S32)(x * mScaleInv); y_begin = (S32)(y * mScaleInv); - x_end = llmath::llround( (x + width) * mScaleInv ); - y_end = llmath::llround( (y + width) * mScaleInv ); + x_end = ll_round( (x + width) * mScaleInv ); + y_end = ll_round( (y + width) * mScaleInv ); if (x_end > mWidth) { diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index a96d64d80..909956610 100644 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -139,6 +139,11 @@ size_t strnlen(const char *s, size_t n) } #endif +const F32 MAX_HOVER_Z = 2.0; +const F32 MIN_HOVER_Z = -2.0; + +// #define OUTPUT_BREAST_DATA + using namespace LLAvatarAppearanceDefines; //----------------------------------------------------------------------------- @@ -903,48 +908,55 @@ const LLUUID SHClientTagMgr::getClientID(const LLVOAvatar* pAvatar) const } return tag.asUUID(); } +bool getColorFor(const LLUUID& id, LLViewerRegion* parent_estate, LLColor4& color, bool name_restricted = false) +{ + static const LLCachedControl ascent_linden_color("AscentLindenColor"); + static const LLCachedControl ascent_estate_owner_color("AscentEstateOwnerColor" ); + static const LLCachedControl ascent_friend_color("AscentFriendColor"); + static const LLCachedControl ascent_muted_color("AscentMutedColor"); + //Lindens are always more Linden than your friend, make that take precedence + if (LLMuteList::getInstance()->isLinden(id)) + color = ascent_linden_color; + //check if they are an estate owner at their current position + else if (parent_estate && parent_estate->isAlive() && id.notNull() && id == parent_estate->getOwner()) + color = ascent_estate_owner_color; + //without these dots, SL would suck. + else if (!name_restricted && LLAvatarTracker::instance().isBuddy(id)) + color = ascent_friend_color; + //big fat jerkface who is probably a jerk, display them as such. + else if (LLMuteList::getInstance()->isMuted(id)) + color = ascent_muted_color; + else + return false; + return true; +} bool mm_getMarkerColor(const LLUUID&, LLColor4&); +bool getCustomColor(const LLUUID& id, LLColor4& color, LLViewerRegion* parent_estate) +{ + return mm_getMarkerColor(id, color) || getColorFor(id, parent_estate, color); +} +bool getCustomColorRLV(const LLUUID& id, LLColor4& color, LLViewerRegion* parent_estate, bool name_restricted) +{ + return mm_getMarkerColor(id, color) || getColorFor(id, parent_estate, color, name_restricted); +} bool SHClientTagMgr::getClientColor(const LLVOAvatar* pAvatar, bool check_status, LLColor4& color) const { - if (mm_getMarkerColor(pAvatar->getID(), color)) return true; + const LLUUID& id(pAvatar->getID()); + if (mm_getMarkerColor(id, color)) return true; static const LLCachedControl ascent_use_status_colors("AscentUseStatusColors",true); static const LLCachedControl ascent_show_self_tag_color("AscentShowSelfTagColor"); static const LLCachedControl ascent_show_others_tag_color("AscentShowOthersTagColor"); - if(check_status && ascent_use_status_colors && !pAvatar->isSelf()) + if (check_status && ascent_use_status_colors && !pAvatar->isSelf()) { - LLViewerRegion* parent_estate = LLWorld::getInstance()->getRegionFromPosGlobal(pAvatar->getPositionGlobal()); - if(LLMuteList::getInstance()->isLinden(pAvatar->getFullname())) - { - static const LLCachedControl ascent_linden_color( "AscentLindenColor" ); - color = ascent_linden_color.get(); + if (getColorFor(id, pAvatar->getRegion(), color, false)) return true; - } - else if(pAvatar->getID().notNull() && parent_estate && parent_estate->isAlive() && pAvatar->getID() == parent_estate->getOwner()) - { - static const LLCachedControl ascent_estate_owner_color( "AscentEstateOwnerColor" ); - color = ascent_estate_owner_color.get(); - return true; - } - else if(LLAvatarTracker::instance().isBuddy(pAvatar->getID())) - { - static const LLCachedControl ascent_friend_color( "AscentFriendColor" ); - color = ascent_friend_color.get(); - return true; - } - else if(LLMuteList::getInstance()->isMuted(pAvatar->getID())) - { - static const LLCachedControl ascent_muted_color( "AscentMutedColor" ); - color = ascent_muted_color.get(); - return true; - } } std::map::const_iterator it; LLSD tag; if( - ((pAvatar->isSelf() && ascent_show_self_tag_color) || - (!pAvatar->isSelf() && ascent_show_others_tag_color)) && - (it = mAvatarTags.find(pAvatar->getID()))!=mAvatarTags.end() && + (pAvatar->isSelf() ? ascent_show_self_tag_color : ascent_show_others_tag_color) && + (it = mAvatarTags.find(id))!=mAvatarTags.end() && (tag = it->second.get("color")).isDefined()) { color.setValue(tag); @@ -1078,6 +1090,7 @@ LLVOAvatar::LLVOAvatar(const LLUUID& id, mFreezeTimeLangolier = freeze_time; //VTResume(); // VTune + setHoverOffset(LLVector3(0.0, 0.0, 0.0)); // mVoiceVisualizer is created by the hud effects manager and uses the HUD Effects pipeline const bool needsSendToSim = false; // currently, this HUD effect doesn't need to pack and unpack data to do its job @@ -3804,7 +3817,8 @@ BOOL LLVOAvatar::updateCharacter(LLAgent &agent) if (gSavedSettings.getBOOL("DebugAvatarAppearanceMessage")) { S32 central_bake_version = -1; - if (getRegion()) + LLViewerRegion* region = getRegion(); + if (region) { central_bake_version = getRegion()->getCentralBakeVersion(); } @@ -3817,9 +3831,10 @@ BOOL LLVOAvatar::updateCharacter(LLAgent &agent) mUseServerBakes, central_bake_version); std::string origin_string = bakedTextureOriginInfo(); debug_line += " [" + origin_string + "]"; - S32 curr_cof_version = LLAppearanceMgr::instance().getCOFVersion(); - S32 last_request_cof_version = LLAppearanceMgr::instance().getLastUpdateRequestCOFVersion(); - S32 last_received_cof_version = LLAppearanceMgr::instance().getLastAppearanceUpdateCOFVersion(); + const LLAppearanceMgr& appmgr(LLAppearanceMgr::instance()); + S32 curr_cof_version = appmgr.getCOFVersion(); + S32 last_request_cof_version = appmgr.getLastUpdateRequestCOFVersion(); + S32 last_received_cof_version = appmgr.getLastAppearanceUpdateCOFVersion(); if (isSelf()) { debug_line += llformat(" - cof: %d req: %d rcv:%d", @@ -3829,6 +3844,16 @@ BOOL LLVOAvatar::updateCharacter(LLAgent &agent) { debug_line += llformat(" - cof rcv:%d", last_received_cof_version); } + debug_line += llformat(" bsz-z: %f avofs-z: %f", mBodySize[2], mAvatarOffset[2]); + bool hover_enabled = region && region->avatarHoverHeightEnabled(); + debug_line += hover_enabled ? " H" : " h"; + const LLVector3& hover_offset = getHoverOffset(); + if (hover_offset[2] != 0.0) + { + debug_line += llformat(" hov_z: %f", hover_offset[2]); + debug_line += llformat(" %s", (mIsSitting ? "S" : "T")); + debug_line += llformat("%s", (isMotionActive(ANIM_AGENT_SIT_GROUND_CONSTRAINED) ? "G" : "-")); + } addDebugText(debug_line); } if (gSavedSettings.getBOOL("DebugAvatarCompositeBaked")) @@ -4010,6 +4035,9 @@ BOOL LLVOAvatar::updateCharacter(LLAgent &agent) LLVector3 xyVel = getVelocity(); xyVel.mV[VZ] = 0.0f; speed = xyVel.length(); + // remembering the value here prevents a display glitch if the + // animation gets toggled during this update. + bool was_sit_ground_constrained = isMotionActive(ANIM_AGENT_SIT_GROUND_CONSTRAINED); if (!(mIsSitting && getParent())) { @@ -4066,6 +4094,10 @@ BOOL LLVOAvatar::updateCharacter(LLAgent &agent) // correct for the fact that the pelvis is not necessarily the center // of the agent's physical representation root_pos.mdV[VZ] -= (0.5f * mBodySize.mV[VZ]) - mPelvisToFoot; + if (!mIsSitting && !was_sit_ground_constrained) + { + root_pos += LLVector3d(getHoverOffset()); + } LLVector3 newPosition = gAgent.getPosAgentFromGlobal(root_pos); @@ -4243,8 +4275,11 @@ BOOL LLVOAvatar::updateCharacter(LLAgent &agent) } else if (mDrawable.notNull()) { - mRoot->setPosition(mDrawable->getPosition()); - mRoot->setRotation(mDrawable->getRotation()); + LLVector3 pos = mDrawable->getPosition(); + const LLQuaternion& rot = mDrawable->getRotation(); + pos += getHoverOffset() * rot; + mRoot->setPosition(pos); + mRoot->setRotation(rot); } //------------------------------------------------------------------------- @@ -4259,6 +4294,19 @@ BOOL LLVOAvatar::updateCharacter(LLAgent &agent) else updateMotions(LLCharacter::NORMAL_UPDATE); + // Special handling for sitting on ground. + if (!getParent() && (mIsSitting || was_sit_ground_constrained)) + { + F32 off_z = LLVector3d(getHoverOffset()).mdV[VZ]; + if (off_z != 0.0) + { + LLVector3 pos = mRoot->getWorldPosition(); + pos.mV[VZ] += off_z; + mRoot->touch(); + mRoot->setWorldPosition(pos); + } + } + // update head position updateHeadOffset(); @@ -7921,6 +7969,8 @@ struct LLAppearanceMessageContents //U32 appearance_flags = 0; std::vector mParamWeights; std::vector mParams; + LLVector3 mHoverOffset; + bool mHoverOffsetWasSet; }; void LLVOAvatar::parseAppearanceMessage(LLMessageSystem* mesgsys, LLAppearanceMessageContents& contents) @@ -7939,6 +7989,17 @@ void LLVOAvatar::parseAppearanceMessage(LLMessageSystem* mesgsys, LLAppearanceMe //mesgsys->getU32Fast(_PREHASH_AppearanceData, _PREHASH_Flags, appearance_flags, 0); } + // Parse the AppearanceHover field, if any. + contents.mHoverOffsetWasSet = false; + if (mesgsys->has(_PREHASH_AppearanceHover)) + { + LLVector3 hover; + mesgsys->getVector3Fast(_PREHASH_AppearanceHover, _PREHASH_HoverHeight, hover); + LL_DEBUGS("Avatar") << avString() << " hover received " << hover.mV[ VX ] << "," << hover.mV[ VY ] << "," << hover.mV[ VZ ] << LL_ENDL; + contents.mHoverOffset = hover; + contents.mHoverOffsetWasSet = true; + } + // Parse visual params, if any. S32 num_blocks = mesgsys->getNumberOfBlocksFast(_PREHASH_VisualParam); bool drop_visual_params_debug = gSavedSettings.getBOOL("BlockSomeAvatarAppearanceVisualParams") && (ll_rand(2) == 0); // pretend that ~12% of AvatarAppearance messages arrived without a VisualParam block, for testing @@ -8002,7 +8063,7 @@ void LLVOAvatar::parseAppearanceMessage(LLMessageSystem* mesgsys, LLAppearanceMe if (it != contents.mParams.end()) { S32 index = it - contents.mParams.begin(); - contents.mParamAppearanceVersion = llmath::llround(contents.mParamWeights[index]); + contents.mParamAppearanceVersion = ll_round(contents.mParamWeights[index]); LL_DEBUGS("Avatar") << "appversion req by appearance_version param: " << contents.mParamAppearanceVersion << LL_ENDL; } } @@ -8251,6 +8312,22 @@ void LLVOAvatar::processAvatarAppearance( LLMessageSystem* mesgsys ) } } + if (contents.mHoverOffsetWasSet && !isSelf()) + { + // Got an update for some other avatar + // Ignore updates for self, because we have a more authoritative value in the preferences. + setHoverOffset(contents.mHoverOffset); + LL_INFOS("Avatar") << avString() << "setting hover from message" << contents.mHoverOffset[2] << LL_ENDL; + } + + if (!contents.mHoverOffsetWasSet && !isSelf()) + { + // If we don't get a value at all, we are presumably in a + // region that does not support hover height. + llwarns << avString() << "zeroing hover because not defined in appearance message" << LL_ENDL; + setHoverOffset(LLVector3(0.0, 0.0, 0.0)); + } + setCompositeUpdatesEnabled( TRUE ); // If all of the avatars are completely baked, release the global image caches to conserve memory. diff --git a/indra/newview/llvoavatar.h b/indra/newview/llvoavatar.h index 6dd1f0b71..ba38d5be1 100644 --- a/indra/newview/llvoavatar.h +++ b/indra/newview/llvoavatar.h @@ -1076,6 +1076,9 @@ private: extern const F32 SELF_ADDITIONAL_PRI; extern const S32 MAX_TEXTURE_VIRTUAL_SIZE_RESET_INTERVAL; +extern const F32 MAX_HOVER_Z; +extern const F32 MIN_HOVER_Z; + void dump_sequential_xml(const std::string outprefix, const LLSD& content); #endif // LL_VOAVATAR_H diff --git a/indra/newview/llvoavatarself.cpp b/indra/newview/llvoavatarself.cpp index c77914e36..9a17ba3e6 100644 --- a/indra/newview/llvoavatarself.cpp +++ b/indra/newview/llvoavatarself.cpp @@ -136,6 +136,11 @@ struct LocalTextureData LLTextureEntry *mTexEntry; }; +// TODO - this class doesn't really do anything, could just use a base +// class responder if nothing else gets added. +// Singu Note: Okay, sure, it's a responder ignore then! +typedef LLHTTPClient::ResponderIgnore LLHoverHeightResponder; + //----------------------------------------------------------------------------- // Callback data //----------------------------------------------------------------------------- @@ -172,7 +177,10 @@ LLVOAvatarSelf::LLVOAvatarSelf(const LLUUID& id, mScreenp(NULL), mLastRegionHandle(0), mRegionCrossingCount(0), - mInitialBakesLoaded(false) + mInitialBakesLoaded(false), + // Value outside legal range, so will always be a mismatch the + // first time through. + mLastHoverOffsetSent(LLVector3(0.0f, 0.0f, -999.0f)) { gAgentWearables.setAvatarObject(this); gAgentCamera.setAvatarObject(this); @@ -259,11 +267,40 @@ void LLVOAvatarSelf::initInstance() return; } + setHoverIfRegionEnabled(); + //doPeriodically(output_self_av_texture_diagnostics, 30.0); doPeriodically(update_avatar_rez_metrics, 5.0); doPeriodically(check_for_unsupported_baked_appearance, 120.0); } +void LLVOAvatarSelf::setHoverIfRegionEnabled() +{ + LLViewerRegion* region = getRegion(); + if (region && region->simulatorFeaturesReceived()) + { + if (region->avatarHoverHeightEnabled()) + { + F32 hover_z = gSavedPerAccountSettings.getF32("AvatarHoverOffsetZ"); + setHoverOffset(LLVector3(0.0, 0.0, llclamp(hover_z,MIN_HOVER_Z,MAX_HOVER_Z))); + LL_INFOS("Avatar") << avString() << " set hover height from debug setting " << hover_z << LL_ENDL; + } + else + { + setHoverOffset(LLVector3(0.0, 0.0, 0.0)); + LL_INFOS("Avatar") << avString() << " zeroing hover height, region does not support" << LL_ENDL; + } + } + else + { + LL_INFOS("Avatar") << avString() << " region or simulator features not known, no change on hover" << LL_ENDL; + if (region) + { + region->setSimulatorFeaturesReceivedCallback(boost::bind(&LLVOAvatarSelf::onSimulatorFeaturesReceived,this,_1)); + } + } +} + // virtual void LLVOAvatarSelf::markDead() { @@ -808,6 +845,12 @@ void LLVOAvatarSelf::removeMissingBakedTextures() } } +void LLVOAvatarSelf::onSimulatorFeaturesReceived(const LLUUID& region_id) +{ + LL_INFOS("Avatar") << "simulator features received, setting hover based on region props" << LL_ENDL; + setHoverIfRegionEnabled(); +} + //virtual void LLVOAvatarSelf::updateRegion(LLViewerRegion *regionp) { @@ -826,6 +869,17 @@ void LLVOAvatarSelf::updateRegion(LLViewerRegion *regionp) //LL_INFOS() << "pos_from_old_region is " << global_pos_from_old_region // << " while pos_from_new_region is " << pos_from_new_region // << LL_ENDL; + + // Update hover height, or schedule callback, based on whether + // it's supported in this region. + if (regionp->simulatorFeaturesReceived()) + { + setHoverIfRegionEnabled(); + } + else + { + regionp->setSimulatorFeaturesReceivedCallback(boost::bind(&LLVOAvatarSelf::onSimulatorFeaturesReceived,this,_1)); + } } if (!regionp || (regionp->getHandle() != mLastRegionHandle)) @@ -3051,6 +3105,39 @@ bool LLVOAvatarSelf::sendAppearanceMessage(LLMessageSystem *mesgsys) const return success; } +//------------------------------------------------------------------------ +// sendHoverHeight() +//------------------------------------------------------------------------ +void LLVOAvatarSelf::sendHoverHeight() const +{ + std::string url = gAgent.getRegion()->getCapability("AgentPreferences"); + + if (!url.empty()) + { + LLSD update = LLSD::emptyMap(); + const LLVector3& hover_offset = getHoverOffset(); + update["hover_height"] = hover_offset[2]; + + LL_DEBUGS("Avatar") << avString() << "sending hover height value " << hover_offset[2] << LL_ENDL; + LLHTTPClient::post(url, update, new LLHoverHeightResponder); + + mLastHoverOffsetSent = hover_offset; + } +} + +void LLVOAvatarSelf::setHoverOffset(const LLVector3& hover_offset, bool send_update) +{ + if (getHoverOffset() != hover_offset) + { + LL_INFOS("Avatar") << avString() << " setting hover due to change " << hover_offset[2] << LL_ENDL; + LLVOAvatar::setHoverOffset(hover_offset, send_update); + } + if (send_update && (hover_offset != mLastHoverOffsetSent)) + { + LL_INFOS("Avatar") << avString() << " sending hover due to change " << hover_offset[2] << LL_ENDL; + sendHoverHeight(); + } +} //------------------------------------------------------------------------ // needsRenderBeam() diff --git a/indra/newview/llvoavatarself.h b/indra/newview/llvoavatarself.h index fea466775..4de2ac8f6 100644 --- a/indra/newview/llvoavatarself.h +++ b/indra/newview/llvoavatarself.h @@ -84,6 +84,9 @@ protected: // LLViewerObject interface and related //-------------------------------------------------------------------- public: + boost::signals2::connection mRegionChangedSlot; + + void onSimulatorFeaturesReceived(const LLUUID& region_id); /*virtual*/ void updateRegion(LLViewerRegion *regionp); /*virtual*/ void idleUpdate(LLAgent &agent, LLWorld &world, const F64 &time); @@ -356,6 +359,14 @@ public: public: bool sendAppearanceMessage(LLMessageSystem *mesgsys) const; + // -- care and feeding of hover height. + void setHoverIfRegionEnabled(); + void sendHoverHeight() const; + /*virtual*/ void setHoverOffset(const LLVector3& hover_offset, bool send_update=true); + +private: + mutable LLVector3 mLastHoverOffsetSent; + public: LLVector3 getLegacyAvatarOffset() const; diff --git a/indra/newview/llvoicevivox.cpp b/indra/newview/llvoicevivox.cpp index ebffc93ec..ce1d09041 100644 --- a/indra/newview/llvoicevivox.cpp +++ b/indra/newview/llvoicevivox.cpp @@ -2647,7 +2647,7 @@ void LLVivoxVoiceClient::sendPositionalUpdate(void) if(!p->mIsSelf) { // scale from the range 0.0-1.0 to vivox volume in the range 0-100 - S32 volume = llmath::llround(p->mVolume / VOLUME_SCALE_VIVOX); + S32 volume = ll_round(p->mVolume / VOLUME_SCALE_VIVOX); bool mute = p->mOnMuteList; if(mute) @@ -3713,7 +3713,7 @@ void LLVivoxVoiceClient::messageEvent( sessionState *session = findSession(sessionHandle); if(session) { - bool is_do_not_disturb = gAgent.getBusy(); + bool is_do_not_disturb = gAgent.isDoNotDisturb(); bool is_muted = LLMuteList::getInstance()->isMuted(session->mCallerID, session->mName, LLMute::flagTextChat); bool is_linden = LLMuteList::getInstance()->isLinden(session->mName); LLChat chat; diff --git a/indra/newview/llvopartgroup.cpp b/indra/newview/llvopartgroup.cpp index 045713b03..d6973f848 100644 --- a/indra/newview/llvopartgroup.cpp +++ b/indra/newview/llvopartgroup.cpp @@ -700,7 +700,7 @@ void LLVOPartGroup::getGeometry(S32 idx, } else { - pglow = LLColor4U(0, 0, 0, (U8) llmath::llround(255.f*part.mStartGlow)); + pglow = LLColor4U(0, 0, 0, (U8) ll_round(255.f*part.mStartGlow)); pcolor = part.mStartColor; } } diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp index a8a9ec104..e25bc88b1 100644 --- a/indra/newview/llvovolume.cpp +++ b/indra/newview/llvovolume.cpp @@ -1210,7 +1210,7 @@ S32 LLVOVolume::computeLODDetail(F32 distance, F32 radius) { // We've got LOD in the profile, and in the twist. Use radius. F32 tan_angle = (LLVOVolume::sLODFactor*radius)/distance; - cur_detail = LLVolumeLODGroup::getDetailFromTan(llmath::llround(tan_angle, 0.01f)); + cur_detail = LLVolumeLODGroup::getDetailFromTan(ll_round(tan_angle, 0.01f)); } else { @@ -1257,8 +1257,8 @@ BOOL LLVOVolume::calcLOD() // DON'T Compensate for field of view changing on FOV zoom. distance *= F_PI/3.f; - cur_detail = computeLODDetail(llmath::llround(distance, 0.01f), - llmath::llround(radius, 0.01f)); + cur_detail = computeLODDetail(ll_round(distance, 0.01f), + ll_round(radius, 0.01f)); if (gPipeline.hasRenderDebugMask(LLPipeline::RENDER_DEBUG_LOD_INFO) && @@ -1271,7 +1271,7 @@ BOOL LLVOVolume::calcLOD() if (cur_detail != mLOD) { - mAppAngle = llmath::llround((F32) atan2( mDrawable->getRadius(), mDrawable->mDistanceWRTCamera) * RAD_TO_DEG, 0.01f); + mAppAngle = ll_round((F32) atan2( mDrawable->getRadius(), mDrawable->mDistanceWRTCamera) * RAD_TO_DEG, 0.01f); mLOD = cur_detail; return TRUE; } @@ -4903,7 +4903,7 @@ void LLVolumeGeometryManager::rebuildGeom(LLSpatialGroup* group) } } /*LLColor4 clr = facep->getFaceColor(); - LLColor4U clru = LLColor4U(llmath::llround(clr.mV[0] * 255.f), llmath::llround(clr.mV[0] * 255.f), llmath::llround(clr.mV[0] * 255.f), llmath::llround(clr.mV[0] * 255.f)); + LLColor4U clru = LLColor4U(ll_round(clr.mV[0] * 255.f), ll_round(clr.mV[0] * 255.f), ll_round(clr.mV[0] * 255.f), ll_round(clr.mV[0] * 255.f)); if(clru.mV[0] == 164 && clru.mV[1] == 106 && clr.mV[2] == 65) { llinfos << "Facepool = " << type << " alpha = " << clr.mV[3] << llendl; diff --git a/indra/newview/llwlanimator.cpp b/indra/newview/llwlanimator.cpp index 3bdc1ae5e..2d4983416 100644 --- a/indra/newview/llwlanimator.cpp +++ b/indra/newview/llwlanimator.cpp @@ -267,7 +267,7 @@ std::string LLWLAnimator::timeToString(F32 curTime) // get hours and minutes hours = (S32) (24.0 * curTime); curTime -= ((F32) hours / 24.0f); - min = llmath::llround(24.0f * 60.0f * curTime); + min = ll_round(24.0f * 60.0f * curTime); // handle case where it's 60 if(min == 60) diff --git a/indra/newview/llworld.cpp b/indra/newview/llworld.cpp index d83f6013c..8af33dee9 100644 --- a/indra/newview/llworld.cpp +++ b/indra/newview/llworld.cpp @@ -142,6 +142,7 @@ void LLWorld::destroyClass() LLViewerRegion* region_to_delete = *region_it++; removeRegion(region_to_delete->getHost()); } + if(LLVOCache::hasInstance()) { LLVOCache::getInstance()->destroyClass() ; @@ -181,7 +182,8 @@ LLViewerRegion* LLWorld::addRegion(const U64 ®ion_handle, const LLHost &host) if (host != old_host) { llwarns << "LLWorld::addRegion exists, but old host " << old_host - << " does not match new host " << host << llendl; + << " does not match new host " << host + << ", removing old region and creating new" << LL_ENDL; } if (!regionp->isAlive()) { @@ -207,7 +209,7 @@ LLViewerRegion* LLWorld::addRegion(const U64 ®ion_handle, const LLHost &host) S32 y = (S32)(jindex/256); //MegaRegion // Aurora Sim llinfos << "Adding new region (" << x << ":" << y << ")" - << " on host: " << host << llendl; + << " on host: " << host << LL_ENDL; LLVector3d origin_global; @@ -321,12 +323,12 @@ void LLWorld::removeRegion(const LLHost &host) llwarns << "RegionDump: " << reg->getName() << " " << reg->getHost() << " " << reg->getOriginGlobal() - << llendl; + << LL_ENDL; } llwarns << "Agent position global " << gAgent.getPositionGlobal() << " agent " << gAgent.getPositionAgent() - << llendl; + << LL_ENDL; llwarns << "Regions visited " << gAgent.getRegionsVisited() << llendl; @@ -349,13 +351,13 @@ void LLWorld::removeRegion(const LLHost &host) mRegionRemovedSignal(regionp); + updateWaterObjects(); + //double check all objects of this region are removed. gObjectList.clearAllMapObjectsInRegion(regionp) ; //llassert_always(!gObjectList.hasMapObjectInRegion(regionp)) ; - updateWaterObjects(); - - delete regionp; + delete regionp; // - Use after free fix? } @@ -698,7 +700,8 @@ void LLWorld::updateVisibilities() if (part) { LLSpatialGroup* group = (LLSpatialGroup*) part->mOctree->getListener(0); - if (LLViewerCamera::getInstance()->AABBInFrustum(group->mBounds[0], group->mBounds[1])) + const LLVector4a* bounds = group->mBounds; + if (LLViewerCamera::getInstance()->AABBInFrustum(bounds[0], bounds[1])) { mCulledRegionList.erase(curiter); mVisibleRegionList.push_back(regionp); @@ -721,13 +724,11 @@ void LLWorld::updateVisibilities() if (part) { LLSpatialGroup* group = (LLSpatialGroup*) part->mOctree->getListener(0); - if (LLViewerCamera::getInstance()->AABBInFrustum(group->mBounds[0], group->mBounds[1])) + const LLVector4a* bounds = group->mBounds; + if (LLViewerCamera::getInstance()->AABBInFrustum(bounds[0], bounds[1])) { regionp->calculateCameraDistance(); - if (!gNoRender) - { - regionp->getLand().updatePatchVisibilities(gAgent); - } + regionp->getLand().updatePatchVisibilities(gAgent); } else { @@ -910,7 +911,7 @@ void LLWorld::printPacketsLost() LLVector3d range = regionp->getCenterGlobal() - gAgent.getPositionGlobal(); llinfos << regionp->getHost() << ", range: " << range.length() - << " packets lost: " << cdp->getPacketsLost() << llendl; + << " packets lost: " << cdp->getPacketsLost() << LL_ENDL; } } } @@ -1124,7 +1125,7 @@ void LLWorld::updateWaterObjects() // Count the found coastline. F32 new_water_height = water_heights[index]; LL_DEBUGS("WaterHeight") << " This is void; counting coastline with water height of " << new_water_height << LL_ENDL; - S32 new_water_height_cm = llmath::llround(new_water_height * 100); + S32 new_water_height_cm = ll_round(new_water_height * 100); int count = (water_height_counts[new_water_height_cm] += 1); // Just use the lowest water height: this is mainly about the horizon water, // and whatever we do, we don't want it to be possible to look under the water @@ -1358,8 +1359,9 @@ void process_enable_simulator(LLMessageSystem *msg, void **user_data) if (!gAgent.getRegion()) return; - static const LLCachedControl connectToNeighbors(gSavedSettings, "AlchemyConnectToNeighbors"); - if (!connectToNeighbors && ((gAgent.getTeleportState() == LLAgent::TELEPORT_LOCAL) || (gAgent.getTeleportState() == LLAgent::TELEPORT_NONE))) + static LLCachedControl connectToNeighbors(gSavedSettings, "AlchemyConnectToNeighbors"); + if ((!connectToNeighbors) && ((gAgent.getTeleportState() == LLAgent::TELEPORT_LOCAL) + || (gAgent.getTeleportState() == LLAgent::TELEPORT_NONE))) return; // enable the appropriate circuit for this simulator and @@ -1428,7 +1430,7 @@ public: if (!regionp) { llwarns << "Got EstablishAgentCommunication for unknown region " - << sim << llendl; + << sim << LL_ENDL; return; } regionp->setSeedCapability(input["body"]["seed-capability"]); @@ -1441,7 +1443,7 @@ void process_disable_simulator(LLMessageSystem *mesgsys, void **user_data) { LLHost host = mesgsys->getSender(); - //llinfos << "Disabling simulator with message from " << host << llendl; + //LL_INFOS() << "Disabling simulator with message from " << host << LL_ENDL; LLWorld::getInstance()->removeRegion(host); mesgsys->disableCircuit(host); @@ -1455,7 +1457,7 @@ void process_region_handshake(LLMessageSystem* msg, void** user_data) if (!regionp) { llwarns << "Got region handshake for unknown region " - << host << llendl; + << host << LL_ENDL; return; } @@ -1539,7 +1541,7 @@ static LLVector3d unpackLocalToGlobalPosition(U32 compact_local, const LLVector3 return region_origin + pos_local; } -void LLWorld::getAvatars(std::vector* avatar_ids, std::vector* positions, const LLVector3d& relative_to, F32 radius) const +void LLWorld::getAvatars(uuid_vec_t* avatar_ids, std::vector* positions, const LLVector3d& relative_to, F32 radius) const { F32 radius_squared = radius * radius; @@ -1578,8 +1580,8 @@ void LLWorld::getAvatars(std::vector* avatar_ids, std::vectorgetRegionList().begin(); - iter != LLWorld::getInstance()->getRegionList().end(); ++iter) + for (LLWorld::region_list_t::const_iterator iter = getRegionList().begin(); + iter != getRegionList().end(); ++iter) { LLViewerRegion* regionp = *iter; const LLVector3d& origin_global = regionp->getOriginGlobal(); @@ -1604,6 +1606,56 @@ void LLWorld::getAvatars(std::vector* avatar_ids, std::vectorempty()) + { + umap->clear(); + } + // get the list of avatars from the character list first, so distances are correct + // when agent is above 1020m and other avatars are nearby + for (std::vector::iterator iter = LLCharacter::sInstances.begin(); + iter != LLCharacter::sInstances.end(); ++iter) + { + LLVOAvatar* pVOAvatar = (LLVOAvatar*) *iter; + + if (!pVOAvatar->isDead() && !pVOAvatar->isSelf() && !pVOAvatar->mIsDummy) + { + LLVector3d pos_global = pVOAvatar->getPositionGlobal(); + LLUUID uuid = pVOAvatar->getID(); + + if (!uuid.isNull() + && dist_vec_squared(pos_global, relative_to) <= radius_squared) + { + umap->emplace(uuid, pos_global); + } + } + } + // region avatars added for situations where radius is greater than RenderFarClip + for (LLWorld::region_list_t::const_iterator iter = getRegionList().begin(); + iter != getRegionList().end(); ++iter) + { + LLViewerRegion* regionp = *iter; + const LLVector3d& origin_global = regionp->getOriginGlobal(); + S32 count = regionp->mMapAvatars.count(); + for (S32 i = 0; i < count; i++) + { + LLVector3d pos_global = unpackLocalToGlobalPosition(regionp->mMapAvatars.get(i), origin_global); + if(dist_vec_squared(pos_global, relative_to) <= radius_squared) + { + LLUUID uuid = regionp->mMapAvatarIDs.get(i); + // if this avatar doesn't already exist in the list, add it + if(uuid.notNull()) + { + umap->emplace(uuid, pos_global); + } + } + } + } +} + bool LLWorld::isRegionListed(const LLViewerRegion* region) const { region_list_t::const_iterator it = find(mRegionList.begin(), mRegionList.end(), region); diff --git a/indra/newview/llworld.h b/indra/newview/llworld.h index b363d0d67..fa65c364a 100644 --- a/indra/newview/llworld.h +++ b/indra/newview/llworld.h @@ -167,10 +167,15 @@ public: // All arguments are optional. Given containers will be emptied and then filled. // Not supplying origin or radius input returns data on all avatars in the known regions. void getAvatars( - std::vector* avatar_ids = NULL, + uuid_vec_t* avatar_ids = NULL, std::vector* positions = NULL, const LLVector3d& relative_to = LLVector3d(), F32 radius = FLT_MAX) const; + typedef boost::unordered_map pos_map_t; + void getAvatars(pos_map_t* map, + const LLVector3d& relative_to = LLVector3d(), + F32 radius = FLT_MAX) const; + // Returns 'true' if the region is in mRegionList, // 'false' if the region has been removed due to region change // or if the circuit to this simulator had been lost. diff --git a/indra/newview/llworldmap.cpp b/indra/newview/llworldmap.cpp index 37db6e081..1770aeacd 100644 --- a/indra/newview/llworldmap.cpp +++ b/indra/newview/llworldmap.cpp @@ -54,7 +54,7 @@ bool LLWorldMap::sGotMapURL = false; // Timers to temporise database requests -const F32 AGENTS_UPDATE_TIMER = 60.0; // Seconds between 2 agent requests for a region +const F32 AGENTS_UPDATE_TIMER = 30.0; // Seconds between 2 agent requests for a region const F32 REQUEST_ITEMS_TIMER = 10.f * 60.f; // Seconds before we consider re-requesting item data for the grid //--------------------------------------------------------------------------- diff --git a/indra/newview/llworldmap.h b/indra/newview/llworldmap.h index 7037d9f05..17e312b1f 100644 --- a/indra/newview/llworldmap.h +++ b/indra/newview/llworldmap.h @@ -157,6 +157,8 @@ public: const std::string getFlagsString() const { return LLViewerRegion::regionFlagsToString(mRegionFlags); } const U64 getRegionFlags() const { return mRegionFlags; } const std::string getAccessString() const { return LLViewerRegion::accessToString((U8)mAccess); } + const std::string getShortAccessString() const { return LLViewerRegion::accessToShortString(static_cast(mAccess)); } // + const std::string getAccessIcon() const { return LLViewerRegion::getAccessIcon(static_cast(mAccess)); } const U8 getAccess() const { return mAccess; } const S32 getAgentCount() const; // Compute the total agents count LLPointer getLandForSaleImage(); // Get the overlay image, fetch it if necessary diff --git a/indra/newview/llworldmapview.cpp b/indra/newview/llworldmapview.cpp index 3742ba4df..0baca364d 100644 --- a/indra/newview/llworldmapview.cpp +++ b/indra/newview/llworldmapview.cpp @@ -467,9 +467,9 @@ void LLWorldMapView::draw() if (overlayimage) { // Inform the fetch mechanism of the size we need - S32 draw_size = llmath::llround(sMapScale); - overlayimage->setKnownDrawSize( llmath::llround(draw_size * LLUI::getScaleFactor().mV[VX] * ((F32)info->getSizeX() / REGION_WIDTH_METERS)), - llmath::llround(draw_size * LLUI::getScaleFactor().mV[VY] * ((F32)info->getSizeY() / REGION_WIDTH_METERS))); + S32 draw_size = ll_round(sMapScale); + overlayimage->setKnownDrawSize( ll_round(draw_size * LLUI::getScaleFactor().mV[VX] * ((F32)info->getSizeX() / REGION_WIDTH_METERS)), + ll_round(draw_size * LLUI::getScaleFactor().mV[VY] * ((F32)info->getSizeY() / REGION_WIDTH_METERS))); // Draw something whenever we have enough info if (overlayimage->hasGLTexture() && !overlayimage->isMissingAsset() && overlayimage->getID() != IMG_DEFAULT) { @@ -674,14 +674,14 @@ void LLWorldMapView::draw() drawImage(pos_global, sAvatarYouImage); LLVector3 pos_map = globalPosToView(pos_global); - if (!pointInView(llmath::llround(pos_map.mV[VX]), llmath::llround(pos_map.mV[VY]))) + if (!pointInView(ll_round(pos_map.mV[VX]), ll_round(pos_map.mV[VY]))) { drawTracking(pos_global, lerp(LLColor4::yellow, LLColor4::orange, 0.4f), TRUE, "You are here", "", - llmath::llround(LLFontGL::getFontSansSerifSmall()->getLineHeight())); // offset vertically by one line, to avoid overlap with target tracking + ll_round(LLFontGL::getFontSansSerifSmall()->getLineHeight())); // offset vertically by one line, to avoid overlap with target tracking } // Show your viewing angle @@ -823,8 +823,8 @@ void LLWorldMapView::drawLegacyBackgroundLayers(S32 width, S32 height) { } current_image->setBoostLevel(LLGLTexture::BOOST_MAP); - current_image->setKnownDrawSize(llmath::llround(pix_width * LLUI::getScaleFactor().mV[VX]), - llmath::llround(pix_height * LLUI::getScaleFactor().mV[VY])); + current_image->setKnownDrawSize(ll_round(pix_width * LLUI::getScaleFactor().mV[VX]), + ll_round(pix_height * LLUI::getScaleFactor().mV[VY])); if (!current_image->hasGLTexture()) //Still loading. { @@ -911,9 +911,9 @@ F32 LLWorldMapView::drawLegacySimTile(LLSimInfo& sim_info, S32 left, S32 top, S3 //call setKnownDrawSize if image is still loading, or its actually being drawn. if(sim_fetching || alpha >= ALPHA_CUTOFF) { - S32 draw_size = llmath::llround(sMapScale); - simimage->setKnownDrawSize( llmath::llround(draw_size * LLUI::getScaleFactor().mV[VX] * ((F32)sim_info.getSizeX() / REGION_WIDTH_METERS)), - llmath::llround(draw_size * LLUI::getScaleFactor().mV[VY] * ((F32)sim_info.getSizeY() / REGION_WIDTH_METERS))); + S32 draw_size = ll_round(sMapScale); + simimage->setKnownDrawSize( ll_round(draw_size * LLUI::getScaleFactor().mV[VX] * ((F32)sim_info.getSizeX() / REGION_WIDTH_METERS)), + ll_round(draw_size * LLUI::getScaleFactor().mV[VY] * ((F32)sim_info.getSizeY() / REGION_WIDTH_METERS))); simimage->setBoostLevel(LLGLTexture::BOOST_MAP); if(alpha >= ALPHA_CUTOFF) { @@ -1128,8 +1128,8 @@ void LLWorldMapView::drawGenericItem(const LLItemInfo& item, LLUIImagePtr image) void LLWorldMapView::drawImage(const LLVector3d& global_pos, LLUIImagePtr image, const LLColor4& color) { LLVector3 pos_map = globalPosToView( global_pos ); - image->draw(llmath::llround(pos_map.mV[VX] - image->getWidth() /2.f), - llmath::llround(pos_map.mV[VY] - image->getHeight()/2.f), + image->draw(ll_round(pos_map.mV[VX] - image->getWidth() /2.f), + ll_round(pos_map.mV[VY] - image->getHeight()/2.f), color); } @@ -1138,8 +1138,8 @@ void LLWorldMapView::drawImageStack(const LLVector3d& global_pos, LLUIImagePtr i LLVector3 pos_map = globalPosToView( global_pos ); for(U32 i=0; idraw(llmath::llround(pos_map.mV[VX] - image->getWidth() /2.f), - llmath::llround(pos_map.mV[VY] - image->getHeight()/2.f + i*offset), + image->draw(ll_round(pos_map.mV[VX] - image->getWidth() /2.f), + ll_round(pos_map.mV[VY] - image->getHeight()/2.f + i*offset), color); } } @@ -1323,8 +1323,8 @@ void LLWorldMapView::drawTracking(const LLVector3d& pos_global, const LLColor4& const std::string& label, const std::string& tooltip, S32 vert_offset ) { LLVector3 pos_local = globalPosToView( pos_global ); - S32 x = llmath::llround( pos_local.mV[VX] ); - S32 y = llmath::llround( pos_local.mV[VY] ); + S32 x = ll_round( pos_local.mV[VX] ); + S32 y = ll_round( pos_local.mV[VY] ); LLFontGL* font = LLFontGL::getFontSansSerifSmall(); S32 text_x = x; S32 text_y = (S32)(y - sTrackCircleImage->getHeight()/2 - font->getLineHeight()); @@ -1356,7 +1356,7 @@ void LLWorldMapView::drawTracking(const LLVector3d& pos_global, const LLColor4& const S32 TEXT_PADDING = DEFAULT_TRACKING_ARROW_SIZE + 2; S32 half_text_width = llfloor(font->getWidthF32(label) * 0.5f); text_x = llclamp(text_x, half_text_width + TEXT_PADDING, getRect().getWidth() - half_text_width - TEXT_PADDING); - text_y = llclamp(text_y + vert_offset, TEXT_PADDING + vert_offset, getRect().getHeight() - llmath::llround(font->getLineHeight()) - TEXT_PADDING - vert_offset); + text_y = llclamp(text_y + vert_offset, TEXT_PADDING + vert_offset, getRect().getHeight() - ll_round(font->getLineHeight()) - TEXT_PADDING - vert_offset); //if (label != "") // [RLVa:KB] - Checked: 2009-07-04 (RLVa-1.4.5) | Added: RLVa-1.0.0 @@ -1484,8 +1484,8 @@ static void drawDot(F32 x_pixels, F32 y_pixels, if(-HEIGHT_THRESHOLD <= relative_z && relative_z <= HEIGHT_THRESHOLD) { - dot_image->draw(llmath::llround(x_pixels) - dot_image->getWidth()/2, - llmath::llround(y_pixels) - dot_image->getHeight()/2, + dot_image->draw(ll_round(x_pixels) - dot_image->getWidth()/2, + ll_round(y_pixels) - dot_image->getHeight()/2, color); } else @@ -1540,9 +1540,9 @@ void LLWorldMapView::drawAvatar(F32 x_pixels, dot_image = sAvatarAboveImage; } - S32 dot_width = llmath::llround(dot_radius * 2.f); - dot_image->draw(llmath::llround(x_pixels - dot_radius), - llmath::llround(y_pixels - dot_radius), + S32 dot_width = ll_round(dot_radius * 2.f); + dot_image->draw(ll_round(x_pixels - dot_radius), + ll_round(y_pixels - dot_radius), dot_width, dot_width, color); @@ -1569,8 +1569,8 @@ void LLWorldMapView::drawIconName(F32 x_pixels, const std::string& second_line) { const S32 VERT_PAD = 8; - S32 text_x = llmath::llround(x_pixels); - S32 text_y = llmath::llround(y_pixels + S32 text_x = ll_round(x_pixels); + S32 text_y = ll_round(y_pixels - BIG_DOT_RADIUS - VERT_PAD); @@ -1584,7 +1584,7 @@ void LLWorldMapView::drawIconName(F32 x_pixels, LLFontGL::NORMAL, LLFontGL::DROP_SHADOW); - text_y -= llmath::llround(LLFontGL::getFontSansSerif()->getLineHeight()); + text_y -= ll_round(LLFontGL::getFontSansSerif()->getLineHeight()); // render text LLFontGL::getFontSansSerif()->renderUTF8(second_line, 0, @@ -1758,8 +1758,8 @@ void LLWorldMapView::setDirectionPos( LLTextBox* text_box, F32 rotation ) F32 radius = llmin( map_half_height - text_half_height, map_half_width - text_half_width ); text_box->setOrigin( - llmath::llround(map_half_width - text_half_width + radius * cos( rotation )), - llmath::llround(map_half_height - text_half_height + radius * sin( rotation )) ); + ll_round(map_half_width - text_half_width + radius * cos( rotation )), + ll_round(map_half_height - text_half_height + radius * sin( rotation )) ); } @@ -1807,8 +1807,8 @@ void LLWorldMapView::reshape( S32 width, S32 height, BOOL called_from_parent ) bool LLWorldMapView::checkItemHit(S32 x, S32 y, LLItemInfo& item, LLUUID* id, bool track) { LLVector3 pos_view = globalPosToView(item.getGlobalPosition()); - S32 item_x = llmath::llround(pos_view.mV[VX]); - S32 item_y = llmath::llround(pos_view.mV[VY]); + S32 item_x = ll_round(pos_view.mV[VX]); + S32 item_y = ll_round(pos_view.mV[VY]); if (x < item_x - BIG_DOT_RADIUS) return false; if (x > item_x + BIG_DOT_RADIUS) return false; @@ -1983,8 +1983,8 @@ BOOL LLWorldMapView::handleMouseDown( S32 x, S32 y, MASK mask ) { gFocusMgr.setMouseCapture( this ); - mMouseDownPanX = llmath::llround(sPanX); - mMouseDownPanY = llmath::llround(sPanY); + mMouseDownPanX = ll_round(sPanX); + mMouseDownPanY = ll_round(sPanY); mMouseDownX = x; mMouseDownY = y; sHandledLastClick = TRUE; diff --git a/indra/newview/rlvhandler.h b/indra/newview/rlvhandler.h index c672608e9..3fd7c733e 100644 --- a/indra/newview/rlvhandler.h +++ b/indra/newview/rlvhandler.h @@ -20,7 +20,7 @@ #include #include "rlvcommon.h" -#if LL_GNUC || LL_ICC || LL_CLANG +#if LL_GNUC || LL_INTELC || LL_CLANG #include "rlvhelper.h" // Needed to make GCC happy #endif // LL_GNUC diff --git a/indra/newview/scriptcounter.cpp b/indra/newview/scriptcounter.cpp index 61219980b..f6f53c067 100644 --- a/indra/newview/scriptcounter.cpp +++ b/indra/newview/scriptcounter.cpp @@ -40,7 +40,7 @@ #include "llvoavatar.h" #include "stringize.h" -void cmdline_printchat(std::string chat); +void cmdline_printchat(const std::string& message); LLVOAvatar* find_avatar_from_object( LLViewerObject* object ); diff --git a/indra/newview/shcommandhandler.cpp b/indra/newview/shcommandhandler.cpp index c6229ad0e..fc0856bf8 100644 --- a/indra/newview/shcommandhandler.cpp +++ b/indra/newview/shcommandhandler.cpp @@ -170,7 +170,7 @@ CMD_SCRIPT(gettext) #include "llphysicsmotion.h" -void cmdline_printchat(std::string message); +void cmdline_printchat(const std::string& message); CMD_CHAT(physparams) { //args[1] = avatar name diff --git a/indra/newview/skins/dark/textures/icn_toolbar_region_tracker.png b/indra/newview/skins/dark/textures/icn_toolbar_region_tracker.png new file mode 100644 index 000000000..aef16414f Binary files /dev/null and b/indra/newview/skins/dark/textures/icn_toolbar_region_tracker.png differ diff --git a/indra/newview/skins/default/textures/icn_toolbar_region_tracker.png b/indra/newview/skins/default/textures/icn_toolbar_region_tracker.png new file mode 100644 index 000000000..49e5d11a2 Binary files /dev/null and b/indra/newview/skins/default/textures/icn_toolbar_region_tracker.png differ diff --git a/indra/newview/skins/default/textures/textures.xml b/indra/newview/skins/default/textures/textures.xml index 574f2b3a7..b6420d4e0 100644 --- a/indra/newview/skins/default/textures/textures.xml +++ b/indra/newview/skins/default/textures/textures.xml @@ -162,8 +162,6 @@ - - @@ -416,4 +414,7 @@ + + + diff --git a/indra/newview/skins/default/xui/de/floater_area_search.xml b/indra/newview/skins/default/xui/de/floater_area_search.xml index ba97c6956..328dc0de6 100644 --- a/indra/newview/skins/default/xui/de/floater_area_search.xml +++ b/indra/newview/skins/default/xui/de/floater_area_search.xml @@ -14,7 +14,5 @@ - + + @@ -546,6 +551,34 @@ mouse_opaque="true" name="Set Busy" width="185"> + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -1030,11 +1063,23 @@ + + + + + + + + + + + + @@ -1056,10 +1101,6 @@ - - - - diff --git a/indra/newview/skins/default/xui/en-us/notifications.xml b/indra/newview/skins/default/xui/en-us/notifications.xml index 1af8cfc62..ff05f179f 100644 --- a/indra/newview/skins/default/xui/en-us/notifications.xml +++ b/indra/newview/skins/default/xui/en-us/notifications.xml @@ -8460,6 +8460,138 @@ Only textures will upload as temporary on Agni and Aditi. canceltext="Cancel"/> + + The SOCKS 5 proxy "[HOST]:[PORT]" refused the connection, not allowed by rule set. + fail + + + + + The SOCKS 5 proxy "[HOST]:[PORT]" refused the connection, could not open TCP channel. + fail + + + + + The SOCKS 5 proxy "[HOST]:[PORT]" refused the selected authentication system. + fail + + + + + The SOCKS 5 proxy "[HOST]:[PORT]" reported your credentials are invalid. + fail + + + + + The SOCKS 5 proxy "[HOST]:[PORT]" refused the UDP associate request. + fail + + + + + Could not connect to SOCKS 5 proxy server "[HOST]:[PORT]". + fail + + + + + Unknown proxy error with server "[HOST]:[PORT]". + fail + + + + + Invalid SOCKS proxy address or port "[HOST]:[PORT]". + fail + + + + + Invalid SOCKS 5 username or password. + fail + + + + + Invalid HTTP proxy address or port "[HOST]:[PORT]". + fail + + + + + Invalid SOCKS proxy address or port "[HOST]:[PORT]". + fail + + + + + Proxy settings take effect after you restart [APP_NAME]. + fail + + + @@ -10361,6 +10493,27 @@ Changes won't take effect until after you restart [APP_NAME]. + +What label would you like to use for +the region "[REGION]"? + confirm +
+ [LABEL] +